merge with main

This commit is contained in:
Georg Brandl 2009-02-14 23:25:30 +01:00
commit 1219e3e73a
47 changed files with 1627 additions and 119 deletions

43
CHANGES
View File

@ -37,6 +37,9 @@ New features added
the directive -- this allows you to define your document
structure, but place the links yourself.
- Image paths can now be absolute (like ``/images/foo.png``).
They are treated as relative to the top source directory.
- #52: There is now a ``hlist`` directive, creating a compact
list by placing distributing items into multiple columns.
@ -49,11 +52,15 @@ New features added
- #23: Added a ``classmethod`` directive along with ``method``
and ``staticmethod``.
- Added a toctree variable to the templates, and the ability to
include external links in toctrees.
- Added a ``toctree`` callable to the templates, and the ability
to include external links in toctrees.
* Configuration:
- The new config value ``rst_epilog`` can contain reST that is
appended to each source file that is read. This is the right
place for global substitutions.
- The new ``html_add_permalinks`` config value can be used to
switch off the generated "paragraph sign" permalinks for each
heading and definition environment.
@ -61,12 +68,21 @@ New features added
- The new ``html_show_sourcelink`` config value can be used to
switch off the links to the reST sources in the sidebar.
- The new ``html_collapse_toctree`` config value can be used to
"collapse" the generated toctree given to the templates.
- The default value for ``htmlhelp_basename`` is now the project
title, cleaned up as a filename.
- The new ``modindex_common_prefix`` config value can be used to
ignore certain package names for module index sorting.
- The new ``trim_footnote_reference_space`` config value mirrors
the docutils config value of the same name and removes the
space before a footnote reference that is necessary for reST
to recognize the reference.
* Builders:
- New builder for Qt help collections, by Antonio Valentino.
@ -78,12 +94,19 @@ New features added
- Italian by Sandro Dentella.
- Ukrainian by Petro Sasnyk.
- Finnish by Jukka Inkeri.
* Extensions and API:
- Autodoc now handles documented attributes.
- Autodoc now handles inner classes and their methods.
- Autodoc can document classes as functions now if explicitly
marked with `autofunction`.
- There is now a ``Sphinx.add_lexer()`` method to be able to use
custom Pygments lexers easily.
@ -106,6 +129,22 @@ New features added
Release 0.5.2 (in development)
==============================
* Recognize toctree directives that are not on section toplevel,
but within block items, such as tables.
* Use a new RFC base URL, since rfc.org seems down.
* Fix a crash in the todolist directive when no todo items are
defined.
* Don't call LaTeX or dvipng over and over again if it was not
found once, and use text-only latex as a substitute in that case.
* Fix problems with footnotes in the LaTeX output.
* Prevent double hyphens becoming en-dashes in literal code in
the LaTeX output.
* Open literalinclude files in universal newline mode to allow
arbitrary newline conventions.

View File

@ -7,8 +7,10 @@ included, please mail to `the Google group
<http://groups.google.com/group/sphinx-dev>`_.
* APSW: http://apsw.googlecode.com/svn/publish/index.html
* boostmpi: http://documen.tician.de/boostmpi/
* Calibre: http://calibre.kovidgoyal.net/user_manual/
* Chaco: http://code.enthought.com/projects/chaco/docs/html/
* CodePy: http://documen.tician.de/codepy/
* Cython: http://docs.cython.org/
* Director: http://packages.python.org/director/
* Django: http://docs.djangoproject.com/
@ -16,30 +18,39 @@ included, please mail to `the Google group
* GeoDjango: http://geodjango.org/docs/
* Glashammer: http://glashammer.org/
* Grok: http://grok.zope.org/doc/current/
* Hedge: http://documen.tician.de/hedge/
* IFM: http://fluffybunny.memebot.com/ifm-docs/index.html
* Jinja: http://jinja.pocoo.org/2/documentation/
* MapServer: http://mapserver.osgeo.org/
* Matplotlib: http://matplotlib.sourceforge.net/
* Mayavi: http://code.enthought.com/projects/mayavi/docs/development/html/mayavi
* MeshPy: http://documen.tician.de/meshpy/
* Mixin.com: http://dev.mixin.com/
* mpmath: http://mpmath.googlecode.com/svn/trunk/doc/build/index.html
* NetworkX: http://networkx.lanl.gov/
* NumPy: http://docs.scipy.org/doc/numpy/reference/
* ObjectListView: http://objectlistview.sourceforge.net/python
* OpenLayers: http://docs.openlayers.org/
* openWNS: http://docs.openwns.org/
* Paste: http://pythonpaste.org/script/
* Paver: http://www.blueskyonmars.com/projects/paver/
* Py on Windows: http://timgolden.me.uk/python-on-windows/
* PyCuda: http://documen.tician.de/pycuda/
* PyEphem: http://rhodesmill.org/pyephem/
* PyPubSub: http://pubsub.sourceforge.net/
* PyUblas: http://tiker.net/doc/pyublas/
* Pyevolve: http://pyevolve.sourceforge.net/
* Pylo: http://documen.tician.de/pylo/
* Pylons: http://docs.pylonshq.com/
* PyPubSub: http://pubsub.sourceforge.net/
* pyrticle: http://documen.tician.de/pyrticle/
* Pysparse: http://pysparse.sourceforge.net/
* Python: http://docs.python.org/dev/
* python-apt: http://people.debian.org/~jak/python-apt-doc/
* PyUblas: http://documen.tician.de/pyublas/
* Reteisi: http://docs.argolinux.org/reteisi/
* Roundup: http://www.roundup-tracker.org/
* Satchmo: http://www.satchmoproject.com/docs/svn/
* Self: http://selflanguage.org/
* SimPy: http://simpy.sourceforge.net/
* Sphinx: http://sphinx.pocoo.org/
* SQLAlchemy: http://www.sqlalchemy.org/docs/
* Sqlkit: http://sqlkit.argolinux.org/

View File

@ -57,8 +57,8 @@ tables of contents. The ``toctree`` directive is the central element.
chapter", "previous chapter" and "parent chapter" links.
Document titles in the :dir:`toctree` will be automatically read from the
title of the referenced document. If that isn't what you want, you can give
the specify an explicit title and target using a similar syntax to reST
title of the referenced document. If that isn't what you want, you can
specify an explicit title and target using a similar syntax to reST
hyperlinks (and Sphinx's :ref:`cross-referencing syntax <xref-syntax>`). This
looks like::

View File

@ -141,8 +141,24 @@ General configuration
instance is then used to render HTML documents, and possibly the output of
other builders (currently the changes builder).
.. confval:: rst_epilog
.. index:: pair: global; substitutions
A string of reStructuredText that will be included at the end of every source
file that is read. This is the right place to add substitutions that should
be available in every file. An example::
rst_epilog = """
.. |psf| replace:: Python Software Foundation
"""
.. versionadded:: 0.6
.. confval:: default_role
.. index:: default; role
The name of a reST role (builtin or Sphinx extension) to use as the default
role, that is, for text marked up ```like this```. This can be set to
``'obj'`` to make ```filter``` a cross-reference to the function "filter".
@ -214,12 +230,14 @@ Project information
* ``de`` -- German
* ``en`` -- English
* ``es`` -- Spanish
* ``fi`` -- Finnish
* ``fr`` -- French
* ``it`` -- Italian
* ``nl`` -- Dutch
* ``pl`` -- Polish
* ``pt_BR`` -- Brazilian Portuguese
* ``sl`` -- Slovenian
* ``uk_UA`` -- Ukrainian
* ``zh_TW`` -- Traditional Chinese
.. confval:: today
@ -271,7 +289,14 @@ Project information
A boolean that decides whether :dir:`moduleauthor` and :dir:`sectionauthor`
directives produce any output in the built files.
.. confval:: trim_footnote_reference_space
Trim spaces before footnote references that are necessary for the reST parser
to recognize the footnote, but do not look too nice in the output.
.. versionadded:: 0.6
.. _html-options:
Options for HTML output
@ -464,6 +489,14 @@ that use Sphinx' HTMLWriter class.
.. versionadded:: 0.4
.. confval:: html_collapse_toctree
If true, the toctree given to the templates as ``toctree`` will be collapsed,
i.e. only the subitems that contain the current page are visible. Default is
``False``.
.. versionadded:: 0.6
.. confval:: htmlhelp_basename
Output file base name for HTML help builder. Default is ``'pydoc'``.

View File

@ -15,6 +15,7 @@ Sphinx documentation contents
templating
extensions
faq
glossary
changes
examples

View File

@ -17,8 +17,9 @@ if possible, reuse that support too.
.. note::
:mod:`sphinx.ext.mathbase` does not need to be added to the
:confval:`extensions` config value.
:mod:`sphinx.ext.mathbase` is not meant to be added to the
:confval:`extensions` config value, instead, use either
:mod:`sphinx.ext.pngmath` or :mod:`sphinx.ext.jsmath` as described below.
The input language for mathematics is LaTeX markup. This is the de-facto
standard for plain-text math notation and has the added advantage that no

20
doc/faq.rst Normal file
View File

@ -0,0 +1,20 @@
.. _faq:
Sphinx FAQ
==========
This is a list of Frequently Asked Questions about Sphinx. Feel free to
suggest new entries!
How do I...
-----------
... add global substitutions?
Add them in the :confval:`rst_epilog` config value.
... use Sphinx with Epydoc?
There's a third-party extension providing an `api role`_ which refers to
Epydoc's API docs for a given identifier.
.. _api role: http://git.savannah.gnu.org/cgit/kenozooid.git/tree/doc/extapi.py

View File

@ -212,10 +212,14 @@ reST supports an image directive, used like so::
.. image:: gnu.png
(options)
When used within Sphinx, the file name given (here ``gnu.png``) must be relative
to the source file, and Sphinx will automatically copy image files over to a
subdirectory of the output directory on building (e.g. the ``_static`` directory
for HTML output.)
When used within Sphinx, the file name given (here ``gnu.png``) must either be
relative to the source file, or absolute which means that they are relative to
the top source directory. For example, the file ``sketch/spam.rst`` could refer
to the image ``images/spam.png`` as ``../images/spam.png`` or
``/images/spam.png``.
Sphinx will automatically copy image files over to a subdirectory of the output
directory on building (e.g. the ``_static`` directory for HTML output.)
Interpretation of image size options (``width`` and ``height``) is as follows:
if the size has no unit or the unit is pixels, the given size will only be
@ -236,6 +240,9 @@ the former, while the HTML builder would prefer the latter.
.. versionchanged:: 0.4
Added the support for file names ending in an asterisk.
.. versionchanged:: 0.6
Image paths can now be absolute.
Footnotes
---------

View File

@ -18,15 +18,8 @@ from cStringIO import StringIO
from docutils import nodes
from docutils.parsers.rst import directives, roles
import sphinx
from sphinx.roles import xfileref_role, innernodetypes
from sphinx.config import Config
from sphinx.builders import BUILTIN_BUILDERS
from sphinx.directives import desc_directive, target_directive, \
additional_xref_types
from sphinx.environment import SphinxStandaloneReader
from sphinx.util.console import bold
# create the error classes before importing the rest of Sphinx, so that
# they can be imported in a circular fashion
class SphinxError(Exception):
"""
@ -56,6 +49,16 @@ class ExtensionError(SphinxError):
return parent_str
import sphinx
from sphinx.roles import xfileref_role, innernodetypes
from sphinx.config import Config
from sphinx.builders import BUILTIN_BUILDERS
from sphinx.directives import desc_directive, target_directive, \
additional_xref_types
from sphinx.environment import SphinxStandaloneReader
from sphinx.util.console import bold
# List of all known core events. Maps name to arguments description.
events = {
'builder-inited': '',

View File

@ -26,6 +26,7 @@ from sphinx.util import SEP, os_path, relative_uri, ensuredir, \
movefile, ustrftime
from sphinx.search import js_index
from sphinx.builders import Builder, ENV_PICKLE_FILENAME
from sphinx.application import SphinxError
from sphinx.highlighting import PygmentsBridge
from sphinx.util.console import bold
from sphinx.writers.html import HTMLWriter, HTMLTranslator, \
@ -180,6 +181,10 @@ class StandaloneHTMLBuilder(Builder):
)
self.globalcontext.update(self.config.html_context)
def _get_local_toctree(self, docname):
return self.render_partial(self.env.get_toctree_for(
docname, self, self.config.html_collapse_toctree))['fragment']
def get_doc_context(self, docname, body, metatags):
"""Collect items for the template context of a page."""
# find out relations
@ -446,6 +451,9 @@ class StandaloneHTMLBuilder(Builder):
[path.join(self.confdir, spath)
for spath in self.config.html_static_path]
for staticdirname in staticdirnames:
if not path.isdir(staticdirname):
self.warn('static directory %r does not exist' % staticdirname)
continue
for filename in os.listdir(staticdirname):
if filename.startswith('.'):
continue
@ -533,6 +541,7 @@ class StandaloneHTMLBuilder(Builder):
ctx['pathto'] = pathto
ctx['hasdoc'] = lambda name: name in self.env.all_docs
ctx['customsidebar'] = self.config.html_sidebars.get(pagename)
ctx['toctree'] = lambda: self._get_local_toctree(pagename)
ctx.update(addctx)
self.app.emit('html-page-context', pagename, templatename,
@ -695,7 +704,6 @@ class JSONHTMLBuilder(SerializingHTMLBuilder):
def init(self):
if json is None:
from sphinx.application import SphinxError
raise SphinxError(
'The module simplejson (or json in Python >= 2.6) '
'is not available. The JSONHTMLBuilder builder will not work.')

View File

@ -52,6 +52,10 @@ class LaTeXBuilder(Builder):
else:
return '%' + docname
def get_relative_uri(self, from_, to, typ=None):
# ignore source path
return self.get_target_uri(to, typ)
def init_document_data(self):
preliminary_document_data = map(list, self.config.latex_documents)
if not preliminary_document_data:
@ -72,11 +76,6 @@ class LaTeXBuilder(Builder):
self.titles.append((docname, entry[2]))
def write(self, *ignored):
# first, assemble the "appendix" docs that are in every PDF
appendices = []
for fname in self.config.latex_appendices:
appendices.append(self.env.get_doctree(fname))
docwriter = LaTeXWriter(self)
docsettings = OptionParser(
defaults=self.env.settings,
@ -94,7 +93,8 @@ class LaTeXBuilder(Builder):
encoding='utf-8')
self.info("processing " + targetname + "... ", nonl=1)
doctree = self.assemble_doctree(docname, toctree_only,
appendices=(docclass == 'manual') and appendices or [])
appendices=((docclass == 'manual') and
self.config.latex_appendices or []))
self.post_process_images(doctree)
self.info("writing... ", nonl=1)
doctree.settings = docsettings
@ -142,7 +142,11 @@ class LaTeXBuilder(Builder):
new_sect += node
tree = new_tree
largetree = process_tree(indexfile, tree)
largetree.extend(appendices)
largetree['docname'] = indexfile
for docname in appendices:
appendix = self.env.get_doctree(docname)
appendix['docname'] = docname
largetree.append(appendix)
self.info()
self.info("resolving references...")
self.env.resolve_references(largetree, indexfile, self)

View File

@ -45,6 +45,7 @@ class Config(object):
default_role = (None, True),
add_function_parentheses = (True, True),
add_module_names = (True, True),
trim_footnote_reference_space = (False, True),
show_authors = (False, True),
pygments_style = (None, False),
highlight_language = ('python', False),
@ -52,6 +53,7 @@ class Config(object):
template_bridge = (None, False),
keep_warnings = (False, True),
modindex_common_prefix = ([], False),
rst_epilog = (None, True),
# HTML options
html_theme = ('default', False),
@ -69,6 +71,7 @@ class Config(object):
html_use_smartypants = (True, False),
html_translator_class = (None, False),
html_sidebars = ({}, False),
html_collapse_toctree = (False, False),
html_additional_pages = ({}, False),
html_use_modindex = (True, False),
html_add_permalinks = (True, False),

View File

@ -429,6 +429,7 @@ def desc_directive(desctype, arguments, options, content, lineno,
env = state.document.settings.env
inode = addnodes.index(entries=[])
node = addnodes.desc()
node.document = state.document
node['desctype'] = desctype
noindex = ('noindex' in options)
@ -525,6 +526,7 @@ def desc_directive(desctype, arguments, options, content, lineno,
inode['entries'].append(('single', indextext, fullname, fullname))
subnode = addnodes.desc_content()
node.append(subnode)
# needed for automatic qualification of members
clsname_set = False
if desctype in ('class', 'exception') and names:
@ -542,7 +544,6 @@ def desc_directive(desctype, arguments, options, content, lineno,
if clsname_set:
env.currclass = None
env.currdesc = None
node.append(subnode)
return [inode, node]
desc_directive.content = 1

View File

@ -14,7 +14,7 @@ from docutils.parsers.rst import directives
from sphinx import addnodes
from sphinx.locale import pairindextypes
from sphinx.util import patfilter, ws_re, caption_ref_re, docname_join
from sphinx.util import patfilter, ws_re, caption_ref_re, url_re, docname_join
from sphinx.util.compat import make_admonition
@ -53,14 +53,14 @@ def toctree_directive(name, arguments, options, content, lineno,
docname = docname[:-len(suffix)]
# absolutize filenames
docname = docname_join(env.docname, docname)
if ref.startswith('http://'): # FIXME: generalize to arbitrary xrefs
if url_re.match(ref):
entries.append((title, ref))
elif docname not in env.found_docs:
ret.append(state.document.reporter.warning(
'toctree references unknown document %r' % docname,
line=lineno))
else:
entries.append((title, ref))
entries.append((title, docname))
includefiles.append(docname)
else:
patname = docname_join(env.docname, entry)
@ -230,6 +230,7 @@ directives.register_directive('index', index_directive)
def version_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
node = addnodes.versionmodified()
node.document = state.document
node['type'] = name
node['version'] = arguments[0]
if len(arguments) == 2:
@ -335,6 +336,7 @@ def glossary_directive(name, arguments, options, content, lineno,
"""Glossary with cross-reference targets for :term: roles."""
env = state.document.settings.env
node = addnodes.glossary()
node.document = state.document
state.nested_parse(content, content_offset, node)
# the content should be definition lists
@ -383,6 +385,7 @@ directives.register_directive('centered', centered_directive)
def acks_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
node = addnodes.acks()
node.document = state.document
state.nested_parse(content, content_offset, node)
if len(node.children) != 1 or not isinstance(node.children[0],
nodes.bullet_list):
@ -399,6 +402,7 @@ def hlist_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
ncolumns = options.get('columns', 2)
node = nodes.paragraph()
node.document = state.document
state.nested_parse(content, content_offset, node)
if len(node.children) != 1 or not isinstance(node.children[0],
nodes.bullet_list):

View File

@ -44,14 +44,15 @@ from docutils.transforms.parts import ContentsFilter
from sphinx import addnodes
from sphinx.util import movefile, get_matching_docs, SEP, ustrftime, \
docname_join, FilenameUniqDict
docname_join, FilenameUniqDict, url_re
from sphinx.directives import additional_xref_types
from sphinx.application import SphinxError
default_settings = {
'embed_stylesheet': False,
'cloak_email_addresses': True,
'pep_base_url': 'http://www.python.org/dev/peps/',
'rfc_base_url': 'http://rfc.net/',
'rfc_base_url': 'http://tools.ietf.org/html/',
'input_encoding': 'utf-8',
'doctitle_xform': False,
'sectsubtitle_xform': False,
@ -59,7 +60,7 @@ default_settings = {
# This is increased every time an environment attribute is added
# or changed to properly invalidate pickle files.
ENV_VERSION = 27
ENV_VERSION = 28
default_substitutions = set([
@ -526,15 +527,20 @@ class BuildEnvironment:
self.docname = docname
self.settings['input_encoding'] = self.config.source_encoding
self.settings['trim_footnote_reference_space'] = \
self.config.trim_footnote_reference_space
class SphinxSourceClass(FileInput):
def read(self):
data = FileInput.read(self)
def read(self_):
data = FileInput.read(self_)
if app:
arg = [data]
app.emit('source-read', docname, arg)
data = arg[0]
return data
if self.config.rst_epilog:
return data + '\n' + self.config.rst_epilog + '\n'
else:
return data
# publish manually
pub = Publisher(reader=SphinxStandaloneReader(),
@ -549,7 +555,6 @@ class BuildEnvironment:
pub.publish()
doctree = pub.document
except UnicodeError, err:
from sphinx.application import SphinxError
raise SphinxError(str(err))
self.filter_messages(doctree)
self.process_dependencies(docname, doctree)
@ -653,7 +658,11 @@ class BuildEnvironment:
candidates['?'] = imguri
continue
# imgpath is the image path *from srcdir*
imgpath = path.normpath(path.join(docdir, imguri))
if imguri.startswith('/') or imguri.startswith(os.sep):
# absolute path (= relative to srcdir)
imgpath = path.normpath(imguri[1:])
else:
imgpath = path.normpath(path.join(docdir, imguri))
# set imgpath as default URI
node['uri'] = imgpath
if imgpath.endswith(os.extsep + '*'):
@ -790,20 +799,32 @@ class BuildEnvironment:
except ValueError:
maxdepth = 0
def traverse_in_section(node, cls):
"""Like traverse(), but stay within the same section."""
result = []
if isinstance(node, cls):
result.append(node)
for child in node.children:
if isinstance(child, nodes.section):
continue
result.extend(traverse_in_section(child, cls))
return result
def build_toc(node, depth=1):
entries = []
for subnode in node:
if isinstance(subnode, addnodes.toctree):
# just copy the toctree node which is then resolved
# in self.get_and_resolve_doctree
item = subnode.copy()
entries.append(item)
# do the inventory stuff
self.note_toctree(docname, subnode)
for sectionnode in node:
# find all toctree nodes in this section and add them
# to the toc (just copying the toctree node which is then
# resolved in self.get_and_resolve_doctree)
if not isinstance(sectionnode, nodes.section):
for toctreenode in traverse_in_section(sectionnode,
addnodes.toctree):
item = toctreenode.copy()
entries.append(item)
# important: do the inventory stuff
self.note_toctree(docname, toctreenode)
continue
if not isinstance(subnode, nodes.section):
continue
title = subnode[0]
title = sectionnode[0]
# copy the contents of the section title, but without references
# and unnecessary stuff
visitor = SphinxContentsFilter(document)
@ -814,7 +835,7 @@ class BuildEnvironment:
# as it is the file's title anyway
anchorname = ''
else:
anchorname = '#' + subnode['ids'][0]
anchorname = '#' + sectionnode['ids'][0]
numentries[0] += 1
reference = nodes.reference('', '', refuri=docname,
anchorname=anchorname,
@ -822,7 +843,7 @@ class BuildEnvironment:
para = addnodes.compact_paragraph('', '', reference)
item = nodes.list_item('', para)
if maxdepth == 0 or depth < maxdepth:
item += build_toc(subnode, depth+1)
item += build_toc(sectionnode, depth+1)
entries.append(item)
if entries:
return nodes.bullet_list('', *entries)
@ -841,14 +862,12 @@ class BuildEnvironment:
node['refuri'] = node['anchorname']
return toc
def get_toctree_for(self, docname, builder):
def get_toctree_for(self, docname, builder, collapse):
"""Return the global TOC nodetree."""
# XXX why master_doc?
doctree = self.get_doctree(self.config.master_doc)
for toctreenode in doctree.traverse(addnodes.toctree):
result = self.resolve_toctree(docname, builder, toctreenode,
prune=True)
prune=True, collapse=collapse)
if result is not None:
return result
@ -924,7 +943,7 @@ class BuildEnvironment:
return doctree
def resolve_toctree(self, docname, builder, toctree, prune=True, maxdepth=0,
titles_only=False):
titles_only=False, collapse=False):
"""
Resolve a *toctree* node into individual bullet lists with titles
as items, returning None (if no containing titles are found) or
@ -934,6 +953,8 @@ class BuildEnvironment:
to the value of the *maxdepth* option on the *toctree* node.
If *titles_only* is True, only toplevel document titles will be in the
resulting tree.
If *collapse* is True, all branches not containing docname will
be collapsed.
"""
if toctree.get('hidden', False):
return None
@ -951,13 +972,30 @@ class BuildEnvironment:
else:
_walk_depth(subnode, depth+1, maxdepth)
# cull sub-entries whose parents aren't 'current'
if (collapse and
depth > 1 and
'current' not in subnode.parent['classes']):
subnode.parent.remove(subnode)
elif isinstance(subnode, nodes.reference):
# Identify the toc entry pointing to the current document.
if subnode['refuri'] == docname and not subnode['anchorname']:
# tag the whole branch as 'current'
# (We can't use traverse here as 'ascend' un-intuitively
# implies 'siblings'.)
p = subnode
while p:
p['classes'].append('current')
p = p.parent
def _entries_from_toctree(toctreenode, separate=False, subtree=False):
"""Return TOC entries for a toctree node."""
refs = [(e[0], str(e[1])) for e in toctreenode['entries']]
entries = []
for (title, ref) in refs:
try:
if ref.startswith('http://'): # FIXME: (see directives/other.py)
if url_re.match(ref):
reference = nodes.reference('', '', refuri=ref, anchorname='',
*[nodes.Text(title)])
para = addnodes.compact_paragraph('', '', reference)
@ -1019,11 +1057,13 @@ class BuildEnvironment:
newnode = addnodes.compact_paragraph('', '', *tocentries)
newnode['toctree'] = True
# prune the tree to maxdepth and replace titles, also set level classes
_walk_depth(newnode, 1, prune and maxdepth or 0)
# set the target paths in the toctrees (they are not known at TOC generation time)
for refnode in newnode.traverse(nodes.reference):
if not refnode['refuri'].startswith('http://'): # FIXME: see above
if not url_re.match(refnode['refuri']):
refnode['refuri'] = builder.get_relative_uri(
docname, refnode['refuri']) + refnode['anchorname']
return newnode

View File

@ -329,7 +329,18 @@ class RstGenerator(object):
# can never get arguments of a C function or method
getargs = False
if getargs:
argspec = inspect.getargspec(obj)
try:
argspec = inspect.getargspec(obj)
except TypeError:
# if a class should be documented as function (yay duck
# typing) we try to use the constructor signature as function
# signature without the first argument.
try:
argspec = inspect.getargspec(obj.__new__)
except TypeError:
argspec = inspect.getargspec(obj.__init__)
if argspec[0]:
del argspec[0][0]
if what in ('class', 'method', 'staticmethod',
'classmethod') and argspec[0] and \
argspec[0][0] in ('cls', 'self'):
@ -354,7 +365,7 @@ class RstGenerator(object):
return ''
def generate(self, what, name, members, add_content, indent=u'',
check_module=False, no_docstring=False):
check_module=False, no_docstring=False, real_module=None):
"""
Generate reST for the object in self.result.
"""
@ -385,9 +396,17 @@ class RstGenerator(object):
(what, str(fullname), err))
return
# If there is no real module defined, figure out which to use.
# The real module is used in the module analyzer to look up the module
# where the attribute documentation would actually be found in.
# This is used for situations where you have a module that collects the
# functions and classes of internal submodules.
if real_module is None:
real_module = getattr(todoc, '__module__', None) or mod
# try to also get a source code analyzer for attribute docs
try:
analyzer = ModuleAnalyzer.for_module(mod)
analyzer = ModuleAnalyzer.for_module(real_module)
# parse right now, to get PycodeErrors on parsing
analyzer.parse()
except PycodeError, err:
@ -463,7 +482,7 @@ class RstGenerator(object):
sys.getfilesystemencoding(), 'replace')
sourcename = u'%s:docstring of %s' % (srcname, fullname)
attr_docs = analyzer.find_attr_docs()
if what in ('data', 'attribute'):
if objpath:
key = ('.'.join(objpath[:-1]), objpath[-1])
if key in attr_docs:
no_docstring = True
@ -610,7 +629,8 @@ class RstGenerator(object):
full_membername = mod + '::' + '.'.join(objpath + [membername])
self.generate(memberwhat, full_membername, ['__all__'],
add_content=content, no_docstring=bool(content),
indent=indent, check_module=members_check_module)
indent=indent, check_module=members_check_module,
real_module=real_module)
self.env.autodoc_current_module = None
self.env.autodoc_current_class = None
@ -648,9 +668,12 @@ def _auto_directive(dirname, arguments, options, content, lineno,
state.memo.reporter = AutodocReporter(generator.result, state.memo.reporter)
if dirname == 'automodule':
node = nodes.section()
node.document = state.document # necessary so that the child nodes
# get the right source/line set
nested_parse_with_titles(state, generator.result, node)
else:
node = nodes.paragraph()
node.document = state.document
state.nested_parse(generator.result, 0, node)
state.memo.reporter = old_reporter
return generator.warnings + node.children

View File

@ -82,6 +82,11 @@ def render_math(self, math):
depth = read_png_depth(outfn)
return relfn, depth
# if latex or dvipng has failed once, don't bother to try again
if hasattr(self.builder, '_mathpng_warned_latex') or \
hasattr(self.builder, '_mathpng_warned_dvipng'):
return None, None
latex = DOC_HEAD + self.builder.config.pngmath_latex_preamble
latex += (use_preview and DOC_BODY_PREVIEW or DOC_BODY) % math
if isinstance(latex, unicode):
@ -116,12 +121,11 @@ def render_math(self, math):
except OSError, err:
if err.errno != 2: # No such file or directory
raise
if not hasattr(self.builder, '_mathpng_warned_latex'):
self.builder.warn('LaTeX command %r cannot be run (needed for '
'math display), check the pngmath_latex '
'setting' % self.builder.config.pngmath_latex)
self.builder._mathpng_warned_latex = True
return relfn, None
self.builder.warn('LaTeX command %r cannot be run (needed for math '
'display), check the pngmath_latex setting' %
self.builder.config.pngmath_latex)
self.builder._mathpng_warned_latex = True
return None, None
finally:
chdir(curdir)
@ -145,12 +149,11 @@ def render_math(self, math):
except OSError, err:
if err.errno != 2: # No such file or directory
raise
if not hasattr(self.builder, '_mathpng_warned_dvipng'):
self.builder.warn('dvipng command %r cannot be run (needed for '
'math display), check the pngmath_dvipng setting'
% self.builder.config.pngmath_dvipng)
self.builder._mathpng_warned_dvipng = True
return relfn, None
self.builder.warn('dvipng command %r cannot be run (needed for math '
'display), check the pngmath_dvipng setting' %
self.builder.config.pngmath_dvipng)
self.builder._mathpng_warned_dvipng = True
return None, None
stdout, stderr = p.communicate()
if p.returncode != 0:
raise MathExtError('dvipng exited with error:\n[stderr]\n%s\n'
@ -185,10 +188,15 @@ def html_visit_math(self, node):
sm.walkabout(self)
self.builder.warn('display latex %r: ' % node['latex'] + str(exc))
raise nodes.SkipNode
self.body.append('<img class="math" src="%s" alt="%s" %s/>' %
(fname, self.encode(node['latex']).strip(),
depth and 'style="vertical-align: %dpx" ' %
(-depth) or ''))
if fname is None:
# something failed -- use text-only as a bad substitute
self.body.append('<span class="math">%s</span>' %
self.encode(node['latex']).strip())
else:
self.body.append(
'<img class="math" src="%s" alt="%s" %s/>' %
(fname, self.encode(node['latex']).strip(),
depth and 'style="vertical-align: %dpx" ' % (-depth) or ''))
raise nodes.SkipNode
def html_visit_displaymath(self, node):
@ -208,8 +216,13 @@ def html_visit_displaymath(self, node):
self.body.append('<p>')
if node['number']:
self.body.append('<span class="eqno">(%s)</span>' % node['number'])
self.body.append('<img src="%s" alt="%s" />\n</div>' %
(fname, self.encode(node['latex']).strip()))
if fname is None:
# something failed -- use text-only as a bad substitute
self.body.append('<span class="math">%s</span>' %
self.encode(node['latex']).strip())
else:
self.body.append('<img src="%s" alt="%s" />\n</div>' %
(fname, self.encode(node['latex']).strip()))
self.body.append('</p>')
raise nodes.SkipNode

View File

@ -61,6 +61,9 @@ def process_todo_nodes(app, doctree, fromdocname):
# Augment each todo with a backlink to the original location.
env = app.builder.env
if not hasattr(env, 'todo_all_todos'):
env.todo_all_todos = []
for node in doctree.traverse(todolist):
if not app.config['todo_include_todos']:
node.replace_self([])

View File

@ -1 +1 @@
Documentation.addTranslations({"locale": "de", "plural_expr": "(n != 1)", "messages": {"module, in ": "Modul, in ", "Preparing search...": "Suche wird vorbereitet...", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "Es wurden keine Dokumente gefunden. Haben Sie alle Suchworte richtig geschrieben und gen\u00fcgend Kategorien ausgew\u00e4hlt?", "Search finished, found %s page(s) matching the search query.": "Suche beendet, %s Seite(n) mit Ergebnissen wurden gefunden.", ", in ": "", "Permalink to this headline": "Permalink zu dieser \u00dcberschrift", "Searching": "Suchen...", "Permalink to this definition": "Permalink zu dieser Definition", "Hide Search Matches": "Suchergebnisse ausblenden", "Search Results": "Suchergebnisse"}});
Documentation.addTranslations({"locale": "de", "plural_expr": "(n != 1)", "messages": {"module, in ": "Modul, in ", "Preparing search...": "Suche wird vorbereitet...", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "Es wurden keine Dokumente gefunden. Haben Sie alle Suchworte richtig geschrieben und gen\u00fcgend Kategorien ausgew\u00e4hlt?", "Search finished, found %s page(s) matching the search query.": "Suche beendet, %s Seite(n) mit Ergebnissen wurden gefunden.", ", in ": ", in ", "Permalink to this headline": "Permalink zu dieser \u00dcberschrift", "Searching": "Suchen...", "Permalink to this definition": "Permalink zu dieser Definition", "Hide Search Matches": "Suchergebnisse ausblenden", "Search Results": "Suchergebnisse"}});

View File

@ -0,0 +1 @@
Documentation.addTranslations({"locale": "fi", "plural_expr": "(n != 1)", "messages": {"module, in ": "", "Preparing search...": "Valmistellaan etsint\u00e4\u00e4...", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "Ei l\u00f6ytynyt yht\u00e4\u00e4n. Tarkista hakuehdot, sanahaku, ei sen osia", "Search finished, found %s page(s) matching the search query.": "Etsint\u00e4 tehty, l\u00f6ydetty %s sivu(a).", ", in ": "", "Permalink to this headline": "", "Searching": "Etsit\u00e4\u00e4n", "Permalink to this definition": "", "Hide Search Matches": "Piilota l\u00f6ydetyt", "Search Results": "Etsinn\u00e4n tulos"}});

Binary file not shown.

View File

@ -0,0 +1,600 @@
# Finnish translations for Sphinx.
# Copyright (C) 2009 ORGANIZATION
# This file is distributed under the same license as the Sphinx project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
#
msgid ""
msgstr ""
"Project-Id-Version: Sphinx 0.6\n"
"Report-Msgid-Bugs-To: sphinx@awot.fi\n"
"POT-Creation-Date: 2009-01-24 18:39+0000\n"
"PO-Revision-Date: 2009-02-11 11:21+0200\n"
"Last-Translator: Jukka Inkeri <sphinx@awot.fi>\n"
"Language-Team: fi <sphinx@awot.fi>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.4\n"
#: sphinx/environment.py:104 sphinx/writers/latex.py:170
#, python-format
msgid "%B %d, %Y"
msgstr "%d.%m.%Y"
#: sphinx/environment.py:300 sphinx/templates/genindex-single.html:2
#: sphinx/templates/genindex-split.html:2
#: sphinx/templates/genindex-split.html:5 sphinx/templates/genindex.html:2
#: sphinx/templates/genindex.html:5 sphinx/templates/genindex.html:48
#: sphinx/templates/layout.html:126 sphinx/writers/latex.py:176
msgid "Index"
msgstr "Sisällysluettelo"
#: sphinx/environment.py:301 sphinx/writers/latex.py:175
msgid "Module Index"
msgstr "Moduuli sisällysluettelo"
#: sphinx/environment.py:302 sphinx/templates/defindex.html:16
msgid "Search Page"
msgstr "Etsi sivu"
#: sphinx/roles.py:53 sphinx/directives/desc.py:580
#, python-format
msgid "environment variable; %s"
msgstr ""
#: sphinx/roles.py:60
#, python-format
msgid "Python Enhancement Proposals!PEP %s"
msgstr ""
#: sphinx/builders/changes.py:64
msgid "Builtins"
msgstr ""
#: sphinx/builders/changes.py:66
msgid "Module level"
msgstr "Moduulitaso"
#: sphinx/builders/html.py:118
#, python-format
msgid "%b %d, %Y"
msgstr "%d.%m.%Y"
#: sphinx/builders/html.py:137 sphinx/templates/defindex.html:21
msgid "General Index"
msgstr "Yleinen sisällysluettelo"
#: sphinx/builders/html.py:137
msgid "index"
msgstr "hakemisto"
#: sphinx/builders/html.py:139 sphinx/builders/htmlhelp.py:182
#: sphinx/builders/qthelp.py:131 sphinx/templates/defindex.html:19
#: sphinx/templates/modindex.html:2 sphinx/templates/modindex.html:13
msgid "Global Module Index"
msgstr "Yleinen moduulien sisällysluettelo"
#: sphinx/builders/html.py:139
msgid "modules"
msgstr "moduulit"
#msgstr "osat"
#: sphinx/builders/html.py:179
msgid "next"
msgstr ">"
#: sphinx/builders/html.py:186
msgid "previous"
msgstr "<"
#: sphinx/builders/latex.py:155 sphinx/builders/pdf.py:162
msgid " (in "
msgstr ""
#: sphinx/directives/desc.py:25
#, python-format
msgid "%s() (built-in function)"
msgstr ""
#: sphinx/directives/desc.py:26 sphinx/directives/desc.py:42
#: sphinx/directives/desc.py:54
#, python-format
msgid "%s() (in module %s)"
msgstr ""
#: sphinx/directives/desc.py:29
#, python-format
msgid "%s (built-in variable)"
msgstr ""
#: sphinx/directives/desc.py:30 sphinx/directives/desc.py:78
#, python-format
msgid "%s (in module %s)"
msgstr ""
#: sphinx/directives/desc.py:33
#, python-format
msgid "%s (built-in class)"
msgstr ""
#: sphinx/directives/desc.py:34
#, python-format
msgid "%s (class in %s)"
msgstr ""
#: sphinx/directives/desc.py:46
#, python-format
msgid "%s() (%s.%s method)"
msgstr ""
#: sphinx/directives/desc.py:48
#, python-format
msgid "%s() (%s method)"
msgstr ""
#: sphinx/directives/desc.py:58
#, python-format
msgid "%s() (%s.%s static method)"
msgstr ""
#: sphinx/directives/desc.py:60
#, python-format
msgid "%s() (%s static method)"
msgstr ""
#: sphinx/directives/desc.py:82
#, python-format
msgid "%s (%s.%s attribute)"
msgstr ""
#: sphinx/directives/desc.py:84
#, python-format
msgid "%s (%s attribute)"
msgstr ""
#: sphinx/directives/desc.py:86
#, python-format
msgid "%s (C function)"
msgstr ""
#: sphinx/directives/desc.py:88
#, python-format
msgid "%s (C member)"
msgstr ""
#: sphinx/directives/desc.py:90
#, python-format
msgid "%s (C macro)"
msgstr ""
#: sphinx/directives/desc.py:92
#, python-format
msgid "%s (C type)"
msgstr ""
#: sphinx/directives/desc.py:94
#, python-format
msgid "%s (C variable)"
msgstr ""
#: sphinx/directives/desc.py:112
msgid "Raises"
msgstr ""
#: sphinx/directives/desc.py:116
msgid "Variable"
msgstr ""
#: sphinx/directives/desc.py:119
msgid "Returns"
msgstr ""
#: sphinx/directives/desc.py:128
msgid "Return type"
msgstr ""
#: sphinx/directives/desc.py:213
msgid "Parameter"
msgstr ""
#: sphinx/directives/desc.py:217
msgid "Parameters"
msgstr ""
#: sphinx/directives/desc.py:465
#, python-format
msgid "%scommand line option; %s"
msgstr ""
#: sphinx/directives/other.py:101
msgid "Platforms: "
msgstr "Ympäristö"
#: sphinx/directives/other.py:106
#, python-format
msgid "%s (module)"
msgstr "%s (moduuli)"
#: sphinx/directives/other.py:146
msgid "Section author: "
msgstr "Luvun kirjoittaja: "
#: sphinx/directives/other.py:148
msgid "Module author: "
msgstr "Moduulin kirjoittaja: "
#: sphinx/directives/other.py:150
msgid "Author: "
msgstr "Tekijä: "
#: sphinx/directives/other.py:249
msgid "See also"
msgstr "Katso myös"
#: sphinx/ext/autodoc.py:442
#, python-format
msgid " Bases: %s"
msgstr ""
#: sphinx/ext/autodoc.py:566 sphinx/ext/autodoc.py:583
#, python-format
msgid "alias of :class:`%s`"
msgstr ""
#: sphinx/ext/todo.py:31
msgid "Todo"
msgstr "Tehtävä vielä"
#: sphinx/ext/todo.py:75
#, python-format
msgid "(The original entry is located in %s, line %d and can be found "
msgstr ""
#: sphinx/ext/todo.py:81
msgid "here"
msgstr "tässä"
#: sphinx/locale/__init__.py:15
msgid "Attention"
msgstr "Huom"
#: sphinx/locale/__init__.py:16
msgid "Caution"
msgstr "Varoitus"
#: sphinx/locale/__init__.py:17
msgid "Danger"
msgstr "Vaara"
#: sphinx/locale/__init__.py:18
msgid "Error"
msgstr "Virhe"
#: sphinx/locale/__init__.py:19
msgid "Hint"
msgstr "Vihje"
#: sphinx/locale/__init__.py:20
msgid "Important"
msgstr "Tärkeä"
#: sphinx/locale/__init__.py:21
msgid "Note"
msgstr "Muista"
#: sphinx/locale/__init__.py:22
msgid "See Also"
msgstr "Katso myös"
#: sphinx/locale/__init__.py:23
msgid "Tip"
msgstr "Vihje"
#: sphinx/locale/__init__.py:24
msgid "Warning"
msgstr "Varoitus"
#: sphinx/locale/__init__.py:28
#, python-format
msgid "New in version %s"
msgstr "Uusi versiossa %s"
#: sphinx/locale/__init__.py:29
#, python-format
msgid "Changed in version %s"
msgstr "Muutettu versiossa %s"
#: sphinx/locale/__init__.py:30
#, python-format
msgid "Deprecated since version %s"
msgstr "Poistettu versiosta %s alkaen"
#: sphinx/locale/__init__.py:34
msgid "module"
msgstr "moduuli"
#msgstr "osa"
#: sphinx/locale/__init__.py:35
msgid "keyword"
msgstr ""
#msgstr "avainsana"
#: sphinx/locale/__init__.py:36
msgid "operator"
msgstr ""
#msgstr "operaattori"
#: sphinx/locale/__init__.py:37
msgid "object"
msgstr ""
#msgstr "objekti"
#: sphinx/locale/__init__.py:38
msgid "exception"
msgstr ""
#msgstr "poikkeus"
#: sphinx/locale/__init__.py:39
msgid "statement"
msgstr ""
#: sphinx/locale/__init__.py:40
msgid "built-in function"
msgstr ""
#: sphinx/static/doctools.js:139 sphinx/writers/html.py:425
msgid "Permalink to this headline"
msgstr ""
#: sphinx/static/doctools.js:145 sphinx/writers/html.py:80
msgid "Permalink to this definition"
msgstr ""
#: sphinx/static/doctools.js:174
msgid "Hide Search Matches"
msgstr "Piilota löydetyt"
#: sphinx/static/searchtools.js:274
msgid "Searching"
msgstr "Etsitään"
#: sphinx/static/searchtools.js:279
msgid "Preparing search..."
msgstr "Valmistellaan etsintää..."
#: sphinx/static/searchtools.js:338
msgid "module, in "
msgstr ""
#: sphinx/static/searchtools.js:347
msgid ", in "
msgstr ""
#: sphinx/static/searchtools.js:453 sphinx/templates/search.html:25
msgid "Search Results"
msgstr "Etsinnän tulos"
#: sphinx/static/searchtools.js:455
msgid ""
"Your search did not match any documents. Please make sure that all words "
"are spelled correctly and that you've selected enough categories."
msgstr "Ei löytynyt yhtään. Tarkista hakuehdot, sanahaku, ei sen osia"
#: sphinx/static/searchtools.js:457
#, python-format
msgid "Search finished, found %s page(s) matching the search query."
msgstr "Etsintä tehty, löydetty %s sivu(a)."
#: sphinx/templates/defindex.html:2
msgid "Overview"
msgstr "Yhteenveto"
#: sphinx/templates/defindex.html:11
msgid "Indices and tables:"
msgstr ""
#: sphinx/templates/defindex.html:14
msgid "Complete Table of Contents"
msgstr ""
#: sphinx/templates/defindex.html:15
msgid "lists all sections and subsections"
msgstr ""
#: sphinx/templates/defindex.html:17
msgid "search this documentation"
msgstr ""
#: sphinx/templates/defindex.html:20
msgid "quick access to all modules"
msgstr ""
#: sphinx/templates/defindex.html:22
msgid "all functions, classes, terms"
msgstr ""
#: sphinx/templates/genindex-single.html:5
#, python-format
msgid "Index &ndash; %(key)s"
msgstr ""
#: sphinx/templates/genindex-single.html:44
#: sphinx/templates/genindex-split.html:14
#: sphinx/templates/genindex-split.html:27 sphinx/templates/genindex.html:54
msgid "Full index on one page"
msgstr "Hakemisto yhtenä luettelona"
#: sphinx/templates/genindex-split.html:7
msgid "Index pages by letter"
msgstr "Hakemisto aakkostus sivuttain"
#: sphinx/templates/genindex-split.html:15
msgid "can be huge"
msgstr "voi olla iso"
#: sphinx/templates/layout.html:9
msgid "Navigation"
msgstr "Navikointi"
#: sphinx/templates/layout.html:40
msgid "Table Of Contents"
msgstr "Sisällysluettelo"
#: sphinx/templates/layout.html:46
msgid "Previous topic"
msgstr "<<"
#: sphinx/templates/layout.html:48
msgid "previous chapter"
msgstr "<<"
#: sphinx/templates/layout.html:51
msgid "Next topic"
msgstr ">>"
#: sphinx/templates/layout.html:53
msgid "next chapter"
msgstr ">>"
#: sphinx/templates/layout.html:58
msgid "This Page"
msgstr "Tämä sivu"
#: sphinx/templates/layout.html:61
msgid "Show Source"
msgstr "Näytä lähdekoodina"
#: sphinx/templates/layout.html:71
msgid "Quick search"
msgstr "Pikahaku"
#: sphinx/templates/layout.html:74
msgid "Go"
msgstr "Siirry"
#: sphinx/templates/layout.html:78
msgid "Enter search terms or a module, class or function name."
msgstr "Anna etsittävä termi tai moduuli, luokka tai funktio"
#: sphinx/templates/layout.html:115
#, python-format
msgid "Search within %(docstitle)s"
msgstr ""
#: sphinx/templates/layout.html:124
msgid "About these documents"
msgstr "Tietoja tästä documentistä"
#: sphinx/templates/layout.html:127 sphinx/templates/search.html:2
#: sphinx/templates/search.html:5
msgid "Search"
msgstr "Etsi"
#: sphinx/templates/layout.html:129
msgid "Copyright"
msgstr ""
#msgstr "(c)"
#: sphinx/templates/layout.html:174
#, python-format
msgid "&copy; <a href=\"%(path)s\">Copyright</a> %(copyright)s."
msgstr ""
#msgstr "&copy; <a href=\"%(path)s\">Copyright</a> %(copyright)s."
#msgstr "&copy; <a href=\"%(path)s\">kaikki pidätetään</A> %(copyright)."
#: sphinx/templates/layout.html:176
#, python-format
msgid "&copy; Copyright %(copyright)s."
msgstr ""
##msgstr "&copy; Copyright %(copyright)s."
#msgstr "&copy; %(copyright)."
#: sphinx/templates/layout.html:179
#, python-format
msgid "Last updated on %(last_updated)s."
msgstr ""
#msgstr "Viimeksi muutettu %(last_updated)."
#: sphinx/templates/layout.html:182
#, python-format
msgid ""
"Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> "
"%(sphinx_version)s."
msgstr """
#msgstr "Tehty <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> %(sphinx_version)"
#: sphinx/templates/modindex.html:36
msgid "Deprecated"
msgstr "Poistettu"
#: sphinx/templates/opensearch.xml:4
#, python-format
msgid "Search %(docstitle)s"
msgstr ""
#: sphinx/templates/search.html:9
msgid ""
"Please activate JavaScript to enable the search\n"
" functionality."
msgstr "Javascript pitää olla sallittu, jotta etsintä toimii."
#: sphinx/templates/search.html:14
msgid ""
"From here you can search these documents. Enter your search\n"
" words into the box below and click \"search\". Note that the search\n"
" function will automatically search for all of the words. Pages\n"
" containing fewer words won't appear in the result list."
msgstr "Anna hakusanat kokonaan, osasanoilla ei haeta."
#: sphinx/templates/search.html:21
msgid "search"
msgstr "etsi"
#: sphinx/templates/search.html:27
msgid "Your search did not match any results."
msgstr "Ei löytynyt ko. ehdoilla yhtään."
#: sphinx/templates/changes/frameset.html:5
#: sphinx/templates/changes/versionchanges.html:12
#, python-format
msgid "Changes in Version %(version)s &mdash; %(docstitle)s"
msgstr "Muutos versiosta %(version) &mdash; %(docstitle)"
#: sphinx/templates/changes/rstsource.html:5
#, python-format
msgid "%(filename)s &mdash; %(docstitle)s"
msgstr ""
#: sphinx/templates/changes/versionchanges.html:17
#, python-format
msgid "Automatically generated list of changes in version %(version)s"
msgstr "Automaattisesti luotu muutoshistoria alkaen versiosta %(version)"
#: sphinx/templates/changes/versionchanges.html:18
msgid "Library changes"
msgstr ""
#: sphinx/templates/changes/versionchanges.html:23
msgid "C API changes"
msgstr ""
#: sphinx/templates/changes/versionchanges.html:25
msgid "Other changes"
msgstr ""
#: sphinx/writers/latex.py:173
msgid "Release"
msgstr ""
#: sphinx/writers/text.py:166
#, python-format
msgid "Ympäristö: %s"
msgstr ""
#: sphinx/writers/text.py:427
msgid "[image]"
msgstr ""

View File

@ -0,0 +1 @@
Documentation.addTranslations({"locale": "uk_UA", "plural_expr": "(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)", "messages": {"module, in ": "\u043c\u043e\u0434\u0443\u043b\u044c, \u0432 ", "Preparing search...": "\u041f\u0456\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u043e \u043f\u043e\u0448\u0443\u043a\u0443...", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "\u0412\u0430\u0448 \u043f\u043e\u0448\u0443\u043a \u043d\u0435 \u0432\u0438\u044f\u0432\u0438\u0432 \u0436\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043f\u0456\u0432\u043f\u0430\u0434\u0456\u043d\u043d\u044f. \u0411\u0443\u0434\u044c-\u043b\u0430\u0441\u043a\u0430 \u043f\u0435\u0440\u0435\u043a\u043e\u043d\u0430\u0439\u0442\u0435\u0441\u044f \u0449\u043e \u0432\u0441\u0456 \u0441\u043b\u043e\u0432\u0430 \u043d\u0430\u0431\u0440\u0430\u043d\u0456 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0456 \u0432\u0438 \u043e\u0431\u0440\u0430\u043b\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043d\u044c\u043e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0456\u0439.", "Search finished, found %s page(s) matching the search query.": "\u041f\u043e\u0448\u0443\u043a \u0437\u0430\u043a\u0456\u043d\u0447\u0435\u043d\u043e, \u0437\u043d\u0430\u0439\u0434\u0435\u043d\u043e %s \u0441\u0442\u043e\u0440\u0456\u043d\u043e\u043a \u044f\u043a\u0456 \u0441\u043f\u0456\u0432\u043f\u0430\u043b\u0438 \u0437 \u043f\u043e\u0448\u0443\u043a\u043e\u0432\u0438\u043c \u0437\u0430\u043f\u0438\u0442\u043e\u043c.", ", in ": ", \u0432 ", "Permalink to this headline": "\u041f\u043e\u0441\u0442\u0456\u0439\u043d\u0435 \u043f\u043e\u0441\u0438\u043b\u0430\u043d\u043d\u044f \u043d\u0430 \u0446\u0435\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a", "Searching": "\u0428\u0443\u043a\u0430\u044e", "Permalink to this definition": "\u041f\u043e\u0441\u0442\u0456\u0439\u043d\u0435 \u043f\u043e\u0441\u0438\u043b\u0430\u043d\u043d\u044f \u043d\u0430 \u0446\u0435 \u0432\u0438\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f", "Hide Search Matches": "\u041f\u0440\u0438\u0445\u043e\u0432\u0430\u0442\u0438 \u0441\u043f\u0456\u0432\u043f\u0430\u0434\u0456\u043d\u043d\u044f \u043f\u043e\u0448\u0443\u043a\u0443", "Search Results": "\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0438 \u043f\u043e\u0448\u0443\u043a\u0443"}});

Binary file not shown.

View File

@ -0,0 +1,595 @@
# Ukrainian (Ukraine) translations for Sphinx.
# Copyright (C) 2009 ORGANIZATION
# This file is distributed under the same license as the Sphinx project.
# Petro Sasnyk <petro@sasnyk.name>, 2009.
#
msgid ""
msgstr ""
"Project-Id-Version: Sphinx 0.6\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2008-12-28 23:40+0100\n"
"PO-Revision-Date: 2009-01-14 17:34+0200\n"
"Last-Translator: Petro Sasnyk <petro@sasnyk.name>\n"
"Language-Team: uk_UA <LL@li.org>\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.4\n"
#: sphinx/environment.py:104 sphinx/writers/latex.py:170
#, python-format
msgid "%B %d, %Y"
msgstr ""
#: sphinx/environment.py:300 sphinx/templates/genindex-single.html:2
#: sphinx/templates/genindex-split.html:2
#: sphinx/templates/genindex-split.html:5 sphinx/templates/genindex.html:2
#: sphinx/templates/genindex.html:5 sphinx/templates/genindex.html:48
#: sphinx/templates/layout.html:126 sphinx/writers/latex.py:176
msgid "Index"
msgstr "Індекс"
#: sphinx/environment.py:301 sphinx/writers/latex.py:175
msgid "Module Index"
msgstr "Індекс модулів"
#: sphinx/environment.py:302 sphinx/templates/defindex.html:16
msgid "Search Page"
msgstr "Сторінка пошуку"
#: sphinx/roles.py:53 sphinx/directives/desc.py:580
#, python-format
msgid "environment variable; %s"
msgstr "змінна оточення; %s"
#: sphinx/roles.py:60
#, python-format
msgid "Python Enhancement Proposals!PEP %s"
msgstr "Python Enhancement Proposals!PEP %s"
#: sphinx/builders/changes.py:64
msgid "Builtins"
msgstr "Вбудовані елементи"
#: sphinx/builders/changes.py:66
msgid "Module level"
msgstr "Рівень модуля"
#: sphinx/builders/html.py:118
#, python-format
msgid "%b %d, %Y"
msgstr "%b %d, %Y"
#: sphinx/builders/html.py:137 sphinx/templates/defindex.html:21
msgid "General Index"
msgstr "Загальний індекс"
#: sphinx/builders/html.py:137
msgid "index"
msgstr "індекс"
#: sphinx/builders/html.py:139 sphinx/builders/htmlhelp.py:182
#: sphinx/builders/qthelp.py:131 sphinx/templates/defindex.html:19
#: sphinx/templates/modindex.html:2 sphinx/templates/modindex.html:13
msgid "Global Module Index"
msgstr "Загальний індекс модулів"
#: sphinx/builders/html.py:139
msgid "modules"
msgstr "модулі"
#: sphinx/builders/html.py:179
msgid "next"
msgstr "наступний"
#: sphinx/builders/html.py:186
msgid "previous"
msgstr "попередній"
#: sphinx/builders/latex.py:155
msgid " (in "
msgstr " (в "
#: sphinx/directives/desc.py:25
#, python-format
msgid "%s() (built-in function)"
msgstr "%s() (вбудована функція)"
#: sphinx/directives/desc.py:26 sphinx/directives/desc.py:42
#: sphinx/directives/desc.py:54
#, python-format
msgid "%s() (in module %s)"
msgstr "%s() (в модулі %s)"
#: sphinx/directives/desc.py:29
#, python-format
msgid "%s (built-in variable)"
msgstr "%s (вбудована змінна)"
#: sphinx/directives/desc.py:30 sphinx/directives/desc.py:78
#, python-format
msgid "%s (in module %s)"
msgstr "%s (в модулі %s)"
#: sphinx/directives/desc.py:33
#, python-format
msgid "%s (built-in class)"
msgstr "%s (вбудований клас)"
#: sphinx/directives/desc.py:34
#, python-format
msgid "%s (class in %s)"
msgstr "%s (клас в %s)"
#: sphinx/directives/desc.py:46
#, python-format
msgid "%s() (%s.%s method)"
msgstr "%s() (%s.%s метод)"
#: sphinx/directives/desc.py:48
#, python-format
msgid "%s() (%s method)"
msgstr "%s() (%s метод)"
#: sphinx/directives/desc.py:58
#, python-format
msgid "%s() (%s.%s static method)"
msgstr "%s() (%s.%s статичний метод)"
#: sphinx/directives/desc.py:60
#, python-format
msgid "%s() (%s static method)"
msgstr "%s() (%s статичний метод)"
#: sphinx/directives/desc.py:82
#, python-format
msgid "%s (%s.%s attribute)"
msgstr "%s (%s.%s атрибут)"
#: sphinx/directives/desc.py:84
#, python-format
msgid "%s (%s attribute)"
msgstr "%s (%s атрибут)"
#: sphinx/directives/desc.py:86
#, python-format
msgid "%s (C function)"
msgstr "%s (С функція)"
#: sphinx/directives/desc.py:88
#, python-format
msgid "%s (C member)"
msgstr "%s (C член)"
#: sphinx/directives/desc.py:90
#, python-format
msgid "%s (C macro)"
msgstr "%s (C макрос)"
#: sphinx/directives/desc.py:92
#, python-format
msgid "%s (C type)"
msgstr "%s (C тип)"
#: sphinx/directives/desc.py:94
#, python-format
msgid "%s (C variable)"
msgstr "%s (C змінна)"
#: sphinx/directives/desc.py:112
msgid "Raises"
msgstr "Викликає"
#: sphinx/directives/desc.py:116
msgid "Variable"
msgstr "Змінна"
#: sphinx/directives/desc.py:119
msgid "Returns"
msgstr "Повертає"
#: sphinx/directives/desc.py:128
msgid "Return type"
msgstr "Тип повернення"
#: sphinx/directives/desc.py:213
msgid "Parameter"
msgstr "Параметр"
#: sphinx/directives/desc.py:217
msgid "Parameters"
msgstr "Параметри"
#: sphinx/directives/desc.py:465
#, python-format
msgid "%scommand line option; %s"
msgstr "%sопція командного рядка; %s"
#: sphinx/directives/other.py:101
msgid "Platforms: "
msgstr "Платформи: "
#: sphinx/directives/other.py:106
#, python-format
msgid "%s (module)"
msgstr "%s (модуль)"
#: sphinx/directives/other.py:146
msgid "Section author: "
msgstr "Автор секції: "
#: sphinx/directives/other.py:148
msgid "Module author: "
msgstr "Автор модуля: "
#: sphinx/directives/other.py:150
msgid "Author: "
msgstr "Автор: "
#: sphinx/directives/other.py:249
msgid "See also"
msgstr "Дивись також"
#: sphinx/ext/autodoc.py:442
#, python-format
msgid " Bases: %s"
msgstr " Базовий: %s"
#: sphinx/ext/autodoc.py:563 sphinx/ext/autodoc.py:580
#, python-format
msgid "alias of :class:`%s`"
msgstr "синонім :class:`%s`"
#: sphinx/ext/todo.py:31
msgid "Todo"
msgstr "Доробити"
#: sphinx/ext/todo.py:75
#, python-format
msgid "(The original entry is located in %s, line %d and can be found "
msgstr "(Початкове входження знаходиться в %s, рядок %d і може бути знайдений "
#: sphinx/ext/todo.py:81
msgid "here"
msgstr "тут"
#: sphinx/locale/__init__.py:15
msgid "Attention"
msgstr "Увага"
#: sphinx/locale/__init__.py:16
msgid "Caution"
msgstr "Застереження"
#: sphinx/locale/__init__.py:17
msgid "Danger"
msgstr "Небезпека"
#: sphinx/locale/__init__.py:18
msgid "Error"
msgstr "Помилка"
#: sphinx/locale/__init__.py:19
msgid "Hint"
msgstr "Підказка"
#: sphinx/locale/__init__.py:20
msgid "Important"
msgstr "Важливо"
#: sphinx/locale/__init__.py:21
msgid "Note"
msgstr "Примітка"
#: sphinx/locale/__init__.py:22
msgid "See Also"
msgstr "Дивись також"
#: sphinx/locale/__init__.py:23
msgid "Tip"
msgstr "Порада"
#: sphinx/locale/__init__.py:24
msgid "Warning"
msgstr "Попередження"
#: sphinx/locale/__init__.py:28
#, python-format
msgid "New in version %s"
msgstr "Нове в версії %s"
#: sphinx/locale/__init__.py:29
#, python-format
msgid "Changed in version %s"
msgstr "Змінено в версії %s"
#: sphinx/locale/__init__.py:30
#, python-format
msgid "Deprecated since version %s"
msgstr "Застаріло починаючи з версії %s"
#: sphinx/locale/__init__.py:34
msgid "module"
msgstr "модуль"
#: sphinx/locale/__init__.py:35
msgid "keyword"
msgstr "ключове слово"
#: sphinx/locale/__init__.py:36
msgid "operator"
msgstr "оператор"
#: sphinx/locale/__init__.py:37
msgid "object"
msgstr "об'єкт"
#: sphinx/locale/__init__.py:38
msgid "exception"
msgstr "виняткова ситуація"
#: sphinx/locale/__init__.py:39
msgid "statement"
msgstr "вираз"
#: sphinx/locale/__init__.py:40
msgid "built-in function"
msgstr "вбудована функція"
#: sphinx/static/doctools.js:139 sphinx/writers/html.py:425
msgid "Permalink to this headline"
msgstr "Постійне посилання на цей заголовок"
#: sphinx/static/doctools.js:145 sphinx/writers/html.py:80
msgid "Permalink to this definition"
msgstr "Постійне посилання на це визначення"
#: sphinx/static/doctools.js:174
msgid "Hide Search Matches"
msgstr "Приховати співпадіння пошуку"
#: sphinx/static/searchtools.js:274
msgid "Searching"
msgstr "Шукаю"
#: sphinx/static/searchtools.js:279
msgid "Preparing search..."
msgstr "Підготовка до пошуку..."
#: sphinx/static/searchtools.js:338
msgid "module, in "
msgstr "модуль, в "
#: sphinx/static/searchtools.js:347
msgid ", in "
msgstr ", в "
#: sphinx/static/searchtools.js:453 sphinx/templates/search.html:25
msgid "Search Results"
msgstr "Результати пошуку"
#: sphinx/static/searchtools.js:455
msgid ""
"Your search did not match any documents. Please make sure that all words "
"are spelled correctly and that you've selected enough categories."
msgstr ""
"Ваш пошук не виявив жодного співпадіння. Будь-ласка переконайтеся що всі "
"слова набрані правильно і ви обрали достатньо категорій."
#: sphinx/static/searchtools.js:457
#, python-format
msgid "Search finished, found %s page(s) matching the search query."
msgstr "Пошук закінчено, знайдено %s сторінок які співпали з пошуковим запитом."
#: sphinx/templates/defindex.html:2
msgid "Overview"
msgstr "Огляд"
#: sphinx/templates/defindex.html:11
msgid "Indices and tables:"
msgstr "Індекси та таблиці:"
#: sphinx/templates/defindex.html:14
msgid "Complete Table of Contents"
msgstr "Повний Зміст"
#: sphinx/templates/defindex.html:15
msgid "lists all sections and subsections"
msgstr "перелічити всі секції та підсекції"
#: sphinx/templates/defindex.html:17
msgid "search this documentation"
msgstr "шукати цю документацію"
#: sphinx/templates/defindex.html:20
msgid "quick access to all modules"
msgstr "швидкий доступ до всіх модулів"
#: sphinx/templates/defindex.html:22
msgid "all functions, classes, terms"
msgstr "всі функції, класи, терміни"
#: sphinx/templates/genindex-single.html:5
#, python-format
msgid "Index &ndash; %(key)s"
msgstr "Індекс &ndash; %(key)"
#: sphinx/templates/genindex-single.html:44
#: sphinx/templates/genindex-split.html:14
#: sphinx/templates/genindex-split.html:27 sphinx/templates/genindex.html:54
msgid "Full index on one page"
msgstr "Повний індекс на одній сторінці"
#: sphinx/templates/genindex-split.html:7
msgid "Index pages by letter"
msgstr "Індексні сторінки по символам"
#: sphinx/templates/genindex-split.html:15
msgid "can be huge"
msgstr "може бути величезним"
#: sphinx/templates/layout.html:9
msgid "Navigation"
msgstr "Навігація"
#: sphinx/templates/layout.html:40
msgid "Table Of Contents"
msgstr "Зміст"
#: sphinx/templates/layout.html:46
msgid "Previous topic"
msgstr "Попередній розділ"
#: sphinx/templates/layout.html:48
msgid "previous chapter"
msgstr "Попередній розділ"
#: sphinx/templates/layout.html:51
msgid "Next topic"
msgstr "Наступна тема"
#: sphinx/templates/layout.html:53
msgid "next chapter"
msgstr "наступний розділ"
#: sphinx/templates/layout.html:58
msgid "This Page"
msgstr "Ця сторінка"
#: sphinx/templates/layout.html:61
msgid "Show Source"
msgstr "Відобразити вихідний текст"
#: sphinx/templates/layout.html:71
msgid "Quick search"
msgstr "Швидкий пошук"
#: sphinx/templates/layout.html:74
msgid "Go"
msgstr "Вперед"
#: sphinx/templates/layout.html:78
msgid "Enter search terms or a module, class or function name."
msgstr "Введіть пошуковий термін, модуль, клас чи назву функції."
#: sphinx/templates/layout.html:115
#, python-format
msgid "Search within %(docstitle)s"
msgstr "Шукати в %(docstitle)s"
#: sphinx/templates/layout.html:124
msgid "About these documents"
msgstr "Про ці документи"
#: sphinx/templates/layout.html:127 sphinx/templates/search.html:2
#: sphinx/templates/search.html:5
msgid "Search"
msgstr "Пошук"
#: sphinx/templates/layout.html:129
msgid "Copyright"
msgstr "Авторські права"
#: sphinx/templates/layout.html:174
#, python-format
msgid "&copy; <a href=\"%(path)s\">Copyright</a> %(copyright)s."
msgstr "&copy; <a href=\"%(path)s\">Copyright</a> %(copyright)s."
#: sphinx/templates/layout.html:176
#, python-format
msgid "&copy; Copyright %(copyright)s."
msgstr "&copy; Copyright %(copyright)s."
#: sphinx/templates/layout.html:179
#, python-format
msgid "Last updated on %(last_updated)s."
msgstr "Востаннє оновлено %(last_updated)s."
#: sphinx/templates/layout.html:182
#, python-format
msgid ""
"Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> "
"%(sphinx_version)s."
msgstr ""
"Створено з використанням <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> "
"%(sphinx_version)s."
#: sphinx/templates/modindex.html:36
msgid "Deprecated"
msgstr "Застарілий"
#: sphinx/templates/opensearch.xml:4
#, python-format
msgid "Search %(docstitle)s"
msgstr "Пошук %(docstitle)s"
#: sphinx/templates/search.html:9
msgid ""
"Please activate JavaScript to enable the search\n"
" functionality."
msgstr "Будь-ласка вімкніть підтримку JavaScript, щоб ввікнути\n"
" пошук."
#: sphinx/templates/search.html:14
msgid ""
"From here you can search these documents. Enter your search\n"
" words into the box below and click \"search\". Note that the search\n"
" function will automatically search for all of the words. Pages\n"
" containing fewer words won't appear in the result list."
msgstr ""
"Звідси ви можете шукати ці документи. Введіть ваші пошукові\n"
" слова в поле нижче та натисніть \"пошук\". Зауважте що функція\n"
" пошуку автоматично шукатиме за всіма словами. Сторінки\n"
" що містять менше слів не з'являться в результуючому списку."
#: sphinx/templates/search.html:21
msgid "search"
msgstr "пошук"
#: sphinx/templates/search.html:27
msgid "Your search did not match any results."
msgstr "Ваш пошук не виявив жодних співпадінь."
#: sphinx/templates/changes/frameset.html:5
#: sphinx/templates/changes/versionchanges.html:12
#, python-format
msgid "Changes in Version %(version)s &mdash; %(docstitle)s"
msgstr "Зміни в Версії %(version)s &mdash; %(docstitle)"
#: sphinx/templates/changes/rstsource.html:5
#, python-format
msgid "%(filename)s &mdash; %(docstitle)s"
msgstr "%(filename) &mdash; %(docstitle)"
#: sphinx/templates/changes/versionchanges.html:17
#, python-format
msgid "Automatically generated list of changes in version %(version)s"
msgstr "Автоматичного згенерований список змін в версії %(version)"
#: sphinx/templates/changes/versionchanges.html:18
msgid "Library changes"
msgstr "Зміни в бібліотеці"
#: sphinx/templates/changes/versionchanges.html:23
msgid "C API changes"
msgstr "зміни C API"
#: sphinx/templates/changes/versionchanges.html:25
msgid "Other changes"
msgstr "Інші зміни"
#: sphinx/writers/latex.py:173
msgid "Release"
msgstr "Реліз"
#: sphinx/writers/text.py:166
#, python-format
msgid "Platform: %s"
msgstr "Платформа: %s"
#: sphinx/writers/text.py:427
msgid "[image]"
msgstr ""

View File

@ -19,6 +19,9 @@
\RequirePackage{color}
\RequirePackage{fancyvrb}
\RequirePackage{threeparttable}
% Handle footnotes in tables.
\RequirePackage{footnote}
\makesavenoteenv{tabulary}
% Redefine these colors to your liking in the preamble.
\definecolor{TitleColor}{rgb}{0.126,0.263,0.361}

View File

@ -109,6 +109,8 @@ Z \string\tymax: \the\tymax^^J}%
\global\advance\TY@linewidth-#1\relax}
\def\endtabulary{%
\gdef\@halignto{}%
\let\TY@footnote\footnote%
\def\footnote{}% prevent footnotes from doing anything
\expandafter\TY@tab\the\toks@
\crcr\omit
{\xdef\TY@save@row{}%
@ -172,6 +174,7 @@ Z \message{> tymin}%
\TY@checkmin
\TY@count\z@
\let\TY@box\TY@box@v
\let\footnote\TY@footnote % restore footnotes
{\expandafter\TY@final\the\toks@\endTY@final}%
\count@\z@
\@tempswatrue

View File

@ -13,6 +13,7 @@ import os
import re
import sys
import time
import types
import fnmatch
import tempfile
import posixpath
@ -23,7 +24,7 @@ from os import path
# Generally useful regular expressions.
ws_re = re.compile(r'\s+')
caption_ref_re = re.compile(r'^([^<]+?)\s*<(.+)>$')
url_re = re.compile(r'(?P<schema>.+)://.*')
# SEP separates path elements in the canonical file names
#
@ -280,9 +281,11 @@ def nested_parse_with_titles(state, content, node):
surrounding_section_level = state.memo.section_level
state.memo.title_styles = []
state.memo.section_level = 0
state.nested_parse(content, 0, node, match_titles=1)
state.memo.title_styles = surrounding_title_styles
state.memo.section_level = surrounding_section_level
try:
return state.nested_parse(content, 0, node, match_titles=1)
finally:
state.memo.title_styles = surrounding_title_styles
state.memo.section_level = surrounding_section_level
def ustrftime(format, *args):
@ -371,3 +374,40 @@ def movefile(source, dest):
except OSError:
pass
os.rename(source, dest)
# monkey-patch Node.traverse to get more speed
# traverse() is called so many times during a build that it saves
# on average 20-25% overall build time!
def _all_traverse(self):
"""Version of Node.traverse() that doesn't need a condition."""
result = []
result.append(self)
for child in self.children:
result.extend(child._all_traverse())
return result
def _fast_traverse(self, cls):
"""Version of Node.traverse() that only supports instance checks."""
result = []
if isinstance(self, cls):
result.append(self)
for child in self.children:
result.extend(child._fast_traverse(cls))
return result
def _new_traverse(self, condition=None,
include_self=1, descend=1, siblings=0, ascend=0):
if include_self and descend and not siblings and not ascend:
if condition is None:
return self._all_traverse()
elif isinstance(condition, (types.ClassType, type)):
return self._fast_traverse(condition)
return self._old_traverse(condition, include_self, descend, siblings, ascend)
import docutils.nodes
docutils.nodes.Node._old_traverse = docutils.nodes.Node.traverse
docutils.nodes.Node._all_traverse = _all_traverse
docutils.nodes.Node._fast_traverse = _fast_traverse
docutils.nodes.Node.traverse = _new_traverse

View File

@ -49,8 +49,12 @@ def prepare_commentdoc(s):
result = []
lines = [line.strip() for line in s.expandtabs().splitlines()]
for line in lines:
if line.startswith('#: '):
result.append(line[3:])
if line.startswith('#:'):
line = line[2:]
# the first space after the comment is ignored
if line and line[0] == ' ':
line = line[1:]
result.append(line)
if result and result[-1]:
result.append('')
return result

View File

@ -22,6 +22,7 @@ from docutils.writers.latex2e import Babel
from sphinx import addnodes
from sphinx import highlighting
from sphinx.locale import admonitionlabels, versionlabels
from sphinx.application import SphinxError
from sphinx.util import ustrftime
from sphinx.util.texescape import tex_escape_map
from sphinx.util.smartypants import educateQuotesLatex
@ -62,6 +63,12 @@ FOOTER = r'''
\end{document}
'''
class collected_footnote(nodes.footnote):
"""Footnotes that are collected are assigned this class."""
class UnsupportedError(SphinxError):
category = 'Markup is unsupported in LaTeX'
class LaTeXWriter(writers.Writer):
@ -208,6 +215,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.highlightlinenothreshold = sys.maxint
self.written_ids = set()
self.footnotestack = []
self.curfilestack = []
if self.elements['docclass'] == 'manual':
if builder.config.latex_use_parts:
self.top_sectionlevel = 0
@ -232,6 +240,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
def visit_document(self, node):
self.footnotestack.append(self.collect_footnotes(node))
self.curfilestack.append(node.get('docname', ''))
if self.first_document == 1:
# the first document is all the regular content ...
self.body.append(BEGIN_DOC % self.elements)
@ -267,6 +276,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.footnotestack.append(self.collect_footnotes(node))
# also add a document target
self.body.append('\\hypertarget{--doc-%s}{}' % node['docname'])
self.curfilestack.append(node['docname'])
def collect_footnotes(self, node):
fnotes = {}
@ -281,12 +291,12 @@ class LaTeXTranslator(nodes.NodeVisitor):
yield k
for fn in footnotes_under(node):
num = fn.children[0].astext().strip()
fnotes[num] = fn
fn.parent.remove(fn)
fnotes[num] = [collected_footnote(*fn.children), False]
return fnotes
def depart_start_of_file(self, node):
self.footnotestack.pop()
self.curfilestack.pop()
def visit_highlightlang(self, node):
self.highlightlang = node['lang']
@ -369,9 +379,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
try:
self.body.append(r'\%s{' % self.sectionnames[self.sectionlevel])
except IndexError:
from sphinx.application import SphinxError
raise SphinxError('too many nesting section levels for LaTeX, '
'at heading: %s' % node.astext())
raise UnsupportedError(
'%s:%s: too many nesting section levels for '
'LaTeX, at heading: %s' % (self.curfilestack[-1],
node.line or '', node.astext()))
self.context.append('}\n')
elif isinstance(parent, (nodes.topic, nodes.sidebar)):
self.body.append(r'\textbf{')
@ -555,9 +566,12 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.body.append(self.context.pop())
def visit_footnote(self, node):
pass
def depart_footnote(self, node):
pass
raise nodes.SkipNode
def visit_collected_footnote(self, node):
self.body.append('\\footnote{')
def depart_collected_footnote(self, node):
self.body.append('}')
def visit_label(self, node):
if isinstance(node.parent, nodes.citation):
@ -570,7 +584,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
def visit_table(self, node):
if self.table:
raise NotImplementedError('Nested tables are not supported.')
raise UnsupportedError('%s:%s: nested tables are not yet implemented.' %
(self.curfilestack[-1], node.line or ''))
self.table = Table()
self.tablebody = []
# Redirect body output until table is finished.
@ -637,8 +652,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
def visit_entry(self, node):
if node.has_key('morerows') or node.has_key('morecols'):
raise NotImplementedError('Column or row spanning cells are '
'not implemented.')
raise UnsupportedError('%s:%s: column or row spanning cells are '
'not yet implemented.' %
(self.curfilestack[-1], node.line or ''))
if self.table.col > 0:
self.body.append(' & ')
self.table.col += 1
@ -1032,7 +1048,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
raise nodes.SkipNode
def visit_literal(self, node):
self.no_contractions += 1
content = self.encode(node.astext().strip())
self.no_contractions -= 1
if self.in_title:
self.body.append(r'\texttt{%s}' % content)
elif node.has_key('role') and node['role'] == 'samp':
@ -1044,14 +1062,19 @@ class LaTeXTranslator(nodes.NodeVisitor):
def visit_footnote_reference(self, node):
num = node.astext().strip()
try:
fn = self.footnotestack[-1][num]
footnode, used = self.footnotestack[-1][num]
except (KeyError, IndexError):
raise nodes.SkipNode
self.body.append('\\footnote{')
fn.walkabout(self)
# if a footnote has been inserted once, it shouldn't be repeated
# by the next reference
if used:
self.body.append('\\footnotemark[%s]' % num)
else:
footnode.walkabout(self)
self.footnotestack[-1][num][1] = True
raise nodes.SkipChildren
def depart_footnote_reference(self, node):
self.body.append('}')
pass
def visit_literal_block(self, node):
self.verbatim = ''

View File

@ -24,6 +24,8 @@ exclude_trees = ['_build']
keep_warnings = True
pygments_style = 'sphinx'
rst_epilog = '.. |subst| replace:: global substitution'
html_style = 'default.css'
html_static_path = ['_static']
html_last_updated_fmt = '%b %d, %Y'

View File

@ -11,6 +11,8 @@ Testing various markup
:author: Me
:keywords: docs, sphinx
A |subst|.
.. _label:
::

BIN
tests/root/rimg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -2,3 +2,5 @@ Image including source in subdir
================================
.. image:: img.*
.. image:: /rimg.png

View File

@ -20,6 +20,11 @@ from subprocess import Popen, PIPE
from util import *
from etree13 import ElementTree as ET
try:
import pygments
except ImportError:
pygments = None
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.builders.latex import LaTeXBuilder
from sphinx.writers.latex import LaTeXTranslator
@ -57,20 +62,12 @@ HTML_XPATH = {
},
'subdir/images.html': {
".//img[@src='../_images/img1.png']": '',
".//img[@src='../_images/rimg.png']": '',
},
'includes.html': {
".//pre/span[@class='s']": u'üöä',
".//pre": u'Max Strauß',
".//a[@href='_downloads/img.png']": '',
".//a[@href='_downloads/img1.png']": '',
".//div[@class='inc-pyobj1 highlight-text']/div/pre":
r'^class Foo:\n pass\n\s*$',
".//div[@class='inc-pyobj2 highlight-text']/div/pre":
r'^ def baz\(\):\n pass\n\s*$',
".//div[@class='inc-lines highlight-text']/div/pre":
r'^class Foo:\n pass\nclass Bar:\n$',
".//div[@class='inc-startend highlight-text']/div/pre":
ur'^foo = u"Including Unicode characters: üöä"\n$',
},
'autodoc.html': {
".//dt[@id='test_autodoc.Class']": '',
@ -83,6 +80,7 @@ HTML_XPATH = {
".//a[@href='contents.html#ref1']": '',
".//div[@id='label']": '',
".//span[@class='option']": '--help',
".//p": 'A global substitution.',
},
'desc.html': {
".//dt[@id='mod.Cls.meth1']": '',
@ -100,6 +98,19 @@ HTML_XPATH = {
},
}
if pygments:
HTML_XPATH['includes.html'].update({
".//pre/span[@class='s']": u'üöä',
".//div[@class='inc-pyobj1 highlight-text']/div/pre":
r'^class Foo:\n pass\n\s*$',
".//div[@class='inc-pyobj2 highlight-text']/div/pre":
r'^ def baz\(\):\n pass\n\s*$',
".//div[@class='inc-lines highlight-text']/div/pre":
r'^class Foo:\n pass\nclass Bar:\n$',
".//div[@class='inc-startend highlight-text']/div/pre":
ur'^foo = u"Including Unicode characters: üöä"\n$',
})
class NslessParser(ET.XMLParser):
"""XMLParser that throws away namespaces in tag names."""

View File

@ -11,6 +11,12 @@
from util import *
try:
import pygments
except ImportError:
from nose.plugins.skip import SkipTest
raise SkipTest('pygments not available')
from pygments.lexer import RegexLexer
from pygments.token import Text, Name
from pygments.formatters.html import HtmlFormatter
@ -28,16 +34,17 @@ class MyLexer(RegexLexer):
],
}
class ComplainOnUnhighlighted(PygmentsBridge):
def unhighlighted(self, source):
raise AssertionError("should highlight %r" % source)
class MyFormatter(HtmlFormatter):
def format(self, tokensource, outfile):
outfile.write('test')
class ComplainOnUnhighlighted(PygmentsBridge):
def unhighlighted(self, source):
raise AssertionError("should highlight %r" % source)
@with_app()
def test_add_lexer(app):
app.add_lexer('test', MyLexer())