mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch 'master' of github.com:sphinx-doc/sphinx
This commit is contained in:
commit
1617e451af
1
CHANGES
1
CHANGES
@ -98,6 +98,7 @@ Bugs fixed
|
||||
now renamed to ``div.literal-block-wrapper``.
|
||||
* ``sphinx.util.pycompat`` has been restored in its backwards-compatibility;
|
||||
slated for removal in Sphinx 1.4.
|
||||
* #1719: LaTeX writer does not respect ``numref_format`` option in captions
|
||||
|
||||
|
||||
Release 1.3b2 (released Dec 5, 2014)
|
||||
|
23
EXAMPLES
23
EXAMPLES
@ -14,16 +14,14 @@ Documentation using the default theme
|
||||
|
||||
* APSW: http://apidoc.apsw.googlecode.com/hg/index.html
|
||||
* ASE: https://wiki.fysik.dtu.dk/ase/
|
||||
* boostmpi: http://documen.tician.de/boostmpi/
|
||||
* Calibre: http://manual.calibre-ebook.com/
|
||||
* CodePy: http://documen.tician.de/codepy/
|
||||
* Cython: http://docs.cython.org/
|
||||
* C\\C++ Python language binding project: http://language-binding.net/index.html
|
||||
* Cormoran: http://cormoran.nhopkg.org/docs/
|
||||
* Director: http://pythonhosted.org/director/
|
||||
* Dirigible: http://www.projectdirigible.com/documentation/
|
||||
* F2py: http://f2py.sourceforge.net/docs/
|
||||
* GeoDjango: http://geodjango.org/docs/
|
||||
* GeoDjango: https://docs.djangoproject.com/en/dev/ref/contrib/gis/
|
||||
* Genomedata:
|
||||
http://noble.gs.washington.edu/proj/genomedata/doc/1.2.2/genomedata.html
|
||||
* gevent: http://www.gevent.org/
|
||||
@ -51,7 +49,6 @@ Documentation using the default theme
|
||||
* Pylo: http://documen.tician.de/pylo/
|
||||
* PyMQI: http://pythonhosted.org/pymqi/
|
||||
* PyPubSub: http://pubsub.sourceforge.net/
|
||||
* pyrticle: http://documen.tician.de/pyrticle/
|
||||
* pySPACE: http://pyspace.github.io/pyspace/
|
||||
* Python: https://docs.python.org/
|
||||
* python-apt: http://apt.alioth.debian.org/python-apt-doc/
|
||||
@ -59,7 +56,7 @@ Documentation using the default theme
|
||||
* Quex: http://quex.sourceforge.net/doc/html/main.html
|
||||
* Scapy: http://www.secdev.org/projects/scapy/doc/
|
||||
* Segway: http://noble.gs.washington.edu/proj/segway/doc/1.1.0/segway.html
|
||||
* SimPy: http://simpy.sourceforge.net/SimPyDocs/index.html
|
||||
* SimPy: http://simpy.readthedocs.org/en/latest/
|
||||
* SymPy: http://docs.sympy.org/
|
||||
* WTForms: http://wtforms.simplecodes.com/docs/
|
||||
* z3c: http://www.ibiblio.org/paulcarduner/z3ctutorial/
|
||||
@ -73,7 +70,7 @@ Documentation using a customized version of the default theme
|
||||
* Bazaar: http://doc.bazaar.canonical.com/en/
|
||||
* CakePHP: http://book.cakephp.org/2.0/en/index.html
|
||||
* Chaco: http://docs.enthought.com/chaco/
|
||||
* Chef: http://docs.opscode.com/
|
||||
* Chef: https://docs.chef.io/index.html
|
||||
* Djagios: http://djagios.org/
|
||||
* EZ-Draw: http://pageperso.lif.univ-mrs.fr/~edouard.thiel/ez-draw/doc/en/html/ez-manual.html
|
||||
* GetFEM++: http://home.gna.org/getfem/
|
||||
@ -90,7 +87,6 @@ Documentation using a customized version of the default theme
|
||||
* NumPy: http://docs.scipy.org/doc/numpy/reference/
|
||||
* OpenCV: http://docs.opencv.org/
|
||||
* Peach^3: http://peach3.nl/doc/latest/userdoc/
|
||||
* PyLit: http://pylit.berlios.de/
|
||||
* Sage: http://sagemath.org/doc/
|
||||
* SciPy: http://docs.scipy.org/doc/scipy/reference/
|
||||
* simuPOP: http://simupop.sourceforge.net/manual_release/build/userGuide.html
|
||||
@ -114,12 +110,11 @@ Documentation using the sphinxdoc theme
|
||||
* Pyre: http://docs.danse.us/pyre/sphinx/
|
||||
* Pysparse: http://pysparse.sourceforge.net/
|
||||
* PyTango:
|
||||
http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
|
||||
http://www.esrf.eu/computing/cs/tango/tango_doc/kernel_doc/pytango/latest/index.html
|
||||
* Python Wild Magic: http://vmlaker.github.io/pythonwildmagic/
|
||||
* Reteisi: http://www.reteisi.org/contents.html
|
||||
* Sqlkit: http://sqlkit.argolinux.org/
|
||||
* Tau: http://www.tango-controls.org/static/tau/latest/doc/html/index.html
|
||||
* Total Open Station: http://tops.berlios.de/
|
||||
* Turbulenz: http://docs.turbulenz.com/
|
||||
* WebFaction: http://docs.webfaction.com/
|
||||
|
||||
@ -132,11 +127,12 @@ Documentation using another builtin theme
|
||||
* jsFiddle: http://doc.jsfiddle.net/ (nature)
|
||||
* libLAS: http://www.liblas.org/ (nature)
|
||||
* MPipe: http://vmlaker.github.io/mpipe/ (sphinx13)
|
||||
* pip: http://pip.openplans.org/ (nature)
|
||||
* pip: https://pip.pypa.io/en/latest/ (sphinx_rtd_theme)
|
||||
* Pyramid web framework:
|
||||
http://docs.pylonsproject.org/projects/pyramid/en/latest/ (pyramid)
|
||||
* Programmieren mit PyGTK und Glade (German):
|
||||
http://www.florian-diesch.de/doc/python-und-glade/online/ (agogo)
|
||||
* Satchmo: http://docs.satchmoproject.com/en/latest/ (sphinx_rtd_theme)
|
||||
* Setuptools: http://pythonhosted.org/setuptools/ (nature)
|
||||
* Spring Python: http://docs.spring.io/spring-python/1.2.x/sphinx/html/ (nature)
|
||||
* sqlparse: http://python-sqlparse.googlecode.com/svn/docs/api/index.html
|
||||
@ -152,7 +148,7 @@ Documentation using a custom theme/integrated in a site
|
||||
* Blender: http://www.blender.org/documentation/250PythonDoc/
|
||||
* Blinker: http://discorporate.us/projects/Blinker/docs/
|
||||
* Ceph: http://ceph.com/docs/master/
|
||||
* Classy: http://classy.pocoo.org/
|
||||
* Classy: http://www.pocoo.org/projects/classy/
|
||||
* DEAP: http://deap.gel.ulaval.ca/doc/0.8/index.html
|
||||
* Django: http://docs.djangoproject.com/
|
||||
* Elemental: http://libelemental.org/documentation/dev/index.html
|
||||
@ -184,20 +180,17 @@ Documentation using a custom theme/integrated in a site
|
||||
* PSI4: http://sirius.chem.vt.edu/psi4manual/latest/index.html
|
||||
* Pylons: http://docs.pylonsproject.org/projects/pylons-webframework/en/latest/
|
||||
* PyMOTW: http://pymotw.com/2/
|
||||
* pypol: http://pypol.altervista.org/ (celery)
|
||||
* python-aspectlib: http://python-aspectlib.readthedocs.org/en/latest/
|
||||
(`sphinx-py3doc-enhanced-theme`_)
|
||||
* QGIS: http://qgis.org/en/docs/index.html
|
||||
* qooxdoo: http://manual.qooxdoo.org/current/
|
||||
* Roundup: http://www.roundup-tracker.org/
|
||||
* Satchmo: http://docs.satchmoproject.com/en/latest/
|
||||
* Selenium: http://docs.seleniumhq.org/docs/
|
||||
* Self: http://selflanguage.org/
|
||||
* Substance D: http://docs.pylonsproject.org/projects/substanced/en/latest/
|
||||
* Tablib: http://tablib.org/
|
||||
* SQLAlchemy: http://www.sqlalchemy.org/docs/
|
||||
* tinyTiM: http://tinytim.sourceforge.net/docs/2.0/
|
||||
* tipfy: http://www.tipfy.org/docs/
|
||||
* Ubuntu packaging guide: http://packaging.ubuntu.com/html/
|
||||
* Werkzeug: http://werkzeug.pocoo.org/docs/
|
||||
* WFront: http://discorporate.us/projects/WFront/
|
||||
@ -251,4 +244,4 @@ Thesis using Sphinx
|
||||
|
||||
* "A Web-Based System for Comparative Analysis of OpenStreetMap Data
|
||||
by the Use of CouchDB":
|
||||
http://gisforge.no-ip.org/files/MasterThesis_MarkusMayr_0542042.pdf
|
||||
https://www.yumpu.com/et/document/view/11722645/masterthesis-markusmayr-0542042
|
||||
|
@ -56,7 +56,7 @@ source code files.
|
||||
.. _NumPy:
|
||||
https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
|
||||
.. _Khan Academy:
|
||||
https://sites.google.com/a/khanacademy.org/forge/for-developers/styleguide/python#TOC-Docstrings
|
||||
https://github.com/Khan/style-guides/blob/master/style/python.md#docstrings
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
|
@ -11,7 +11,7 @@ Sphinx packages are available on the `Python Package Index
|
||||
|
||||
You can also download a snapshot from the Git repository:
|
||||
|
||||
* as a `.tar.bz2 <https://github.com/sphinx-doc/sphinx/archive/master.tar.bz2>`_
|
||||
* as a `.tar.gz <https://github.com/sphinx-doc/sphinx/archive/master.tar.gz>`__
|
||||
file or
|
||||
* as a `.zip <https://github.com/sphinx-doc/sphinx/archive/master.zip>`_ file
|
||||
|
||||
|
@ -192,7 +192,7 @@ easy to fetch and push translations.
|
||||
For example:
|
||||
|
||||
:Project ID: ``sphinx-document-test_1_0``
|
||||
:Project URL: https://www.transifex.com/projects/p/sphinx-document-test_1_0/
|
||||
:Project URL: ``https://www.transifex.com/projects/p/sphinx-document-test_1_0/``
|
||||
|
||||
|
||||
#. Create config files for tx command
|
||||
|
@ -43,6 +43,7 @@ HEADER = r'''%% Generated by Sphinx.
|
||||
\usepackage{sphinx}
|
||||
\usepackage{multirow}
|
||||
%(usepackages)s
|
||||
%(numfig_format)s
|
||||
%(preamble)s
|
||||
|
||||
\title{%(title)s}
|
||||
@ -155,6 +156,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
'fncychap': '\\usepackage[Bjarne]{fncychap}',
|
||||
'longtable': '\\usepackage{longtable}',
|
||||
'usepackages': '',
|
||||
'numfig_format': '',
|
||||
'preamble': '',
|
||||
'title': '',
|
||||
'date': '',
|
||||
@ -249,6 +251,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
if self.elements['extraclassoptions']:
|
||||
self.elements['classoptions'] += ',' + \
|
||||
self.elements['extraclassoptions']
|
||||
self.elements['numfig_format'] = self.generate_numfig_format(builder)
|
||||
|
||||
self.highlighter = highlighting.PygmentsBridge('latex',
|
||||
builder.config.pygments_style, builder.config.trim_doctest_flags)
|
||||
@ -323,6 +326,63 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
encode('ascii', 'backslashreplace').decode('ascii').\
|
||||
replace('\\', '_')
|
||||
|
||||
def generate_numfig_format(self, builder):
|
||||
ret = []
|
||||
if builder.config.language == 'ja':
|
||||
babel_prefix = ''
|
||||
babel_suffix = ''
|
||||
else:
|
||||
if builder.config.language:
|
||||
language = ExtBabel(builder.config.language).get_language()
|
||||
if language is None:
|
||||
language = 'english'
|
||||
else:
|
||||
language = 'english'
|
||||
|
||||
babel_prefix = '\\addto\\captions%s{' % language
|
||||
babel_suffix = '}'
|
||||
|
||||
figure = self.builder.config.numfig_format['figure'].split('%s', 1)
|
||||
if len(figure) == 1:
|
||||
ret.append('\\def\\fnum@figure{%s}\n' %
|
||||
text_type(figure[0]).translate(tex_escape_map))
|
||||
else:
|
||||
ret.append('%s\\renewcommand{\\figurename}{%s}%s\n' %
|
||||
(babel_prefix,
|
||||
text_type(figure[0]).translate(tex_escape_map),
|
||||
babel_suffix))
|
||||
if figure[1]:
|
||||
ret.append('\\makeatletter\n')
|
||||
ret.append('\\def\\fnum@figure{\\figurename\\thefigure%s}\n' %
|
||||
text_type(figure[1]).translate(tex_escape_map))
|
||||
ret.append('\\makeatother\n')
|
||||
|
||||
table = self.builder.config.numfig_format['table'].split('%s', 1)
|
||||
if len(table) == 1:
|
||||
ret.append('\\def\\fnum@table{%s}\n' %
|
||||
text_type(table[0]).translate(tex_escape_map))
|
||||
else:
|
||||
ret.append('%s\\renewcommand{\\tablename}{%s}%s\n' %
|
||||
(babel_prefix,
|
||||
text_type(table[0]).translate(tex_escape_map),
|
||||
babel_suffix))
|
||||
if table[1]:
|
||||
ret.append('\\makeatletter\n')
|
||||
ret.append('\\def\\fnum@table{\\tablename\\thetable%s}\n' %
|
||||
text_type(table[1]).translate(tex_escape_map))
|
||||
ret.append('\\makeatother\n')
|
||||
|
||||
codeblock = self.builder.config.numfig_format['code-block'].split('%s', 1)
|
||||
if len(codeblock) == 1:
|
||||
pass # FIXME
|
||||
else:
|
||||
ret.append('\\floatname{literal-block}{%s}\n' %
|
||||
text_type(codeblock[0]).translate(tex_escape_map))
|
||||
if table[1]:
|
||||
pass # FIXME
|
||||
|
||||
return ''.join(ret)
|
||||
|
||||
def generate_indices(self):
|
||||
def generate(content, collapsed):
|
||||
ret.append('\\begin{theindex}\n')
|
||||
@ -1290,8 +1350,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
id = node.get('refuri', '')[1:].replace('#', ':')
|
||||
|
||||
ref = '\\ref{%s}' % self.idescape(id)
|
||||
title = node.get('title', '#')
|
||||
self.body.append(title.replace('#', ref))
|
||||
title = text_type(node.get('title', '#')).translate(tex_escape_map)
|
||||
hyperref = '\\hyperref[%s]{%s}' % (self.idescape(id), title.replace('\\#', ref))
|
||||
self.body.append(hyperref)
|
||||
|
||||
raise nodes.SkipNode
|
||||
|
||||
|
@ -166,12 +166,67 @@ def test_numref(app, status, warning):
|
||||
print(result)
|
||||
print(status.getvalue())
|
||||
print(warning.getvalue())
|
||||
assert '\\renewcommand{\\figurename}{Fig. }' in result
|
||||
assert '\\renewcommand{\\tablename}{Table }' in result
|
||||
assert '\\floatname{literal-block}{Listing }' in result
|
||||
assert '\\hyperref[index:fig1]{Fig. \\ref{index:fig1}}' in result
|
||||
assert '\\hyperref[baz:fig22]{Figure\\ref{baz:fig22}}' in result
|
||||
assert '\\hyperref[index:table-1]{Table \\ref{index:table-1}}' in result
|
||||
assert '\\hyperref[baz:table22]{Table:\\ref{baz:table22}}' in result
|
||||
assert '\\hyperref[index:code-1]{Listing \\ref{index:code-1}}' in result
|
||||
assert '\\hyperref[baz:code22]{Code-\\ref{baz:code22}}' in result
|
||||
|
||||
|
||||
@with_app(buildername='latex', testroot='numfig',
|
||||
confoverrides={'numfig': True,
|
||||
'numfig_format': {'figure': 'Figure:%s',
|
||||
'table': 'Tab_%s',
|
||||
'code-block': 'Code-%s'}})
|
||||
def test_numref_with_prefix1(app, status, warning):
|
||||
app.builder.build_all()
|
||||
result = (app.outdir / 'Python.tex').text(encoding='utf8')
|
||||
print(result)
|
||||
print(status.getvalue())
|
||||
print(warning.getvalue())
|
||||
assert '\\renewcommand{\\figurename}{Figure:}' in result
|
||||
assert '\\renewcommand{\\tablename}{Tab\\_}' in result
|
||||
assert '\\floatname{literal-block}{Code-}' in result
|
||||
assert '\\ref{index:fig1}' in result
|
||||
assert '\\ref{baz:fig22}' in result
|
||||
assert '\\ref{index:table-1}' in result
|
||||
assert '\\ref{baz:table22}' in result
|
||||
assert '\\ref{index:code-1}' in result
|
||||
assert '\\ref{baz:code22}' in result
|
||||
assert '\\hyperref[index:fig1]{Figure:\\ref{index:fig1}}' in result
|
||||
assert '\\hyperref[baz:fig22]{Figure\\ref{baz:fig22}}' in result
|
||||
assert '\\hyperref[index:table-1]{Tab\\_\\ref{index:table-1}}' in result
|
||||
assert '\\hyperref[baz:table22]{Table:\\ref{baz:table22}}' in result
|
||||
assert '\\hyperref[index:code-1]{Code-\\ref{index:code-1}}' in result
|
||||
assert '\\hyperref[baz:code22]{Code-\\ref{baz:code22}}' in result
|
||||
|
||||
|
||||
@with_app(buildername='latex', testroot='numfig',
|
||||
confoverrides={'numfig': True,
|
||||
'numfig_format': {'figure': 'Figure:%s.',
|
||||
'table': 'Tab_%s:',
|
||||
'code-block': 'Code-%s | '}})
|
||||
def test_numref_with_prefix2(app, status, warning):
|
||||
app.builder.build_all()
|
||||
result = (app.outdir / 'Python.tex').text(encoding='utf8')
|
||||
print(result)
|
||||
print(status.getvalue())
|
||||
print(warning.getvalue())
|
||||
assert '\\renewcommand{\\figurename}{Figure:}' in result
|
||||
assert '\\def\\fnum@figure{\\figurename\\thefigure.}' in result
|
||||
assert '\\renewcommand{\\tablename}{Tab\\_}' in result
|
||||
assert '\\def\\fnum@table{\\tablename\\thetable:}' in result
|
||||
assert '\\floatname{literal-block}{Code-}' in result
|
||||
assert '\\hyperref[index:fig1]{Figure:\\ref{index:fig1}.}' in result
|
||||
assert '\\hyperref[baz:fig22]{Figure\\ref{baz:fig22}}' in result
|
||||
assert '\\hyperref[index:table-1]{Tab\\_\\ref{index:table-1}:}' in result
|
||||
assert '\\hyperref[baz:table22]{Table:\\ref{baz:table22}}' in result
|
||||
assert '\\hyperref[index:code-1]{Code-\\ref{index:code-1} \\textbar{} }' in result
|
||||
assert '\\hyperref[baz:code22]{Code-\\ref{baz:code22}}' in result
|
||||
|
||||
|
||||
@with_app(buildername='latex')
|
||||
|
Loading…
Reference in New Issue
Block a user