diff options
Diffstat (limited to 'sphinx')
174 files changed, 17358 insertions, 6195 deletions
diff --git a/sphinx/__init__.py b/sphinx/__init__.py index 6bcdfb9b..6fd96bdc 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -12,8 +12,8 @@ import sys from os import path -__version__ = '0.6.5+' -__released__ = '0.6.5' # used when Sphinx builds its own docs +__version__ = '1.0pre' +__released__ = '1.0 (hg)' # used when Sphinx builds its own docs package_dir = path.abspath(path.dirname(__file__)) diff --git a/sphinx/addnodes.py b/sphinx/addnodes.py index 83ba8a00..0a2f0f7f 100644 --- a/sphinx/addnodes.py +++ b/sphinx/addnodes.py @@ -14,7 +14,7 @@ from docutils import nodes # index markup class index(nodes.Invisible, nodes.Inline, nodes.TextElement): pass -# description units (classdesc, funcdesc etc.) +# domain-specific object descriptions (class, function etc.) # parent node for signature and content class desc(nodes.Admonition, nodes.Element): pass @@ -90,9 +90,6 @@ class abbreviation(nodes.Inline, nodes.TextElement): pass # glossary class glossary(nodes.Element): pass -# module declaration -class module(nodes.Element): pass - # start of a file, used in the LaTeX builder only class start_of_file(nodes.Element): pass diff --git a/sphinx/application.py b/sphinx/application.py index 3817009f..b5ba514c 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -14,21 +14,26 @@ import sys import types import posixpath +from os import path from cStringIO import StringIO from docutils import nodes -from docutils.parsers.rst import directives, roles +from docutils.parsers.rst import Directive, convert_directive_function, \ + directives, roles import sphinx -from sphinx.roles import xfileref_role, innernodetypes +from sphinx import package_dir, locale +from sphinx.roles import XRefRole from sphinx.config import Config -from sphinx.errors import SphinxError, SphinxWarning, ExtensionError +from sphinx.errors import SphinxError, SphinxWarning, ExtensionError, \ + VersionRequirementError +from sphinx.domains import ObjType, BUILTIN_DOMAINS +from sphinx.domains.std import GenericObject, Target, StandardDomain from sphinx.builders import BUILTIN_BUILDERS -from sphinx.directives import GenericDesc, Target, additional_xref_types -from sphinx.environment import SphinxStandaloneReader +from sphinx.environment import BuildEnvironment, SphinxStandaloneReader from sphinx.util import pycompat # imported for side-effects from sphinx.util.tags import Tags -from sphinx.util.compat import Directive, directive_dwim +from sphinx.util.osutil import ENOENT from sphinx.util.console import bold @@ -44,23 +49,27 @@ events = { 'missing-reference': 'env, node, contnode', 'doctree-resolved': 'doctree, docname', 'env-updated': 'env', + 'html-collect-pages': 'builder', 'html-page-context': 'pagename, context, doctree or None', 'build-finished': 'exception', } CONFIG_FILENAME = 'conf.py' +ENV_PICKLE_FILENAME = 'environment.pickle' class Sphinx(object): def __init__(self, srcdir, confdir, outdir, doctreedir, buildername, - confoverrides, status, warning=sys.stderr, freshenv=False, - warningiserror=False, tags=None): + confoverrides=None, status=sys.stdout, warning=sys.stderr, + freshenv=False, warningiserror=False, tags=None): self.next_listener_id = 0 self._extensions = {} self._listeners = {} + self.domains = BUILTIN_DOMAINS.copy() self.builderclasses = BUILTIN_BUILDERS.copy() self.builder = None + self.env = None self.srcdir = srcdir self.confdir = confdir @@ -91,7 +100,8 @@ class Sphinx(object): # read config self.tags = Tags(tags) - self.config = Config(confdir, CONFIG_FILENAME, confoverrides, self.tags) + self.config = Config(confdir, CONFIG_FILENAME, + confoverrides or {}, self.tags) self.config.check_unicode(self.warn) # set confdir to srcdir if -C given (!= no confdir); a few pieces @@ -109,8 +119,69 @@ class Sphinx(object): # now that we know all config values, collect them from conf.py self.config.init_values() + # check the Sphinx version if requested + if self.config.needs_sphinx and \ + self.config.needs_sphinx > sphinx.__version__[:3]: + raise VersionRequirementError( + 'This project needs at least Sphinx v%s and therefore cannot ' + 'be built with this version.' % self.config.needs_sphinx) + + # set up translation infrastructure + self._init_i18n() + # set up the build environment + self._init_env(freshenv) + # set up the builder + self._init_builder(buildername) + + def _init_i18n(self): + """ + Load translated strings from the configured localedirs if + enabled in the configuration. + """ + if self.config.language is not None: + self.info(bold('loading translations [%s]... ' % + self.config.language), nonl=True) + locale_dirs = [None, path.join(package_dir, 'locale')] + \ + [path.join(self.srcdir, x) for x in self.config.locale_dirs] + else: + locale_dirs = [] + self.translator, has_translation = locale.init(locale_dirs, + self.config.language) + if self.config.language is not None: + if has_translation: + self.info('done') + else: + self.info('locale not available') + + def _init_env(self, freshenv): + if freshenv: + self.env = BuildEnvironment(self.srcdir, self.doctreedir, + self.config) + self.env.find_files(self.config) + for domain in self.domains.keys(): + self.env.domains[domain] = self.domains[domain](self.env) + else: + try: + self.info(bold('loading pickled environment... '), nonl=True) + self.env = BuildEnvironment.frompickle(self.config, + path.join(self.doctreedir, ENV_PICKLE_FILENAME)) + self.env.domains = {} + for domain in self.domains.keys(): + # this can raise if the data version doesn't fit + self.env.domains[domain] = self.domains[domain](self.env) + self.info('done') + except Exception, err: + if type(err) is IOError and err.errno == ENOENT: + self.info('not yet created') + else: + self.info('failed: %s' % err) + return self._init_env(freshenv=True) + + self.env.set_warnfunc(self.warn) + + def _init_builder(self, buildername): if buildername is None: - print >>status, 'No builder selected, using default: html' + print >>self._status, 'No builder selected, using default: html' buildername = 'html' if buildername not in self.builderclasses: raise SphinxError('Builder name %s not registered' % buildername) @@ -121,14 +192,12 @@ class Sphinx(object): mod, cls = builderclass builderclass = getattr( __import__('sphinx.builders.' + mod, None, None, [cls]), cls) - self.builder = builderclass(self, freshenv=freshenv) - self.builder.tags = self.tags - self.builder.tags.add(self.builder.format) + self.builder = builderclass(self) self.emit('builder-inited') - def build(self, all_files, filenames): + def build(self, force_all=False, filenames=None): try: - if all_files: + if force_all: self.builder.build_all() elif filenames: self.builder.build_specific(filenames) @@ -178,9 +247,21 @@ class Sphinx(object): self.warn('extension %r has no setup() function; is it really ' 'a Sphinx extension module?' % extension) else: - mod.setup(self) + try: + mod.setup(self) + except VersionRequirementError, err: + # add the extension name to the version required + raise VersionRequirementError( + 'The %s extension used by this project needs at least ' + 'Sphinx v%s; it therefore cannot be built with this ' + 'version.' % (extension, err)) self._extensions[extension] = mod + def require_sphinx(self, version): + # check the Sphinx version if requested + if version > sphinx.__version__[:3]: + raise VersionRequirementError(version) + def import_object(self, objname, source=None): """Import an object from a 'module.name' string.""" try: @@ -222,11 +303,11 @@ class Sphinx(object): event.pop(listener_id, None) def emit(self, event, *args): - result = [] + results = [] if event in self._listeners: for _, callback in self._listeners[event].iteritems(): - result.append(callback(self, *args)) - return result + results.append(callback(self, *args)) + return results def emit_firstresult(self, event, *args): for result in self.emit(event, *args): @@ -276,6 +357,9 @@ class Sphinx(object): from sphinx.writers.latex import LaTeXTranslator as translator elif key == 'text': from sphinx.writers.text import TextTranslator as translator + elif key == 'man': + from sphinx.writers.manpage import ManualPageTranslator \ + as translator else: # ignore invalid keys for compatibility continue @@ -283,17 +367,21 @@ class Sphinx(object): if depart: setattr(translator, 'depart_'+node.__name__, depart) - def add_directive(self, name, obj, content=None, arguments=None, **options): + def _directive_helper(self, obj, content=None, arguments=None, **options): if isinstance(obj, clstypes) and issubclass(obj, Directive): if content or arguments or options: raise ExtensionError('when adding directive classes, no ' 'additional arguments may be given') - directives.register_directive(name, directive_dwim(obj)) + return obj else: obj.content = content - obj.arguments = arguments + obj.arguments = arguments or (0, 0, False) obj.options = options - directives.register_directive(name, obj) + return convert_directive_function(obj) + + def add_directive(self, name, obj, content=None, arguments=None, **options): + directives.register_directive( + name, self._directive_helper(obj, content, arguments, **options)) def add_role(self, name, role): roles.register_local_role(name, role) @@ -304,23 +392,62 @@ class Sphinx(object): role = roles.GenericRole(name, nodeclass) roles.register_local_role(name, role) - def add_description_unit(self, directivename, rolename, indextemplate='', - parse_node=None, ref_nodeclass=None): - additional_xref_types[directivename] = (rolename, indextemplate, - parse_node) - directives.register_directive(directivename, - directive_dwim(GenericDesc)) - roles.register_local_role(rolename, xfileref_role) - if ref_nodeclass is not None: - innernodetypes[rolename] = ref_nodeclass + def add_domain(self, domain): + if domain.name in self.domains: + raise ExtensionError('domain %s already registered' % domain.name) + self.domains[domain.name] = domain + + def override_domain(self, domain): + if domain.name not in self.domains: + raise ExtensionError('domain %s not yet registered' % domain.name) + if not issubclass(domain, self.domains[domain.name]): + raise ExtensionError('new domain not a subclass of registered ' + 'domain' % domain.name) + self.domains[domain.name] = domain + + def add_directive_to_domain(self, domain, name, obj, + content=None, arguments=None, **options): + if domain not in self.domains: + raise ExtensionError('domain %s not yet registered' % domain) + self.domains[domain].directives[name] = \ + self._directive_helper(obj, content, arguments, **options) + + def add_role_to_domain(self, domain, name, role): + if domain not in self.domains: + raise ExtensionError('domain %s not yet registered' % domain) + self.domains[domain].roles[name] = role + + def add_index_to_domain(self, domain, name, localname, shortname, func): + if domain not in self.domains: + raise ExtensionError('domain %s not yet registered' % domain) + self.domains[domain].indices.append((name, localname, shortname)) + setattr(self.domains[domain], 'get_%s_index' % name, func) + + def add_object_type(self, directivename, rolename, indextemplate='', + parse_node=None, ref_nodeclass=None, objname=''): + StandardDomain.object_types[directivename] = \ + ObjType(objname or directivename, rolename) + # create a subclass of GenericObject as the new directive + new_directive = type(directivename, (GenericObject, object), + {'indextemplate': indextemplate, + 'parse_node': staticmethod(parse_node)}) + StandardDomain.directives[directivename] = new_directive + # XXX support more options? + StandardDomain.roles[rolename] = XRefRole(innernodeclass=ref_nodeclass) + + # backwards compatible alias + add_description_unit = add_object_type def add_crossref_type(self, directivename, rolename, indextemplate='', - ref_nodeclass=None): - additional_xref_types[directivename] = (rolename, indextemplate, None) - directives.register_directive(directivename, directive_dwim(Target)) - roles.register_local_role(rolename, xfileref_role) - if ref_nodeclass is not None: - innernodetypes[rolename] = ref_nodeclass + ref_nodeclass=None, objname=''): + StandardDomain.object_types[directivename] = \ + ObjType(objname or directivename, rolename) + # create a subclass of Target as the new directive + new_directive = type(directivename, (Target, object), + {'indextemplate': indextemplate}) + StandardDomain.directives[directivename] = new_directive + # XXX support more options? + StandardDomain.roles[rolename] = XRefRole(innernodeclass=ref_nodeclass) def add_transform(self, transform): SphinxStandaloneReader.transforms.append(transform) @@ -330,6 +457,11 @@ class Sphinx(object): StandaloneHTMLBuilder.script_files.append( posixpath.join('_static', filename)) + def add_stylesheet(self, filename): + from sphinx.builders.html import StandaloneHTMLBuilder + StandaloneHTMLBuilder.css_files.append( + posixpath.join('_static', filename)) + def add_lexer(self, alias, lexer): from sphinx.highlighting import lexers if lexers is None: diff --git a/sphinx/builder.py b/sphinx/builder.py deleted file mode 100644 index 2625ec8a..00000000 --- a/sphinx/builder.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -""" - sphinx.builder - ~~~~~~~~~~~~~~ - - .. warning:: - - This module is only kept for API compatibility; new code should - import these classes directly from the sphinx.builders package. - - :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -import warnings - -from sphinx.builders import Builder -from sphinx.builders.text import TextBuilder -from sphinx.builders.html import StandaloneHTMLBuilder, WebHTMLBuilder, \ - PickleHTMLBuilder, JSONHTMLBuilder -from sphinx.builders.latex import LaTeXBuilder -from sphinx.builders.changes import ChangesBuilder -from sphinx.builders.htmlhelp import HTMLHelpBuilder -from sphinx.builders.linkcheck import CheckExternalLinksBuilder - -warnings.warn('The sphinx.builder module is deprecated; please import ' - 'builders from the respective sphinx.builders submodules.', - DeprecationWarning, stacklevel=2) diff --git a/sphinx/builders/__init__.py b/sphinx/builders/__init__.py index 5d75a886..e345d570 100644 --- a/sphinx/builders/__init__.py +++ b/sphinx/builders/__init__.py @@ -10,14 +10,11 @@ """ import os -import gettext from os import path from docutils import nodes -from sphinx import package_dir, locale -from sphinx.util import SEP, ENOENT, relative_uri -from sphinx.environment import BuildEnvironment +from sphinx.util.osutil import SEP, relative_uri from sphinx.util.console import bold, purple, darkgreen, term_width_line # side effect: registers roles and directives @@ -25,9 +22,6 @@ from sphinx import roles from sphinx import directives -ENV_PICKLE_FILENAME = 'environment.pickle' - - class Builder(object): """ Builds target formats from the reST sources. @@ -38,7 +32,8 @@ class Builder(object): # builder's output format, or '' if no document output is produced format = '' - def __init__(self, app, env=None, freshenv=False): + def __init__(self, app): + self.env = app.env self.srcdir = app.srcdir self.confdir = app.confdir self.outdir = app.outdir @@ -50,21 +45,15 @@ class Builder(object): self.warn = app.warn self.info = app.info self.config = app.config - - self.load_i18n() + self.tags = app.tags + self.tags.add(self.format) # images that need to be copied over (source -> dest) self.images = {} - # if None, this is set in load_env() - self.env = env - self.freshenv = freshenv - self.init() - self.load_env() # helper methods - def init(self): """ Load necessary templates and perform initialization. The default @@ -167,62 +156,6 @@ class Builder(object): # build methods - def load_i18n(self): - """ - Load translated strings from the configured localedirs if - enabled in the configuration. - """ - self.translator = None - if self.config.language is not None: - self.info(bold('loading translations [%s]... ' % - self.config.language), nonl=True) - # the None entry is the system's default locale path - locale_dirs = [None, path.join(package_dir, 'locale')] + \ - [path.join(self.srcdir, x) for x in self.config.locale_dirs] - for dir_ in locale_dirs: - try: - trans = gettext.translation('sphinx', localedir=dir_, - languages=[self.config.language]) - if self.translator is None: - self.translator = trans - else: - self.translator._catalog.update(trans._catalog) - except Exception: - # Language couldn't be found in the specified path - pass - if self.translator is not None: - self.info('done') - else: - self.info('locale not available') - if self.translator is None: - self.translator = gettext.NullTranslations() - self.translator.install(unicode=True) - locale.init() # translate common labels - - def load_env(self): - """Set up the build environment.""" - if self.env: - return - if not self.freshenv: - try: - self.info(bold('loading pickled environment... '), nonl=True) - self.env = BuildEnvironment.frompickle(self.config, - path.join(self.doctreedir, ENV_PICKLE_FILENAME)) - self.info('done') - except Exception, err: - if type(err) is IOError and err.errno == ENOENT: - self.info('not found') - else: - self.info('failed: %s' % err) - self.env = BuildEnvironment(self.srcdir, self.doctreedir, - self.config) - self.env.find_files(self.config) - else: - self.env = BuildEnvironment(self.srcdir, self.doctreedir, - self.config) - self.env.find_files(self.config) - self.env.set_warnfunc(self.warn) - def build_all(self): """Build all source files.""" self.build(None, summary='all source files', method='all') @@ -302,6 +235,7 @@ class Builder(object): if updated_docnames: # save the environment + from sphinx.application import ENV_PICKLE_FILENAME self.info(bold('pickling environment... '), nonl=True) self.env.topickle(path.join(self.doctreedir, ENV_PICKLE_FILENAME)) self.info('done') @@ -380,15 +314,19 @@ class Builder(object): BUILTIN_BUILDERS = { - 'html': ('html', 'StandaloneHTMLBuilder'), - 'dirhtml': ('html', 'DirectoryHTMLBuilder'), - 'pickle': ('html', 'PickleHTMLBuilder'), - 'json': ('html', 'JSONHTMLBuilder'), - 'web': ('html', 'PickleHTMLBuilder'), - 'htmlhelp': ('htmlhelp', 'HTMLHelpBuilder'), - 'qthelp': ('qthelp', 'QtHelpBuilder'), - 'latex': ('latex', 'LaTeXBuilder'), - 'text': ('text', 'TextBuilder'), - 'changes': ('changes', 'ChangesBuilder'), - 'linkcheck': ('linkcheck', 'CheckExternalLinksBuilder'), + 'html': ('html', 'StandaloneHTMLBuilder'), + 'dirhtml': ('html', 'DirectoryHTMLBuilder'), + 'singlehtml': ('html', 'SingleFileHTMLBuilder'), + 'pickle': ('html', 'PickleHTMLBuilder'), + 'json': ('html', 'JSONHTMLBuilder'), + 'web': ('html', 'PickleHTMLBuilder'), + 'htmlhelp': ('htmlhelp', 'HTMLHelpBuilder'), + 'devhelp': ('devhelp', 'DevhelpBuilder'), + 'qthelp': ('qthelp', 'QtHelpBuilder'), + 'epub': ('epub', 'EpubBuilder'), + 'latex': ('latex', 'LaTeXBuilder'), + 'text': ('text', 'TextBuilder'), + 'man': ('manpage', 'ManualPageBuilder'), + 'changes': ('changes', 'ChangesBuilder'), + 'linkcheck': ('linkcheck', 'CheckExternalLinksBuilder'), } diff --git a/sphinx/builders/changes.py b/sphinx/builders/changes.py index 1844354a..980ed760 100644 --- a/sphinx/builders/changes.py +++ b/sphinx/builders/changes.py @@ -14,9 +14,11 @@ from os import path from cgi import escape from sphinx import package_dir -from sphinx.util import ensuredir, os_path, copy_static_entry +from sphinx.util import copy_static_entry +from sphinx.locale import _ from sphinx.theming import Theme from sphinx.builders import Builder +from sphinx.util.osutil import ensuredir, os_path from sphinx.util.console import bold @@ -93,6 +95,7 @@ class ChangesBuilder(Builder): 'libchanges': sorted(libchanges.iteritems()), 'apichanges': sorted(apichanges), 'otherchanges': sorted(otherchanges.iteritems()), + 'show_copyright': self.config.html_show_copyright, 'show_sphinx': self.config.html_show_sphinx, } f = codecs.open(path.join(self.outdir, 'index.html'), 'w', 'utf8') @@ -138,11 +141,10 @@ class ChangesBuilder(Builder): self.theme.get_options({}).iteritems()) copy_static_entry(path.join(package_dir, 'themes', 'default', 'static', 'default.css_t'), - path.join(self.outdir, 'default.css_t'), - self, themectx) + self.outdir, self, themectx) copy_static_entry(path.join(package_dir, 'themes', 'basic', 'static', 'basic.css'), - path.join(self.outdir, 'basic.css'), self) + self.outdir, self) def hl(self, text, version): text = escape(text) diff --git a/sphinx/builders/devhelp.py b/sphinx/builders/devhelp.py new file mode 100644 index 00000000..a5a0f280 --- /dev/null +++ b/sphinx/builders/devhelp.py @@ -0,0 +1,133 @@ +# -*- coding: utf-8 -*- +""" + sphinx.builders.devhelp + ~~~~~~~~~~~~~~~~~~~~~~~ + + Build HTML documentation and Devhelp_ support files. + + .. _Devhelp: http://live.gnome.org/devhelp + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re +from os import path + +from docutils import nodes + +from sphinx import addnodes +from sphinx.builders.html import StandaloneHTMLBuilder + +try: + import xml.etree.ElementTree as etree +except ImportError: + try: + import lxml.etree as etree + except ImportError: + try: + import elementtree.ElementTree as etree + except ImportError: + import cElementTree as etree + +try: + import gzip + def comp_open(filename, mode='rb'): + return gzip.open(filename + '.gz', mode) +except ImportError: + def comp_open(filename, mode='rb'): + return open(filename, mode) + + +class DevhelpBuilder(StandaloneHTMLBuilder): + """ + Builder that also outputs GNOME Devhelp file. + + """ + name = 'devhelp' + + # don't copy the reST source + copysource = False + supported_image_types = ['image/png', 'image/gif', 'image/jpeg'] + + # don't add links + add_permalinks = False + # don't add sidebar etc. + embedded = True + + def init(self): + StandaloneHTMLBuilder.init(self) + self.out_suffix = '.html' + + def handle_finish(self): + self.build_devhelp(self.outdir, self.config.devhelp_basename) + + def build_devhelp(self, outdir, outname): + self.info('dumping devhelp index...') + + # Basic info + root = etree.Element('book', + title=self.config.html_title, + name=self.config.project, + link="index.html", + version=self.config.version) + tree = etree.ElementTree(root) + + # TOC + chapters = etree.SubElement(root, 'chapters') + + tocdoc = self.env.get_and_resolve_doctree( + self.config.master_doc, self, prune_toctrees=False) + + def write_toc(node, parent): + if isinstance(node, addnodes.compact_paragraph) or \ + isinstance(node, nodes.bullet_list): + for subnode in node: + write_toc(subnode, parent) + elif isinstance(node, nodes.list_item): + item = etree.SubElement(parent, 'sub') + for subnode in node: + write_toc(subnode, item) + elif isinstance(node, nodes.reference): + parent.attrib['link'] = node['refuri'] + parent.attrib['name'] = node.astext().encode('utf-8') + + def istoctree(node): + return isinstance(node, addnodes.compact_paragraph) and \ + node.has_key('toctree') + + for node in tocdoc.traverse(istoctree): + write_toc(node, chapters) + + # Index + functions = etree.SubElement(root, 'functions') + index = self.env.create_index(self) + + def write_index(title, refs, subitems): + if len(refs) == 0: + pass + elif len(refs) == 1: + etree.SubElement(functions, 'function', + name=title, link=refs[0]) + else: + for i, ref in enumerate(refs): + etree.SubElement(functions, 'function', + name="[%d] %s" % (i, title), + link=ref) + + if subitems: + parent_title = re.sub(r'\s*\(.*\)\s*$', '', title) + for subitem in subitems: + write_index("%s %s" % (parent_title, subitem[0]), + subitem[1], []) + + for (key, group) in index: + for title, (refs, subitems) in group: + write_index(title, refs, subitems) + + # Dump the XML file + f = comp_open(path.join(outdir, outname + '.devhelp'), 'w') + try: + tree.write(f) + finally: + f.close() diff --git a/sphinx/builders/epub.py b/sphinx/builders/epub.py new file mode 100644 index 00000000..9767391e --- /dev/null +++ b/sphinx/builders/epub.py @@ -0,0 +1,441 @@ +# -*- coding: utf-8 -*- +""" + sphinx.builders.epub + ~~~~~~~~~~~~~~~~~~~~ + + Build epub files. + Originally derived from qthelp.py. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import os +import codecs +from os import path +import zipfile + +from docutils import nodes +from docutils.transforms import Transform + +from sphinx.builders.html import StandaloneHTMLBuilder +from sphinx.util.osutil import EEXIST + + +# (Fragment) templates from which the metainfo files content.opf, toc.ncx, +# mimetype, and META-INF/container.xml are created. +# This template section also defines strings that are embedded in the html +# output but that may be customized by (re-)setting module attributes, +# e.g. from conf.py. + +_mimetype_template = 'application/epub+zip' # no EOL! + +_container_template = u'''\ +<?xml version="1.0" encoding="UTF-8"?> +<container version="1.0" + xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> + <rootfiles> + <rootfile full-path="content.opf" + media-type="application/oebps-package+xml"/> + </rootfiles> +</container> +''' + +_toc_template = u'''\ +<?xml version="1.0"?> +<ncx version="2005-1" xmlns="http://www.daisy.org/z3986/2005/ncx/"> + <head> + <meta name="dtb:uid" content="%(uid)s"/> + <meta name="dtb:depth" content="%(level)d"/> + <meta name="dtb:totalPageCount" content="0"/> + <meta name="dtb:maxPageNumber" content="0"/> + </head> + <docTitle> + <text>%(title)s</text> + </docTitle> + <navMap> +%(navpoints)s + </navMap> +</ncx> +''' + +_navpoint_template = u'''\ +%(indent)s <navPoint id="%(navpoint)s" playOrder="%(playorder)d"> +%(indent)s <navLabel> +%(indent)s <text>%(text)s</text> +%(indent)s </navLabel> +%(indent)s <content src="%(refuri)s" /> +%(indent)s </navPoint>''' + +_navpoint_indent = ' ' +_navPoint_template = 'navPoint%d' + +_content_template = u'''\ +<?xml version="1.0" encoding="UTF-8"?> +<package xmlns="http://www.idpf.org/2007/opf" version="2.0" + unique-identifier="%(uid)s"> + <metadata xmlns:opf="http://www.idpf.org/2007/opf" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + <dc:language>%(lang)s</dc:language> + <dc:title>%(title)s</dc:title> + <dc:creator opf:role="aut">%(author)s</dc:creator> + <dc:publisher>%(publisher)s</dc:publisher> + <dc:rights>%(copyright)s</dc:rights> + <dc:identifier id="%(uid)s" opf:scheme="%(scheme)s">%(id)s</dc:identifier> + </metadata> + <manifest> + <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml" /> +%(files)s + </manifest> + <spine toc="ncx"> +%(spine)s + </spine> +</package> +''' + +_file_template = u'''\ + <item id="%(id)s" + href="%(href)s" + media-type="%(media_type)s" />''' + +_spine_template = u'''\ + <itemref idref="%(idref)s" />''' + +_toctree_template = u'toctree-l%d' + +_link_target_template = u' [%(uri)s]' + +_css_link_target_class = u'link-target' + +_media_types = { + '.html': 'application/xhtml+xml', + '.css': 'text/css', + '.png': 'image/png', + '.gif': 'image/gif', + '.svg': 'image/svg+xml', + '.jpg': 'image/jpeg', + '.jpeg': 'image/jpeg', + '.otf': 'application/x-font-otf', + '.ttf': 'application/x-font-ttf', +} + + +# The transform to show link targets + +class VisibleLinksTransform(Transform): + """ + Add the link target of referances to the text, unless it is already + present in the description. + """ + + # This transform must run after the references transforms + default_priority = 680 + + def apply(self): + for ref in self.document.traverse(nodes.reference): + uri = ref.get('refuri', '') + if ( uri.startswith('http:') or uri.startswith('https:') or \ + uri.startswith('ftp:') ) and uri not in ref.astext(): + uri = _link_target_template % {'uri': uri} + if uri: + idx = ref.parent.index(ref) + 1 + link = nodes.inline(uri, uri) + link['classes'].append(_css_link_target_class) + ref.parent.insert(idx, link) + + +# The epub publisher + +class EpubBuilder(StandaloneHTMLBuilder): + """Builder that outputs epub files. + + It creates the metainfo files container.opf, toc.ncx, mimetype, and + META-INF/container.xml. Afterwards, all necessary files are zipped to an + epub file. + """ + name = 'epub' + + # don't copy the reST source + copysource = False + supported_image_types = ['image/svg+xml', 'image/png', 'image/gif', + 'image/jpeg'] + + # don't add links + add_permalinks = False + # don't add sidebar etc. + embedded = True + + def init(self): + StandaloneHTMLBuilder.init(self) + # the output files for epub must be .html only + self.out_suffix = '.html' + self.playorder = 0 + self.app.add_transform(VisibleLinksTransform) + + def get_theme_config(self): + return self.config.epub_theme, {} + + # generic support functions + def make_id(self, name): + """Replace all characters not allowed for (X)HTML ids.""" + return name.replace('/', '_').replace(' ', '') + + def esc(self, name): + """Replace all characters not allowed in text an attribute values.""" + # Like cgi.escape, but also replace apostrophe + name = name.replace('&', '&') + name = name.replace('<', '<') + name = name.replace('>', '>') + name = name.replace('"', '"') + name = name.replace('\'', ''') + return name + + def get_refnodes(self, doctree, result): + """Collect section titles, their depth in the toc and the refuri.""" + # XXX: is there a better way than checking the attribute + # toctree-l[1-8] on the parent node? + if isinstance(doctree, nodes.reference): + classes = doctree.parent.attributes['classes'] + level = 1 + for l in range(8, 0, -1): # or range(1, 8)? + if (_toctree_template % l) in classes: + level = l + result.append({ + 'level': level, + 'refuri': self.esc(doctree['refuri']), + 'text': self.esc(doctree.astext()) + }) + else: + for elem in doctree.children: + result = self.get_refnodes(elem, result) + return result + + def get_toc(self): + """Get the total table of contents, containg the master_doc + and pre and post files not managed by sphinx. + """ + doctree = self.env.get_and_resolve_doctree(self.config.master_doc, + self, prune_toctrees=False) + self.refnodes = self.get_refnodes(doctree, []) + self.refnodes.insert(0, { + 'level': 1, + 'refuri': self.esc(self.config.master_doc + '.html'), + 'text': self.esc(self.env.titles[self.config.master_doc].astext()) + }) + for file, text in reversed(self.config.epub_pre_files): + self.refnodes.insert(0, { + 'level': 1, + 'refuri': self.esc(file + '.html'), + 'text': self.esc(text) + }) + for file, text in self.config.epub_post_files: + self.refnodes.append({ + 'level': 1, + 'refuri': self.esc(file + '.html'), + 'text': self.esc(text) + }) + + + # Finish by building the epub file + def handle_finish(self): + """Create the metainfo files and finally the epub.""" + self.get_toc() + self.build_mimetype(self.outdir, 'mimetype') + self.build_container(self.outdir, 'META-INF/container.xml') + self.build_content(self.outdir, 'content.opf') + self.build_toc(self.outdir, 'toc.ncx') + self.build_epub(self.outdir, self.config.epub_basename + '.epub') + + def build_mimetype(self, outdir, outname): + """Write the metainfo file mimetype.""" + self.info('writing %s file...' % outname) + f = codecs.open(path.join(outdir, outname), 'w', 'utf-8') + try: + f.write(_mimetype_template) + finally: + f.close() + + def build_container(self, outdir, outname): + """Write the metainfo file META-INF/cointainer.xml.""" + self.info('writing %s file...' % outname) + fn = path.join(outdir, outname) + try: + os.mkdir(path.dirname(fn)) + except OSError, err: + if err.errno != EEXIST: + raise + f = codecs.open(path.join(outdir, outname), 'w', 'utf-8') + try: + f.write(_container_template) + finally: + f.close() + + def content_metadata(self, files, spine): + """Create a dictionary with all metadata for the content.opf + file properly escaped. + """ + metadata = {} + metadata['title'] = self.esc(self.config.epub_title) + metadata['author'] = self.esc(self.config.epub_author) + metadata['uid'] = self.esc(self.config.epub_uid) + metadata['lang'] = self.esc(self.config.epub_language) + metadata['publisher'] = self.esc(self.config.epub_publisher) + metadata['copyright'] = self.esc(self.config.epub_copyright) + metadata['scheme'] = self.esc(self.config.epub_scheme) + metadata['id'] = self.esc(self.config.epub_identifier) + metadata['files'] = files + metadata['spine'] = spine + return metadata + + def build_content(self, outdir, outname): + """Write the metainfo file content.opf It contains bibliographic data, + a file list and the spine (the reading order). + """ + self.info('writing %s file...' % outname) + + # files + if not outdir.endswith(os.sep): + outdir += os.sep + olen = len(outdir) + projectfiles = [] + self.files = [] + self.ignored_files = ['.buildinfo', + 'mimetype', 'content.opf', 'toc.ncx', 'META-INF/container.xml', + self.config.epub_basename + '.epub'] + \ + self.config.epub_exclude_files + for root, dirs, files in os.walk(outdir): + for fn in files: + filename = path.join(root, fn)[olen:] + if filename in self.ignored_files: + continue + ext = path.splitext(filename)[-1] + if ext not in _media_types: + self.warn('unknown mimetype for %s, ignoring' % filename) + continue + projectfiles.append(_file_template % { + 'href': self.esc(filename), + 'id': self.esc(self.make_id(filename)), + 'media_type': self.esc(_media_types[ext]) + }) + self.files.append(filename) + projectfiles = '\n'.join(projectfiles) + + # spine + spine = [] + for item in self.refnodes: + if '#' in item['refuri']: + continue + if item['refuri'] in self.ignored_files: + continue + spine.append(_spine_template % { + 'idref': self.esc(self.make_id(item['refuri'])) + }) + spine = '\n'.join(spine) + + # write the project file + f = codecs.open(path.join(outdir, outname), 'w', 'utf-8') + try: + f.write(_content_template % \ + self.content_metadata(projectfiles, spine)) + finally: + f.close() + + def new_navpoint(self, node, level, incr=True): + """Create a new entry in the toc from the node at given level.""" + # XXX Modifies the node + if incr: + self.playorder += 1 + node['indent'] = _navpoint_indent * level + node['navpoint'] = self.esc(_navPoint_template % self.playorder) + node['playorder'] = self.playorder + return _navpoint_template % node + + def insert_subnav(self, node, subnav): + """Insert nested navpoints for given node. + The node and subnav are already rendered to text. + """ + nlist = node.rsplit('\n', 1) + nlist.insert(-1, subnav) + return '\n'.join(nlist) + + def build_navpoints(self, nodes): + """Create the toc navigation structure. + + Subelements of a node are nested inside the navpoint. + For nested nodes the parent node is reinserted in the subnav. + """ + navstack = [] + navlist = [] + level = 1 + lastnode = None + for node in nodes: + file = node['refuri'].split('#')[0] + if file in self.ignored_files: + continue + if node['level'] > self.config.epub_tocdepth: + continue + if node['level'] == level: + navlist.append(self.new_navpoint(node, level)) + elif node['level'] == level + 1: + navstack.append(navlist) + navlist = [] + level += 1 + if lastnode: + # Insert starting point in subtoc with same playOrder + navlist.append(self.new_navpoint(lastnode, level, False)) + navlist.append(self.new_navpoint(node, level)) + else: + while node['level'] < level: + subnav = '\n'.join(navlist) + navlist = navstack.pop() + navlist[-1] = self.insert_subnav(navlist[-1], subnav) + level -= 1 + navlist.append(self.new_navpoint(node, level)) + lastnode = node + while level != 1: + subnav = '\n'.join(navlist) + navlist = navstack.pop() + navlist[-1] = self.insert_subnav(navlist[-1], subnav) + level -= 1 + return '\n'.join(navlist) + + def toc_metadata(self, level, navpoints): + """Create a dictionary with all metadata for the toc.ncx + file properly escaped. + """ + metadata = {} + metadata['uid'] = self.config.epub_uid + metadata['title'] = self.config.epub_title + metadata['level'] = level + metadata['navpoints'] = navpoints + return metadata + + def build_toc(self, outdir, outname): + """Write the metainfo file toc.ncx.""" + self.info('writing %s file...' % outname) + + navpoints = self.build_navpoints(self.refnodes) + level = max(item['level'] for item in self.refnodes) + level = min(level, self.config.epub_tocdepth) + f = codecs.open(path.join(outdir, outname), 'w', 'utf-8') + try: + f.write(_toc_template % self.toc_metadata(level, navpoints)) + finally: + f.close() + + def build_epub(self, outdir, outname): + """Write the epub file. + + It is a zip file with the mimetype file stored uncompressed + as the first entry. + """ + self.info('writing %s file...' % outname) + projectfiles = ['META-INF/container.xml', 'content.opf', 'toc.ncx'] \ + + self.files + epub = zipfile.ZipFile(path.join(outdir, outname), 'w', \ + zipfile.ZIP_DEFLATED) + epub.write(path.join(outdir, 'mimetype'), 'mimetype', \ + zipfile.ZIP_STORED) + for file in projectfiles: + epub.write(path.join(outdir, file), file, zipfile.ZIP_DEFLATED) + epub.close() diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index 322b9df3..2dbca037 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -11,6 +11,7 @@ import os import sys +import zlib import codecs import posixpath import cPickle as pickle @@ -23,20 +24,26 @@ except ImportError: from docutils import nodes from docutils.io import DocTreeInput, StringOutput -from docutils.core import publish_parts +from docutils.core import Publisher from docutils.utils import new_document from docutils.frontend import OptionParser from docutils.readers.doctree import Reader as DoctreeReader from sphinx import package_dir, __version__ -from sphinx.util import SEP, os_path, relative_uri, ensuredir, \ - movefile, ustrftime, copy_static_entry, copyfile +from sphinx.util import copy_static_entry +from sphinx.util.osutil import SEP, os_path, relative_uri, ensuredir, \ + movefile, ustrftime, copyfile +from sphinx.util.nodes import inline_all_toctrees +from sphinx.util.matching import patmatch, compile_matchers +from sphinx.util.pycompat import any from sphinx.errors import SphinxError +from sphinx.locale import _ from sphinx.search import js_index from sphinx.theming import Theme -from sphinx.builders import Builder, ENV_PICKLE_FILENAME +from sphinx.builders import Builder +from sphinx.application import ENV_PICKLE_FILENAME from sphinx.highlighting import PygmentsBridge -from sphinx.util.console import bold +from sphinx.util.console import bold, darkgreen from sphinx.writers.html import HTMLWriter, HTMLTranslator, \ SmartyPantsHTMLTranslator @@ -71,7 +78,16 @@ class StandaloneHTMLBuilder(Builder): embedded = False # for things like HTML help or Qt help: suppresses sidebar # This is a class attribute because it is mutated by Sphinx.add_javascript. - script_files = ['_static/jquery.js', '_static/doctools.js'] + script_files = ['_static/jquery.js', '_static/underscore.js', + '_static/doctools.js'] + # Dito for this one. + css_files = [] + + default_sidebars = ['localtoc.html', 'relations.html', + 'sourcelink.html', 'searchbox.html'] + + # cached publisher object for snippets + _publisher = None def init(self): # a hash of all config values that, if changed, cause a full rebuild @@ -102,9 +118,14 @@ class StandaloneHTMLBuilder(Builder): self.script_files.append('_static/translations.js') break + def get_theme_config(self): + return self.config.html_theme, self.config.html_theme_options + def init_templates(self): Theme.init_themes(self) - self.theme = Theme(self.config.html_theme) + themename, themeoptions = self.get_theme_config() + self.theme = Theme(themename) + self.theme_options = themeoptions.copy() self.create_template_bridge() self.templates.init(self, self.theme) @@ -116,7 +137,8 @@ class StandaloneHTMLBuilder(Builder): style = self.theme.get_confstr('theme', 'pygments_style', 'none') else: style = 'sphinx' - self.highlighter = PygmentsBridge('html', style) + self.highlighter = PygmentsBridge('html', style, + self.config.trim_doctest_flags) def init_translator_class(self): if self.config.html_translator_class: @@ -187,13 +209,24 @@ class StandaloneHTMLBuilder(Builder): return {'fragment': ''} doc = new_document('<partial node>') doc.append(node) - return publish_parts( - doc, - source_class=DocTreeInput, - reader=DoctreeReader(), - writer=HTMLWriter(self), - settings_overrides={'output_encoding': 'unicode'} - ) + + if self._publisher is None: + self._publisher = Publisher( + source_class = DocTreeInput, + destination_class=StringOutput) + self._publisher.set_components('standalone', + 'restructuredtext', 'pseudoxml') + + pub = self._publisher + + pub.reader = DoctreeReader() + pub.writer = HTMLWriter(self) + pub.process_programmatic_settings( + None, {'output_encoding': 'unicode'}, None) + pub.set_source(doc, None) + pub.set_destination(None, None) + pub.publish() + return pub.writer.parts def prepare_writing(self, docnames): from sphinx.search import IndexBuilder @@ -204,6 +237,27 @@ class StandaloneHTMLBuilder(Builder): self.docsettings = OptionParser( defaults=self.env.settings, components=(self.docwriter,)).get_default_values() + self.docsettings.compact_lists = bool(self.config.html_compact_lists) + + # determine the additional indices to include + self.domain_indices = [] + # html_domain_indices can be False/True or a list of index names + indices_config = self.config.html_domain_indices + if indices_config: + for domain in self.env.domains.itervalues(): + for indexcls in domain.indices: + indexname = '%s-%s' % (domain.name, indexcls.name) + if isinstance(indices_config, list): + if indexname not in indices_config: + continue + # deprecated config value + if indexname == 'py-modindex' and \ + not self.config.html_use_modindex: + continue + content, collapse = indexcls(domain).generate() + if content: + self.domain_indices.append( + (indexname, indexcls, content, collapse)) # format the "last updated on" string, only once is enough since it # typically doesn't include the time of day @@ -229,9 +283,11 @@ class StandaloneHTMLBuilder(Builder): rellinks = [] if self.config.html_use_index: rellinks.append(('genindex', _('General Index'), 'I', _('index'))) - if self.config.html_use_modindex and self.env.modules: - rellinks.append(('modindex', _('Global Module Index'), - 'M', _('modules'))) + for indexname, indexcls, content, collapse in self.domain_indices: + # if it has a short name + if indexcls.shortname: + rellinks.append((indexname, indexcls.localname, + '', indexcls.shortname)) if self.config.html_style is not None: stylename = self.config.html_style @@ -251,11 +307,13 @@ class StandaloneHTMLBuilder(Builder): use_opensearch = self.config.html_use_opensearch, docstitle = self.config.html_title, shorttitle = self.config.html_short_title, + show_copyright = self.config.html_show_copyright, show_sphinx = self.config.html_show_sphinx, has_source = self.config.html_copy_source, show_source = self.config.html_show_sourcelink, file_suffix = self.out_suffix, script_files = self.script_files, + css_files = self.css_files, sphinx_version = __version__, style = stylename, rellinks = rellinks, @@ -267,8 +325,7 @@ class StandaloneHTMLBuilder(Builder): if self.theme: self.globalcontext.update( ('theme_' + key, val) for (key, val) in - self.theme.get_options( - self.config.html_theme_options).iteritems()) + self.theme.get_options(self.theme_options).iteritems()) self.globalcontext.update(self.config.html_context) def get_doc_context(self, docname, body, metatags): @@ -359,128 +416,17 @@ class StandaloneHTMLBuilder(Builder): def finish(self): self.info(bold('writing additional files...'), nonl=1) - # the global general index + # pages from extensions + for pagelist in self.app.emit('html-collect-pages'): + for pagename, context, template in pagelist: + self.handle_page(pagename, context, template) + # the global general index if self.config.html_use_index: - # the total count of lines for each index letter, used to distribute - # the entries into two columns - genindex = self.env.create_index(self) - indexcounts = [] - for _, entries in genindex: - indexcounts.append(sum(1 + len(subitems) - for _, (_, subitems) in entries)) - - genindexcontext = dict( - genindexentries = genindex, - genindexcounts = indexcounts, - split_index = self.config.html_split_index, - ) - self.info(' genindex', nonl=1) - - if self.config.html_split_index: - self.handle_page('genindex', genindexcontext, - 'genindex-split.html') - self.handle_page('genindex-all', genindexcontext, - 'genindex.html') - for (key, entries), count in zip(genindex, indexcounts): - ctx = {'key': key, 'entries': entries, 'count': count, - 'genindexentries': genindex} - self.handle_page('genindex-' + key, ctx, - 'genindex-single.html') - else: - self.handle_page('genindex', genindexcontext, 'genindex.html') - - # the global module index - - if self.config.html_use_modindex and self.env.modules: - # the sorted list of all modules, for the global module index - modules = sorted(((mn, (self.get_relative_uri('modindex', fn) + - '#module-' + mn, sy, pl, dep)) - for (mn, (fn, sy, pl, dep)) in - self.env.modules.iteritems()), - key=lambda x: x[0].lower()) - # collect all platforms - platforms = set() - # sort out collapsable modules - modindexentries = [] - letters = [] - pmn = '' - num_toplevels = 0 - num_collapsables = 0 - cg = 0 # collapse group - fl = '' # first letter - for mn, (fn, sy, pl, dep) in modules: - pl = pl and pl.split(', ') or [] - platforms.update(pl) - - ignore = self.env.config['modindex_common_prefix'] - ignore = sorted(ignore, key=len, reverse=True) - for i in ignore: - if mn.startswith(i): - mn = mn[len(i):] - stripped = i - break - else: - stripped = '' - - # we stripped the whole module name - if not mn: - continue - - if fl != mn[0].lower() and mn[0] != '_': - # heading - letter = mn[0].upper() - if letter not in letters: - modindexentries.append(['', False, 0, False, - letter, '', [], False, '']) - letters.append(letter) - tn = mn.split('.')[0] - if tn != mn: - # submodule - if pmn == tn: - # first submodule - make parent collapsable - modindexentries[-1][1] = True - num_collapsables += 1 - elif not pmn.startswith(tn): - # submodule without parent in list, add dummy entry - cg += 1 - modindexentries.append([tn, True, cg, False, '', '', - [], False, stripped]) - else: - num_toplevels += 1 - cg += 1 - modindexentries.append([mn, False, cg, (tn != mn), fn, sy, pl, - dep, stripped]) - pmn = mn - fl = mn[0].lower() - platforms = sorted(platforms) - - # apply heuristics when to collapse modindex at page load: - # only collapse if number of toplevel modules is larger than - # number of submodules - collapse = len(modules) - num_toplevels < num_toplevels - - # As some parts of the module names may have been stripped, those - # names have changed, thus it is necessary to sort the entries. - if ignore: - def sorthelper(entry): - name = entry[0] - if name == '': - # heading - name = entry[4] - return name.lower() - - modindexentries.sort(key=sorthelper) - letters.sort() - - modindexcontext = dict( - modindexentries = modindexentries, - platforms = platforms, - letters = letters, - collapse_modindex = collapse, - ) - self.info(' modindex', nonl=1) - self.handle_page('modindex', modindexcontext, 'modindex.html') + self.write_genindex() + + # the global domain-specific indices + self.write_domain_indices() # the search page if self.name != 'htmlhelp': @@ -499,6 +445,54 @@ class StandaloneHTMLBuilder(Builder): self.info() + self.copy_image_files() + self.copy_download_files() + self.copy_static_files() + self.write_buildinfo() + + # dump the search index + self.handle_finish() + + def write_genindex(self): + # the total count of lines for each index letter, used to distribute + # the entries into two columns + genindex = self.env.create_index(self) + indexcounts = [] + for _, entries in genindex: + indexcounts.append(sum(1 + len(subitems) + for _, (_, subitems) in entries)) + + genindexcontext = dict( + genindexentries = genindex, + genindexcounts = indexcounts, + split_index = self.config.html_split_index, + ) + self.info(' genindex', nonl=1) + + if self.config.html_split_index: + self.handle_page('genindex', genindexcontext, + 'genindex-split.html') + self.handle_page('genindex-all', genindexcontext, + 'genindex.html') + for (key, entries), count in zip(genindex, indexcounts): + ctx = {'key': key, 'entries': entries, 'count': count, + 'genindexentries': genindex} + self.handle_page('genindex-' + key, ctx, + 'genindex-single.html') + else: + self.handle_page('genindex', genindexcontext, 'genindex.html') + + def write_domain_indices(self): + for indexname, indexcls, content, collapse in self.domain_indices: + indexcontext = dict( + indextitle = indexcls.localname, + content = content, + collapse_index = collapse, + ) + self.info(' ' + indexname, nonl=1) + self.handle_page(indexname, indexcontext, 'domainindex.html') + + def copy_image_files(self): # copy image files if self.images: self.info(bold('copying images...'), nonl=True) @@ -513,6 +507,7 @@ class StandaloneHTMLBuilder(Builder): (path.join(self.srcdir, src), err)) self.info() + def copy_download_files(self): # copy downloadable files if self.env.dlfiles: self.info(bold('copying downloadable files...'), nonl=True) @@ -527,6 +522,7 @@ class StandaloneHTMLBuilder(Builder): (path.join(self.srcdir, src), err)) self.info() + def copy_static_files(self): # copy static files self.info(bold('copying static files... '), nonl=True) ensuredir(path.join(self.outdir, '_static')) @@ -545,31 +541,42 @@ class StandaloneHTMLBuilder(Builder): copyfile(jsfile, path.join(self.outdir, '_static', 'translations.js')) break - # then, copy over all user-supplied static files + # then, copy over theme-supplied static files if self.theme: - staticdirnames = [path.join(themepath, 'static') - for themepath in self.theme.get_dirchain()[::-1]] - else: - staticdirnames = [] - staticdirnames += [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) + themeentries = [path.join(themepath, 'static') + for themepath in self.theme.get_dirchain()[::-1]] + for entry in themeentries: + copy_static_entry(entry, path.join(self.outdir, '_static'), + self, self.globalcontext) + # then, copy over all user-supplied static files + staticentries = [path.join(self.confdir, spath) + for spath in self.config.html_static_path] + matchers = compile_matchers( + self.config.exclude_patterns + + ['**/' + d for d in self.config.exclude_dirnames] + ) + for entry in staticentries: + if not path.exists(entry): + self.warn('html_static_path entry %r does not exist' % entry) continue - for filename in os.listdir(staticdirname): - if filename.startswith('.'): - continue - fullname = path.join(staticdirname, filename) - targetname = path.join(self.outdir, '_static', filename) - copy_static_entry(fullname, targetname, self, - self.globalcontext) - # last, copy logo file (handled differently) + copy_static_entry(entry, path.join(self.outdir, '_static'), self, + self.globalcontext, exclude_matchers=matchers) + # copy logo and favicon files if not already in static path if self.config.html_logo: logobase = path.basename(self.config.html_logo) - copyfile(path.join(self.confdir, self.config.html_logo), - path.join(self.outdir, '_static', logobase)) + logotarget = path.join(self.outdir, '_static', logobase) + if not path.isfile(logotarget): + copyfile(path.join(self.confdir, self.config.html_logo), + logotarget) + if self.config.html_favicon: + iconbase = path.basename(self.config.html_favicon) + icontarget = path.join(self.outdir, '_static', iconbase) + if not path.isfile(icontarget): + copyfile(path.join(self.confdir, self.config.html_favicon), + icontarget) + self.info('done') + def write_buildinfo(self): # write build info file fp = open(path.join(self.outdir, '.buildinfo'), 'w') try: @@ -581,11 +588,6 @@ class StandaloneHTMLBuilder(Builder): finally: fp.close() - self.info('done') - - # dump the search index - self.handle_finish() - def cleanup(self): # clean up theme stuff if self.theme: @@ -635,13 +637,43 @@ class StandaloneHTMLBuilder(Builder): if self.indexer is not None and title: self.indexer.feed(pagename, title, doctree) - def _get_local_toctree(self, docname, collapse=True): + def _get_local_toctree(self, docname, collapse=True, maxdepth=0): return self.render_partial(self.env.get_toctree_for( docname, self, collapse))['fragment'] def get_outfilename(self, pagename): return path.join(self.outdir, os_path(pagename) + self.out_suffix) + def add_sidebars(self, pagename, ctx): + def has_wildcard(pattern): + return any(char in pattern for char in '*?[') + sidebars = None + matched = None + customsidebar = None + for pattern, patsidebars in self.config.html_sidebars.iteritems(): + if patmatch(pagename, pattern): + if matched: + if has_wildcard(pattern): + # warn if both patterns contain wildcards + if has_wildcard(matched): + self.warn('page %s matches two patterns in ' + 'html_sidebars: %r and %r' % + (pagename, matched, pattern)) + # else the already matched pattern is more specific + # than the present one, because it contains no wildcard + continue + matched = pattern + sidebars = patsidebars + if sidebars is None: + # keep defaults + pass + elif isinstance(sidebars, basestring): + # 0.x compatible mode: insert custom sidebar before searchbox + customsidebar = sidebars + sidebars = None + ctx['sidebars'] = sidebars + ctx['customsidebar'] = customsidebar + # --------- these are overwritten by the serialization builder def get_target_uri(self, docname, typ=None): @@ -661,8 +693,9 @@ class StandaloneHTMLBuilder(Builder): return uri ctx['pathto'] = pathto ctx['hasdoc'] = lambda name: name in self.env.all_docs - ctx['customsidebar'] = self.config.html_sidebars.get(pagename) + ctx['encoding'] = encoding = self.config.html_output_encoding ctx['toctree'] = lambda **kw: self._get_local_toctree(pagename, **kw) + self.add_sidebars(pagename, ctx) ctx.update(addctx) self.app.emit('html-page-context', pagename, templatename, @@ -681,7 +714,7 @@ class StandaloneHTMLBuilder(Builder): # outfilename's path is in general different from self.outdir ensuredir(path.dirname(outfilename)) try: - f = codecs.open(outfilename, 'w', 'utf-8') + f = codecs.open(outfilename, 'w', encoding) try: f.write(output) finally: @@ -696,6 +729,36 @@ class StandaloneHTMLBuilder(Builder): copyfile(self.env.doc2path(pagename), source_name) def handle_finish(self): + self.dump_search_index() + self.dump_inventory() + + def dump_inventory(self): + self.info(bold('dumping object inventory... '), nonl=True) + f = open(path.join(self.outdir, INVENTORY_FILENAME), 'wb') + try: + f.write('# Sphinx inventory version 2\n') + f.write('# Project: %s\n' % self.config.project.encode('utf-8')) + f.write('# Version: %s\n' % self.config.version) + f.write('# The remainder of this file is compressed using zlib.\n') + compressor = zlib.compressobj(9) + for domainname, domain in self.env.domains.iteritems(): + for name, dispname, type, docname, anchor, prio in \ + domain.get_objects(): + if anchor.endswith(name): + # this can shorten the inventory by as much as 25% + anchor = anchor[:-len(name)] + '$' + uri = self.get_target_uri(docname) + '#' + anchor + if dispname == name: + dispname = '-' + f.write(compressor.compress( + '%s %s:%s %s %s %s\n' % (name, domainname, type, prio, + uri, dispname))) + f.write(compressor.flush()) + finally: + f.close() + self.info('done') + + def dump_search_index(self): self.info(bold('dumping search index... '), nonl=True) self.indexer.prune(self.env.all_docs) searchindexfn = path.join(self.outdir, self.searchindex_filename) @@ -709,21 +772,6 @@ class StandaloneHTMLBuilder(Builder): movefile(searchindexfn + '.tmp', searchindexfn) self.info('done') - self.info(bold('dumping object inventory... '), nonl=True) - f = open(path.join(self.outdir, INVENTORY_FILENAME), 'w') - try: - f.write('# Sphinx inventory version 1\n') - f.write('# Project: %s\n' % self.config.project.encode('utf-8')) - f.write('# Version: %s\n' % self.config.version) - for modname, info in self.env.modules.iteritems(): - f.write('%s mod %s\n' % (modname, self.get_target_uri(info[0]))) - for refname, (docname, desctype) in self.env.descrefs.iteritems(): - f.write('%s %s %s\n' % (refname, desctype, - self.get_target_uri(docname))) - finally: - f.close() - self.info('done') - class DirectoryHTMLBuilder(StandaloneHTMLBuilder): """ @@ -751,6 +799,110 @@ class DirectoryHTMLBuilder(StandaloneHTMLBuilder): return outfilename +class SingleFileHTMLBuilder(StandaloneHTMLBuilder): + """ + A StandaloneHTMLBuilder subclass that puts the whole document tree on one + HTML page. + """ + name = 'singlehtml' + copysource = False + + def get_outdated_docs(self): + return 'all documents' + + def get_target_uri(self, docname, typ=None): + if docname in self.env.all_docs: + # all references are on the same page... + return self.config.master_doc + self.out_suffix + \ + '#document-' + docname + else: + # chances are this is a html_additional_page + return docname + self.out_suffix + + def get_relative_uri(self, from_, to, typ=None): + # ignore source + return self.get_target_uri(to, typ) + + def fix_refuris(self, tree): + # fix refuris with double anchor + fname = self.config.master_doc + self.out_suffix + for refnode in tree.traverse(nodes.reference): + if 'refuri' not in refnode: + continue + refuri = refnode['refuri'] + hashindex = refuri.find('#') + if hashindex < 0: + continue + hashindex = refuri.find('#', hashindex+1) + if hashindex >= 0: + refnode['refuri'] = fname + refuri[hashindex:] + + def assemble_doctree(self): + master = self.config.master_doc + tree = self.env.get_doctree(master) + tree = inline_all_toctrees(self, set(), master, tree, darkgreen) + tree['docname'] = master + self.env.resolve_references(tree, master, self) + self.fix_refuris(tree) + return tree + + def get_doc_context(self, docname, body, metatags): + # no relation links... + toc = self.env.get_toctree_for(self.config.master_doc, self, False) + self.fix_refuris(toc) + toc = self.render_partial(toc)['fragment'] + return dict( + parents = [], + prev = None, + next = None, + docstitle = None, + title = self.config.html_title, + meta = None, + body = body, + metatags = metatags, + rellinks = [], + sourcename = '', + toc = toc, + display_toc = True, + ) + + def write(self, *ignored): + docnames = self.env.all_docs + + self.info(bold('preparing documents... '), nonl=True) + self.prepare_writing(docnames) + self.info('done') + + self.info(bold('assembling single document... '), nonl=True) + doctree = self.assemble_doctree() + self.info() + self.info(bold('writing... '), nonl=True) + self.write_doc(self.config.master_doc, doctree) + self.info('done') + + def finish(self): + # no indices or search pages are supported + self.info(bold('writing additional files...'), nonl=1) + + # additional pages from conf.py + for pagename, template in self.config.html_additional_pages.items(): + self.info(' '+pagename, nonl=1) + self.handle_page(pagename, {}, template) + + if self.config.html_use_opensearch: + self.info(' opensearch', nonl=1) + fn = path.join(self.outdir, '_static', 'opensearch.xml') + self.handle_page('opensearch', {}, 'opensearch.xml', outfilename=fn) + + self.info() + + self.copy_image_files() + self.copy_download_files() + self.copy_static_files() + self.write_buildinfo() + self.dump_inventory() + + class SerializingHTMLBuilder(StandaloneHTMLBuilder): """ An abstract builder that serializes the generated HTML. @@ -784,9 +936,7 @@ class SerializingHTMLBuilder(StandaloneHTMLBuilder): def handle_page(self, pagename, ctx, templatename='page.html', outfilename=None, event_arg=None): ctx['current_page_name'] = pagename - sidebarfile = self.config.html_sidebars.get(pagename) - if sidebarfile: - ctx['customsidebar'] = sidebarfile + self.add_sidebars(pagename, ctx) if not outfilename: outfilename = path.join(self.outdir, diff --git a/sphinx/builders/htmlhelp.py b/sphinx/builders/htmlhelp.py index bf486fc9..538f4c84 100644 --- a/sphinx/builders/htmlhelp.py +++ b/sphinx/builders/htmlhelp.py @@ -216,9 +216,9 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder): # special books f.write('<LI> ' + object_sitemap % (self.config.html_short_title, 'index.html')) - if self.config.html_use_modindex: - f.write('<LI> ' + object_sitemap % (_('Global Module Index'), - 'modindex.html')) + for indexname, indexcls, content, collapse in self.domain_indices: + f.write('<LI> ' + object_sitemap % (indexcls.localname, + '%s.html' % indexname)) # the TOC tocdoc = self.env.get_and_resolve_doctree( self.config.master_doc, self, prune_toctrees=False) diff --git a/sphinx/builders/latex.py b/sphinx/builders/latex.py index 751bf28c..0481b308 100644 --- a/sphinx/builders/latex.py +++ b/sphinx/builders/latex.py @@ -18,9 +18,12 @@ from docutils.utils import new_document from docutils.frontend import OptionParser from sphinx import package_dir, addnodes -from sphinx.util import SEP, texescape, copyfile +from sphinx.util import texescape +from sphinx.locale import _ from sphinx.builders import Builder from sphinx.environment import NoUri +from sphinx.util.nodes import inline_all_toctrees +from sphinx.util.osutil import SEP, copyfile from sphinx.util.console import bold, darkgreen from sphinx.writers.latex import LaTeXWriter @@ -114,27 +117,6 @@ class LaTeXBuilder(Builder): def assemble_doctree(self, indexfile, toctree_only, appendices): self.docnames = set([indexfile] + appendices) self.info(darkgreen(indexfile) + " ", nonl=1) - def process_tree(docname, tree): - tree = tree.deepcopy() - for toctreenode in tree.traverse(addnodes.toctree): - newnodes = [] - includefiles = map(str, toctreenode['includefiles']) - for includefile in includefiles: - try: - self.info(darkgreen(includefile) + " ", nonl=1) - subtree = process_tree( - includefile, self.env.get_doctree(includefile)) - self.docnames.add(includefile) - except Exception: - self.warn('toctree contains ref to nonexisting ' - 'file %r' % includefile, - self.env.doc2path(docname)) - else: - sof = addnodes.start_of_file(docname=includefile) - sof.children = subtree.children - newnodes.append(sof) - toctreenode.parent.replace(toctreenode, newnodes) - return tree tree = self.env.get_doctree(indexfile) tree['docname'] = indexfile if toctree_only: @@ -148,7 +130,8 @@ class LaTeXBuilder(Builder): for node in tree.traverse(addnodes.toctree): new_sect += node tree = new_tree - largetree = process_tree(indexfile, tree) + largetree = inline_all_toctrees(self, self.docnames, indexfile, tree, + darkgreen) largetree['docname'] = indexfile for docname in appendices: appendix = self.env.get_doctree(docname) diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index 1fead717..c9bc363d 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -72,6 +72,8 @@ class CheckExternalLinksBuilder(Builder): lineno = node.line if uri[0:5] == 'http:' or uri[0:6] == 'https:': + if lineno: + self.info('(line %3d) ' % lineno, nonl=1) self.info(uri, nonl=1) if uri in self.broken: diff --git a/sphinx/builders/manpage.py b/sphinx/builders/manpage.py new file mode 100644 index 00000000..756e4732 --- /dev/null +++ b/sphinx/builders/manpage.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +""" + sphinx.builders.manpage + ~~~~~~~~~~~~~~~~~~~~~~~ + + Manual pages builder. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from os import path + +from docutils.io import FileOutput +from docutils.frontend import OptionParser + +from sphinx import addnodes +from sphinx.errors import SphinxError +from sphinx.builders import Builder +from sphinx.environment import NoUri +from sphinx.util.nodes import inline_all_toctrees +from sphinx.util.console import bold, darkgreen +from sphinx.writers.manpage import ManualPageWriter, has_manpage_writer + + +class ManualPageBuilder(Builder): + """ + Builds groff output in manual page format. + """ + name = 'man' + format = 'man' + supported_image_types = [] + + def init(self): + if not has_manpage_writer: + raise SphinxError('The docutils manual page writer can\'t be ' + 'found; it is only available as of docutils 0.6.') + if not self.config.man_pages: + self.warn('no "man_pages" config value found; no manual pages ' + 'will be written') + + def get_outdated_docs(self): + return 'all manpages' # for now + + def get_target_uri(self, docname, typ=None): + if typ == 'token': + return '' + raise NoUri + + def write(self, *ignored): + docwriter = ManualPageWriter(self) + docsettings = OptionParser( + defaults=self.env.settings, + components=(docwriter,)).get_default_values() + + self.info(bold('writing... '), nonl=True) + + for info in self.config.man_pages: + docname, name, description, authors, section = info + if isinstance(authors, basestring): + if authors: + authors = [authors] + else: + authors = [] + + targetname = '%s.%s' % (name, section) + self.info(darkgreen(targetname) + ' { ', nonl=True) + destination = FileOutput( + destination_path=path.join(self.outdir, targetname), + encoding='utf-8') + + tree = self.env.get_doctree(docname) + docnames = set() + largetree = inline_all_toctrees(self, docnames, docname, tree, + darkgreen) + self.info('} ', nonl=True) + self.env.resolve_references(largetree, docname, self) + # remove pending_xref nodes + for pendingnode in largetree.traverse(addnodes.pending_xref): + pendingnode.replace_self(pendingnode.children) + + largetree.settings = docsettings + largetree.settings.title = name + largetree.settings.subtitle = description + largetree.settings.authors = authors + largetree.settings.section = section + + docwriter.write(largetree, destination) + self.info() + + def finish(self): + pass diff --git a/sphinx/builders/qthelp.py b/sphinx/builders/qthelp.py index 89bda0dc..cad1e020 100644 --- a/sphinx/builders/qthelp.py +++ b/sphinx/builders/qthelp.py @@ -21,6 +21,7 @@ from docutils import nodes from sphinx import addnodes from sphinx.builders.html import StandaloneHTMLBuilder + _idpattern = re.compile( r'(?P<title>.+) (\((?P<id>[\w\.]+)( (?P<descr>\w+))?\))$') @@ -126,9 +127,9 @@ class QtHelpBuilder(StandaloneHTMLBuilder): for node in tocdoc.traverse(istoctree): sections.extend(self.write_toc(node)) - if self.config.html_use_modindex: - item = section_template % {'title': _('Global Module Index'), - 'ref': 'modindex.html'} + for index in self.domain_indices: + item = section_template % {'title': index[2], + 'ref': '%s-%s.html' % index[0:2]} sections.append(' '*4*4 + item) sections = '\n'.join(sections) @@ -251,7 +252,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder): shortname = shortname[:-2] id = '%s.%s' % (id, shortname) else: - id = descr = None + id = None if id: item = ' '*12 + '<keyword name="%s" id="%s" ref="%s"/>' % ( diff --git a/sphinx/builders/text.py b/sphinx/builders/text.py index d8451371..092a1d97 100644 --- a/sphinx/builders/text.py +++ b/sphinx/builders/text.py @@ -14,8 +14,8 @@ from os import path from docutils.io import StringOutput -from sphinx.util import ensuredir, os_path from sphinx.builders import Builder +from sphinx.util.osutil import ensuredir, os_path from sphinx.writers.text import TextWriter diff --git a/sphinx/cmdline.py b/sphinx/cmdline.py index dc3269e2..e3e94465 100644 --- a/sphinx/cmdline.py +++ b/sphinx/cmdline.py @@ -43,6 +43,7 @@ new and changed files -C -- use no config file at all, only -D options -D <setting=value> -- override a setting in configuration -A <name=value> -- pass a value into the templates, for HTML builder + -n -- nit-picky mode, warn about all missing references -N -- do not do colored output -q -- no output on stdout, just warnings on stderr -Q -- no output at all, not even warnings @@ -61,7 +62,7 @@ def main(argv): nocolor() try: - opts, args = getopt.getopt(argv[1:], 'ab:t:d:c:CD:A:g:NEqQWw:P') + opts, args = getopt.getopt(argv[1:], 'ab:t:d:c:CD:A:ng:NEqQWw:P') allopts = set(opt[0] for opt in opts) srcdir = confdir = path.abspath(args[0]) if not path.isdir(srcdir): @@ -89,8 +90,8 @@ def main(argv): if err: return 1 - buildername = all_files = None - freshenv = warningiserror = use_pdb = False + buildername = None + force_all = freshenv = warningiserror = use_pdb = False status = sys.stdout warning = sys.stderr error = sys.stderr @@ -105,7 +106,7 @@ def main(argv): if filenames: usage(argv, 'Cannot combine -a option and filenames.') return 1 - all_files = True + force_all = True elif opt == '-t': tags.append(val) elif opt == '-d': @@ -142,6 +143,8 @@ def main(argv): except ValueError: pass confoverrides['html_context.%s' % key] = val + elif opt == '-n': + confoverrides['nitpicky'] = True elif opt == '-N': nocolor() elif opt == '-E': @@ -167,7 +170,7 @@ def main(argv): app = Sphinx(srcdir, confdir, outdir, doctreedir, buildername, confoverrides, status, warning, freshenv, warningiserror, tags) - app.build(all_files, filenames) + app.build(force_all, filenames) return app.statuscode except KeyboardInterrupt: if use_pdb: diff --git a/sphinx/config.py b/sphinx/config.py index 4cd51492..e9de2970 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -13,8 +13,8 @@ import os import re from os import path -from sphinx.util import make_filename from sphinx.errors import ConfigError +from sphinx.util.osutil import make_filename nonascii_re = re.compile(r'[\x80-\xff]') @@ -42,8 +42,9 @@ class Config(object): master_doc = ('contents', 'env'), source_suffix = ('.rst', 'env'), source_encoding = ('utf-8-sig', 'env'), + exclude_patterns = ([], 'env'), + # the next three are all deprecated now unused_docs = ([], 'env'), - exclude_dirs = ([], 'env'), exclude_trees = ([], 'env'), exclude_dirnames = ([], 'env'), default_role = (None, 'env'), @@ -58,6 +59,11 @@ class Config(object): keep_warnings = (False, 'env'), modindex_common_prefix = ([], 'html'), rst_epilog = (None, 'env'), + rst_prolog = (None, 'env'), + trim_doctest_flags = (True, 'env'), + default_domain = ('py', 'env'), + needs_sphinx = (None, None), + nitpicky = (False, 'env'), # HTML options html_theme = ('default', 'html'), @@ -77,7 +83,8 @@ class Config(object): html_translator_class = (None, 'html'), html_sidebars = ({}, 'html'), html_additional_pages = ({}, 'html'), - html_use_modindex = (True, 'html'), + html_use_modindex = (True, 'html'), # deprecated + html_domain_indices = (True, 'html'), html_add_permalinks = (True, 'html'), html_use_index = (True, 'html'), html_split_index = (False, 'html'), @@ -86,8 +93,12 @@ class Config(object): html_use_opensearch = ('', 'html'), html_file_suffix = (None, 'html'), html_link_suffix = (None, 'html'), + html_show_copyright = (True, 'html'), html_show_sphinx = (True, 'html'), html_context = ({}, 'html'), + html_output_encoding = ('utf-8', 'html'), + html_compact_lists = (True, 'html'), + html_secnumber_suffix = ('. ', 'html'), # HTML help only options htmlhelp_basename = (lambda self: make_filename(self.project), None), @@ -95,20 +106,48 @@ class Config(object): # Qt help only options qthelp_basename = (lambda self: make_filename(self.project), None), + # Devhelp only options + devhelp_basename = (lambda self: make_filename(self.project), None), + + # Epub options + epub_basename = (lambda self: make_filename(self.project), None), + epub_theme = ('epub', 'html'), + epub_title = (lambda self: self.html_title, 'html'), + epub_author = ('unknown', 'html'), + epub_language = (lambda self: self.language or 'en', 'html'), + epub_publisher = ('unknown', 'html'), + epub_copyright = (lambda self: self.copyright, 'html'), + epub_identifier = ('unknown', 'html'), + epub_scheme = ('unknown', 'html'), + epub_uid = ('unknown', 'env'), + epub_pre_files = ([], 'env'), + epub_post_files = ([], 'env'), + epub_exclude_files = ([], 'env'), + epub_tocdepth = (3, 'env'), + # LaTeX options latex_documents = ([], None), latex_logo = (None, None), latex_appendices = ([], None), latex_use_parts = (False, None), - latex_use_modindex = (True, None), + latex_use_modindex = (True, None), # deprecated + latex_domain_indices = (True, None), # paper_size and font_size are still separate values # so that you can give them easily on the command line latex_paper_size = ('letter', None), latex_font_size = ('10pt', None), latex_elements = ({}, None), latex_additional_files = ([], None), + latex_docclass = ({}, None), # now deprecated - use latex_elements latex_preamble = ('', None), + + # text options + text_sectionchars = ('*=-~"+`', 'text'), + text_windows_newlines = (False, 'text'), + + # manpage options + man_pages = ([], None), ) def __init__(self, dirname, filename, overrides, tags): diff --git a/sphinx/directives/__init__.py b/sphinx/directives/__init__.py index 00bb55ec..6c03b8e5 100644 --- a/sphinx/directives/__init__.py +++ b/sphinx/directives/__init__.py @@ -9,11 +9,15 @@ :license: BSD, see LICENSE for details. """ -from docutils.parsers.rst import directives +import re + +from docutils.parsers.rst import Directive, directives from docutils.parsers.rst.directives import images +from sphinx import addnodes +from sphinx.util.docfields import DocFieldTransformer + # import and register directives -from sphinx.directives.desc import * from sphinx.directives.code import * from sphinx.directives.other import * @@ -25,3 +29,171 @@ try: except AttributeError: images.figure.options['figwidth'] = \ directives.length_or_percentage_or_unitless + + +# RE to strip backslash escapes +strip_backslash_re = re.compile(r'\\(?=[^\\])') + + +class ObjectDescription(Directive): + """ + Directive to describe a class, function or similar object. Not used + directly, but subclassed (in domain-specific directives) to add custom + behavior. + """ + + has_content = True + required_arguments = 1 + optional_arguments = 0 + final_argument_whitespace = True + option_spec = { + 'noindex': directives.flag, + } + + # types of doc fields that this directive handles, see sphinx.util.docfields + doc_field_types = [] + + def get_signatures(self): + """ + Retrieve the signatures to document from the directive arguments. By + default, signatures are given as arguments, one per line. + """ + # remove backslashes to support (dummy) escapes; helps Vim highlighting + return [strip_backslash_re.sub('', sig.strip()) + for sig in self.arguments[0].split('\n')] + + def handle_signature(self, sig, signode): + """ + Parse the signature *sig* into individual nodes and append them to + *signode*. If ValueError is raised, parsing is aborted and the whole + *sig* is put into a single desc_name node. + + The return value should be a value that identifies the object. It is + passed to :meth:`add_target_and_index()` unchanged, and otherwise only + used to skip duplicates. + """ + raise ValueError + + def add_target_and_index(self, name, sig, signode): + """ + Add cross-reference IDs and entries to self.indexnode, if applicable. + + *name* is whatever :meth:`handle_signature()` returned. + """ + return # do nothing by default + + def before_content(self): + """ + Called before parsing content. Used to set information about the current + directive context on the build environment. + """ + pass + + def after_content(self): + """ + Called after parsing content. Used to reset information about the + current directive context on the build environment. + """ + pass + + def run(self): + """ + Main directive entry function, called by docutils upon encountering the + directive. + + This directive is meant to be quite easily subclassable, so it delegates + to several additional methods. What it does: + + * find out if called as a domain-specific directive, set self.domain + * create a `desc` node to fit all description inside + * parse standard options, currently `noindex` + * create an index node if needed as self.indexnode + * parse all given signatures (as returned by self.get_signatures()) + using self.handle_signature(), which should either return a name + or raise ValueError + * add index entries using self.add_target_and_index() + * parse the content and handle doc fields in it + """ + if ':' in self.name: + self.domain, self.objtype = self.name.split(':', 1) + else: + self.domain, self.objtype = '', self.name + self.env = self.state.document.settings.env + self.indexnode = addnodes.index(entries=[]) + + node = addnodes.desc() + node.document = self.state.document + node['domain'] = self.domain + # 'desctype' is a backwards compatible attribute + node['objtype'] = node['desctype'] = self.objtype + node['noindex'] = noindex = ('noindex' in self.options) + + self.names = [] + signatures = self.get_signatures() + for i, sig in enumerate(signatures): + # add a signature node for each signature in the current unit + # and add a reference target for it + signode = addnodes.desc_signature(sig, '') + signode['first'] = False + node.append(signode) + try: + # name can also be a tuple, e.g. (classname, objname); + # this is strictly domain-specific (i.e. no assumptions may + # be made in this base class) + name = self.handle_signature(sig, signode) + except ValueError: + # signature parsing failed + signode.clear() + signode += addnodes.desc_name(sig, sig) + continue # we don't want an index entry here + if not noindex and name not in self.names: + # only add target and index entry if this is the first + # description of the object with this name in this desc block + self.names.append(name) + self.add_target_and_index(name, sig, signode) + + contentnode = addnodes.desc_content() + node.append(contentnode) + if self.names: + # needed for association of version{added,changed} directives + self.env.temp_data['object'] = self.names[0] + self.before_content() + self.state.nested_parse(self.content, self.content_offset, contentnode) + #self.handle_doc_fields(contentnode) + DocFieldTransformer(self).transform_all(contentnode) + self.env.temp_data['object'] = None + self.after_content() + return [self.indexnode, node] + +# backwards compatible old name +DescDirective = ObjectDescription + + +class DefaultDomain(Directive): + """ + Directive to (re-)set the default domain for this source file. + """ + + has_content = False + required_arguments = 1 + optional_arguments = 0 + final_argument_whitespace = False + option_spec = {} + + def run(self): + env = self.state.document.settings.env + domain_name = self.arguments[0].lower() + # if domain_name not in env.domains: + # # try searching by label + # for domain in env.domains.itervalues(): + # if domain.label.lower() == domain_name: + # domain_name = domain.name + # break + env.temp_data['default_domain'] = env.domains.get(domain_name) + return [] + + +directives.register_directive('default-domain', DefaultDomain) +directives.register_directive('describe', ObjectDescription) +# new, more consistent, name +directives.register_directive('object', ObjectDescription) diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index b4375a98..d82dd76d 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -13,11 +13,10 @@ import codecs from os import path from docutils import nodes -from docutils.parsers.rst import directives +from docutils.parsers.rst import Directive, directives from sphinx import addnodes from sphinx.util import parselinenos -from sphinx.util.compat import Directive, directive_dwim class Highlight(Directive): @@ -81,12 +80,15 @@ class LiteralInclude(Directive): final_argument_whitespace = False option_spec = { 'linenos': directives.flag, + 'tab-width': int, 'language': directives.unchanged_required, 'encoding': directives.encoding, 'pyobject': directives.unchanged_required, 'lines': directives.unchanged_required, 'start-after': directives.unchanged_required, 'end-before': directives.unchanged_required, + 'prepend': directives.unchanged_required, + 'append': directives.unchanged_required, } def run(self): @@ -152,7 +154,9 @@ class LiteralInclude(Directive): lines = [lines[i] for i in linelist] startafter = self.options.get('start-after') - endbefore = self.options.get('end-before') + endbefore = self.options.get('end-before') + prepend = self.options.get('prepend') + append = self.options.get('append') if startafter is not None or endbefore is not None: use = not startafter res = [] @@ -166,7 +170,14 @@ class LiteralInclude(Directive): res.append(line) lines = res + if prepend: + lines.insert(0, prepend + '\n') + if append: + lines.append(append + '\n') + text = ''.join(lines) + if self.options.get('tab-width'): + text = text.expandtabs(self.options['tab-width']) retnode = nodes.literal_block(text, text, source=fn) retnode.line = 1 if self.options.get('language', ''): @@ -177,8 +188,8 @@ class LiteralInclude(Directive): return [retnode] -directives.register_directive('highlight', directive_dwim(Highlight)) -directives.register_directive('highlightlang', directive_dwim(Highlight)) # old -directives.register_directive('code-block', directive_dwim(CodeBlock)) -directives.register_directive('sourcecode', directive_dwim(CodeBlock)) -directives.register_directive('literalinclude', directive_dwim(LiteralInclude)) +directives.register_directive('highlight', Highlight) +directives.register_directive('highlightlang', Highlight) # old +directives.register_directive('code-block', CodeBlock) +directives.register_directive('sourcecode', CodeBlock) +directives.register_directive('literalinclude', LiteralInclude) diff --git a/sphinx/directives/desc.py b/sphinx/directives/desc.py deleted file mode 100644 index 5a8ed791..00000000 --- a/sphinx/directives/desc.py +++ /dev/null @@ -1,771 +0,0 @@ -# -*- coding: utf-8 -*- -""" - sphinx.directives.desc - ~~~~~~~~~~~~~~~~~~~~~~ - - :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -import re -import string - -from docutils import nodes -from docutils.parsers.rst import directives - -from sphinx import addnodes -from sphinx.util import ws_re -from sphinx.util.compat import Directive, directive_dwim - - -def _is_only_paragraph(node): - """True if the node only contains one paragraph (and system messages).""" - if len(node) == 0: - return False - elif len(node) > 1: - for subnode in node[1:]: - if not isinstance(subnode, nodes.system_message): - return False - if isinstance(node[0], nodes.paragraph): - return True - return False - - -# REs for Python signatures -py_sig_re = re.compile( - r'''^ ([\w.]*\.)? # class name(s) - (\w+) \s* # thing name - (?: \((.*)\) # optional: arguments - (?:\s* -> \s* (.*))? # return annotation - )? $ # and nothing more - ''', re.VERBOSE) - -py_paramlist_re = re.compile(r'([\[\],])') # split at '[', ']' and ',' - -# REs for C signatures -c_sig_re = re.compile( - r'''^([^(]*?) # return type - ([\w:]+) \s* # thing name (colon allowed for C++ class names) - (?: \((.*)\) )? # optionally arguments - (\s+const)? $ # const specifier - ''', re.VERBOSE) -c_funcptr_sig_re = re.compile( - r'''^([^(]+?) # return type - (\( [^()]+ \)) \s* # name in parentheses - \( (.*) \) # arguments - (\s+const)? $ # const specifier - ''', re.VERBOSE) -c_funcptr_name_re = re.compile(r'^\(\s*\*\s*(.*?)\s*\)$') - -# RE for option descriptions -option_desc_re = re.compile( - r'((?:/|-|--)[-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)') - -# RE to split at word boundaries -wsplit_re = re.compile(r'(\W+)') - -# RE to strip backslash escapes -strip_backslash_re = re.compile(r'\\(?=[^\\])') - - -class DescDirective(Directive): - """ - Directive to describe a class, function or similar object. Not used - directly, but subclassed to add custom behavior. - """ - - has_content = True - required_arguments = 1 - optional_arguments = 0 - final_argument_whitespace = True - option_spec = { - 'noindex': directives.flag, - 'module': directives.unchanged, - } - - _ = lambda x: x # make gettext extraction in constants possible - - doc_fields_with_arg = { - 'param': '%param', - 'parameter': '%param', - 'arg': '%param', - 'argument': '%param', - 'keyword': '%param', - 'kwarg': '%param', - 'kwparam': '%param', - 'type': '%type', - 'raises': _('Raises'), - 'raise': 'Raises', - 'exception': 'Raises', - 'except': 'Raises', - 'var': _('Variable'), - 'ivar': 'Variable', - 'cvar': 'Variable', - 'returns': _('Returns'), - 'return': 'Returns', - } - - doc_fields_with_linked_arg = ('raises', 'raise', 'exception', 'except') - - doc_fields_without_arg = { - 'returns': 'Returns', - 'return': 'Returns', - 'rtype': _('Return type'), - } - - def handle_doc_fields(self, node): - """ - Convert field lists with known keys inside the description content into - better-looking equivalents. - """ - # don't traverse, only handle field lists that are immediate children - for child in node.children: - if not isinstance(child, nodes.field_list): - continue - params = [] - pfield = None - param_nodes = {} - param_types = {} - new_list = nodes.field_list() - for field in child: - fname, fbody = field - try: - typ, obj = fname.astext().split(None, 1) - typdesc = _(self.doc_fields_with_arg[typ]) - if _is_only_paragraph(fbody): - children = fbody.children[0].children - else: - children = fbody.children - if typdesc == '%param': - if not params: - # add the field that later gets all the parameters - pfield = nodes.field() - new_list += pfield - dlitem = nodes.list_item() - dlpar = nodes.paragraph() - dlpar += nodes.emphasis(obj, obj) - dlpar += nodes.Text(' -- ', ' -- ') - dlpar += children - param_nodes[obj] = dlpar - dlitem += dlpar - params.append(dlitem) - elif typdesc == '%type': - typenodes = fbody.children - if _is_only_paragraph(fbody): - typenodes = ([nodes.Text(' (')] + - typenodes[0].children + - [nodes.Text(')')]) - param_types[obj] = typenodes - else: - fieldname = typdesc + ' ' - nfield = nodes.field() - nfieldname = nodes.field_name(fieldname, fieldname) - nfield += nfieldname - node = nfieldname - if typ in self.doc_fields_with_linked_arg: - node = addnodes.pending_xref( - obj, reftype='obj', refcaption=False, - reftarget=obj, modname=self.env.currmodule, - classname=self.env.currclass) - nfieldname += node - node += nodes.Text(obj, obj) - nfield += nodes.field_body() - nfield[1] += fbody.children - new_list += nfield - except (KeyError, ValueError): - fnametext = fname.astext() - try: - typ = _(self.doc_fields_without_arg[fnametext]) - except KeyError: - # at least capitalize the field name - typ = fnametext.capitalize() - fname[0] = nodes.Text(typ) - new_list += field - if params: - if len(params) == 1: - pfield += nodes.field_name('', _('Parameter')) - pfield += nodes.field_body() - pfield[1] += params[0][0] - else: - pfield += nodes.field_name('', _('Parameters')) - pfield += nodes.field_body() - pfield[1] += nodes.bullet_list() - pfield[1][0].extend(params) - - for param, type in param_types.iteritems(): - if param in param_nodes: - param_nodes[param][1:1] = type - child.replace_self(new_list) - - def get_signatures(self): - """ - Retrieve the signatures to document from the directive arguments. - """ - # remove backslashes to support (dummy) escapes; helps Vim highlighting - return [strip_backslash_re.sub('', sig.strip()) - for sig in self.arguments[0].split('\n')] - - def parse_signature(self, sig, signode): - """ - Parse the signature *sig* into individual nodes and append them to - *signode*. If ValueError is raised, parsing is aborted and the whole - *sig* is put into a single desc_name node. - """ - raise ValueError - - def add_target_and_index(self, name, sig, signode): - """ - Add cross-reference IDs and entries to self.indexnode, if applicable. - """ - return # do nothing by default - - def before_content(self): - """ - Called before parsing content. Used to set information about the current - directive context on the build environment. - """ - pass - - def after_content(self): - """ - Called after parsing content. Used to reset information about the - current directive context on the build environment. - """ - pass - - def run(self): - self.desctype = self.name - self.env = self.state.document.settings.env - self.indexnode = addnodes.index(entries=[]) - - node = addnodes.desc() - node.document = self.state.document - node['desctype'] = self.desctype - node['noindex'] = noindex = ('noindex' in self.options) - - self.names = [] - signatures = self.get_signatures() - for i, sig in enumerate(signatures): - # add a signature node for each signature in the current unit - # and add a reference target for it - signode = addnodes.desc_signature(sig, '') - signode['first'] = False - node.append(signode) - try: - # name can also be a tuple, e.g. (classname, objname) - name = self.parse_signature(sig, signode) - except ValueError, err: - # signature parsing failed - signode.clear() - signode += addnodes.desc_name(sig, sig) - continue # we don't want an index entry here - if not noindex and name not in self.names: - # only add target and index entry if this is the first - # description of the object with this name in this desc block - self.names.append(name) - self.add_target_and_index(name, sig, signode) - - contentnode = addnodes.desc_content() - node.append(contentnode) - if self.names: - # needed for association of version{added,changed} directives - self.env.currdesc = self.names[0] - self.before_content() - self.state.nested_parse(self.content, self.content_offset, contentnode) - self.handle_doc_fields(contentnode) - self.env.currdesc = None - self.after_content() - return [self.indexnode, node] - - -class PythonDesc(DescDirective): - """ - Description of a general Python object. - """ - - def get_signature_prefix(self, sig): - """ - May return a prefix to put before the object name in the signature. - """ - return '' - - def needs_arglist(self): - """ - May return true if an empty argument list is to be generated even if - the document contains none. - """ - return False - - def parse_signature(self, sig, signode): - """ - Transform a Python signature into RST nodes. - Returns (fully qualified name of the thing, classname if any). - - If inside a class, the current class name is handled intelligently: - * it is stripped from the displayed name if present - * it is added to the full name (return value) if not present - """ - m = py_sig_re.match(sig) - if m is None: - raise ValueError - classname, name, arglist, retann = m.groups() - - if self.env.currclass: - add_module = False - if classname and classname.startswith(self.env.currclass): - fullname = classname + name - # class name is given again in the signature - classname = classname[len(self.env.currclass):].lstrip('.') - elif classname: - # class name is given in the signature, but different - # (shouldn't happen) - fullname = self.env.currclass + '.' + classname + name - else: - # class name is not given in the signature - fullname = self.env.currclass + '.' + name - else: - add_module = True - fullname = classname and classname + name or name - - prefix = self.get_signature_prefix(sig) - if prefix: - signode += addnodes.desc_annotation(prefix, prefix) - - if classname: - signode += addnodes.desc_addname(classname, classname) - # exceptions are a special case, since they are documented in the - # 'exceptions' module. - elif add_module and self.env.config.add_module_names: - modname = self.options.get('module', self.env.currmodule) - if modname and modname != 'exceptions': - nodetext = modname + '.' - signode += addnodes.desc_addname(nodetext, nodetext) - - signode += addnodes.desc_name(name, name) - if not arglist: - if self.needs_arglist(): - # for callables, add an empty parameter list - signode += addnodes.desc_parameterlist() - if retann: - signode += addnodes.desc_returns(retann, retann) - return fullname, classname - signode += addnodes.desc_parameterlist() - - stack = [signode[-1]] - for token in py_paramlist_re.split(arglist): - if token == '[': - opt = addnodes.desc_optional() - stack[-1] += opt - stack.append(opt) - elif token == ']': - try: - stack.pop() - except IndexError: - raise ValueError - elif not token or token == ',' or token.isspace(): - pass - else: - token = token.strip() - stack[-1] += addnodes.desc_parameter(token, token) - if len(stack) != 1: - raise ValueError - if retann: - signode += addnodes.desc_returns(retann, retann) - return fullname, classname - - def get_index_text(self, modname, name): - """ - Return the text for the index entry of the object. - """ - raise NotImplementedError('must be implemented in subclasses') - - def add_target_and_index(self, name_cls, sig, signode): - modname = self.options.get('module', self.env.currmodule) - fullname = (modname and modname + '.' or '') + name_cls[0] - # note target - if fullname not in self.state.document.ids: - signode['names'].append(fullname) - signode['ids'].append(fullname) - signode['first'] = (not self.names) - self.state.document.note_explicit_target(signode) - self.env.note_descref(fullname, self.desctype, self.lineno) - - indextext = self.get_index_text(modname, name_cls) - if indextext: - self.indexnode['entries'].append(('single', indextext, - fullname, fullname)) - - def before_content(self): - # needed for automatic qualification of members (reset in subclasses) - self.clsname_set = False - - def after_content(self): - if self.clsname_set: - self.env.currclass = None - - -class ModulelevelDesc(PythonDesc): - """ - Description of an object on module level (functions, data). - """ - - def needs_arglist(self): - return self.desctype == 'function' - - def get_index_text(self, modname, name_cls): - if self.desctype == 'function': - if not modname: - return _('%s() (built-in function)') % name_cls[0] - return _('%s() (in module %s)') % (name_cls[0], modname) - elif self.desctype == 'data': - if not modname: - return _('%s (built-in variable)') % name_cls[0] - return _('%s (in module %s)') % (name_cls[0], modname) - else: - return '' - - -class ClasslikeDesc(PythonDesc): - """ - Description of a class-like object (classes, interfaces, exceptions). - """ - - def get_signature_prefix(self, sig): - return self.desctype + ' ' - - def get_index_text(self, modname, name_cls): - if self.desctype == 'class': - if not modname: - return _('%s (built-in class)') % name_cls[0] - return _('%s (class in %s)') % (name_cls[0], modname) - elif self.desctype == 'exception': - return name_cls[0] - else: - return '' - - def before_content(self): - PythonDesc.before_content(self) - if self.names: - self.env.currclass = self.names[0][0] - self.clsname_set = True - - -class ClassmemberDesc(PythonDesc): - """ - Description of a class member (methods, attributes). - """ - - def needs_arglist(self): - return self.desctype.endswith('method') - - def get_signature_prefix(self, sig): - if self.desctype == 'staticmethod': - return 'static ' - elif self.desctype == 'classmethod': - return 'classmethod ' - return '' - - def get_index_text(self, modname, name_cls): - name, cls = name_cls - add_modules = self.env.config.add_module_names - if self.desctype == 'method': - try: - clsname, methname = name.rsplit('.', 1) - except ValueError: - if modname: - return _('%s() (in module %s)') % (name, modname) - else: - return '%s()' % name - if modname and add_modules: - return _('%s() (%s.%s method)') % (methname, modname, clsname) - else: - return _('%s() (%s method)') % (methname, clsname) - elif self.desctype == 'staticmethod': - try: - clsname, methname = name.rsplit('.', 1) - except ValueError: - if modname: - return _('%s() (in module %s)') % (name, modname) - else: - return '%s()' % name - if modname and add_modules: - return _('%s() (%s.%s static method)') % (methname, modname, - clsname) - else: - return _('%s() (%s static method)') % (methname, clsname) - elif self.desctype == 'classmethod': - try: - clsname, methname = name.rsplit('.', 1) - except ValueError: - if modname: - return '%s() (in module %s)' % (name, modname) - else: - return '%s()' % name - if modname: - return '%s() (%s.%s class method)' % (methname, modname, - clsname) - else: - return '%s() (%s class method)' % (methname, clsname) - elif self.desctype == 'attribute': - try: - clsname, attrname = name.rsplit('.', 1) - except ValueError: - if modname: - return _('%s (in module %s)') % (name, modname) - else: - return name - if modname and add_modules: - return _('%s (%s.%s attribute)') % (attrname, modname, clsname) - else: - return _('%s (%s attribute)') % (attrname, clsname) - else: - return '' - - def before_content(self): - PythonDesc.before_content(self) - if self.names and self.names[-1][1] and not self.env.currclass: - self.env.currclass = self.names[-1][1].strip('.') - self.clsname_set = True - - -class CDesc(DescDirective): - """ - Description of a C language object. - """ - - # These C types aren't described anywhere, so don't try to create - # a cross-reference to them - stopwords = set(('const', 'void', 'char', 'int', 'long', 'FILE', 'struct')) - - def _parse_type(self, node, ctype): - # add cross-ref nodes for all words - for part in filter(None, wsplit_re.split(ctype)): - tnode = nodes.Text(part, part) - if part[0] in string.ascii_letters+'_' and \ - part not in self.stopwords: - pnode = addnodes.pending_xref( - '', reftype='ctype', reftarget=part, - modname=None, classname=None) - pnode += tnode - node += pnode - else: - node += tnode - - def parse_signature(self, sig, signode): - """Transform a C (or C++) signature into RST nodes.""" - # first try the function pointer signature regex, it's more specific - m = c_funcptr_sig_re.match(sig) - if m is None: - m = c_sig_re.match(sig) - if m is None: - raise ValueError('no match') - rettype, name, arglist, const = m.groups() - - signode += addnodes.desc_type('', '') - self._parse_type(signode[-1], rettype) - try: - classname, funcname = name.split('::', 1) - classname += '::' - signode += addnodes.desc_addname(classname, classname) - signode += addnodes.desc_name(funcname, funcname) - # name (the full name) is still both parts - except ValueError: - signode += addnodes.desc_name(name, name) - # clean up parentheses from canonical name - m = c_funcptr_name_re.match(name) - if m: - name = m.group(1) - if not arglist: - if self.desctype == 'cfunction': - # for functions, add an empty parameter list - signode += addnodes.desc_parameterlist() - if const: - signode += addnodes.desc_addname(const, const) - return name - - paramlist = addnodes.desc_parameterlist() - arglist = arglist.replace('`', '').replace('\\ ', '') # remove markup - # this messes up function pointer types, but not too badly ;) - args = arglist.split(',') - for arg in args: - arg = arg.strip() - param = addnodes.desc_parameter('', '', noemph=True) - try: - ctype, argname = arg.rsplit(' ', 1) - except ValueError: - # no argument name given, only the type - self._parse_type(param, arg) - else: - self._parse_type(param, ctype) - param += nodes.emphasis(' '+argname, ' '+argname) - paramlist += param - signode += paramlist - if const: - signode += addnodes.desc_addname(const, const) - return name - - def get_index_text(self, name): - if self.desctype == 'cfunction': - return _('%s (C function)') % name - elif self.desctype == 'cmember': - return _('%s (C member)') % name - elif self.desctype == 'cmacro': - return _('%s (C macro)') % name - elif self.desctype == 'ctype': - return _('%s (C type)') % name - elif self.desctype == 'cvar': - return _('%s (C variable)') % name - else: - return '' - - def add_target_and_index(self, name, sig, signode): - # note target - if name not in self.state.document.ids: - signode['names'].append(name) - signode['ids'].append(name) - signode['first'] = (not self.names) - self.state.document.note_explicit_target(signode) - self.env.note_descref(name, self.desctype, self.lineno) - - indextext = self.get_index_text(name) - if indextext: - self.indexnode['entries'].append(('single', indextext, name, name)) - - -class CmdoptionDesc(DescDirective): - """ - Description of a command-line option (.. cmdoption). - """ - - def parse_signature(self, sig, signode): - """Transform an option description into RST nodes.""" - count = 0 - firstname = '' - for m in option_desc_re.finditer(sig): - optname, args = m.groups() - if count: - signode += addnodes.desc_addname(', ', ', ') - signode += addnodes.desc_name(optname, optname) - signode += addnodes.desc_addname(args, args) - if not count: - firstname = optname - count += 1 - if not firstname: - raise ValueError - return firstname - - def add_target_and_index(self, name, sig, signode): - targetname = name.replace('/', '-') - if self.env.currprogram: - targetname = '-' + self.env.currprogram + targetname - targetname = 'cmdoption' + targetname - signode['ids'].append(targetname) - self.state.document.note_explicit_target(signode) - self.indexnode['entries'].append( - ('pair', _('%scommand line option; %s') % - ((self.env.currprogram and - self.env.currprogram + ' ' or ''), sig), - targetname, targetname)) - self.env.note_progoption(name, targetname) - - -class GenericDesc(DescDirective): - """ - A generic x-ref directive registered with Sphinx.add_description_unit(). - """ - - def parse_signature(self, sig, signode): - parse_node = additional_xref_types[self.desctype][2] - if parse_node: - name = parse_node(self.env, sig, signode) - else: - signode.clear() - signode += addnodes.desc_name(sig, sig) - # normalize whitespace like xfileref_role does - name = ws_re.sub('', sig) - return name - - def add_target_and_index(self, name, sig, signode): - rolename, indextemplate = additional_xref_types[self.desctype][:2] - targetname = '%s-%s' % (rolename, name) - signode['ids'].append(targetname) - self.state.document.note_explicit_target(signode) - if indextemplate: - indexentry = _(indextemplate) % (name,) - indextype = 'single' - colon = indexentry.find(':') - if colon != -1: - indextype = indexentry[:colon].strip() - indexentry = indexentry[colon+1:].strip() - self.indexnode['entries'].append((indextype, indexentry, - targetname, targetname)) - self.env.note_reftarget(rolename, name, targetname) - - -class Target(Directive): - """ - Generic target for user-defined cross-reference types. - """ - - has_content = False - required_arguments = 1 - optional_arguments = 0 - final_argument_whitespace = True - option_spec = {} - - def run(self): - env = self.state.document.settings.env - rolename, indextemplate, foo = additional_xref_types[self.name] - # normalize whitespace in fullname like xfileref_role does - fullname = ws_re.sub('', self.arguments[0].strip()) - targetname = '%s-%s' % (rolename, fullname) - node = nodes.target('', '', ids=[targetname]) - self.state.document.note_explicit_target(node) - ret = [node] - if indextemplate: - indexentry = indextemplate % (fullname,) - indextype = 'single' - colon = indexentry.find(':') - if colon != -1: - indextype = indexentry[:colon].strip() - indexentry = indexentry[colon+1:].strip() - inode = addnodes.index(entries=[(indextype, indexentry, - targetname, targetname)]) - ret.insert(0, inode) - env.note_reftarget(rolename, fullname, targetname) - return ret - -# Note: the target directive is not registered here, it is used by the -# application when registering additional xref types. - -_ = lambda x: x - -# Generic cross-reference types; they can be registered in the application; -# the directives are either desc_directive or target_directive. -additional_xref_types = { - # directive name: (role name, index text, function to parse the desc node) - 'envvar': ('envvar', _('environment variable; %s'), None), -} - -del _ - - -directives.register_directive('describe', directive_dwim(DescDirective)) - -directives.register_directive('function', directive_dwim(ModulelevelDesc)) -directives.register_directive('data', directive_dwim(ModulelevelDesc)) -directives.register_directive('class', directive_dwim(ClasslikeDesc)) -directives.register_directive('exception', directive_dwim(ClasslikeDesc)) -directives.register_directive('method', directive_dwim(ClassmemberDesc)) -directives.register_directive('classmethod', directive_dwim(ClassmemberDesc)) -directives.register_directive('staticmethod', directive_dwim(ClassmemberDesc)) -directives.register_directive('attribute', directive_dwim(ClassmemberDesc)) - -directives.register_directive('cfunction', directive_dwim(CDesc)) -directives.register_directive('cmember', directive_dwim(CDesc)) -directives.register_directive('cmacro', directive_dwim(CDesc)) -directives.register_directive('ctype', directive_dwim(CDesc)) -directives.register_directive('cvar', directive_dwim(CDesc)) - -directives.register_directive('cmdoption', directive_dwim(CmdoptionDesc)) -directives.register_directive('envvar', directive_dwim(GenericDesc)) diff --git a/sphinx/directives/other.py b/sphinx/directives/other.py index b11d6b2a..138d10c8 100644 --- a/sphinx/directives/other.py +++ b/sphinx/directives/other.py @@ -7,15 +7,15 @@ :license: BSD, see LICENSE for details. """ -import re - from docutils import nodes -from docutils.parsers.rst import directives +from docutils.parsers.rst import Directive, directives from sphinx import addnodes -from sphinx.locale import pairindextypes -from sphinx.util import patfilter, ws_re, caption_ref_re, url_re, docname_join -from sphinx.util.compat import Directive, directive_dwim, make_admonition +from sphinx.locale import pairindextypes, _ +from sphinx.util import url_re, docname_join +from sphinx.util.nodes import explicit_title_re +from sphinx.util.compat import make_admonition +from sphinx.util.matching import patfilter class TocTree(Directive): @@ -33,6 +33,7 @@ class TocTree(Directive): 'glob': directives.flag, 'hidden': directives.flag, 'numbered': directives.flag, + 'titlesonly': directives.flag, } def run(self): @@ -45,7 +46,6 @@ class TocTree(Directive): # and title may be None if the document's title is to be used entries = [] includefiles = [] - includetitles = {} all_docnames = env.found_docs.copy() # don't add the currently visited file in catch-all patterns all_docnames.remove(env.docname) @@ -54,7 +54,7 @@ class TocTree(Directive): continue if not glob: # look for explicit titles ("Some Title <document>") - m = caption_ref_re.match(entry) + m = explicit_title_re.match(entry) if m: ref = m.group(2) title = m.group(1) @@ -97,79 +97,13 @@ class TocTree(Directive): subnode['glob'] = glob subnode['hidden'] = 'hidden' in self.options subnode['numbered'] = 'numbered' in self.options - ret.append(subnode) - return ret - - -class Module(Directive): - """ - Directive to mark description of a new module. - """ - - has_content = False - required_arguments = 1 - optional_arguments = 0 - final_argument_whitespace = False - option_spec = { - 'platform': lambda x: x, - 'synopsis': lambda x: x, - 'noindex': directives.flag, - 'deprecated': directives.flag, - } - - def run(self): - env = self.state.document.settings.env - modname = self.arguments[0].strip() - noindex = 'noindex' in self.options - env.currmodule = modname - env.note_module(modname, self.options.get('synopsis', ''), - self.options.get('platform', ''), - 'deprecated' in self.options) - modulenode = addnodes.module() - modulenode['modname'] = modname - modulenode['synopsis'] = self.options.get('synopsis', '') - targetnode = nodes.target('', '', ids=['module-' + modname], ismod=True) - self.state.document.note_explicit_target(targetnode) - ret = [modulenode, targetnode] - if 'platform' in self.options: - platform = self.options['platform'] - modulenode['platform'] = platform - node = nodes.paragraph() - node += nodes.emphasis('', _('Platforms: ')) - node += nodes.Text(platform, platform) - ret.append(node) - # the synopsis isn't printed; in fact, it is only used in the - # modindex currently - if not noindex: - indextext = _('%s (module)') % modname - inode = addnodes.index(entries=[('single', indextext, - 'module-' + modname, modname)]) - ret.insert(0, inode) + subnode['titlesonly'] = 'titlesonly' in self.options + wrappernode = nodes.compound(classes=['toctree-wrapper']) + wrappernode.append(subnode) + ret.append(wrappernode) return ret -class CurrentModule(Directive): - """ - This directive is just to tell Sphinx that we're documenting - stuff in module foo, but links to module foo won't lead here. - """ - - has_content = False - required_arguments = 1 - optional_arguments = 0 - final_argument_whitespace = False - option_spec = {} - - def run(self): - env = self.state.document.settings.env - modname = self.arguments[0].strip() - if modname == 'None': - env.currmodule = None - else: - env.currmodule = modname - return [] - - class Author(Directive): """ Directive to give the name of the author of the current document @@ -193,6 +127,8 @@ class Author(Directive): text = _('Section author: ') elif self.name == 'moduleauthor': text = _('Module author: ') + elif self.name == 'codeauthor': + text = _('Code author: ') else: text = _('Author: ') emph += nodes.Text(text, text) @@ -202,27 +138,6 @@ class Author(Directive): return [para] + messages -class Program(Directive): - """ - Directive to name the program for which options are documented. - """ - - has_content = False - required_arguments = 1 - optional_arguments = 0 - final_argument_whitespace = True - option_spec = {} - - def run(self): - env = self.state.document.settings.env - program = ws_re.sub('-', self.arguments[0].strip()) - if program == 'None': - env.currprogram = None - else: - env.currprogram = program - return [] - - class Index(Directive): """ Directive to add entries to the index. @@ -241,8 +156,7 @@ class Index(Directive): def run(self): arguments = self.arguments[0].split('\n') env = self.state.document.settings.env - targetid = 'index-%s' % env.index_num - env.index_num += 1 + targetid = 'index-%s' % env.new_serialno('index') targetnode = nodes.target('', '', ids=[targetid]) self.state.document.note_explicit_target(targetnode) indexnode = addnodes.index() @@ -299,7 +213,12 @@ class VersionChange(Directive): else: ret = [node] env = self.state.document.settings.env - env.note_versionchange(node['type'], node['version'], node, self.lineno) + env.versionchanges.setdefault(node['version'], []).append( + (node['type'], env.temp_data['docname'], self.lineno, + # XXX: python domain specific + env.temp_data.get('py:module'), + env.temp_data.get('object'), + node.astext())) return ret @@ -329,66 +248,6 @@ class SeeAlso(Directive): return ret -token_re = re.compile('`([a-z_]+)`') - -def token_xrefs(text, env): - retnodes = [] - pos = 0 - for m in token_re.finditer(text): - if m.start() > pos: - txt = text[pos:m.start()] - retnodes.append(nodes.Text(txt, txt)) - refnode = addnodes.pending_xref(m.group(1)) - refnode['reftype'] = 'token' - refnode['reftarget'] = m.group(1) - refnode['modname'] = env.currmodule - refnode['classname'] = env.currclass - refnode += nodes.literal(m.group(1), m.group(1), classes=['xref']) - retnodes.append(refnode) - pos = m.end() - if pos < len(text): - retnodes.append(nodes.Text(text[pos:], text[pos:])) - return retnodes - -class ProductionList(Directive): - """ - Directive to list grammar productions. - """ - - has_content = False - required_arguments = 1 - optional_arguments = 0 - final_argument_whitespace = True - option_spec = {} - - def run(self): - env = self.state.document.settings.env - node = addnodes.productionlist() - messages = [] - i = 0 - - for rule in self.arguments[0].split('\n'): - if i == 0 and ':' not in rule: - # production group - continue - i += 1 - try: - name, tokens = rule.split(':', 1) - except ValueError: - break - subnode = addnodes.production() - subnode['tokenname'] = name.strip() - if subnode['tokenname']: - idname = 'grammar-token-%s' % subnode['tokenname'] - if idname not in self.state.document.ids: - subnode['ids'].append(idname) - self.state.document.note_implicit_target(subnode, subnode) - env.note_reftarget('token', subnode['tokenname'], idname) - subnode.extend(token_xrefs(tokens, env)) - node.append(subnode) - return [node] + messages - - class TabularColumns(Directive): """ Directive to give an explicit tabulary column definition to LaTeX. @@ -406,57 +265,6 @@ class TabularColumns(Directive): return [node] -class Glossary(Directive): - """ - Directive to create a glossary with cross-reference targets - for :term: roles. - """ - - has_content = True - required_arguments = 0 - optional_arguments = 0 - final_argument_whitespace = False - option_spec = { - 'sorted': directives.flag, - } - - def run(self): - env = self.state.document.settings.env - node = addnodes.glossary() - node.document = self.state.document - self.state.nested_parse(self.content, self.content_offset, node) - - # the content should be definition lists - dls = [child for child in node - if isinstance(child, nodes.definition_list)] - # now, extract definition terms to enable cross-reference creation - new_dl = nodes.definition_list() - new_dl['classes'].append('glossary') - items = [] - for dl in dls: - for li in dl.children: - if not li.children or not isinstance(li[0], nodes.term): - continue - termtext = li.children[0].astext() - new_id = 'term-' + nodes.make_id(termtext) - if new_id in env.gloss_entries: - new_id = 'term-' + str(len(env.gloss_entries)) - env.gloss_entries.add(new_id) - li[0]['names'].append(new_id) - li[0]['ids'].append(new_id) - env.note_reftarget('term', termtext.lower(), new_id) - # add an index entry too - indexnode = addnodes.index() - indexnode['entries'] = [('single', termtext, new_id, termtext)] - li.insert(0, indexnode) - items.append((termtext, li)) - if 'sorted' in self.options: - items.sort(key=lambda x: x[0].lower()) - new_dl.extend(item[1] for item in items) - node.children = [new_dl] - return [node] - - class Centered(Directive): """ Directive to create a centered line of bold text. @@ -559,36 +367,24 @@ class Only(Directive): return [node] -directives.register_directive('toctree', directive_dwim(TocTree)) -directives.register_directive('module', directive_dwim(Module)) -directives.register_directive('currentmodule', directive_dwim(CurrentModule)) -directives.register_directive('sectionauthor', directive_dwim(Author)) -directives.register_directive('moduleauthor', directive_dwim(Author)) -directives.register_directive('program', directive_dwim(Program)) -directives.register_directive('index', directive_dwim(Index)) -directives.register_directive('deprecated', directive_dwim(VersionChange)) -directives.register_directive('versionadded', directive_dwim(VersionChange)) -directives.register_directive('versionchanged', directive_dwim(VersionChange)) -directives.register_directive('seealso', directive_dwim(SeeAlso)) -directives.register_directive('productionlist', directive_dwim(ProductionList)) -directives.register_directive('tabularcolumns', directive_dwim(TabularColumns)) -directives.register_directive('glossary', directive_dwim(Glossary)) -directives.register_directive('centered', directive_dwim(Centered)) -directives.register_directive('acks', directive_dwim(Acks)) -directives.register_directive('hlist', directive_dwim(HList)) -directives.register_directive('only', directive_dwim(Only)) +directives.register_directive('toctree', TocTree) +directives.register_directive('sectionauthor', Author) +directives.register_directive('moduleauthor', Author) +directives.register_directive('codeauthor', Author) +directives.register_directive('index', Index) +directives.register_directive('deprecated', VersionChange) +directives.register_directive('versionadded', VersionChange) +directives.register_directive('versionchanged', VersionChange) +directives.register_directive('seealso', SeeAlso) +directives.register_directive('tabularcolumns', TabularColumns) +directives.register_directive('centered', Centered) +directives.register_directive('acks', Acks) +directives.register_directive('hlist', HList) +directives.register_directive('only', Only) # register the standard rst class directive under a different name - -try: - # docutils 0.4 - from docutils.parsers.rst.directives.misc import class_directive - directives.register_directive('cssclass', class_directive) -except ImportError: - try: - # docutils 0.5 - from docutils.parsers.rst.directives.misc import Class - directives.register_directive('cssclass', Class) - except ImportError: - # whatever :) - pass +from docutils.parsers.rst.directives.misc import Class +# only for backwards compatibility now +directives.register_directive('cssclass', Class) +# new standard name when default-domain with "class" is in effect +directives.register_directive('rst-class', Class) diff --git a/sphinx/domains/__init__.py b/sphinx/domains/__init__.py new file mode 100644 index 00000000..2119c0a8 --- /dev/null +++ b/sphinx/domains/__init__.py @@ -0,0 +1,261 @@ +# -*- coding: utf-8 -*- +""" + sphinx.domains + ~~~~~~~~~~~~~~ + + Support for domains, which are groupings of description directives + and roles describing e.g. constructs of one programming language. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from sphinx.errors import SphinxError + + +class ObjType(object): + """ + An ObjType is the description for a type of object that a domain can + document. In the object_types attribute of Domain subclasses, object type + names are mapped to instances of this class. + + Constructor arguments: + + - *lname*: localized name of the type + - *roles*: all the roles that can refer to an object of this type + - *attrs*: object attributes -- currently only "searchprio" is known, + which defines the object's priority in the full-text search index, + see :meth:`Domain.get_objects()`. + """ + + known_attrs = { + 'searchprio': 1, + } + + def __init__(self, lname, *roles, **attrs): + self.lname = lname + self.roles = roles + self.attrs = self.known_attrs.copy() + self.attrs.update(attrs) + + +class Index(object): + """ + An Index is the description for a domain-specific index. To add an index to + a domain, subclass Index, overriding the three name attributes: + + * `name` is an identifier used for generating file names. + * `localname` is the section title for the index. + * `shortname` is a short name for the index, for use in the relation bar in + HTML output. Can be empty to disable entries in the relation bar. + + and providing a :meth:`generate()` method. Then, add the index class to + your domain's `indices` list. Extensions can add indices to existing + domains using :meth:`~sphinx.application.Sphinx.add_index_to_domain()`. + """ + + name = None + localname = None + shortname = None + + def __init__(self, domain): + if self.name is None or self.localname is None: + raise SphinxError('Index subclass %s has no valid name or localname' + % self.__class__.__name__) + self.domain = domain + + def generate(self, docnames=None): + """ + Return entries for the index given by *name*. If *docnames* is given, + restrict to entries referring to these docnames. + + The return value is a tuple of ``(content, collapse)``, where *collapse* + is a boolean that determines if sub-entries should start collapsed (for + output formats that support collapsing sub-entries). + + *content* is a sequence of ``(letter, entries)`` tuples, where *letter* + is the "heading" for the given *entries*, usually the starting letter. + + *entries* is a sequence of single entries, where a single entry is a + sequence ``[name, subtype, docname, anchor, extra, qualifier, descr]``. + The items in this sequence have the following meaning: + + - `name` -- the name of the index entry to be displayed + - `subtype` -- sub-entry related type: + 0 -- normal entry + 1 -- entry with sub-entries + 2 -- sub-entry + - `docname` -- docname where the entry is located + - `anchor` -- anchor for the entry within `docname` + - `extra` -- extra info for the entry + - `qualifier` -- qualifier for the description + - `descr` -- description for the entry + + Qualifier and description are not rendered e.g. in LaTeX output. + """ + return [] + + +class Domain(object): + """ + A Domain is meant to be a group of "object" description directives for + objects of a similar nature, and corresponding roles to create references to + them. Examples would be Python modules, classes, functions etc., elements + of a templating language, Sphinx roles and directives, etc. + + Each domain has a separate storage for information about existing objects + and how to reference them in `self.data`, which must be a dictionary. It + also must implement several functions that expose the object information in + a uniform way to parts of Sphinx that allow the user to reference or search + for objects in a domain-agnostic way. + + About `self.data`: since all object and cross-referencing information is + stored on a BuildEnvironment instance, the `domain.data` object is also + stored in the `env.domaindata` dict under the key `domain.name`. Before the + build process starts, every active domain is instantiated and given the + environment object; the `domaindata` dict must then either be nonexistent or + a dictionary whose 'version' key is equal to the domain class' + :attr:`data_version` attribute. Otherwise, `IOError` is raised and the + pickled environment is discarded. + """ + + #: domain name: should be short, but unique + name = '' + #: domain label: longer, more descriptive (used in messages) + label = '' + #: type (usually directive) name -> ObjType instance + object_types = {} + #: directive name -> directive class + directives = {} + #: role name -> role callable + roles = {} + #: a list of Index subclasses + indices = [] + + #: data value for a fresh environment + initial_data = {} + #: data version, bump this when the format of `self.data` changes + data_version = 0 + + def __init__(self, env): + self.env = env + if self.name not in env.domaindata: + assert isinstance(self.initial_data, dict) + new_data = self.initial_data.copy() + new_data['version'] = self.data_version + self.data = env.domaindata[self.name] = new_data + else: + self.data = env.domaindata[self.name] + if self.data['version'] != self.data_version: + raise IOError('data of %r domain out of date' % self.label) + self._role_cache = {} + self._directive_cache = {} + self._role2type = {} + for name, obj in self.object_types.iteritems(): + for rolename in obj.roles: + self._role2type.setdefault(rolename, []).append(name) + self.objtypes_for_role = self._role2type.get + + def role(self, name): + """ + Return a role adapter function that always gives the registered + role its full name ('domain:name') as the first argument. + """ + if name in self._role_cache: + return self._role_cache[name] + if name not in self.roles: + return None + fullname = '%s:%s' % (self.name, name) + def role_adapter(typ, rawtext, text, lineno, inliner, + options={}, content=[]): + return self.roles[name](fullname, rawtext, text, lineno, + inliner, options, content) + self._role_cache[name] = role_adapter + return role_adapter + + def directive(self, name): + """ + Return a directive adapter class that always gives the registered + directive its full name ('domain:name') as ``self.name``. + """ + if name in self._directive_cache: + return self._directive_cache[name] + if name not in self.directives: + return None + fullname = '%s:%s' % (self.name, name) + BaseDirective = self.directives[name] + class DirectiveAdapter(BaseDirective): + def run(self): + self.name = fullname + return BaseDirective.run(self) + self._directive_cache[name] = DirectiveAdapter + return DirectiveAdapter + + # methods that should be overwritten + + def clear_doc(self, docname): + """ + Remove traces of a document in the domain-specific inventories. + """ + pass + + def process_doc(self, env, docname, document): + """ + Process a document after it is read by the environment. + """ + pass + + def resolve_xref(self, env, fromdocname, builder, + typ, target, node, contnode): + """ + Resolve the ``pending_xref`` *node* with the given *typ* and *target*. + + This method should return a new node, to replace the xref node, + containing the *contnode* which is the markup content of the + cross-reference. + + If no resolution can be found, None can be returned; the xref node will + then given to the 'missing-reference' event, and if that yields no + resolution, replaced by *contnode*. + + The method can also raise :exc:`sphinx.environment.NoUri` to suppress + the 'missing-reference' event being emitted. + """ + pass + + def get_objects(self): + """ + Return an iterable of "object descriptions", which are tuples with + five items: + + * `name` -- fully qualified name + * `dispname` -- name to display when searching/linking + * `type` -- object type, a key in ``self.object_types`` + * `docname` -- the document where it is to be found + * `anchor` -- the anchor name for the object + * `priority` -- how "important" the object is (determines placement + in search results) + + - 1: default priority (placed before full-text matches) + - 0: object is important (placed before default-priority objects) + - 2: object is unimportant (placed after full-text matches) + - -1: object should not show up in search at all + """ + return [] + + +from sphinx.domains.c import CDomain +from sphinx.domains.cpp import CPPDomain +from sphinx.domains.std import StandardDomain +from sphinx.domains.python import PythonDomain +from sphinx.domains.javascript import JavaScriptDomain +from sphinx.domains.rst import ReSTDomain + +BUILTIN_DOMAINS = { + 'std': StandardDomain, + 'py': PythonDomain, + 'c': CDomain, + 'cpp': CPPDomain, + 'js': JavaScriptDomain, + 'rst': ReSTDomain, +} diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py new file mode 100644 index 00000000..0e85c809 --- /dev/null +++ b/sphinx/domains/c.py @@ -0,0 +1,213 @@ +# -*- coding: utf-8 -*- +""" + sphinx.domains.c + ~~~~~~~~~~~~~~~~ + + The C language domain. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re +import string + +from docutils import nodes + +from sphinx import addnodes +from sphinx.roles import XRefRole +from sphinx.locale import l_, _ +from sphinx.domains import Domain, ObjType +from sphinx.directives import ObjectDescription +from sphinx.util.nodes import make_refnode +from sphinx.util.docfields import Field, TypedField + + +# RE to split at word boundaries +wsplit_re = re.compile(r'(\W+)') + +# REs for C signatures +c_sig_re = re.compile( + r'''^([^(]*?) # return type + ([\w:.]+) \s* # thing name (colon allowed for C++) + (?: \((.*)\) )? # optionally arguments + (\s+const)? $ # const specifier + ''', re.VERBOSE) +c_funcptr_sig_re = re.compile( + r'''^([^(]+?) # return type + (\( [^()]+ \)) \s* # name in parentheses + \( (.*) \) # arguments + (\s+const)? $ # const specifier + ''', re.VERBOSE) +c_funcptr_name_re = re.compile(r'^\(\s*\*\s*(.*?)\s*\)$') + + +class CObject(ObjectDescription): + """ + Description of a C language object. + """ + + doc_field_types = [ + TypedField('parameter', label=l_('Parameters'), + names=('param', 'parameter', 'arg', 'argument'), + typerolename='type', typenames=('type',)), + Field('returnvalue', label=l_('Returns'), has_arg=False, + names=('returns', 'return')), + Field('returntype', label=l_('Return type'), has_arg=False, + names=('rtype',)), + ] + + # These C types aren't described anywhere, so don't try to create + # a cross-reference to them + stopwords = set(('const', 'void', 'char', 'int', 'long', 'FILE', 'struct')) + + def _parse_type(self, node, ctype): + # add cross-ref nodes for all words + for part in filter(None, wsplit_re.split(ctype)): + tnode = nodes.Text(part, part) + if part[0] in string.ascii_letters+'_' and \ + part not in self.stopwords: + pnode = addnodes.pending_xref( + '', refdomain='c', reftype='type', reftarget=part, + modname=None, classname=None) + pnode += tnode + node += pnode + else: + node += tnode + + def handle_signature(self, sig, signode): + """Transform a C signature into RST nodes.""" + # first try the function pointer signature regex, it's more specific + m = c_funcptr_sig_re.match(sig) + if m is None: + m = c_sig_re.match(sig) + if m is None: + raise ValueError('no match') + rettype, name, arglist, const = m.groups() + + signode += addnodes.desc_type('', '') + self._parse_type(signode[-1], rettype) + try: + classname, funcname = name.split('::', 1) + classname += '::' + signode += addnodes.desc_addname(classname, classname) + signode += addnodes.desc_name(funcname, funcname) + # name (the full name) is still both parts + except ValueError: + signode += addnodes.desc_name(name, name) + # clean up parentheses from canonical name + m = c_funcptr_name_re.match(name) + if m: + name = m.group(1) + if not arglist: + if self.objtype == 'function': + # for functions, add an empty parameter list + signode += addnodes.desc_parameterlist() + if const: + signode += addnodes.desc_addname(const, const) + return name + + paramlist = addnodes.desc_parameterlist() + arglist = arglist.replace('`', '').replace('\\ ', '') # remove markup + # this messes up function pointer types, but not too badly ;) + args = arglist.split(',') + for arg in args: + arg = arg.strip() + param = addnodes.desc_parameter('', '', noemph=True) + try: + ctype, argname = arg.rsplit(' ', 1) + except ValueError: + # no argument name given, only the type + self._parse_type(param, arg) + else: + self._parse_type(param, ctype) + param += nodes.emphasis(' '+argname, ' '+argname) + paramlist += param + signode += paramlist + if const: + signode += addnodes.desc_addname(const, const) + return name + + def get_index_text(self, name): + if self.objtype == 'function': + return _('%s (C function)') % name + elif self.objtype == 'member': + return _('%s (C member)') % name + elif self.objtype == 'macro': + return _('%s (C macro)') % name + elif self.objtype == 'type': + return _('%s (C type)') % name + elif self.objtype == 'var': + return _('%s (C variable)') % name + else: + return '' + + def add_target_and_index(self, name, sig, signode): + # note target + if name not in self.state.document.ids: + signode['names'].append(name) + signode['ids'].append(name) + signode['first'] = (not self.names) + self.state.document.note_explicit_target(signode) + inv = self.env.domaindata['c']['objects'] + if name in inv: + self.env.warn( + self.env.docname, + 'duplicate C object description of %s, ' % name + + 'other instance in ' + self.env.doc2path(inv[name][0]), + self.lineno) + inv[name] = (self.env.docname, self.objtype) + + indextext = self.get_index_text(name) + if indextext: + self.indexnode['entries'].append(('single', indextext, name, name)) + + +class CDomain(Domain): + """C language domain.""" + name = 'c' + label = 'C' + object_types = { + 'function': ObjType(l_('C function'), 'func'), + 'member': ObjType(l_('C member'), 'member'), + 'macro': ObjType(l_('C macro'), 'macro'), + 'type': ObjType(l_('C type'), 'type'), + 'var': ObjType(l_('C variable'), 'data'), + } + + directives = { + 'function': CObject, + 'member': CObject, + 'macro': CObject, + 'type': CObject, + 'var': CObject, + } + roles = { + 'func' : XRefRole(fix_parens=True), + 'member': XRefRole(), + 'macro': XRefRole(), + 'data': XRefRole(), + 'type': XRefRole(), + } + initial_data = { + 'objects': {}, # fullname -> docname, objtype + } + + def clear_doc(self, docname): + for fullname, (fn, _) in self.data['objects'].items(): + if fn == docname: + del self.data['objects'][fullname] + + def resolve_xref(self, env, fromdocname, builder, + typ, target, node, contnode): + # strip pointer asterisk + target = target.rstrip(' *') + if target not in self.data['objects']: + return None + obj = self.data['objects'][target] + return make_refnode(builder, fromdocname, obj[0], target, + contnode, target) + + def get_objects(self): + for refname, (docname, type) in self.data['objects'].iteritems(): + yield (refname, refname, type, docname, refname, 1) diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py new file mode 100644 index 00000000..b43517be --- /dev/null +++ b/sphinx/domains/cpp.py @@ -0,0 +1,1097 @@ +# -*- coding: utf-8 -*- +""" + sphinx.domains.cpp + ~~~~~~~~~~~~~~~~~~ + + The C++ language domain. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re +import string +from copy import deepcopy + +from docutils import nodes + +from sphinx import addnodes +from sphinx.roles import XRefRole +from sphinx.locale import l_, _ +from sphinx.domains import Domain, ObjType +from sphinx.directives import ObjectDescription +from sphinx.util.nodes import make_refnode +from sphinx.util.compat import Directive +from sphinx.util.docfields import Field, TypedField + + +_identifier_re = re.compile(r'\b(~?[a-zA-Z_][a-zA-Z0-9_]*)\b') +_whitespace_re = re.compile(r'\s+(?u)') +_string_re = re.compile(r"[LuU8]?('([^'\\]*(?:\\.[^'\\]*)*)'" + r'|"([^"\\]*(?:\\.[^"\\]*)*)")', re.S) +_visibility_re = re.compile(r'\b(public|private|protected)\b') +_operator_re = re.compile(r'''(?x) + \[\s*\] + | \(\s*\) + | [!<>=/*%+|&^-]=? + | \+\+ | -- + | (<<|>>)=? | ~ | && | \| | \|\| + | ->\*? | \, +''') + +_id_shortwords = { + 'char': 'c', + 'signed char': 'c', + 'unsigned char': 'C', + 'int': 'i', + 'signed int': 'i', + 'unsigned int': 'U', + 'long': 'l', + 'signed long': 'l', + 'unsigned long': 'L', + 'bool': 'b', + 'size_t': 's', + 'std::string': 'ss', + 'std::ostream': 'os', + 'std::istream': 'is', + 'std::iostream': 'ios', + 'std::vector': 'v', + 'std::map': 'm', + 'operator[]': 'subscript-operator', + 'operator()': 'call-operator', + 'operator!': 'not-operator', + 'operator<': 'lt-operator', + 'operator<=': 'lte-operator', + 'operator>': 'gt-operator', + 'operator>=': 'gte-operator', + 'operator=': 'assign-operator', + 'operator/': 'div-operator', + 'operator*': 'mul-operator', + 'operator%': 'mod-operator', + 'operator+': 'add-operator', + 'operator-': 'sub-operator', + 'operator|': 'or-operator', + 'operator&': 'and-operator', + 'operator^': 'xor-operator', + 'operator&&': 'sand-operator', + 'operator||': 'sor-operator', + 'operator==': 'eq-operator', + 'operator!=': 'neq-operator', + 'operator<<': 'lshift-operator', + 'operator>>': 'rshift-operator', + 'operator-=': 'sub-assign-operator', + 'operator+=': 'add-assign-operator', + 'operator*-': 'mul-assign-operator', + 'operator/=': 'div-assign-operator', + 'operator%=': 'mod-assign-operator', + 'operator&=': 'and-assign-operator', + 'operator|=': 'or-assign-operator', + 'operator<<=': 'lshift-assign-operator', + 'operator>>=': 'rshift-assign-operator', + 'operator^=': 'xor-assign-operator', + 'operator,': 'comma-operator', + 'operator->': 'pointer-operator', + 'operator->*': 'pointer-by-pointer-operator', + 'operator~': 'inv-operator', + 'operator++': 'inc-operator', + 'operator--': 'dec-operator', + 'operator new': 'new-operator', + 'operator new[]': 'new-array-operator', + 'operator delete': 'delete-operator', + 'operator delete[]': 'delete-array-operator' +} + + +class DefinitionError(Exception): + + def __init__(self, description): + self.description = description + + def __unicode__(self): + return self.description + + def __str__(self): + return unicode(self.encode('utf-8')) + + +class DefExpr(object): + + def __unicode__(self): + raise NotImplementedError() + + def __eq__(self, other): + if type(self) is not type(other): + return False + try: + for key, value in self.__dict__.iteritems(): + if value != getattr(other, value): + return False + except AttributeError: + return False + return True + + def __ne__(self, other): + return not self.__eq__(other) + + def clone(self): + """Close a definition expression node""" + return deepcopy(self) + + def get_id(self): + """Returns the id for the node""" + return u'' + + def get_name(self): + """Returns the name. Returns either `None` or a node with + a name you might call :meth:`split_owner` on. + """ + return None + + def split_owner(self): + """Nodes returned by :meth:`get_name` can split off their + owning parent. This function returns the owner and the + name as a tuple of two items. If a node does not support + it, :exc:`NotImplementedError` is raised. + """ + raise NotImplementedError() + + def prefix(self, prefix): + """Prefixes a name node (a node returned by :meth:`get_name`).""" + raise NotImplementedError() + + def __str__(self): + return unicode(self).encode('utf-8') + + def __repr__(self): + return '<defexpr %s>' % self + + +class PrimaryDefExpr(DefExpr): + + def get_name(self): + return self + + def split_owner(self): + return None, self + + def prefix(self, prefix): + if isinstance(prefix, PathDefExpr): + prefix = prefix.clone() + prefix.path.append(self) + return prefix + return PathDefExpr([prefix, self]) + + +class NameDefExpr(PrimaryDefExpr): + + def __init__(self, name): + self.name = name + + def get_id(self): + name = _id_shortwords.get(self.name) + if name is not None: + return name + return self.name.replace(u' ', u'-') + + def __unicode__(self): + return unicode(self.name) + + +class PathDefExpr(PrimaryDefExpr): + + def __init__(self, parts): + self.path = parts + + def get_id(self): + rv = u'::'.join(x.get_id() for x in self.path) + return _id_shortwords.get(rv, rv) + + def split_owner(self): + if len(self.path) > 1: + return PathDefExpr(self.path[:-1]), self.path[-1] + return None, self + + def prefix(self, prefix): + if isinstance(prefix, PathDefExpr): + prefix = prefix.clone() + prefix.path.extend(self.path) + return prefix + return PathDefExpr([prefix] + self.path) + + def __unicode__(self): + return u'::'.join(map(unicode, self.path)) + + +class TemplateDefExpr(PrimaryDefExpr): + + def __init__(self, typename, args): + self.typename = typename + self.args = args + + def split_owner(self): + owner, typename = self.typename.split_owner() + return owner, TemplateDefExpr(typename, self.args) + + def get_id(self): + return u'%s:%s:' % (self.typename.get_id(), + u'.'.join(x.get_id() for x in self.args)) + + def __unicode__(self): + return u'%s<%s>' % (self.typename, u', '.join(map(unicode, self.args))) + + +class WrappingDefExpr(DefExpr): + + def __init__(self, typename): + self.typename = typename + + def get_name(self): + return self.typename.get_name() + + +class ModifierDefExpr(WrappingDefExpr): + + def __init__(self, typename, modifiers): + WrappingDefExpr.__init__(self, typename) + self.modifiers = modifiers + + def get_id(self): + pieces = [_id_shortwords.get(unicode(x), unicode(x)) + for x in self.modifiers] + pieces.append(self.typename.get_id()) + return u'-'.join(pieces) + + def __unicode__(self): + return u' '.join(map(unicode, list(self.modifiers) + [self.typename])) + + +class PtrDefExpr(WrappingDefExpr): + + def get_id(self): + return self.typename.get_id() + u'P' + + def __unicode__(self): + return u'%s*' % self.typename + + +class RefDefExpr(WrappingDefExpr): + + def get_id(self): + return self.typename.get_id() + u'R' + + def __unicode__(self): + return u'%s&' % self.typename + + +class ConstDefExpr(WrappingDefExpr): + + def __init__(self, typename, prefix=False): + WrappingDefExpr.__init__(self, typename) + self.prefix = prefix + + def get_id(self): + return self.typename.get_id() + u'C' + + def __unicode__(self): + return (self.prefix and u'const %s' or u'%s const') % self.typename + + +class CastOpDefExpr(PrimaryDefExpr): + + def __init__(self, typename): + self.typename = typename + + def get_id(self): + return u'castto-%s-operator' % self.typename.get_id() + + def __unicode__(self): + return u'operator %s' % self.typename + + +class ArgumentDefExpr(DefExpr): + + def __init__(self, type, name, default=None): + self.name = name + self.type = type + self.default = default + + def get_name(self): + return self.name.get_name() + + def get_id(self): + return self.type.get_id() + + def __unicode__(self): + return (self.type is not None and u'%s %s' % (self.type, self.name) + or unicode(self.name)) + (self.default is not None and + u'=%s' % self.default or u'') + + +class NamedDefExpr(DefExpr): + + def __init__(self, name, visibility, static): + self.name = name + self.visibility = visibility + self.static = static + + def get_name(self): + return self.name.get_name() + + def get_modifiers(self): + rv = [] + if self.visibility != 'public': + rv.append(self.visibility) + if self.static: + rv.append(u'static') + return rv + + +class TypeObjDefExpr(NamedDefExpr): + + def __init__(self, name, visibility, static, typename): + NamedDefExpr.__init__(self, name, visibility, static) + self.typename = typename + + def get_id(self): + if self.typename is None: + return self.name.get_id() + return u'%s__%s' % (self.name.get_id(), self.typename.get_id()) + + def __unicode__(self): + buf = self.get_modifiers() + if self.typename is None: + buf.append(unicode(self.name)) + else: + buf.extend(map(unicode, (self.typename, self.name))) + return u' '.join(buf) + + +class MemberObjDefExpr(NamedDefExpr): + + def __init__(self, name, visibility, static, typename, value): + NamedDefExpr.__init__(self, name, visibility, static) + self.typename = typename + self.value = value + + def get_id(self): + return u'%s__%s' % (self.name.get_id(), self.typename.get_id()) + + def __unicode__(self): + buf = self.get_modifiers() + buf.append(u'%s %s' % (self.typename, self.name)) + if self.value is not None: + buf.append(u'= %s' % self.value) + return u' '.join(buf) + + +class FuncDefExpr(NamedDefExpr): + + def __init__(self, name, visibility, static, explicit, rv, + signature, const, pure_virtual): + NamedDefExpr.__init__(self, name, visibility, static) + self.rv = rv + self.signature = signature + self.explicit = explicit + self.const = const + self.pure_virtual = pure_virtual + + def get_id(self): + return u'%s%s%s' % ( + self.name.get_id(), + self.signature and u'__' + + u'.'.join(x.get_id() for x in self.signature) or u'', + self.const and u'C' or u'' + ) + + def __unicode__(self): + buf = self.get_modifiers() + if self.explicit: + buf.append(u'explicit') + if self.rv is not None: + buf.append(unicode(self.rv)) + buf.append(u'%s(%s)' % (self.name, u', '.join( + map(unicode, self.signature)))) + if self.const: + buf.append(u'const') + if self.pure_virtual: + buf.append(u'= 0') + return u' '.join(buf) + + +class ClassDefExpr(NamedDefExpr): + + def __init__(self, name, visibility, static): + NamedDefExpr.__init__(self, name, visibility, static) + + def get_id(self): + return self.name.get_id() + + def __unicode__(self): + buf = self.get_modifiers() + buf.append(unicode(self.name)) + return u' '.join(buf) + + +class DefinitionParser(object): + + # mapping of valid type modifiers. if the set is None it means + # the modifier can prefix all types, otherwise only the types + # (actually more keywords) in the set. Also check + # _guess_typename when changing this. + _modifiers = { + 'volatile': None, + 'register': None, + 'mutable': None, + 'const': None, + 'typename': None, + 'unsigned': set(('char', 'int', 'long')), + 'signed': set(('char', 'int', 'long')), + 'short': set(('int', 'short')), + 'long': set(('int', 'long', 'double')) + } + + def __init__(self, definition): + self.definition = definition.strip() + self.pos = 0 + self.end = len(self.definition) + self.last_match = None + self._previous_state = (0, None) + + def fail(self, msg): + raise DefinitionError('Invalid definition: %s [error at %d]\n %s' % + (msg, self.pos, self.definition)) + + def match(self, regex): + match = regex.match(self.definition, self.pos) + if match is not None: + self._previous_state = (self.pos, self.last_match) + self.pos = match.end() + self.last_match = match + return True + return False + + def backout(self): + self.pos, self.last_match = self._previous_state + + def skip_string(self, string): + strlen = len(string) + if self.definition[self.pos:self.pos + strlen] == string: + self.pos += strlen + return True + return False + + def skip_word(self, word): + return self.match(re.compile(r'\b%s\b' % re.escape(word))) + + def skip_ws(self): + return self.match(_whitespace_re) + + @property + def eof(self): + return self.pos >= self.end + + @property + def current_char(self): + try: + return self.definition[self.pos] + except IndexError: + return 'EOF' + + @property + def matched_text(self): + if self.last_match is not None: + return self.last_match.group() + + def _parse_operator(self): + self.skip_ws() + # thank god, a regular operator definition + if self.match(_operator_re): + return NameDefExpr('operator' + + _whitespace_re.sub('', self.matched_text)) + + # new/delete operator? + for allocop in 'new', 'delete': + if not self.skip_word(allocop): + continue + self.skip_ws() + if self.skip_string('['): + self.skip_ws() + if not self.skip_string(']'): + self.fail('expected "]" for ' + allocop) + allocop += '[]' + return NameDefExpr('operator ' + allocop) + + # oh well, looks like a cast operator definition. + # In that case, eat another type. + type = self._parse_type() + return CastOpDefExpr(type) + + def _parse_name(self): + if not self.match(_identifier_re): + self.fail('expected name') + identifier = self.matched_text + + # strictly speaking, operators are not regular identifiers + # but because operator is a keyword, it might not be used + # for variable names anyways, so we can safely parse the + # operator here as identifier + if identifier == 'operator': + return self._parse_operator() + + return NameDefExpr(identifier) + + def _guess_typename(self, path): + if not path: + return [], 'int' + # for the long type, we don't want the int in there + if 'long' in path: + path = [x for x in path if x != 'int'] + # remove one long + path.remove('long') + return path, 'long' + if path[-1] in ('int', 'char'): + return path[:-1], path[-1] + return path, 'int' + + def _attach_crefptr(self, expr, is_const=False): + if is_const: + expr = ConstDefExpr(expr, prefix=True) + while 1: + self.skip_ws() + if self.skip_word('const'): + expr = ConstDefExpr(expr) + elif self.skip_string('*'): + expr = PtrDefExpr(expr) + elif self.skip_string('&'): + expr = RefDefExpr(expr) + else: + return expr + + def _peek_const(self, path): + try: + path.remove('const') + return True + except ValueError: + return False + + def _parse_builtin(self, modifier): + path = [modifier] + following = self._modifiers[modifier] + while 1: + self.skip_ws() + if not self.match(_identifier_re): + break + identifier = self.matched_text + if identifier in following: + path.append(identifier) + following = self._modifiers[modifier] + assert following + else: + self.backout() + break + + is_const = self._peek_const(path) + modifiers, typename = self._guess_typename(path) + rv = ModifierDefExpr(NameDefExpr(typename), modifiers) + return self._attach_crefptr(rv, is_const) + + def _parse_type_expr(self): + typename = self._parse_name() + self.skip_ws() + if not self.skip_string('<'): + return typename + + args = [] + while 1: + self.skip_ws() + if self.skip_string('>'): + break + if args: + if not self.skip_string(','): + self.fail('"," or ">" in template expected') + self.skip_ws() + args.append(self._parse_type(True)) + return TemplateDefExpr(typename, args) + + def _parse_type(self, in_template=False): + self.skip_ws() + result = [] + modifiers = [] + + # if there is a leading :: or not, we don't care because we + # treat them exactly the same. Buf *if* there is one, we + # don't have to check for type modifiers + if not self.skip_string('::'): + self.skip_ws() + while self.match(_identifier_re): + modifier = self.matched_text + if modifier in self._modifiers: + following = self._modifiers[modifier] + # if the set is not none, there is a limited set + # of types that might follow. It is technically + # impossible for a template to follow, so what + # we do is go to a different function that just + # eats types + if following is not None: + return self._parse_builtin(modifier) + modifiers.append(modifier) + else: + self.backout() + break + + while 1: + self.skip_ws() + if (in_template and self.current_char in ',>') or \ + (result and not self.skip_string('::')) or \ + self.eof: + break + result.append(self._parse_type_expr()) + + if not result: + self.fail('expected type') + if len(result) == 1: + rv = result[0] + else: + rv = PathDefExpr(result) + is_const = self._peek_const(modifiers) + if modifiers: + rv = ModifierDefExpr(rv, modifiers) + return self._attach_crefptr(rv, is_const) + + def _parse_default_expr(self): + self.skip_ws() + if self.match(_string_re): + return self.matched_text + idx1 = self.definition.find(',', self.pos) + idx2 = self.definition.find(')', self.pos) + if idx1 < 0: + idx = idx2 + elif idx2 < 0: + idx = idx1 + else: + idx = min(idx1, idx2) + if idx < 0: + self.fail('unexpected end in default expression') + rv = self.definition[self.pos:idx] + self.pos = idx + return rv + + def _parse_signature(self): + self.skip_ws() + if not self.skip_string('('): + self.fail('expected parentheses for function') + + args = [] + while 1: + self.skip_ws() + if self.eof: + self.fail('missing closing parentheses') + if self.skip_string(')'): + break + if args: + if not self.skip_string(','): + self.fail('expected comma between arguments') + self.skip_ws() + + argname = self._parse_type() + argtype = default = None + self.skip_ws() + if self.skip_string('='): + self.pos += 1 + default = self._parse_default_expr() + elif self.current_char not in ',)': + argtype = argname + argname = self._parse_name() + self.skip_ws() + if self.skip_string('='): + default = self._parse_default_expr() + + args.append(ArgumentDefExpr(argtype, argname, default)) + self.skip_ws() + const = self.skip_word('const') + if const: + self.skip_ws() + if self.skip_string('='): + self.skip_ws() + if not (self.skip_string('0') or \ + self.skip_word('NULL') or \ + self.skip_word('nullptr')): + self.fail('pure virtual functions must be defined with ' + 'either 0, NULL or nullptr, other macros are ' + 'not allowed') + pure_virtual = True + else: + pure_virtual = False + return args, const, pure_virtual + + def _parse_visibility_static(self): + visibility = 'public' + if self.match(_visibility_re): + visibility = self.matched_text + static = self.skip_word('static') + return visibility, static + + def parse_type(self): + return self._parse_type() + + def parse_type_object(self): + visibility, static = self._parse_visibility_static() + typename = self._parse_type() + self.skip_ws() + if not self.eof: + name = self._parse_type() + else: + name = typename + typename = None + return TypeObjDefExpr(name, visibility, static, typename) + + def parse_member_object(self): + visibility, static = self._parse_visibility_static() + typename = self._parse_type() + name = self._parse_type() + self.skip_ws() + if self.skip_string('='): + value = self.read_rest().strip() + else: + value = None + return MemberObjDefExpr(name, visibility, static, typename, value) + + def parse_function(self): + visibility, static = self._parse_visibility_static() + if self.skip_word('explicit'): + explicit = True + self.skip_ws() + else: + explicit = False + rv = self._parse_type() + self.skip_ws() + # some things just don't have return values + if self.current_char == '(': + name = rv + rv = None + else: + name = self._parse_type() + return FuncDefExpr(name, visibility, static, explicit, rv, + *self._parse_signature()) + + def parse_class(self): + visibility, static = self._parse_visibility_static() + return ClassDefExpr(self._parse_type(), visibility, static) + + def read_rest(self): + rv = self.definition[self.pos:] + self.pos = self.end + return rv + + def assert_end(self): + self.skip_ws() + if not self.eof: + self.fail('expected end of definition, got %r' % + self.definition[self.pos:]) + + +class CPPObject(ObjectDescription): + """Description of a C++ language object.""" + + def attach_name(self, node, name): + owner, name = name.split_owner() + varname = unicode(name) + if owner is not None: + owner = unicode(owner) + '::' + node += addnodes.desc_addname(owner, owner) + node += addnodes.desc_name(varname, varname) + + def attach_type(self, node, type): + # XXX: link to c? + text = unicode(type) + pnode = addnodes.pending_xref( + '', refdomain='cpp', reftype='type', + reftarget=text, modname=None, classname=None) + pnode['cpp:parent'] = self.env.temp_data.get('cpp:parent') + pnode += nodes.Text(text) + node += pnode + + def attach_modifiers(self, node, obj): + if obj.visibility != 'public': + node += addnodes.desc_annotation(obj.visibility, + obj.visibility) + node += nodes.Text(' ') + if obj.static: + node += addnodes.desc_annotation('static', 'static') + node += nodes.Text(' ') + + def add_target_and_index(self, sigobj, sig, signode): + theid = sigobj.get_id() + name = unicode(sigobj.name) + signode['names'].append(theid) + signode['ids'].append(theid) + signode['first'] = (not self.names) + self.state.document.note_explicit_target(signode) + self.env.domaindata['cpp']['objects'][name] = \ + (self.env.docname, self.objtype) + + indextext = self.get_index_text(name) + if indextext: + self.indexnode['entries'].append(('single', indextext, name, name)) + + def before_content(self): + lastname = self.names and self.names[-1] + if lastname and not self.env.temp_data.get('cpp:parent'): + assert isinstance(lastname, NamedDefExpr) + self.env.temp_data['cpp:parent'] = lastname.name + self.parentname_set = True + else: + self.parentname_set = False + + def after_content(self): + if self.parentname_set: + self.env.temp_data['cpp:parent'] = None + + def parse_definition(self, parser): + raise NotImplementedError() + + def describe_signature(self, signode, arg): + raise NotImplementedError() + + def handle_signature(self, sig, signode): + parser = DefinitionParser(sig) + try: + rv = self.parse_definition(parser) + parser.assert_end() + except DefinitionError, e: + self.env.warn(self.env.docname, + e.description, self.lineno) + raise ValueError + self.describe_signature(signode, rv) + + parent = self.env.temp_data.get('cpp:parent') + if parent is not None: + rv = rv.clone() + rv.name = rv.name.prefix(parent) + return rv + + +class CPPClassObject(CPPObject): + + def get_index_text(self, name): + return _('%s (C++ class)') % name + + def parse_definition(self, parser): + return parser.parse_class() + + def describe_signature(self, signode, cls): + self.attach_modifiers(signode, cls) + signode += addnodes.desc_annotation('class ', 'class ') + self.attach_name(signode, cls.name) + + +class CPPTypeObject(CPPObject): + + def get_index_text(self, name): + if self.objtype == 'type': + return _('%s (C++ type)') % name + return '' + + def parse_definition(self, parser): + return parser.parse_type_object() + + def describe_signature(self, signode, obj): + self.attach_modifiers(signode, obj) + signode += addnodes.desc_annotation('type ', 'type ') + if obj.typename is not None: + self.attach_type(signode, obj.typename) + signode += nodes.Text(' ') + self.attach_name(signode, obj.name) + + +class CPPMemberObject(CPPObject): + + def get_index_text(self, name): + if self.objtype == 'member': + return _('%s (C++ member)') % name + return '' + + def parse_definition(self, parser): + return parser.parse_member_object() + + def describe_signature(self, signode, obj): + self.attach_modifiers(signode, obj) + self.attach_type(signode, obj.typename) + signode += nodes.Text(' ') + self.attach_name(signode, obj.name) + if obj.value is not None: + signode += nodes.Text(u' = ' + obj.value) + + +class CPPFunctionObject(CPPObject): + + def attach_function(self, node, func): + owner, name = func.name.split_owner() + if owner is not None: + owner = unicode(owner) + '::' + node += addnodes.desc_addname(owner, owner) + + # cast operator is special. in this case the return value + # is reversed. + if isinstance(name, CastOpDefExpr): + node += addnodes.desc_name('operator', 'operator') + node += nodes.Text(u' ') + self.attach_type(node, name.typename) + else: + funcname = unicode(name) + node += addnodes.desc_name(funcname, funcname) + + paramlist = addnodes.desc_parameterlist() + for arg in func.signature: + param = addnodes.desc_parameter('', '', noemph=True) + if arg.type is not None: + self.attach_type(param, arg.type) + param += nodes.Text(u' ') + param += nodes.emphasis(unicode(arg.name), unicode(arg.name)) + if arg.default is not None: + def_ = u'=' + unicode(arg.default) + param += nodes.emphasis(def_, def_) + paramlist += param + + node += paramlist + if func.const: + node += addnodes.desc_addname(' const', ' const') + if func.pure_virtual: + node += addnodes.desc_addname(' = 0', ' = 0') + + def get_index_text(self, name): + return _('%s (C++ function)') % name + + def parse_definition(self, parser): + return parser.parse_function() + + def describe_signature(self, signode, func): + self.attach_modifiers(signode, func) + if func.explicit: + signode += addnodes.desc_annotation('explicit', 'explicit') + signode += nodes.Text(' ') + # return value is None for things with a reverse return value + # such as casting operator definitions or constructors + # and destructors. + if func.rv is not None: + self.attach_type(signode, func.rv) + signode += nodes.Text(u' ') + self.attach_function(signode, func) + + +class CPPCurrentNamespace(Directive): + """This directive is just to tell Sphinx that we're documenting + stuff in namespace foo. + """ + + has_content = False + required_arguments = 1 + optional_arguments = 0 + final_argument_whitespace = True + option_spec = {} + + def run(self): + env = self.state.document.settings.env + if self.arguments[0].strip() in ('NULL', '0', 'nullptr'): + env.temp_data['cpp:prefix'] = None + else: + parser = DefinitionParser(self.arguments[0]) + try: + prefix = parser.parse_type() + parser.assert_end() + except DefinitionError, e: + self.env.warn(self.env.docname, + e.description, self.lineno) + else: + env.temp_data['cpp:prefix'] = prefix + return [] + + +class CPPXRefRole(XRefRole): + + def process_link(self, env, refnode, has_explicit_title, title, target): + refnode['cpp:parent'] = env.temp_data.get('cpp:parent') + if not has_explicit_title: + target = target.lstrip('~') # only has a meaning for the title + # if the first character is a tilde, don't display the module/class + # parts of the contents + if title[:1] == '~': + title = title[1:] + dcolon = title.rfind('::') + if dcolon != -1: + title = title[dcolon + 2:] + return title, target + + +class CPPDomain(Domain): + """C++ language domain.""" + name = 'cpp' + label = 'C++' + object_types = { + 'class': ObjType(l_('C++ class'), 'class'), + 'function': ObjType(l_('C++ function'), 'func'), + 'member': ObjType(l_('C++ member'), 'member'), + 'type': ObjType(l_('C++ type'), 'type') + } + + directives = { + 'class': CPPClassObject, + 'function': CPPFunctionObject, + 'member': CPPMemberObject, + 'type': CPPTypeObject, + 'namespace': CPPCurrentNamespace + } + roles = { + 'class': CPPXRefRole(), + 'func' : CPPXRefRole(fix_parens=True), + 'member': CPPXRefRole(), + 'type': CPPXRefRole() + } + initial_data = { + 'objects': {}, # fullname -> docname, objtype + } + + def clear_doc(self, docname): + for fullname, (fn, _) in self.data['objects'].items(): + if fn == docname: + del self.data['objects'][fullname] + + def resolve_xref(self, env, fromdocname, builder, + typ, target, node, contnode): + def _create_refnode(expr): + name = unicode(expr) + if name not in self.data['objects']: + return None + obj = self.data['objects'][name] + if obj[1] != typ: + return None + return make_refnode(builder, fromdocname, obj[0], expr.get_id(), + contnode, name) + + parser = DefinitionParser(target) + # XXX: warn? + try: + expr = parser.parse_type().get_name() + parser.skip_ws() + if not parser.eof or expr is None: + return None + except DefinitionError: + return None + + parent = node['cpp:parent'] + + rv = _create_refnode(expr) + if rv is not None or parent is None: + return rv + parent = parent.get_name() + + rv = _create_refnode(expr.prefix(parent)) + if rv is not None: + return rv + + parent, name = parent.split_owner() + return _create_refnode(expr.prefix(parent)) + + def get_objects(self): + for refname, (docname, type) in self.data['objects'].iteritems(): + yield (refname, refname, type, docname, refname, 1) diff --git a/sphinx/domains/javascript.py b/sphinx/domains/javascript.py new file mode 100644 index 00000000..51ff1da1 --- /dev/null +++ b/sphinx/domains/javascript.py @@ -0,0 +1,217 @@ +# -*- coding: utf-8 -*- +""" + sphinx.domains.javascript + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + The JavaScript domain. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from sphinx import addnodes +from sphinx.domains import Domain, ObjType +from sphinx.locale import l_, _ +from sphinx.directives import ObjectDescription +from sphinx.domains.python import py_paramlist_re as js_paramlist_re +from sphinx.roles import XRefRole +from sphinx.util.nodes import make_refnode +from sphinx.util.docfields import Field, GroupedField, TypedField + + +class JSObject(ObjectDescription): + """ + Description of a JavaScript object. + """ + #: If set to ``True`` this object is callable and a `desc_parameterlist` is + #: added + has_arguments = False + + def handle_signature(self, sig, signode): + sig = sig.strip() + if '(' in sig and sig[-1:] == ')': + prefix, arglist = sig.split('(', 1) + arglist = arglist[:-1].strip() + else: + prefix = sig + arglist = None + if '.' in prefix: + nameprefix, name = prefix.rsplit('.', 1) + else: + nameprefix = None + name = prefix + + objectname = self.env.temp_data.get('js:object') + if nameprefix: + if objectname: + # someone documenting the method of an attribute of the current + # object? shouldn't happen but who knows... + nameprefix = objectname + '.' + nameprefix + fullname = nameprefix + '.' + name + elif objectname: + fullname = objectname + '.' + name + else: + # just a function or constructor + objectname = '' + fullname = '' + + signode['object'] = objectname + signode['fullname'] = fullname + + if nameprefix: + signode += addnodes.desc_addname(nameprefix + '.', nameprefix + '.') + signode += addnodes.desc_name(name, name) + if self.has_arguments: + signode += addnodes.desc_parameterlist() + if not arglist: + return fullname, nameprefix + + stack = [signode[-1]] + for token in js_paramlist_re.split(arglist): + if token == '[': + opt = addnodes.desc_optional() + stack[-1] += opt + stack.append(opt) + elif token == ']': + try: + stack.pop() + except IndexError: + raise ValueError() + elif not token or token == ',' or token.isspace(): + pass + else: + token = token.strip() + stack[-1] += addnodes.desc_parameter(token, token) + if len(stack) != 1: + raise ValueError() + return fullname, nameprefix + + def add_target_and_index(self, name_obj, sig, signode): + objectname = self.options.get( + 'object', self.env.temp_data.get('js:object')) + fullname = name_obj[0] + if fullname not in self.state.document.ids: + signode['names'].append(fullname) + signode['ids'].append(fullname.replace('$', '_S_')) + signode['first'] = not self.names + self.state.document.note_explicit_target(signode) + objects = self.env.domaindata['js']['objects'] + if fullname in objects: + self.env.warn( + self.env.docname, + 'duplicate object description of %s, ' % fullname + + 'other instance in ' + + self.env.doc2path(objects[fullname][0]), + self.lineno) + objects[fullname] = self.env.docname, self.objtype + + indextext = self.get_index_text(objectname, name_obj) + if indextext: + self.indexnode['entries'].append(('single', indextext, + fullname, fullname)) + + def get_index_text(self, objectname, name_obj): + name, obj = name_obj + if self.objtype == 'function': + if not obj: + return _('%s() (built-in function)') % name + return _('%s() (%s method)') % (name, obj) + elif self.objtype == 'data': + return _('%s (global variable or constant)') % name + elif self.objtype == 'attribute': + return _('%s (%s attribute)') % (name, obj) + return '' + + +class JSCallable(JSObject): + """Description of a JavaScript function, method or constructor.""" + has_arguments = True + + doc_field_types = [ + TypedField('arguments', label=l_('Arguments'), + names=('argument', 'arg', 'parameter', 'param'), + typerolename='func', typenames=('paramtype', 'type')), + GroupedField('errors', label=l_('Throws'), rolename='err', + names=('throws', ), + can_collapse=True), + Field('returnvalue', label=l_('Returns'), has_arg=False, + names=('returns', 'return')), + ] + + +class JSXRefRole(XRefRole): + def process_link(self, env, refnode, has_explicit_title, title, target): + # basically what sphinx.domains.python.PyXRefRole does + refnode['js:object'] = env.temp_data.get('js:object') + if not has_explicit_title: + title = title.lstrip('.') + target = target.lstrip('~') + if title[0:1] == '~': + title = title[1:] + dot = title.rfind('.') + if dot != -1: + title = title[dot+1:] + if target[0:1] == '.': + target = target[1:] + refnode['refspecific'] = True + return title, target + + +class JavaScriptDomain(Domain): + """JavaScript language domain.""" + name = 'js' + label = 'JavaScript' + # if you add a new object type make sure to edit JSObject.get_index_string + object_types = { + 'function': ObjType(l_('JavaScript function'), 'func'), + 'data': ObjType(l_('JavaScript data'), 'data'), + 'attribute': ObjType(l_('JavaScript attribute'), 'attr'), + } + directives = { + 'function': JSCallable, + 'data': JSObject, + 'attribute': JSObject, + } + roles = { + 'func': JSXRefRole(fix_parens=True), + 'data': JSXRefRole(), + 'attr': JSXRefRole(), + } + initial_data = { + 'objects': {}, # fullname -> docname, objtype + } + + def clear_doc(self, docname): + for fullname, (fn, _) in self.data['objects'].items(): + if fn == docname: + del self.data['objects'][fullname] + + def find_obj(self, env, obj, name, typ, searchorder=0): + if name[-2:] == '()': + name = name[:-2] + objects = self.data['objects'] + newname = None + if searchorder == 1: + if obj and obj + '.' + name in objects: + newname = obj + '.' + name + else: + newname = name + else: + if name in objects: + newname = name + elif obj and obj + '.' + name in objects: + newname = obj + '.' + name + return newname, objects.get(newname) + + def resolve_xref(self, env, fromdocname, builder, typ, target, node, + contnode): + objectname = node.get('js:object') + searchorder = node.hasattr('refspecific') and 1 or 0 + name, obj = self.find_obj(env, objectname, target, typ, searchorder) + if not obj: + return None + return make_refnode(builder, fromdocname, obj[0], name, contnode, name) + + def get_objects(self): + for refname, (docname, type) in self.data['objects'].iteritems(): + yield refname, refname, type, docname, refname, 1 diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py new file mode 100644 index 00000000..b97b9b42 --- /dev/null +++ b/sphinx/domains/python.py @@ -0,0 +1,622 @@ +# -*- coding: utf-8 -*- +""" + sphinx.domains.python + ~~~~~~~~~~~~~~~~~~~~~ + + The Python domain. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from docutils import nodes +from docutils.parsers.rst import directives + +from sphinx import addnodes +from sphinx.roles import XRefRole +from sphinx.locale import l_, _ +from sphinx.domains import Domain, ObjType, Index +from sphinx.directives import ObjectDescription +from sphinx.util.nodes import make_refnode +from sphinx.util.compat import Directive +from sphinx.util.docfields import Field, GroupedField, TypedField + + +# REs for Python signatures +py_sig_re = re.compile( + r'''^ ([\w.]*\.)? # class name(s) + (\w+) \s* # thing name + (?: \((.*)\) # optional: arguments + (?:\s* -> \s* (.*))? # return annotation + )? $ # and nothing more + ''', re.VERBOSE) + +py_paramlist_re = re.compile(r'([\[\],])') # split at '[', ']' and ',' + + +class PyObject(ObjectDescription): + """ + Description of a general Python object. + """ + option_spec = { + 'noindex': directives.flag, + 'module': directives.unchanged, + } + + doc_field_types = [ + TypedField('parameter', label=l_('Parameters'), + names=('param', 'parameter', 'arg', 'argument', + 'keyword', 'kwarg', 'kwparam'), + typerolename='obj', typenames=('paramtype', 'type')), + TypedField('variable', label=l_('Variables'), rolename='obj', + names=('var', 'ivar', 'cvar'), + typerolename='obj', typenames=('vartype',)), + GroupedField('exceptions', label=l_('Raises'), rolename='exc', + names=('raises', 'raise', 'exception', 'except'), + can_collapse=True), + Field('returnvalue', label=l_('Returns'), has_arg=False, + names=('returns', 'return')), + Field('returntype', label=l_('Return type'), has_arg=False, + names=('rtype',)), + ] + + def get_signature_prefix(self, sig): + """ + May return a prefix to put before the object name in the signature. + """ + return '' + + def needs_arglist(self): + """ + May return true if an empty argument list is to be generated even if + the document contains none. + """ + return False + + def handle_signature(self, sig, signode): + """ + Transform a Python signature into RST nodes. + Returns (fully qualified name of the thing, classname if any). + + If inside a class, the current class name is handled intelligently: + * it is stripped from the displayed name if present + * it is added to the full name (return value) if not present + """ + m = py_sig_re.match(sig) + if m is None: + raise ValueError + name_prefix, name, arglist, retann = m.groups() + + # determine module and class name (if applicable), as well as full name + modname = self.options.get( + 'module', self.env.temp_data.get('py:module')) + classname = self.env.temp_data.get('py:class') + if classname: + add_module = False + if name_prefix and name_prefix.startswith(classname): + fullname = name_prefix + name + # class name is given again in the signature + name_prefix = name_prefix[len(classname):].lstrip('.') + elif name_prefix: + # class name is given in the signature, but different + # (shouldn't happen) + fullname = classname + '.' + name_prefix + name + else: + # class name is not given in the signature + fullname = classname + '.' + name + else: + add_module = True + if name_prefix: + classname = name_prefix.rstrip('.') + fullname = name_prefix + name + else: + classname = '' + fullname = name + + signode['module'] = modname + signode['class'] = classname + signode['fullname'] = fullname + + sig_prefix = self.get_signature_prefix(sig) + if sig_prefix: + signode += addnodes.desc_annotation(sig_prefix, sig_prefix) + + if name_prefix: + signode += addnodes.desc_addname(name_prefix, name_prefix) + # exceptions are a special case, since they are documented in the + # 'exceptions' module. + elif add_module and self.env.config.add_module_names: + modname = self.options.get( + 'module', self.env.temp_data.get('py:module')) + if modname and modname != 'exceptions': + nodetext = modname + '.' + signode += addnodes.desc_addname(nodetext, nodetext) + + signode += addnodes.desc_name(name, name) + if not arglist: + if self.needs_arglist(): + # for callables, add an empty parameter list + signode += addnodes.desc_parameterlist() + if retann: + signode += addnodes.desc_returns(retann, retann) + return fullname, name_prefix + signode += addnodes.desc_parameterlist() + + stack = [signode[-1]] + for token in py_paramlist_re.split(arglist): + if token == '[': + opt = addnodes.desc_optional() + stack[-1] += opt + stack.append(opt) + elif token == ']': + try: + stack.pop() + except IndexError: + raise ValueError + elif not token or token == ',' or token.isspace(): + pass + else: + token = token.strip() + stack[-1] += addnodes.desc_parameter(token, token) + if len(stack) != 1: + raise ValueError + if retann: + signode += addnodes.desc_returns(retann, retann) + return fullname, name_prefix + + def get_index_text(self, modname, name): + """ + Return the text for the index entry of the object. + """ + raise NotImplementedError('must be implemented in subclasses') + + def add_target_and_index(self, name_cls, sig, signode): + modname = self.options.get( + 'module', self.env.temp_data.get('py:module')) + fullname = (modname and modname + '.' or '') + name_cls[0] + # note target + if fullname not in self.state.document.ids: + signode['names'].append(fullname) + signode['ids'].append(fullname) + signode['first'] = (not self.names) + self.state.document.note_explicit_target(signode) + objects = self.env.domaindata['py']['objects'] + if fullname in objects: + self.env.warn( + self.env.docname, + 'duplicate object description of %s, ' % fullname + + 'other instance in ' + + self.env.doc2path(objects[fullname][0]) + + ', use :noindex: for one of them', + self.lineno) + objects[fullname] = (self.env.docname, self.objtype) + + indextext = self.get_index_text(modname, name_cls) + if indextext: + self.indexnode['entries'].append(('single', indextext, + fullname, fullname)) + + def before_content(self): + # needed for automatic qualification of members (reset in subclasses) + self.clsname_set = False + + def after_content(self): + if self.clsname_set: + self.env.temp_data['py:class'] = None + + +class PyModulelevel(PyObject): + """ + Description of an object on module level (functions, data). + """ + + def needs_arglist(self): + return self.objtype == 'function' + + def get_index_text(self, modname, name_cls): + if self.objtype == 'function': + if not modname: + return _('%s() (built-in function)') % name_cls[0] + return _('%s() (in module %s)') % (name_cls[0], modname) + elif self.objtype == 'data': + if not modname: + return _('%s (built-in variable)') % name_cls[0] + return _('%s (in module %s)') % (name_cls[0], modname) + else: + return '' + + +class PyClasslike(PyObject): + """ + Description of a class-like object (classes, interfaces, exceptions). + """ + + def get_signature_prefix(self, sig): + return self.objtype + ' ' + + def get_index_text(self, modname, name_cls): + if self.objtype == 'class': + if not modname: + return _('%s (built-in class)') % name_cls[0] + return _('%s (class in %s)') % (name_cls[0], modname) + elif self.objtype == 'exception': + return name_cls[0] + else: + return '' + + def before_content(self): + PyObject.before_content(self) + if self.names: + self.env.temp_data['py:class'] = self.names[0][0] + self.clsname_set = True + + +class PyClassmember(PyObject): + """ + Description of a class member (methods, attributes). + """ + + def needs_arglist(self): + return self.objtype.endswith('method') + + def get_signature_prefix(self, sig): + if self.objtype == 'staticmethod': + return 'static ' + elif self.objtype == 'classmethod': + return 'classmethod ' + return '' + + def get_index_text(self, modname, name_cls): + name, cls = name_cls + add_modules = self.env.config.add_module_names + if self.objtype == 'method': + try: + clsname, methname = name.rsplit('.', 1) + except ValueError: + if modname: + return _('%s() (in module %s)') % (name, modname) + else: + return '%s()' % name + if modname and add_modules: + return _('%s() (%s.%s method)') % (methname, modname, clsname) + else: + return _('%s() (%s method)') % (methname, clsname) + elif self.objtype == 'staticmethod': + try: + clsname, methname = name.rsplit('.', 1) + except ValueError: + if modname: + return _('%s() (in module %s)') % (name, modname) + else: + return '%s()' % name + if modname and add_modules: + return _('%s() (%s.%s static method)') % (methname, modname, + clsname) + else: + return _('%s() (%s static method)') % (methname, clsname) + elif self.objtype == 'classmethod': + try: + clsname, methname = name.rsplit('.', 1) + except ValueError: + if modname: + return _('%s() (in module %s)') % (name, modname) + else: + return '%s()' % name + if modname: + return _('%s() (%s.%s class method)') % (methname, modname, + clsname) + else: + return _('%s() (%s class method)') % (methname, clsname) + elif self.objtype == 'attribute': + try: + clsname, attrname = name.rsplit('.', 1) + except ValueError: + if modname: + return _('%s (in module %s)') % (name, modname) + else: + return name + if modname and add_modules: + return _('%s (%s.%s attribute)') % (attrname, modname, clsname) + else: + return _('%s (%s attribute)') % (attrname, clsname) + else: + return '' + + def before_content(self): + PyObject.before_content(self) + lastname = self.names and self.names[-1][1] + if lastname and not self.env.temp_data.get('py:class'): + self.env.temp_data['py:class'] = lastname.strip('.') + self.clsname_set = True + + +class PyModule(Directive): + """ + Directive to mark description of a new module. + """ + + has_content = False + required_arguments = 1 + optional_arguments = 0 + final_argument_whitespace = False + option_spec = { + 'platform': lambda x: x, + 'synopsis': lambda x: x, + 'noindex': directives.flag, + 'deprecated': directives.flag, + } + + def run(self): + env = self.state.document.settings.env + modname = self.arguments[0].strip() + noindex = 'noindex' in self.options + env.temp_data['py:module'] = modname + env.domaindata['py']['modules'][modname] = \ + (env.docname, self.options.get('synopsis', ''), + self.options.get('platform', ''), 'deprecated' in self.options) + targetnode = nodes.target('', '', ids=['module-' + modname], ismod=True) + self.state.document.note_explicit_target(targetnode) + ret = [targetnode] + # XXX this behavior of the module directive is a mess... + if 'platform' in self.options: + platform = self.options['platform'] + node = nodes.paragraph() + node += nodes.emphasis('', _('Platforms: ')) + node += nodes.Text(platform, platform) + ret.append(node) + # the synopsis isn't printed; in fact, it is only used in the + # modindex currently + if not noindex: + indextext = _('%s (module)') % modname + inode = addnodes.index(entries=[('single', indextext, + 'module-' + modname, modname)]) + ret.append(inode) + return ret + + +class PyCurrentModule(Directive): + """ + This directive is just to tell Sphinx that we're documenting + stuff in module foo, but links to module foo won't lead here. + """ + + has_content = False + required_arguments = 1 + optional_arguments = 0 + final_argument_whitespace = False + option_spec = {} + + def run(self): + env = self.state.document.settings.env + modname = self.arguments[0].strip() + if modname == 'None': + env.temp_data['py:module'] = None + else: + env.temp_data['py:module'] = modname + return [] + + +class PyXRefRole(XRefRole): + def process_link(self, env, refnode, has_explicit_title, title, target): + refnode['py:module'] = env.temp_data.get('py:module') + refnode['py:class'] = env.temp_data.get('py:class') + if not has_explicit_title: + title = title.lstrip('.') # only has a meaning for the target + target = target.lstrip('~') # only has a meaning for the title + # if the first character is a tilde, don't display the module/class + # parts of the contents + if title[0:1] == '~': + title = title[1:] + dot = title.rfind('.') + if dot != -1: + title = title[dot+1:] + # if the first character is a dot, search more specific namespaces first + # else search builtins first + if target[0:1] == '.': + target = target[1:] + refnode['refspecific'] = True + return title, target + + +class PythonModuleIndex(Index): + """ + Index subclass to provide the Python module index. + """ + + name = 'modindex' + localname = l_('Python Module Index') + shortname = l_('modules') + + def generate(self, docnames=None): + content = {} + # list of prefixes to ignore + ignores = self.domain.env.config['modindex_common_prefix'] + ignores = sorted(ignores, key=len, reverse=True) + # list of all modules, sorted by module name + modules = sorted(self.domain.data['modules'].iteritems(), + key=lambda x: x[0].lower()) + # sort out collapsable modules + prev_modname = '' + num_toplevels = 0 + for modname, (docname, synopsis, platforms, deprecated) in modules: + if docnames and docname not in docnames: + continue + + for ignore in ignores: + if modname.startswith(ignore): + modname = modname[len(ignore):] + stripped = ignore + break + else: + stripped = '' + + # we stripped the whole module name? + if not modname: + modname, stripped = stripped, '' + + entries = content.setdefault(modname[0].lower(), []) + + package = modname.split('.')[0] + if package != modname: + # it's a submodule + if prev_modname == package: + # first submodule - make parent a group head + entries[-1][1] = 1 + elif not prev_modname.startswith(package): + # submodule without parent in list, add dummy entry + entries.append([stripped + package, 1, '', '', '', '', '']) + subtype = 2 + else: + num_toplevels += 1 + subtype = 0 + + qualifier = deprecated and _('Deprecated') or '' + entries.append([stripped + modname, subtype, docname, + 'module-' + stripped + modname, platforms, + qualifier, synopsis]) + prev_modname = modname + + # apply heuristics when to collapse modindex at page load: + # only collapse if number of toplevel modules is larger than + # number of submodules + collapse = len(modules) - num_toplevels < num_toplevels + + # sort by first letter + content = sorted(content.iteritems()) + + return content, collapse + + +class PythonDomain(Domain): + """Python language domain.""" + name = 'py' + label = 'Python' + object_types = { + 'function': ObjType(l_('function'), 'func', 'obj'), + 'data': ObjType(l_('data'), 'data', 'obj'), + 'class': ObjType(l_('class'), 'class', 'obj'), + 'exception': ObjType(l_('exception'), 'exc', 'obj'), + 'method': ObjType(l_('method'), 'meth', 'obj'), + 'classmethod': ObjType(l_('class method'), 'meth', 'obj'), + 'staticmethod': ObjType(l_('static method'), 'meth', 'obj'), + 'attribute': ObjType(l_('attribute'), 'attr', 'obj'), + 'module': ObjType(l_('module'), 'mod', 'obj'), + } + + directives = { + 'function': PyModulelevel, + 'data': PyModulelevel, + 'class': PyClasslike, + 'exception': PyClasslike, + 'method': PyClassmember, + 'classmethod': PyClassmember, + 'staticmethod': PyClassmember, + 'attribute': PyClassmember, + 'module': PyModule, + 'currentmodule': PyCurrentModule, + } + roles = { + 'data': PyXRefRole(), + 'exc': PyXRefRole(), + 'func': PyXRefRole(fix_parens=True), + 'class': PyXRefRole(), + 'const': PyXRefRole(), + 'attr': PyXRefRole(), + 'meth': PyXRefRole(fix_parens=True), + 'mod': PyXRefRole(), + 'obj': PyXRefRole(), + } + initial_data = { + 'objects': {}, # fullname -> docname, objtype + 'modules': {}, # modname -> docname, synopsis, platform, deprecated + } + indices = [ + PythonModuleIndex, + ] + + def clear_doc(self, docname): + for fullname, (fn, _) in self.data['objects'].items(): + if fn == docname: + del self.data['objects'][fullname] + for modname, (fn, _, _, _) in self.data['modules'].items(): + if fn == docname: + del self.data['modules'][modname] + + def find_obj(self, env, modname, classname, name, type, searchorder=0): + """ + Find a Python object for "name", perhaps using the given module and/or + classname. + """ + # skip parens + if name[-2:] == '()': + name = name[:-2] + + if not name: + return None, None + + objects = self.data['objects'] + + newname = None + if searchorder == 1: + if modname and classname and \ + modname + '.' + classname + '.' + name in objects: + newname = modname + '.' + classname + '.' + name + elif modname and modname + '.' + name in objects: + newname = modname + '.' + name + elif name in objects: + newname = name + else: + if name in objects: + newname = name + elif classname and classname + '.' + name in objects: + newname = classname + '.' + name + elif modname and modname + '.' + name in objects: + newname = modname + '.' + name + elif modname and classname and \ + modname + '.' + classname + '.' + name in objects: + newname = modname + '.' + classname + '.' + name + # special case: builtin exceptions have module "exceptions" set + elif type == 'exc' and '.' not in name and \ + 'exceptions.' + name in objects: + newname = 'exceptions.' + name + # special case: object methods + elif type in ('func', 'meth') and '.' not in name and \ + 'object.' + name in objects: + newname = 'object.' + name + if newname is None: + return None, None + return newname, objects[newname] + + def resolve_xref(self, env, fromdocname, builder, + typ, target, node, contnode): + if (typ == 'mod' or + typ == 'obj' and target in self.data['modules']): + docname, synopsis, platform, deprecated = \ + self.data['modules'].get(target, ('','','', '')) + if not docname: + return None + else: + title = '%s%s%s' % ((platform and '(%s) ' % platform), + synopsis, + (deprecated and ' (deprecated)' or '')) + return make_refnode(builder, fromdocname, docname, + 'module-' + target, contnode, title) + else: + modname = node.get('py:module') + clsname = node.get('py:class') + searchorder = node.hasattr('refspecific') and 1 or 0 + name, obj = self.find_obj(env, modname, clsname, + target, typ, searchorder) + if not obj: + return None + else: + return make_refnode(builder, fromdocname, obj[0], name, + contnode, name) + + def get_objects(self): + for modname, info in self.data['modules'].iteritems(): + yield (modname, modname, 'module', info[0], 'module-' + modname, 0) + for refname, (docname, type) in self.data['objects'].iteritems(): + yield (refname, refname, type, docname, refname, 1) diff --git a/sphinx/domains/rst.py b/sphinx/domains/rst.py new file mode 100644 index 00000000..8b98c519 --- /dev/null +++ b/sphinx/domains/rst.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- +""" + sphinx.domains.rst + ~~~~~~~~~~~~~~~~~~ + + The reStructuredText domain. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from sphinx import addnodes +from sphinx.domains import Domain, ObjType +from sphinx.locale import l_, _ +from sphinx.directives import ObjectDescription +from sphinx.roles import XRefRole +from sphinx.util.nodes import make_refnode + + +dir_sig_re = re.compile(r'\.\. (.+?)::(.*)$') + + +class ReSTMarkup(ObjectDescription): + """ + Description of generic reST markup. + """ + + def add_target_and_index(self, name, sig, signode): + if name not in self.state.document.ids: + signode['names'].append(name) + signode['ids'].append(name) + signode['first'] = (not self.names) + self.state.document.note_explicit_target(signode) + + objects = self.env.domaindata['rst']['objects'] + if (self.objtype, name) in objects: + self.env.warn(self.env.docname, + 'duplicate description of %s %s, ' % + (self.objtype, name) + + 'other instance in ' + + self.env.doc2path(objects[name][0]), + self.lineno) + objects[self.objtype, name] = self.env.docname + indextext = self.get_index_text(self.objtype, name) + if indextext: + self.indexnode['entries'].append(('single', indextext, + name, name)) + + def get_index_text(self, objectname, name): + if self.objtype == 'directive': + return _('%s (directive)') % name + elif self.objtype == 'role': + return _('%s (role)') % name + return '' + + +def parse_directive(d): + """ + Parses a directive signature. Returns (directive, arguments) string tuple. + if no arguments are given, returns (directive, ''). + """ + dir = d.strip() + if not dir.startswith('.'): + # Assume it is a directive without syntax + return (dir, '') + m = dir_sig_re.match(dir) + if not m: + return (dir, '') + parsed_dir, parsed_args = m.groups() + return (parsed_dir.strip(), ' ' + parsed_args.strip()) + + +class ReSTDirective(ReSTMarkup): + """ + Description of a reST directive. + """ + def handle_signature(self, sig, signode): + name, args = parse_directive(sig) + desc_name = '.. %s::' % name + signode += addnodes.desc_name(desc_name, desc_name) + if len(args) > 0: + signode += addnodes.desc_addname(args, args) + return name + + +class ReSTRole(ReSTMarkup): + """ + Description of a reST role. + """ + def handle_signature(self, sig, signode): + signode += addnodes.desc_name(':%s:' % sig, ':%s:' % sig) + return sig + + +class ReSTDomain(Domain): + """ReStructuredText domain.""" + name = 'rst' + label = 'reStructuredText' + + object_types = { + 'directive': ObjType(l_('reStructuredText directive'), 'dir'), + 'role': ObjType(l_('reStructuredText role'), 'role'), + } + directives = { + 'directive': ReSTDirective, + 'role': ReSTRole, + } + roles = { + 'dir': XRefRole(), + 'role': XRefRole(), + } + initial_data = { + 'objects': {}, # fullname -> docname, objtype + } + + def clear_doc(self, docname): + for (typ, name), doc in self.data['objects'].items(): + if doc == docname: + del self.data['objects'][typ, name] + + def resolve_xref(self, env, fromdocname, builder, typ, target, node, + contnode): + objects = self.data['objects'] + + if not (typ, target) in objects: + return None + return make_refnode(builder, fromdocname, objects[typ, target][0], + target, contnode, target) + + def get_objects(self): + for (typ, name), docname in self.data['objects'].iteritems(): + yield name, name, typ, docname, name, 1 diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py new file mode 100644 index 00000000..48c96640 --- /dev/null +++ b/sphinx/domains/std.py @@ -0,0 +1,497 @@ +# -*- coding: utf-8 -*- +""" + sphinx.domains.std + ~~~~~~~~~~~~~~~~~~ + + The standard domain. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from docutils import nodes +from docutils.parsers.rst import directives + +from sphinx import addnodes +from sphinx.roles import XRefRole +from sphinx.locale import l_, _ +from sphinx.domains import Domain, ObjType +from sphinx.directives import ObjectDescription +from sphinx.util import ws_re +from sphinx.util.nodes import clean_astext, make_refnode +from sphinx.util.compat import Directive + + +# RE for option descriptions +option_desc_re = re.compile( + r'((?:/|-|--)[-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)') + + +class GenericObject(ObjectDescription): + """ + A generic x-ref directive registered with Sphinx.add_object_type(). + """ + indextemplate = '' + parse_node = None + + def handle_signature(self, sig, signode): + if self.parse_node: + name = self.parse_node(self.env, sig, signode) + else: + signode.clear() + signode += addnodes.desc_name(sig, sig) + # normalize whitespace like XRefRole does + name = ws_re.sub('', sig) + return name + + def add_target_and_index(self, name, sig, signode): + targetname = '%s-%s' % (self.objtype, name) + signode['ids'].append(targetname) + self.state.document.note_explicit_target(signode) + if self.indextemplate: + colon = self.indextemplate.find(':') + if colon != -1: + indextype = self.indextemplate[:colon].strip() + indexentry = self.indextemplate[colon+1:].strip() % (name,) + else: + indextype = 'single' + indexentry = self.indextemplate % (name,) + self.indexnode['entries'].append((indextype, indexentry, + targetname, targetname)) + self.env.domaindata['std']['objects'][self.objtype, name] = \ + self.env.docname, targetname + + +class EnvVar(GenericObject): + indextemplate = l_('environment variable; %s') + + +class EnvVarXRefRole(XRefRole): + """ + Cross-referencing role for environment variables (adds an index entry). + """ + + def result_nodes(self, document, env, node, is_ref): + if not is_ref: + return [node], [] + varname = node['reftarget'] + tgtid = 'index-%s' % env.new_serialno('index') + indexnode = addnodes.index() + indexnode['entries'] = [ + ('single', varname, tgtid, varname), + ('single', _('environment variable; %s') % varname, tgtid, varname) + ] + targetnode = nodes.target('', '', ids=[tgtid]) + document.note_explicit_target(targetnode) + return [indexnode, targetnode, node], [] + + +class Target(Directive): + """ + Generic target for user-defined cross-reference types. + """ + indextemplate = '' + + has_content = False + required_arguments = 1 + optional_arguments = 0 + final_argument_whitespace = True + option_spec = {} + + def run(self): + env = self.state.document.settings.env + # normalize whitespace in fullname like XRefRole does + fullname = ws_re.sub(' ', self.arguments[0].strip()) + targetname = '%s-%s' % (self.name, fullname) + node = nodes.target('', '', ids=[targetname]) + self.state.document.note_explicit_target(node) + ret = [node] + if self.indextemplate: + indexentry = self.indextemplate % (fullname,) + indextype = 'single' + colon = indexentry.find(':') + if colon != -1: + indextype = indexentry[:colon].strip() + indexentry = indexentry[colon+1:].strip() + inode = addnodes.index(entries=[(indextype, indexentry, + targetname, targetname)]) + ret.insert(0, inode) + name = self.name + if ':' in self.name: + _, name = self.name.split(':', 1) + env.domaindata['std']['objects'][name, fullname] = \ + env.docname, targetname + return ret + + +class Cmdoption(ObjectDescription): + """ + Description of a command-line option (.. cmdoption). + """ + + def handle_signature(self, sig, signode): + """Transform an option description into RST nodes.""" + count = 0 + firstname = '' + for m in option_desc_re.finditer(sig): + optname, args = m.groups() + if count: + signode += addnodes.desc_addname(', ', ', ') + signode += addnodes.desc_name(optname, optname) + signode += addnodes.desc_addname(args, args) + if not count: + firstname = optname + count += 1 + if not firstname: + raise ValueError + return firstname + + def add_target_and_index(self, name, sig, signode): + targetname = name.replace('/', '-') + currprogram = self.env.temp_data.get('std:program') + if currprogram: + targetname = '-' + currprogram + targetname + targetname = 'cmdoption' + targetname + signode['ids'].append(targetname) + self.state.document.note_explicit_target(signode) + self.indexnode['entries'].append( + ('pair', _('%scommand line option; %s') % + ((currprogram and currprogram + ' ' or ''), sig), + targetname, targetname)) + self.env.domaindata['std']['progoptions'][currprogram, name] = \ + self.env.docname, targetname + + +class Program(Directive): + """ + Directive to name the program for which options are documented. + """ + + has_content = False + required_arguments = 1 + optional_arguments = 0 + final_argument_whitespace = True + option_spec = {} + + def run(self): + env = self.state.document.settings.env + program = ws_re.sub('-', self.arguments[0].strip()) + if program == 'None': + env.temp_data['std:program'] = None + else: + env.temp_data['std:program'] = program + return [] + + +class OptionXRefRole(XRefRole): + innernodeclass = addnodes.literal_emphasis + + def process_link(self, env, refnode, has_explicit_title, title, target): + program = env.temp_data.get('std:program') + if not has_explicit_title: + if ' ' in title and not (title.startswith('/') or + title.startswith('-')): + program, target = re.split(' (?=-|--|/)', title, 1) + program = ws_re.sub('-', program) + target = target.strip() + elif ' ' in target: + program, target = re.split(' (?=-|--|/)', target, 1) + program = ws_re.sub('-', program) + refnode['refprogram'] = program + return title, target + + +class Glossary(Directive): + """ + Directive to create a glossary with cross-reference targets + for :term: roles. + """ + + has_content = True + required_arguments = 0 + optional_arguments = 0 + final_argument_whitespace = False + option_spec = { + 'sorted': directives.flag, + } + + def run(self): + env = self.state.document.settings.env + objects = env.domaindata['std']['objects'] + gloss_entries = env.temp_data.setdefault('gloss_entries', set()) + node = addnodes.glossary() + node.document = self.state.document + self.state.nested_parse(self.content, self.content_offset, node) + + # the content should be definition lists + dls = [child for child in node + if isinstance(child, nodes.definition_list)] + # now, extract definition terms to enable cross-reference creation + new_dl = nodes.definition_list() + new_dl['classes'].append('glossary') + items = [] + for dl in dls: + for li in dl.children: + if not li.children or not isinstance(li[0], nodes.term): + continue + termtext = li.children[0].astext() + new_id = 'term-' + nodes.make_id(termtext) + if new_id in gloss_entries: + new_id = 'term-' + str(len(gloss_entries)) + gloss_entries.add(new_id) + li[0]['names'].append(new_id) + li[0]['ids'].append(new_id) + objects['term', termtext.lower()] = env.docname, new_id + # add an index entry too + indexnode = addnodes.index() + indexnode['entries'] = [('single', termtext, new_id, termtext)] + li.insert(0, indexnode) + items.append((termtext, li)) + if 'sorted' in self.options: + items.sort(key=lambda x: x[0].lower()) + new_dl.extend(item[1] for item in items) + node.children = [new_dl] + return [node] + + +token_re = re.compile('`([a-z_][a-z0-9_]*)`') + +def token_xrefs(text): + retnodes = [] + pos = 0 + for m in token_re.finditer(text): + if m.start() > pos: + txt = text[pos:m.start()] + retnodes.append(nodes.Text(txt, txt)) + refnode = addnodes.pending_xref( + m.group(1), reftype='token', refdomain='std', reftarget=m.group(1)) + refnode += nodes.literal(m.group(1), m.group(1), classes=['xref']) + retnodes.append(refnode) + pos = m.end() + if pos < len(text): + retnodes.append(nodes.Text(text[pos:], text[pos:])) + return retnodes + + +class ProductionList(Directive): + """ + Directive to list grammar productions. + """ + + has_content = False + required_arguments = 1 + optional_arguments = 0 + final_argument_whitespace = True + option_spec = {} + + def run(self): + env = self.state.document.settings.env + objects = env.domaindata['std']['objects'] + node = addnodes.productionlist() + messages = [] + i = 0 + + for rule in self.arguments[0].split('\n'): + if i == 0 and ':' not in rule: + # production group + continue + i += 1 + try: + name, tokens = rule.split(':', 1) + except ValueError: + break + subnode = addnodes.production() + subnode['tokenname'] = name.strip() + if subnode['tokenname']: + idname = 'grammar-token-%s' % subnode['tokenname'] + if idname not in self.state.document.ids: + subnode['ids'].append(idname) + self.state.document.note_implicit_target(subnode, subnode) + objects['token', subnode['tokenname']] = env.docname, idname + subnode.extend(token_xrefs(tokens)) + node.append(subnode) + return [node] + messages + + +class StandardDomain(Domain): + """ + Domain for all objects that don't fit into another domain or are added + via the application interface. + """ + + name = 'std' + label = 'Default' + + object_types = { + 'term': ObjType(l_('glossary term'), 'term', searchprio=-1), + 'token': ObjType(l_('grammar token'), 'token', searchprio=-1), + 'label': ObjType(l_('reference label'), 'ref', searchprio=-1), + 'envvar': ObjType(l_('environment variable'), 'envvar'), + 'cmdoption': ObjType(l_('program option'), 'option'), + } + + directives = { + 'program': Program, + 'cmdoption': Cmdoption, # old name for backwards compatibility + 'option': Cmdoption, + 'envvar': EnvVar, + 'glossary': Glossary, + 'productionlist': ProductionList, + } + roles = { + 'option': OptionXRefRole(innernodeclass=addnodes.literal_emphasis), + 'envvar': EnvVarXRefRole(), + # links to tokens in grammar productions + 'token': XRefRole(), + # links to terms in glossary + 'term': XRefRole(lowercase=True, innernodeclass=nodes.emphasis), + # links to headings or arbitrary labels + 'ref': XRefRole(lowercase=True, innernodeclass=nodes.emphasis), + # links to labels, without a different title + 'keyword': XRefRole(), + } + + initial_data = { + 'progoptions': {}, # (program, name) -> docname, labelid + 'objects': {}, # (type, name) -> docname, labelid + 'labels': { # labelname -> docname, labelid, sectionname + 'genindex': ('genindex', '', l_('Index')), + 'modindex': ('py-modindex', '', l_('Module Index')), + 'search': ('search', '', l_('Search Page')), + }, + 'anonlabels': { # labelname -> docname, labelid + 'genindex': ('genindex', ''), + 'modindex': ('py-modindex', ''), + 'search': ('search', ''), + }, + } + + def clear_doc(self, docname): + for key, (fn, _) in self.data['progoptions'].items(): + if fn == docname: + del self.data['progoptions'][key] + for key, (fn, _) in self.data['objects'].items(): + if fn == docname: + del self.data['objects'][key] + for key, (fn, _, _) in self.data['labels'].items(): + if fn == docname: + del self.data['labels'][key] + for key, (fn, _) in self.data['anonlabels'].items(): + if fn == docname: + del self.data['anonlabels'][key] + + def process_doc(self, env, docname, document): + labels, anonlabels = self.data['labels'], self.data['anonlabels'] + for name, explicit in document.nametypes.iteritems(): + if not explicit: + continue + labelid = document.nameids[name] + if labelid is None: + continue + node = document.ids[labelid] + if name.isdigit() or node.has_key('refuri') or \ + node.tagname.startswith('desc_'): + # ignore footnote labels, labels automatically generated from a + # link and object descriptions + continue + if name in labels: + env.warn(docname, 'duplicate label %s, ' % name + + 'other instance in ' + env.doc2path(labels[name][0]), + node.line) + anonlabels[name] = docname, labelid + if node.tagname == 'section': + sectname = clean_astext(node[0]) # node[0] == title node + elif node.tagname == 'figure': + for n in node: + if n.tagname == 'caption': + sectname = clean_astext(n) + break + else: + continue + else: + # anonymous-only labels + continue + labels[name] = docname, labelid, sectname + + def resolve_xref(self, env, fromdocname, builder, + typ, target, node, contnode): + if typ == 'ref': + #refdoc = node.get('refdoc', fromdocname) + if node['refexplicit']: + # reference to anonymous label; the reference uses + # the supplied link caption + docname, labelid = self.data['anonlabels'].get(target, ('','')) + sectname = node.astext() + # XXX warn somehow if not resolved by intersphinx + #if not docname: + # env.warn(refdoc, 'undefined label: %s' % + # target, node.line) + else: + # reference to named label; the final node will + # contain the section name after the label + docname, labelid, sectname = self.data['labels'].get(target, + ('','','')) + # XXX warn somehow if not resolved by intersphinx + #if not docname: + # env.warn(refdoc, + # 'undefined label: %s' % target + ' -- if you ' + # 'don\'t give a link caption the label must ' + # 'precede a section header.', node.line) + if not docname: + return None + newnode = nodes.reference('', '') + innernode = nodes.emphasis(sectname, sectname) + if docname == fromdocname: + newnode['refid'] = labelid + else: + # set more info in contnode; in case the + # get_relative_uri call raises NoUri, + # the builder will then have to resolve these + contnode = addnodes.pending_xref('') + contnode['refdocname'] = docname + contnode['refsectname'] = sectname + newnode['refuri'] = builder.get_relative_uri( + fromdocname, docname) + if labelid: + newnode['refuri'] += '#' + labelid + newnode.append(innernode) + return newnode + elif typ == 'keyword': + # keywords are oddballs: they are referenced by named labels + docname, labelid, _ = self.data['labels'].get(target, ('','','')) + if not docname: + #env.warn(refdoc, 'unknown keyword: %s' % target) + return None + else: + return make_refnode(builder, fromdocname, docname, + labelid, contnode) + elif typ == 'option': + progname = node['refprogram'] + docname, labelid = self.data['progoptions'].get((progname, target), + ('', '')) + if not docname: + return None + else: + return make_refnode(builder, fromdocname, docname, + labelid, contnode) + else: + docname, labelid = self.data['objects'].get((typ, target), ('', '')) + if not docname: + if typ == 'term': + env.warn(node.get('refdoc', fromdocname), + 'term not in glossary: %s' % target, node.line) + return None + else: + return make_refnode(builder, fromdocname, docname, + labelid, contnode) + + def get_objects(self): + for (prog, option), info in self.data['progoptions'].iteritems(): + yield (option, option, 'option', info[0], info[1], 1) + for (type, name), info in self.data['objects'].iteritems(): + yield (name, name, type, info[0], info[1], + self.object_types[type].attrs['searchprio']) + for name, info in self.data['labels'].iteritems(): + yield (name, info[2], 'label', info[0], info[1], -1) diff --git a/sphinx/environment.py b/sphinx/environment.py index 96eb3b0a..212fd655 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -12,12 +12,10 @@ import re import os import time -import heapq import types import codecs import imghdr import string -import difflib import cPickle as pickle from os import path from glob import glob @@ -28,7 +26,7 @@ from docutils.io import FileInput, NullOutput from docutils.core import Publisher from docutils.utils import Reporter, relative_path from docutils.readers import standalone -from docutils.parsers.rst import roles +from docutils.parsers.rst import roles, directives from docutils.parsers.rst.languages import en as english from docutils.parsers.rst.directives.html import MetaBody from docutils.writers import UnfilteredWriter @@ -36,10 +34,20 @@ from docutils.transforms import Transform from docutils.transforms.parts import ContentsFilter from sphinx import addnodes -from sphinx.util import movefile, get_matching_docs, SEP, ustrftime, \ - docname_join, FilenameUniqDict, url_re, clean_astext -from sphinx.errors import SphinxError -from sphinx.directives import additional_xref_types +from sphinx.util import url_re, get_matching_docs, docname_join, \ + FilenameUniqDict +from sphinx.util.nodes import clean_astext, make_refnode +from sphinx.util.osutil import movefile, SEP, ustrftime +from sphinx.util.matching import compile_matchers +from sphinx.errors import SphinxError, ExtensionError +from sphinx.locale import _ + + +orig_role_function = roles.role +orig_directive_function = directives.directive + +class ElementLookupError(Exception): pass + default_settings = { 'embed_stylesheet': False, @@ -53,7 +61,7 @@ default_settings = { # This is increased every time an environment attribute is added # or changed to properly invalidate pickle files. -ENV_VERSION = 31 +ENV_VERSION = 36 default_substitutions = set([ @@ -101,7 +109,10 @@ class DefaultSubstitutions(Transform): class MoveModuleTargets(Transform): """ - Move module targets to their nearest enclosing section title. + Move module targets that are the first thing in a section to the section + title. + + XXX Python specific """ default_priority = 210 @@ -109,10 +120,11 @@ class MoveModuleTargets(Transform): for node in self.document.traverse(nodes.target): if not node['ids']: continue - if node['ids'][0].startswith('module-') and \ - node.parent.__class__ is nodes.section and \ - node.has_key('ismod'): - node.parent['ids'] = node['ids'] + if (node.has_key('ismod') and + node.parent.__class__ is nodes.section and + # index 0 is the section title node + node.parent.index(node) == 1): + node.parent['ids'][0:0] = node['ids'] node.parent.remove(node) @@ -143,7 +155,8 @@ class SortIds(Transform): class CitationReferences(Transform): """ - Handle citation references before the default docutils transform does. + Replace citation references by pending_xref nodes before the default + docutils transform tries to resolve them. """ default_priority = 619 @@ -204,9 +217,9 @@ class BuildEnvironment: env = pickle.load(picklefile) finally: picklefile.close() - env.config.values = config.values if env.version != ENV_VERSION: raise IOError('env version not current') + env.config.values = config.values return env def topickle(self, filename): @@ -215,6 +228,8 @@ class BuildEnvironment: self.set_warnfunc(None) values = self.config.values del self.config.values + domains = self.domains + del self.domains # first write to a temporary file, so that if dumping fails, # the existing environment won't be overwritten picklefile = open(filename + '.tmp', 'wb') @@ -231,6 +246,7 @@ class BuildEnvironment: picklefile.close() movefile(filename + '.tmp', filename) # reset attributes + self.domains = domains self.config.values = values self.set_warnfunc(warnfunc) @@ -244,6 +260,9 @@ class BuildEnvironment: # the application object; only set while update() runs self.app = None + # all the registered domains, set by the application + self.domains = {} + # the docutils settings for building self.settings = default_settings.copy() self.settings['env'] = self @@ -282,18 +301,11 @@ class BuildEnvironment: self.glob_toctrees = set() # docnames that have :glob: toctrees self.numbered_toctrees = set() # docnames that have :numbered: toctrees - # X-ref target inventory - self.descrefs = {} # fullname -> docname, desctype - self.filemodules = {} # docname -> [modules] - self.modules = {} # modname -> docname, synopsis, - # platform, deprecated - self.labels = {} # labelname -> docname, labelid, sectionname - self.anonlabels = {} # labelname -> docname, labelid - self.progoptions = {} # (program, name) -> docname, labelid - self.reftargets = {} # (type, name) -> docname, labelid - # type: term, token, envvar, citation + # domain-specific inventories, here to be pickled + self.domaindata = {} # domainname -> domain-specific dict # Other inventories + self.citations = {} # citation name -> docname, labelid self.indexentries = {} # docname -> list of # (type, string, target, aliasname) self.versionchanges = {} # version -> list of (type, docname, @@ -303,22 +315,8 @@ class BuildEnvironment: self.images = FilenameUniqDict() self.dlfiles = FilenameUniqDict() - # These are set while parsing a file - self.docname = None # current document name - self.currmodule = None # current module name - self.currclass = None # current class name - self.currdesc = None # current descref name - self.currprogram = None # current program name - self.index_num = 0 # autonumber for index targets - self.gloss_entries = set() # existing definition labels - - # Some magically present labels - def add_magic_label(name, description): - self.labels[name] = (name, '', description) - self.anonlabels[name] = (name, '') - add_magic_label('genindex', _('Index')) - add_magic_label('modindex', _('Module Index')) - add_magic_label('search', _('Search Page')) + # temporary data storage while reading a document + self.temp_data = {} def set_warnfunc(self, func): self._warnfunc = func @@ -344,7 +342,6 @@ class BuildEnvironment: self.toc_secnumbers.pop(docname, None) self.toc_num_entries.pop(docname, None) self.toctree_includes.pop(docname, None) - self.filemodules.pop(docname, None) self.indexentries.pop(docname, None) self.glob_toctrees.discard(docname) self.numbered_toctrees.discard(docname) @@ -355,25 +352,16 @@ class BuildEnvironment: fnset.discard(docname) if not fnset: del self.files_to_rebuild[subfn] - for fullname, (fn, _) in self.descrefs.items(): + for key, (fn, _) in self.citations.items(): if fn == docname: - del self.descrefs[fullname] - for modname, (fn, _, _, _) in self.modules.items(): - if fn == docname: - del self.modules[modname] - for labelname, (fn, _, _) in self.labels.items(): - if fn == docname: - del self.labels[labelname] - for key, (fn, _) in self.reftargets.items(): - if fn == docname: - del self.reftargets[key] - for key, (fn, _) in self.progoptions.items(): - if fn == docname: - del self.progoptions[key] + del self.citations[key] for version, changes in self.versionchanges.items(): new = [change for change in changes if change[1] != docname] changes[:] = new + for domain in self.domains.values(): + domain.clear_doc(docname) + def doc2path(self, docname, base=True, suffix=None): """ Return the filename for the document name. @@ -395,14 +383,15 @@ class BuildEnvironment: """ Find all source files in the source dir and put them in self.found_docs. """ - exclude_dirs = [d.replace(SEP, path.sep) for d in config.exclude_dirs] - exclude_trees = [d.replace(SEP, path.sep) for d in config.exclude_trees] + matchers = compile_matchers( + config.exclude_patterns[:] + + config.exclude_trees + + [d + config.source_suffix for d in config.unused_docs] + + ['**/' + d for d in config.exclude_dirnames] + + ['**/_sources'] + ) self.found_docs = set(get_matching_docs( - self.srcdir, config.source_suffix, - exclude_docs=set(config.unused_docs), - exclude_dirs=exclude_dirs, - exclude_trees=exclude_trees, - exclude_dirnames=['_sources'] + config.exclude_dirnames)) + self.srcdir, config.source_suffix, exclude_matchers=matchers)) def get_outdated_files(self, config_changed): """ @@ -531,9 +520,7 @@ class BuildEnvironment: # --------- SINGLE FILE READING -------------------------------------------- def warn_and_replace(self, error): - """ - Custom decoding error handler that warns and replaces. - """ + """Custom decoding error handler that warns and replaces.""" linestart = error.object.rfind('\n', 0, error.start) lineend = error.object.find('\n', error.start) if lineend == -1: lineend = len(error.object) @@ -545,6 +532,51 @@ class BuildEnvironment: error.object[error.end:lineend]), lineno) return (u'?', error.end) + def lookup_domain_element(self, type, name): + """Lookup a markup element (directive or role), given its name which can + be a full name (with domain). + """ + name = name.lower() + # explicit domain given? + if ':' in name: + domain_name, name = name.split(':', 1) + if domain_name in self.domains: + domain = self.domains[domain_name] + element = getattr(domain, type)(name) + if element is not None: + return element, [] + # else look in the default domain + else: + def_domain = self.temp_data.get('default_domain') + if def_domain is not None: + element = getattr(def_domain, type)(name) + if element is not None: + return element, [] + # always look in the std domain + element = getattr(self.domains['std'], type)(name) + if element is not None: + return element, [] + raise ElementLookupError + + def patch_lookup_functions(self): + """Monkey-patch directive and role dispatch, so that domain-specific + markup takes precedence. + """ + def directive(name, lang_module, document): + try: + return self.lookup_domain_element('directive', name) + except ElementLookupError: + return orig_directive_function(name, lang_module, document) + + def role(name, lang_module, lineno, reporter): + try: + return self.lookup_domain_element('role', name) + except ElementLookupError: + return orig_role_function(name, lang_module, lineno, reporter) + + directives.directive = directive + roles.role = role + def read_doc(self, docname, src_path=None, save_parsed=True, app=None): """ Parse a file and add/update inventory entries for the doctree. @@ -553,11 +585,23 @@ class BuildEnvironment: # remove all inventory entries for that file if app: app.emit('env-purge-doc', self, docname) + self.clear_doc(docname) if src_path is None: src_path = self.doc2path(docname) + self.temp_data['docname'] = docname + # defaults to the global default, but can be re-set in a document + self.temp_data['default_domain'] = \ + self.domains.get(self.config.default_domain) + + self.settings['input_encoding'] = self.config.source_encoding + self.settings['trim_footnote_reference_space'] = \ + self.config.trim_footnote_reference_space + + self.patch_lookup_functions() + if self.config.default_role: role_fn, messages = roles.role(self.config.default_role, english, 0, dummy_reporter) @@ -567,13 +611,6 @@ class BuildEnvironment: self.warn(docname, 'default role %s not found' % self.config.default_role) - self.docname = docname - self.settings['input_encoding'] = self.config.source_encoding - self.settings['trim_footnote_reference_space'] = \ - self.config.trim_footnote_reference_space - - codecs.register_error('sphinx', self.warn_and_replace) - codecs.register_error('sphinx', self.warn_and_replace) class SphinxSourceClass(FileInput): @@ -587,9 +624,10 @@ class BuildEnvironment: app.emit('source-read', docname, arg) data = arg[0] if self.config.rst_epilog: - return data + '\n' + self.config.rst_epilog + '\n' - else: - return data + data = data + '\n' + self.config.rst_epilog + '\n' + if self.config.rst_prolog: + data = self.config.rst_prolog + '\n' + data + return data # publish manually pub = Publisher(reader=SphinxStandaloneReader(), @@ -605,23 +643,28 @@ class BuildEnvironment: doctree = pub.document except UnicodeError, err: raise SphinxError(str(err)) + + # post-processing self.filter_messages(doctree) self.process_dependencies(docname, doctree) self.process_images(docname, doctree) self.process_downloads(docname, doctree) self.process_metadata(docname, doctree) + self.process_refonly_bullet_lists(docname, doctree) self.create_title_from(docname, doctree) - self.note_labels_from(docname, doctree) self.note_indexentries_from(docname, doctree) self.note_citations_from(docname, doctree) self.build_toc_from(docname, doctree) + for domain in self.domains.itervalues(): + domain.process_doc(self, docname, doctree) - # store time of build, for outdated files detection - self.all_docs[docname] = time.time() - + # allow extension-specific post-processing if app: app.emit('doctree-read', doctree) + # store time of build, for outdated files detection + self.all_docs[docname] = time.time() + # make it picklable doctree.reporter = None doctree.transformer = None @@ -633,10 +676,7 @@ class BuildEnvironment: metanode.__class__ = addnodes.meta # cleanup - self.docname = None - self.currmodule = None - self.currclass = None - self.gloss_entries = set() + self.temp_data.clear() if save_parsed: # save the parsed doctree @@ -653,6 +693,35 @@ class BuildEnvironment: else: return doctree + # utilities to use while reading a document + + @property + def docname(self): + """Backwards compatible alias.""" + return self.temp_data['docname'] + + @property + def currmodule(self): + """Backwards compatible alias.""" + return self.temp_data.get('py:module') + + @property + def currclass(self): + """Backwards compatible alias.""" + return self.temp_data.get('py:class') + + def new_serialno(self, category=''): + """Return a serial number, e.g. for index entry targets.""" + key = category + 'serialno' + cur = self.temp_data.get(key, 0) + self.temp_data[key] = cur + 1 + return cur + + def note_dependency(self, filename): + self.dependencies.setdefault(self.docname, set()).add(filename) + + # post-processing of read doctrees + def filter_messages(self, doctree): """ Filter system messages from a doctree. @@ -757,6 +826,7 @@ class BuildEnvironment: def process_metadata(self, docname, doctree): """ Process the docinfo part of the doctree as metadata. + Keep processing minimal -- just return what docutils says. """ self.metadata[docname] = md = {} try: @@ -768,14 +838,77 @@ class BuildEnvironment: # nothing to see here return for node in docinfo: - if node.__class__ is nodes.author: - # handled specially by docutils - md['author'] = node.astext() - elif node.__class__ is nodes.field: + # nodes are multiply inherited... + if isinstance(node, nodes.authors): + md['authors'] = [author.astext() for author in node] + elif isinstance(node, nodes.TextElement): # e.g. author + md[node.__class__.__name__] = node.astext() + else: name, body = node md[name.astext()] = body.astext() del doctree[0] + def process_refonly_bullet_lists(self, docname, doctree): + """Change refonly bullet lists to use compact_paragraphs. + + Specifically implemented for 'Indices and Tables' section, which looks + odd when html_compact_lists is false. + """ + if self.config.html_compact_lists: + return + + class RefOnlyListChecker(nodes.GenericNodeVisitor): + """Raise `nodes.NodeFound` if non-simple list item is encountered. + + Here 'simple' means a list item containing only a paragraph with a + single reference in it. + """ + + def default_visit(self, node): + raise nodes.NodeFound + + def visit_bullet_list(self, node): + pass + + def visit_list_item(self, node): + children = [] + for child in node.children: + if not isinstance(child, nodes.Invisible): + children.append(child) + if len(children) != 1: + raise nodes.NodeFound + if not isinstance(children[0], nodes.paragraph): + raise nodes.NodeFound + para = children[0] + if len(para) != 1: + raise nodes.NodeFound + if not isinstance(para[0], addnodes.pending_xref): + raise nodes.NodeFound + raise nodes.SkipChildren + + def invisible_visit(self, node): + """Invisible nodes should be ignored.""" + pass + + def check_refonly_list(node): + """Check for list with only references in it.""" + visitor = RefOnlyListChecker(doctree) + try: + node.walk(visitor) + except nodes.NodeFound: + return False + else: + return True + + for node in doctree.traverse(nodes.bullet_list): + if check_refonly_list(node): + for item in node.traverse(nodes.list_item): + para = item[0] + ref = para[0] + compact_para = addnodes.compact_paragraph() + compact_para += ref + item.replace(para, compact_para) + def create_title_from(self, docname, document): """ Add a title node to the document (just copy the first section title), @@ -800,39 +933,6 @@ class BuildEnvironment: self.titles[docname] = titlenode self.longtitles[docname] = longtitlenode - def note_labels_from(self, docname, document): - for name, explicit in document.nametypes.iteritems(): - if not explicit: - continue - labelid = document.nameids[name] - if labelid is None: - continue - node = document.ids[labelid] - if name.isdigit() or node.has_key('refuri') or \ - node.tagname.startswith('desc_'): - # ignore footnote labels, labels automatically generated from a - # link and description units - continue - if name in self.labels: - self.warn(docname, 'duplicate label %s, ' % name + - 'other instance in ' + - self.doc2path(self.labels[name][0]), - node.line) - self.anonlabels[name] = docname, labelid - if node.tagname == 'section': - sectname = clean_astext(node[0]) # node[0] == title node - elif node.tagname == 'figure': - for n in node: - if n.tagname == 'caption': - sectname = clean_astext(n) - break - else: - continue - else: - # anonymous-only labels - continue - self.labels[name] = docname, labelid, sectname - def note_indexentries_from(self, docname, document): entries = self.indexentries[docname] = [] for node in document.traverse(addnodes.index): @@ -841,11 +941,11 @@ class BuildEnvironment: def note_citations_from(self, docname, document): for node in document.traverse(nodes.citation): label = node[0].astext() - if ('citation', label) in self.reftargets: + if label in self.citations: self.warn(docname, 'duplicate citation %s, ' % label + 'other instance in %s' % self.doc2path( - self.reftargets['citation', label][0]), node.line) - self.reftargets['citation', label] = (docname, node['ids'][0]) + self.citations[label][0]), node.line) + self.citations[label] = (docname, node['ids'][0]) def note_toctree(self, docname, toctreenode): """Note a TOC tree directive in a document and gather information about @@ -933,13 +1033,14 @@ class BuildEnvironment: node['refuri'] = node['anchorname'] or '#' return toc - def get_toctree_for(self, docname, builder, collapse): + def get_toctree_for(self, docname, builder, collapse, maxdepth=0): """Return the global TOC nodetree.""" doctree = self.get_doctree(self.config.master_doc) toctrees = [] for toctreenode in doctree.traverse(addnodes.toctree): toctree = self.resolve_toctree(docname, builder, toctreenode, prune=True, collapse=collapse, + maxdepth=maxdepth, includehidden=True) toctrees.append(toctree) if not toctrees: @@ -949,37 +1050,13 @@ class BuildEnvironment: result.extend(toctree.children) return result - # ------- - # these are called from docutils directives and therefore use self.docname - # - def note_descref(self, fullname, desctype, line): - if fullname in self.descrefs: - self.warn(self.docname, - 'duplicate canonical description name %s, ' % fullname + - 'other instance in ' + - self.doc2path(self.descrefs[fullname][0]) + - ', use :noindex: for one of them', - line) - self.descrefs[fullname] = (self.docname, desctype) - - def note_module(self, modname, synopsis, platform, deprecated): - self.modules[modname] = (self.docname, synopsis, platform, deprecated) - self.filemodules.setdefault(self.docname, []).append(modname) - - def note_progoption(self, optname, labelid): - self.progoptions[self.currprogram, optname] = (self.docname, labelid) - - def note_reftarget(self, type, name, labelid): - self.reftargets[type, name] = (self.docname, labelid) - - def note_versionchange(self, type, version, node, lineno): - self.versionchanges.setdefault(version, []).append( - (type, self.docname, lineno, self.currmodule, self.currdesc, - node.astext())) - - def note_dependency(self, filename): - self.dependencies.setdefault(self.docname, set()).add(filename) - # ------- + def get_domain(self, domainname): + """Return the domain instance with the specified name. + Raises an ExtensionError if the domain is not registered.""" + try: + return self.domains[domainname] + except KeyError: + raise ExtensionError('Domain %r is not registered' % domainname) # --------- RESOLVING REFERENCES AND TOCTREES ------------------------------ @@ -1139,6 +1216,8 @@ class BuildEnvironment: return entries maxdepth = maxdepth or toctree.get('maxdepth', -1) + if not titles_only and toctree.get('titlesonly', False): + titles_only = True # NOTE: previously, this was separate=True, but that leads to artificial # separation when two or more toctree entries form a logical unit, so @@ -1161,72 +1240,36 @@ class BuildEnvironment: docname, refnode['refuri']) + refnode['anchorname'] return newnode - descroles = frozenset(('data', 'exc', 'func', 'class', 'const', - 'attr', 'obj', 'meth', 'cfunc', 'cmember', - 'cdata', 'ctype', 'cmacro')) - def resolve_references(self, doctree, fromdocname, builder): - reftarget_roles = set(('token', 'term', 'citation')) - # add all custom xref types too - reftarget_roles.update(i[0] for i in additional_xref_types.values()) - for node in doctree.traverse(addnodes.pending_xref): contnode = node[0].deepcopy() newnode = None typ = node['reftype'] target = node['reftarget'] + refdoc = node.get('refdoc', fromdocname) + warned = False try: - if typ == 'ref': - if node['refcaption']: - # reference to anonymous label; the reference uses - # the supplied link caption - docname, labelid = self.anonlabels.get(target, ('','')) - sectname = node.astext() - if not docname: - self.warn(node['refdoc'], 'undefined label: %s' % - target, node.line) - else: - # reference to the named label; the final node will - # contain the section name after the label - docname, labelid, sectname = self.labels.get(target, - ('','','')) - if not docname: - self.warn( - node['refdoc'], - 'undefined label: %s' % target + ' -- if you ' - 'don\'t give a link caption the label must ' - 'precede a section header.', node.line) - if docname: - newnode = nodes.reference('', '') - innernode = nodes.emphasis(sectname, sectname) - if docname == fromdocname: - newnode['refid'] = labelid - else: - # set more info in contnode; in case the - # get_relative_uri call raises NoUri, - # the builder will then have to resolve these - contnode = addnodes.pending_xref('') - contnode['refdocname'] = docname - contnode['refsectname'] = sectname - newnode['refuri'] = builder.get_relative_uri( - fromdocname, docname) - if labelid: - newnode['refuri'] += '#' + labelid - newnode.append(innernode) - else: - newnode = contnode + if node.has_key('refdomain') and node['refdomain']: + # let the domain try to resolve the reference + try: + domain = self.domains[node['refdomain']] + except KeyError: + raise NoUri + newnode = domain.resolve_xref(self, fromdocname, builder, + typ, target, node, contnode) + # really hardwired reference types elif typ == 'doc': # directly reference to document by source name; # can be absolute or relative - docname = docname_join(node['refdoc'], target) + docname = docname_join(refdoc, target) if docname not in self.all_docs: - self.warn(node['refdoc'], + self.warn(refdoc, 'unknown document: %s' % docname, node.line) - newnode = contnode + warned = True else: - if node['refcaption']: + if node['refexplicit']: # reference with explicit title caption = node.astext() else: @@ -1236,105 +1279,29 @@ class BuildEnvironment: newnode['refuri'] = builder.get_relative_uri( fromdocname, docname) newnode.append(innernode) - elif typ == 'keyword': - # keywords are referenced by named labels - docname, labelid, _ = self.labels.get(target, ('','','')) - if not docname: - #self.warn(node['refdoc'], - # 'unknown keyword: %s' % target) - newnode = contnode - else: - newnode = nodes.reference('', '') - if docname == fromdocname: - newnode['refid'] = labelid - else: - newnode['refuri'] = builder.get_relative_uri( - fromdocname, docname) + '#' + labelid - newnode.append(contnode) - elif typ == 'option': - progname = node['refprogram'] - docname, labelid = self.progoptions.get((progname, target), - ('', '')) + elif typ == 'citation': + docname, labelid = self.citations.get(target, ('', '')) if not docname: - newnode = contnode + self.warn(refdoc, + 'citation not found: %s' % target, node.line) + warned = True else: - newnode = nodes.reference('', '') - if docname == fromdocname: - newnode['refid'] = labelid - else: - newnode['refuri'] = builder.get_relative_uri( - fromdocname, docname) + '#' + labelid - newnode.append(contnode) - elif typ in reftarget_roles: - docname, labelid = self.reftargets.get((typ, target), - ('', '')) - if not docname: - if typ == 'term': - self.warn(node['refdoc'], - 'term not in glossary: %s' % target, - node.line) - elif typ == 'citation': - self.warn(node['refdoc'], - 'citation not found: %s' % target, - node.line) - newnode = contnode - else: - newnode = nodes.reference('', '') - if docname == fromdocname: - newnode['refid'] = labelid - else: - newnode['refuri'] = builder.get_relative_uri( - fromdocname, docname, typ) + '#' + labelid - newnode.append(contnode) - elif typ == 'mod' or \ - typ == 'obj' and target in self.modules: - docname, synopsis, platform, deprecated = \ - self.modules.get(target, ('','','', '')) - if not docname: - newnode = builder.app.emit_firstresult( - 'missing-reference', self, node, contnode) - if not newnode: - newnode = contnode - elif docname == fromdocname: - # don't link to self - newnode = contnode - else: - newnode = nodes.reference('', '') - newnode['refuri'] = builder.get_relative_uri( - fromdocname, docname) + '#module-' + target - newnode['reftitle'] = '%s%s%s' % ( - (platform and '(%s) ' % platform), - synopsis, (deprecated and ' (deprecated)' or '')) - newnode.append(contnode) - elif typ in self.descroles: - # "descrefs" - modname = node['modname'] - clsname = node['classname'] - searchorder = node.hasattr('refspecific') and 1 or 0 - name, desc = self.find_desc(modname, clsname, - target, typ, searchorder) - if not desc: - newnode = builder.app.emit_firstresult( - 'missing-reference', self, node, contnode) - if not newnode: - newnode = contnode - else: - newnode = nodes.reference('', '') - if desc[0] == fromdocname: - newnode['refid'] = name - else: - newnode['refuri'] = ( - builder.get_relative_uri(fromdocname, desc[0]) - + '#' + name) - newnode['reftitle'] = name - newnode.append(contnode) - else: - raise RuntimeError('unknown xfileref node encountered: %s' - % node) + newnode = make_refnode(builder, fromdocname, docname, + labelid, contnode) + # no new node found? try the missing-reference event + if newnode is None: + newnode = builder.app.emit_firstresult( + 'missing-reference', self, node, contnode) + # still not found? warn if in nit-picky mode + if newnode is None and not warned and self.config.nitpicky: + self.warn(refdoc, + 'reference target not found: %stype %s, target %s' + % (node.get('refdomain') and + 'domain %s, ' % node['refdomain'] or '', + typ, target)) except NoUri: newnode = contnode - if newnode: - node.replace_self(newnode) + node.replace_self(newnode or contnode) for node in doctree.traverse(addnodes.only): try: @@ -1498,7 +1465,7 @@ class BuildEnvironment: i += 1 # group the entries by letter - def keyfunc((k, v), letters=string.ascii_uppercase + '_'): + def keyfunc2((k, v), letters=string.ascii_uppercase + '_'): # hack: mutating the subitems dicts to a list in the keyfunc v[1] = sorted((si, se) for (si, (se, void)) in v[1].iteritems()) # now calculate the key @@ -1509,7 +1476,7 @@ class BuildEnvironment: # get all other symbols under one heading return 'Symbols' return [(key, list(group)) - for (key, group) in groupby(newlist, keyfunc)] + for (key, group) in groupby(newlist, keyfunc2)] def collect_relations(self): relations = {} @@ -1564,119 +1531,6 @@ class BuildEnvironment: if docname == self.config.master_doc: # the master file is not included anywhere ;) continue + if 'orphan' in self.metadata[docname]: + continue self.warn(docname, 'document isn\'t included in any toctree') - - # --------- QUERYING ------------------------------------------------------- - - def find_desc(self, modname, classname, name, type, searchorder=0): - """Find a description node matching "name", perhaps using - the given module and/or classname.""" - # skip parens - if name[-2:] == '()': - name = name[:-2] - - if not name: - return None, None - - # don't add module and class names for C things - if type[0] == 'c' and type not in ('class', 'const'): - # skip trailing star and whitespace - name = name.rstrip(' *') - if name in self.descrefs and self.descrefs[name][1][0] == 'c': - return name, self.descrefs[name] - return None, None - - newname = None - if searchorder == 1: - if modname and classname and \ - modname + '.' + classname + '.' + name in self.descrefs: - newname = modname + '.' + classname + '.' + name - elif modname and modname + '.' + name in self.descrefs: - newname = modname + '.' + name - elif name in self.descrefs: - newname = name - else: - if name in self.descrefs: - newname = name - elif classname and classname + '.' + name in self.descrefs: - newname = classname + '.' + name - elif modname and modname + '.' + name in self.descrefs: - newname = modname + '.' + name - elif modname and classname and \ - modname + '.' + classname + '.' + name in self.descrefs: - newname = modname + '.' + classname + '.' + name - # special case: builtin exceptions have module "exceptions" set - elif type == 'exc' and '.' not in name and \ - 'exceptions.' + name in self.descrefs: - newname = 'exceptions.' + name - # special case: object methods - elif type in ('func', 'meth') and '.' not in name and \ - 'object.' + name in self.descrefs: - newname = 'object.' + name - if newname is None: - return None, None - return newname, self.descrefs[newname] - - def find_keyword(self, keyword, avoid_fuzzy=False, cutoff=0.6, n=20): - """ - Find keyword matches for a keyword. If there's an exact match, - just return it, else return a list of fuzzy matches if avoid_fuzzy - isn't True. - - Keywords searched are: first modules, then descrefs. - - Returns: None if nothing found - (type, docname, anchorname) if exact match found - list of (quality, type, docname, anchorname, description) - if fuzzy - """ - - if keyword in self.modules: - docname, title, system, deprecated = self.modules[keyword] - return 'module', docname, 'module-' + keyword - if keyword in self.descrefs: - docname, ref_type = self.descrefs[keyword] - return ref_type, docname, keyword - # special cases - if '.' not in keyword: - # exceptions are documented in the exceptions module - if 'exceptions.'+keyword in self.descrefs: - docname, ref_type = self.descrefs['exceptions.'+keyword] - return ref_type, docname, 'exceptions.'+keyword - # special methods are documented as object methods - if 'object.'+keyword in self.descrefs: - docname, ref_type = self.descrefs['object.'+keyword] - return ref_type, docname, 'object.'+keyword - - if avoid_fuzzy: - return - - # find fuzzy matches - s = difflib.SequenceMatcher() - s.set_seq2(keyword.lower()) - - def possibilities(): - for title, (fn, desc, _, _) in self.modules.iteritems(): - yield ('module', fn, 'module-'+title, desc) - for title, (fn, desctype) in self.descrefs.iteritems(): - yield (desctype, fn, title, '') - - def dotsearch(string): - parts = string.lower().split('.') - for idx in xrange(0, len(parts)): - yield '.'.join(parts[idx:]) - - result = [] - for type, docname, title, desc in possibilities(): - best_res = 0 - for part in dotsearch(title): - s.set_seq1(part) - if s.real_quick_ratio() >= cutoff and \ - s.quick_ratio() >= cutoff and \ - s.ratio() >= cutoff and \ - s.ratio() > best_res: - best_res = s.ratio() - if best_res: - result.append((best_res, type, docname, title, desc)) - - return heapq.nlargest(n, result) diff --git a/sphinx/errors.py b/sphinx/errors.py index 4e62b1af..b614d9ab 100644 --- a/sphinx/errors.py +++ b/sphinx/errors.py @@ -50,3 +50,15 @@ class ConfigError(SphinxError): class ThemeError(SphinxError): category = 'Theme error' + + +class VersionRequirementError(SphinxError): + category = 'Sphinx version error' + + +class PycodeError(Exception): + def __str__(self): + res = self.args[0] + if len(self.args) > 1: + res += ' (exception was: %r)' % self.args[1] + return res diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 084ae155..8e5c5ce9 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -20,9 +20,11 @@ from docutils import nodes from docutils.utils import assemble_option_dict from docutils.statemachine import ViewList -from sphinx.util import rpartition, nested_parse_with_titles, force_decode +from sphinx.util import rpartition, force_decode +from sphinx.locale import _ from sphinx.pycode import ModuleAnalyzer, PycodeError from sphinx.application import ExtensionError +from sphinx.util.nodes import nested_parse_with_titles from sphinx.util.compat import Directive from sphinx.util.inspect import isdescriptor, safe_getmembers, safe_getattr from sphinx.util.docstrings import prepare_docstring @@ -72,6 +74,7 @@ class Options(dict): ALL = object() +INSTANCEATTR = object() def members_option(arg): """Used to convert the :members: option to auto directives.""" @@ -355,6 +358,16 @@ class Documenter(object): """ return None + def format_name(self): + """ + Format the name of *self.object*. This normally should be something + that can be parsed by the generated directive, but doesn't need to be + (Sphinx will display it unparsed then). + """ + # normally the name doesn't contain the module (except for module + # directives of course) + return '.'.join(self.objpath) or self.modname + def format_signature(self): """ Format the signature (arguments and return annotation) of the object. @@ -387,11 +400,10 @@ class Documenter(object): def add_directive_header(self, sig): """Add the directive header and options to the generated content.""" + domain = getattr(self, 'domain', 'py') directive = getattr(self, 'directivetype', self.objtype) - # the name to put into the generated directive -- doesn't contain - # the module (except for module directive of course) - name_in_directive = '.'.join(self.objpath) or self.modname - self.add_line(u'.. %s:: %s%s' % (directive, name_in_directive, sig), + name = self.format_name() + self.add_line(u'.. %s:%s:: %s%s' % (domain, directive, name, sig), '<autodoc>') if self.options.noindex: self.add_line(u' :noindex:', '<autodoc>') @@ -472,19 +484,30 @@ class Documenter(object): self.directive.warn('missing attribute %s in object %s' % (mname, self.fullname)) return False, ret - elif self.options.inherited_members: + + if self.options.inherited_members: # safe_getmembers() uses dir() which pulls in members from all # base classes - return False, safe_getmembers(self.object) + members = safe_getmembers(self.object) else: # __dict__ contains only the members directly defined in # the class (but get them via getattr anyway, to e.g. get # unbound method objects instead of function objects); # using keys() because apparently there are objects for which # __dict__ changes while getting attributes - return False, sorted([ - (mname, self.get_attr(self.object, mname, None)) - for mname in self.get_attr(self.object, '__dict__').keys()]) + obj_dict = self.get_attr(self.object, '__dict__') + members = [(mname, self.get_attr(self.object, mname, None)) + for mname in obj_dict.keys()] + membernames = set(m[0] for m in members) + # add instance attributes from the analyzer + if self.analyzer: + attr_docs = self.analyzer.find_attr_docs() + namespace = '.'.join(self.objpath) + for item in attr_docs.iteritems(): + if item[0][0] == namespace: + if item[0][1] not in membernames: + members.append((item[0][1], INSTANCEATTR)) + return False, sorted(members) def filter_members(self, members, want_all): """ @@ -546,9 +569,9 @@ class Documenter(object): do all members, else those given by *self.options.members*. """ # set current namespace for finding members - self.env.autodoc_current_module = self.modname + self.env.temp_data['autodoc:module'] = self.modname if self.objpath: - self.env.autodoc_current_class = self.objpath[0] + self.env.temp_data['autodoc:class'] = self.objpath[0] want_all = all_members or self.options.inherited_members or \ self.options.members is ALL @@ -576,12 +599,19 @@ class Documenter(object): '.'.join(self.objpath + [mname]) documenter = classes[-1](self.directive, full_mname, self.indent) memberdocumenters.append((documenter, isattr)) - - if (self.options.member_order or self.env.config.autodoc_member_order) \ - == 'groupwise': + member_order = self.options.member_order or \ + self.env.config.autodoc_member_order + if member_order == 'groupwise': # sort by group; relies on stable sort to keep items in the # same group sorted alphabetically - memberdocumenters.sort(key=lambda d: d[0].member_order) + memberdocumenters.sort(key=lambda e: e[0].member_order) + elif member_order == 'bysource' and self.analyzer: + # sort by source order, by virtue of the module analyzer + tagorder = self.analyzer.tagorder + def keyfunc(entry): + fullname = entry[0].name.split('::')[1] + return tagorder.get(fullname, len(tagorder)) + memberdocumenters.sort(key=keyfunc) for documenter, isattr in memberdocumenters: documenter.generate( @@ -589,8 +619,8 @@ class Documenter(object): check_module=members_check_module and not isattr) # reset current objects - self.env.autodoc_current_module = None - self.env.autodoc_current_class = None + self.env.temp_data['autodoc:module'] = None + self.env.temp_data['autodoc:class'] = None def generate(self, more_content=None, real_modname=None, check_module=False, all_members=False): @@ -743,11 +773,10 @@ class ModuleLevelDocumenter(Documenter): else: # if documenting a toplevel object without explicit module, # it can be contained in another auto directive ... - if hasattr(self.env, 'autodoc_current_module'): - modname = self.env.autodoc_current_module + modname = self.env.temp_data.get('autodoc:module') # ... or in the scope of a module directive if not modname: - modname = self.env.currmodule + modname = self.env.temp_data.get('py:module') # ... else, it stays None, which means invalid return modname, parents + [base] @@ -766,21 +795,20 @@ class ClassLevelDocumenter(Documenter): # if documenting a class-level object without path, # there must be a current class, either from a parent # auto directive ... - if hasattr(self.env, 'autodoc_current_class'): - mod_cls = self.env.autodoc_current_class + mod_cls = self.env.temp_data.get('autodoc:class') # ... or from a class directive if mod_cls is None: - mod_cls = self.env.currclass + mod_cls = self.env.temp_data.get('py:class') # ... if still None, there's no way to know if mod_cls is None: return None, [] modname, cls = rpartition(mod_cls, '.') parents = [cls] # if the module name is still missing, get it like above - if not modname and hasattr(self.env, 'autodoc_current_module'): - modname = self.env.autodoc_current_module if not modname: - modname = self.env.currmodule + modname = self.env.temp_data.get('autodoc:module') + if not modname: + modname = self.env.temp_data.get('py:module') # ... else, it stays None, which means invalid return modname, parents + [base] @@ -1032,6 +1060,34 @@ class AttributeDocumenter(ClassLevelDocumenter): pass +class InstanceAttributeDocumenter(AttributeDocumenter): + """ + Specialized Documenter subclass for attributes that cannot be imported + because they are instance attributes (e.g. assigned in __init__). + """ + objtype = 'instanceattribute' + directivetype = 'attribute' + member_order = 60 + + # must be higher than AttributeDocumenter + priority = 11 + + @classmethod + def can_document_member(cls, member, membername, isattr, parent): + """This documents only INSTANCEATTR members.""" + return isattr and (member is INSTANCEATTR) + + def import_object(self): + """Never import anything.""" + # disguise as an attribute + self.objtype = 'attribute' + return True + + def add_content(self, more_content, no_docstring=False): + """Never try to get a docstring from the object.""" + AttributeDocumenter.add_content(self, more_content, no_docstring=True) + + class AutoDirective(Directive): """ The AutoDirective class is used for all autodoc directives. It dispatches @@ -1053,6 +1109,10 @@ class AutoDirective(Directive): # a registry of type -> getattr function _special_attrgetters = {} + # flags that can be given in autodoc_default_flags + _default_flags = set(['members', 'undoc-members', 'inherited-members', + 'show-inheritance']) + # standard docutils directive settings has_content = True required_arguments = 1 @@ -1075,6 +1135,14 @@ class AutoDirective(Directive): # find out what documenter to call objtype = self.name[4:] doc_class = self._registry[objtype] + # add default flags + for flag in self._default_flags: + if flag not in doc_class.option_spec: + continue + negated = self.options.pop('no-' + flag, 'not given') is None + if flag in self.env.config.autodoc_default_flags and \ + not negated: + self.options[flag] = None # process the options with the selected documenter's option_spec self.genopt = Options(assemble_option_dict( self.options.items(), doc_class.option_spec)) @@ -1087,7 +1155,7 @@ class AutoDirective(Directive): # record all filenames as dependencies -- this will at least # partially make automatic invalidation possible for fn in self.filename_set: - self.env.note_dependency(fn) + self.state.document.settings.record_dependencies.add(fn) # use a custom reporter that correctly assigns lines to source # filename/description and lineno @@ -1128,9 +1196,11 @@ def setup(app): app.add_autodocumenter(FunctionDocumenter) app.add_autodocumenter(MethodDocumenter) app.add_autodocumenter(AttributeDocumenter) + app.add_autodocumenter(InstanceAttributeDocumenter) app.add_config_value('autoclass_content', 'class', True) app.add_config_value('autodoc_member_order', 'alphabetic', True) + app.add_config_value('autodoc_default_flags', [], True) app.add_event('autodoc-process-docstring') app.add_event('autodoc-process-signature') app.add_event('autodoc-skip-member') diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py index 0d750589..cf67c7fb 100644 --- a/sphinx/ext/autosummary/__init__.py +++ b/sphinx/ext/autosummary/__init__.py @@ -58,14 +58,12 @@ import re import sys import inspect import posixpath -from os import path from docutils.parsers.rst import directives from docutils.statemachine import ViewList from docutils import nodes -from sphinx import addnodes, roles -from sphinx.util import patfilter +from sphinx import addnodes from sphinx.util.compat import Directive @@ -101,13 +99,63 @@ def autosummary_toc_visit_html(self, node): """Hide autosummary toctree list in HTML output.""" raise nodes.SkipNode -def autosummary_toc_visit_latex(self, node): - """Show autosummary toctree (= put the referenced pages here) in Latex.""" +def autosummary_noop(self, node): pass -def autosummary_noop(self, node): + +# -- autosummary_table node ---------------------------------------------------- + +class autosummary_table(nodes.comment): pass +def autosummary_table_visit_html(self, node): + """Make the first column of the table non-breaking.""" + try: + tbody = node[0][0][-1] + for row in tbody: + col1_entry = row[0] + par = col1_entry[0] + for j, subnode in enumerate(list(par)): + if isinstance(subnode, nodes.Text): + new_text = unicode(subnode.astext()) + new_text = new_text.replace(u" ", u"\u00a0") + par[j] = nodes.Text(new_text) + except IndexError: + pass + + +# -- autodoc integration ------------------------------------------------------- + +try: + ismemberdescriptor = inspect.ismemberdescriptor + isgetsetdescriptor = inspect.isgetsetdescriptor +except AttributeError: + def ismemberdescriptor(obj): + return False + isgetsetdescriptor = ismemberdescriptor + +def get_documenter(obj): + """ + Get an autodoc.Documenter class suitable for documenting the given object + """ + import sphinx.ext.autodoc as autodoc + + if inspect.isclass(obj): + if issubclass(obj, Exception): + return autodoc.ExceptionDocumenter + return autodoc.ClassDocumenter + elif inspect.ismodule(obj): + return autodoc.ModuleDocumenter + elif inspect.ismethod(obj) or inspect.ismethoddescriptor(obj): + return autodoc.MethodDocumenter + elif (ismemberdescriptor(obj) or isgetsetdescriptor(obj) + or inspect.isdatadescriptor(obj)): + return autodoc.AttributeDocumenter + elif inspect.isroutine(obj): + return autodoc.FunctionDocumenter + else: + return autodoc.DataDocumenter + # -- .. autosummary:: ---------------------------------------------------------- @@ -125,35 +173,37 @@ class Autosummary(Directive): option_spec = { 'toctree': directives.unchanged, 'nosignatures': directives.flag, + 'template': directives.unchanged, } - def run(self): - names = [] - names += [x.strip() for x in self.content if x.strip()] + def warn(self, msg): + self.warnings.append(self.state.document.reporter.warning( + msg, line=self.lineno)) - table, warnings, real_names = get_autosummary( - names, self.state, 'nosignatures' in self.options) - node = table + def run(self): + self.env = env = self.state.document.settings.env + self.genopt = {} + self.warnings = [] - env = self.state.document.settings.env - suffix = env.config.source_suffix - all_docnames = env.found_docs.copy() - dirname = posixpath.dirname(env.docname) + names = [x.strip().split()[0] for x in self.content + if x.strip() and re.search(r'^[~a-zA-Z_]', x.strip()[0])] + items = self.get_items(names) + nodes = self.get_table(items) if 'toctree' in self.options: + suffix = env.config.source_suffix + dirname = posixpath.dirname(env.docname) + tree_prefix = self.options['toctree'].strip() docnames = [] - for name in names: - name = real_names.get(name, name) - - docname = posixpath.join(tree_prefix, name) + for name, sig, summary, real_name in items: + docname = posixpath.join(tree_prefix, real_name) if docname.endswith(suffix): docname = docname[:-len(suffix)] docname = posixpath.normpath(posixpath.join(dirname, docname)) if docname not in env.found_docs: - warnings.append(self.state.document.reporter.warning( - 'toctree references unknown document %r' % docname, - line=self.lineno)) + self.warn('toctree references unknown document %r' + % docname) docnames.append(docname) tocnode = addnodes.toctree() @@ -163,63 +213,168 @@ class Autosummary(Directive): tocnode['glob'] = None tocnode = autosummary_toc('', '', tocnode) - return warnings + [node] + [tocnode] - else: - return warnings + [node] + nodes.append(tocnode) + return self.warnings + nodes -def get_autosummary(names, state, no_signatures=False): - """ - Generate a proper table node for autosummary:: directive. + def get_items(self, names): + """ + Try to import the given names, and return a list of + ``[(name, signature, summary_string, real_name), ...]``. + """ + env = self.state.document.settings.env + + prefixes = [''] + currmodule = env.temp_data.get('py:module') + if currmodule: + prefixes.insert(0, currmodule) + + items = [] + + max_item_chars = 50 + + for name in names: + display_name = name + if name.startswith('~'): + name = name[1:] + display_name = name.split('.')[-1] + + try: + obj, real_name = import_by_name(name, prefixes=prefixes) + except ImportError: + self.warn('failed to import %s' % name) + items.append((name, '', '', name)) + continue - *names* is a list of names of Python objects to be imported and added to the - table. *document* is the Docutils document object. + # NB. using real_name here is important, since Documenters + # handle module prefixes slightly differently + documenter = get_documenter(obj)(self, real_name) + if not documenter.parse_name(): + self.warn('failed to parse name %s' % real_name) + items.append((display_name, '', '', real_name)) + continue + if not documenter.import_object(): + self.warn('failed to import object %s' % real_name) + items.append((display_name, '', '', real_name)) + continue + + # -- Grab the signature + + sig = documenter.format_signature() + if not sig: + sig = '' + else: + max_chars = max(10, max_item_chars - len(display_name)) + sig = mangle_signature(sig, max_chars=max_chars) + sig = sig.replace('*', r'\*') + # -- Grab the summary + + doc = list(documenter.process_doc(documenter.get_doc())) + + while doc and not doc[0].strip(): + doc.pop(0) + m = re.search(r"^([A-Z][^A-Z]*?\.\s)", " ".join(doc).strip()) + if m: + summary = m.group(1).strip() + elif doc: + summary = doc[0].strip() + else: + summary = '' + + items.append((display_name, sig, summary, real_name)) + + return items + + def get_table(self, items): + """ + Generate a proper list of table nodes for autosummary:: directive. + + *items* is a list produced by :meth:`get_items`. + """ + table_spec = addnodes.tabular_col_spec() + table_spec['spec'] = 'LL' + + table = autosummary_table('') + real_table = nodes.table('') + table.append(real_table) + group = nodes.tgroup('', cols=2) + real_table.append(group) + group.append(nodes.colspec('', colwidth=10)) + group.append(nodes.colspec('', colwidth=90)) + body = nodes.tbody('') + group.append(body) + + def append_row(*column_texts): + row = nodes.row('') + for text in column_texts: + node = nodes.paragraph('') + vl = ViewList() + vl.append(text, '<autosummary>') + self.state.nested_parse(vl, 0, node) + try: + if isinstance(node[0], nodes.paragraph): + node = node[0] + except IndexError: + pass + row.append(nodes.entry('', node)) + body.append(row) + + for name, sig, summary, real_name in items: + qualifier = 'obj' + if 'nosignatures' not in self.options: + col1 = ':%s:`%s <%s>`\ %s' % (qualifier, name, real_name, sig) + else: + col1 = ':%s:`%s <%s>`' % (qualifier, name, real_name) + col2 = summary + append_row(col1, col2) + + return [table_spec, table] + +def mangle_signature(sig, max_chars=30): + """Reformat a function signature to a more compact form.""" + sig = re.sub(r"^\((.*)\)$", r"\1", sig) + ", " + r = re.compile(r"(?P<name>[a-zA-Z0-9_*]+)(?P<default>=.*?)?, ") + items = r.findall(sig) + + args = [name for name, default in items if not default] + opts = [name for name, default in items if default] + + sig = limited_join(", ", args, max_chars=max_chars-2) + if opts: + if not sig: + sig = "[%s]" % limited_join(", ", opts, max_chars=max_chars-4) + elif len(sig) < max_chars - 4 - 2 - 3: + sig += "[, %s]" % limited_join(", ", opts, + max_chars=max_chars-len(sig)-4-2) + + return u"(%s)" % sig + +def limited_join(sep, items, max_chars=30, overflow_marker="..."): """ - document = state.document - - real_names = {} - warnings = [] - - prefixes = [''] - prefixes.insert(0, document.settings.env.currmodule) - - table = nodes.table('') - group = nodes.tgroup('', cols=2) - table.append(group) - group.append(nodes.colspec('', colwidth=30)) - group.append(nodes.colspec('', colwidth=70)) - body = nodes.tbody('') - group.append(body) - - def append_row(*column_texts): - row = nodes.row('') - for text in column_texts: - node = nodes.paragraph('') - vl = ViewList() - vl.append(text, '<autosummary>') - state.nested_parse(vl, 0, node) - row.append(nodes.entry('', node)) - body.append(row) - - for name in names: - try: - obj, real_name = import_by_name(name, prefixes=prefixes) - except ImportError: - warnings.append(document.reporter.warning( - 'failed to import %s' % name)) - append_row(':obj:`%s`' % name, '') - continue + Join a number of strings to one, limiting the length to *max_chars*. + + If the string overflows this limit, replace the last fitting item by + *overflow_marker*. - real_names[name] = real_name + Returns: joined_string + """ + full_str = sep.join(items) + if len(full_str) < max_chars: + return full_str + + n_chars = 0 + n_items = 0 + for j, item in enumerate(items): + n_chars += len(item) + len(sep) + if n_chars < max_chars - len(overflow_marker): + n_items += 1 + else: + break - title = '' - qualifier = 'obj' - col1 = ':'+qualifier+':`%s <%s>`' % (name, real_name) - col2 = title - append_row(col1, col2) + return sep.join(list(items[:n_items]) + [overflow_marker]) - return table, warnings, real_names +# -- Importing items ----------------------------------------------------------- def import_by_name(name, prefixes=[None]): """ @@ -241,14 +396,16 @@ def import_by_name(name, prefixes=[None]): def _import_by_name(name): """Import a Python object given its full name.""" try: - # try first interpret `name` as MODNAME.OBJ name_parts = name.split('.') - try: - modname = '.'.join(name_parts[:-1]) - __import__(modname) - return getattr(sys.modules[modname], name_parts[-1]) - except (ImportError, IndexError, AttributeError): - pass + + # try first interpret `name` as MODNAME.OBJ + modname = '.'.join(name_parts[:-1]) + if modname: + try: + __import__(modname) + return getattr(sys.modules[modname], name_parts[-1]) + except (ImportError, IndexError, AttributeError): + pass # ... then as MODNAME, MODNAME.OBJ1, MODNAME.OBJ1.OBJ2, ... last_j = 0 @@ -284,8 +441,9 @@ def autolink_role(typ, rawtext, etext, lineno, inliner, Expands to ':obj:`text`' if `text` is an object that can be imported; otherwise expands to '*text*'. """ - r = roles.xfileref_role('obj', rawtext, etext, lineno, inliner, - options, content) + env = inliner.document.settings.env + r = env.get_domain('py').role('obj')( + 'obj', rawtext, etext, lineno, inliner, options, content) pnode = r[0][0] prefixes = [None] @@ -301,16 +459,25 @@ def autolink_role(typ, rawtext, etext, lineno, inliner, def process_generate_options(app): genfiles = app.config.autosummary_generate + + ext = app.config.source_suffix + + if genfiles and not hasattr(genfiles, '__len__'): + env = app.builder.env + genfiles = [x + ext for x in env.found_docs + if os.path.isfile(env.doc2path(x))] + if not genfiles: return + from sphinx.ext.autosummary.generate import generate_autosummary_docs - ext = app.config.source_suffix - genfiles = [path.join(app.srcdir, genfile + - (not genfile.endswith(ext) and ext or '')) + genfiles = [genfile + (not genfile.endswith(ext) and ext or '') for genfile in genfiles] - generate_autosummary_docs(genfiles, warn=app.warn, info=app.info, - suffix=ext) + + generate_autosummary_docs(genfiles, builder=app.builder, + warn=app.warn, info=app.info, suffix=ext, + base_path=app.srcdir) def setup(app): @@ -318,8 +485,14 @@ def setup(app): app.setup_extension('sphinx.ext.autodoc') app.add_node(autosummary_toc, html=(autosummary_toc_visit_html, autosummary_noop), - latex=(autosummary_toc_visit_latex, autosummary_noop), - text=(autosummary_noop, autosummary_noop)) + latex=(autosummary_noop, autosummary_noop), + text=(autosummary_noop, autosummary_noop), + man=(autosummary_noop, autosummary_noop)) + app.add_node(autosummary_table, + html=(autosummary_table_visit_html, autosummary_noop), + latex=(autosummary_noop, autosummary_noop), + text=(autosummary_noop, autosummary_noop), + man=(autosummary_noop, autosummary_noop)) app.add_directive('autosummary', Autosummary) app.add_role('autolink', autolink_role) app.connect('doctree-read', process_autosummary_toc) diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py index 26cf1a7c..66a124d2 100644 --- a/sphinx/ext/autosummary/generate.py +++ b/sphinx/ext/autosummary/generate.py @@ -20,219 +20,289 @@ import os import re import sys -import getopt -import inspect +import pydoc +import optparse -from jinja2 import Environment, PackageLoader +from jinja2 import FileSystemLoader, TemplateNotFound +from jinja2.sandbox import SandboxedEnvironment -from sphinx.ext.autosummary import import_by_name -from sphinx.util import ensuredir +from sphinx.ext.autosummary import import_by_name, get_documenter +from sphinx.jinja2glue import BuiltinTemplateLoader +from sphinx.util.osutil import ensuredir -# create our own templating environment, for module template only -env = Environment(loader=PackageLoader('sphinx.ext.autosummary', 'templates')) +def main(argv=sys.argv): + usage = """%prog [OPTIONS] SOURCEFILE ...""" + p = optparse.OptionParser(usage.strip()) + p.add_option("-o", "--output-dir", action="store", type="string", + dest="output_dir", default=None, + help="Directory to place all output in") + p.add_option("-s", "--suffix", action="store", type="string", + dest="suffix", default="rst", + help="Default suffix for files (default: %default)") + p.add_option("-t", "--templates", action="store", type="string", + dest="templates", default=None, + help="Custom template directory (default: %default)") + options, args = p.parse_args(argv[1:]) + + if len(args) < 1: + p.error('no input files given') + generate_autosummary_docs(args, options.output_dir, + "." + options.suffix, + template_dir=options.templates) def _simple_info(msg): print msg def _simple_warn(msg): - print >>sys.stderr, 'WARNING: ' + msg + print >> sys.stderr, 'WARNING: ' + msg + +# -- Generating output --------------------------------------------------------- + +def generate_autosummary_docs(sources, output_dir=None, suffix='.rst', + warn=_simple_warn, info=_simple_info, + base_path=None, builder=None, template_dir=None): + + showed_sources = list(sorted(sources)) + if len(showed_sources) > 20: + showed_sources = showed_sources[:10] + ['...'] + showed_sources[-10:] + info('[autosummary] generating autosummary for: %s' % + ', '.join(showed_sources)) -def generate_autosummary_docs(sources, output_dir=None, suffix=None, - warn=_simple_warn, info=_simple_info): - info('generating autosummary for: %s' % ', '.join(sources)) if output_dir: - info('writing to %s' % output_dir) + info('[autosummary] writing to %s' % output_dir) + + if base_path is not None: + sources = [os.path.join(base_path, filename) for filename in sources] + + # create our own templating environment + template_dirs = [os.path.join(os.path.dirname(__file__), 'templates')] + if builder is not None: + # allow the user to override the templates + template_loader = BuiltinTemplateLoader() + template_loader.init(builder, dirs=template_dirs) + else: + if template_dir: + template_dirs.insert(0, template_dir) + template_loader = FileSystemLoader(template_dirs) + template_env = SandboxedEnvironment(loader=template_loader) + # read - names = {} - for name, loc in get_documented(sources).items(): - for (filename, sec_title, keyword, toctree) in loc: - if toctree is not None: - path = os.path.join(os.path.dirname(filename), toctree) - names[name] = os.path.abspath(path) + items = find_autosummary_in_files(sources) + + # remove possible duplicates + items = dict([(item, True) for item in items]).keys() + + # keep track of new files + new_files = [] # write - for name, path in sorted(names.items()): - path = output_dir or path + for name, path, template_name in sorted(items): + if path is None: + # The corresponding autosummary:: directive did not have + # a :toctree: option + continue + + path = output_dir or os.path.abspath(path) ensuredir(path) try: obj, name = import_by_name(name) except ImportError, e: - warn('failed to import %r: %s' % (name, e)) + warn('[autosummary] failed to import %r: %s' % (name, e)) continue - fn = os.path.join(path, name + (suffix or '.rst')) + fn = os.path.join(path, name + suffix) + # skip it if it exists if os.path.isfile(fn): continue + new_files.append(fn) + f = open(fn, 'w') try: - if inspect.ismodule(obj): - # XXX replace this with autodoc's API? - tmpl = env.get_template('module') - functions = [getattr(obj, item).__name__ - for item in dir(obj) - if inspect.isfunction(getattr(obj, item))] - classes = [getattr(obj, item).__name__ - for item in dir(obj) - if inspect.isclass(getattr(obj, item)) - and not issubclass(getattr(obj, item), Exception)] - exceptions = [getattr(obj, item).__name__ - for item in dir(obj) - if inspect.isclass(getattr(obj, item)) - and issubclass(getattr(obj, item), Exception)] - rendered = tmpl.render(name=name, - underline='='*len(name), - functions=functions, - classes=classes, - exceptions=exceptions, - len_functions=len(functions), - len_classes=len(classes), - len_exceptions=len(exceptions)) - f.write(rendered) + doc = get_documenter(obj) + + if template_name is not None: + template = template_env.get_template(template_name) else: - f.write('%s\n%s\n\n' % (name, '='*len(name))) - - if inspect.isclass(obj): - if issubclass(obj, Exception): - f.write(format_modulemember(name, 'autoexception')) - else: - f.write(format_modulemember(name, 'autoclass')) - elif inspect.ismethod(obj) or inspect.ismethoddescriptor(obj): - f.write(format_classmember(name, 'automethod')) - elif callable(obj): - f.write(format_modulemember(name, 'autofunction')) - elif hasattr(obj, '__get__'): - f.write(format_classmember(name, 'autoattribute')) - else: - f.write(format_modulemember(name, 'autofunction')) - finally: - f.close() + try: + template = template_env.get_template('autosummary/%s.rst' + % doc.objtype) + except TemplateNotFound: + template = template_env.get_template('autosummary/base.rst') + + def get_members(obj, typ, include_public=[]): + items = [ + name for name in dir(obj) + if get_documenter(getattr(obj, name)).objtype == typ + ] + public = [x for x in items + if x in include_public or not x.startswith('_')] + return public, items + + ns = {} + + if doc.objtype == 'module': + ns['members'] = dir(obj) + ns['functions'], ns['all_functions'] = \ + get_members(obj, 'function') + ns['classes'], ns['all_classes'] = \ + get_members(obj, 'class') + ns['exceptions'], ns['all_exceptions'] = \ + get_members(obj, 'exception') + elif doc.objtype == 'class': + ns['members'] = dir(obj) + ns['methods'], ns['all_methods'] = \ + get_members(obj, 'method', ['__init__']) + ns['attributes'], ns['all_attributes'] = \ + get_members(obj, 'attribute') + + parts = name.split('.') + if doc.objtype in ('method', 'attribute'): + mod_name = '.'.join(parts[:-2]) + cls_name = parts[-2] + obj_name = '.'.join(parts[-2:]) + ns['class'] = cls_name + else: + mod_name, obj_name = '.'.join(parts[:-1]), parts[-1] + ns['fullname'] = name + ns['module'] = mod_name + ns['objname'] = obj_name + ns['name'] = parts[-1] -def format_modulemember(name, directive): - parts = name.split('.') - mod, name = '.'.join(parts[:-1]), parts[-1] - return '.. currentmodule:: %s\n\n.. %s:: %s\n' % (mod, directive, name) + ns['objtype'] = doc.objtype + ns['underline'] = len(name) * '=' + rendered = template.render(**ns) + f.write(rendered) + finally: + f.close() -def format_classmember(name, directive): - parts = name.split('.') - mod, name = '.'.join(parts[:-2]), '.'.join(parts[-2:]) - return '.. currentmodule:: %s\n\n.. %s:: %s\n' % (mod, directive, name) + # descend recursively to new files + if new_files: + generate_autosummary_docs(new_files, output_dir=output_dir, + suffix=suffix, warn=warn, info=info, + base_path=base_path, builder=builder, + template_dir=template_dir) -title_underline_re = re.compile('^[-=*_^#]{3,}\s*$') -autodoc_re = re.compile(r'.. auto(function|method|attribute|class|exception' - '|module)::\s*([A-Za-z0-9_.]+)\s*$') -autosummary_re = re.compile(r'^\.\.\s+autosummary::\s*') -module_re = re.compile(r'^\.\.\s+(current)?module::\s*([a-zA-Z0-9_.]+)\s*$') -autosummary_item_re = re.compile(r'^\s+([_a-zA-Z][a-zA-Z0-9_.]*)\s*') -toctree_arg_re = re.compile(r'^\s+:toctree:\s*(.*?)\s*$') +# -- Finding documented entries in files --------------------------------------- -def get_documented(filenames): +def find_autosummary_in_files(filenames): """ - Find out what items are documented in the given filenames. - - Returns a dict of list of (filename, title, keyword, toctree) Keys are - documented names of objects. The value is a list of locations where the - object was documented. Each location is a tuple of filename, the current - section title, the name of the directive, and the value of the :toctree: - argument (if present) of the directive. + Find out what items are documented in source/*.rst. + See `find_autosummary_in_lines`. """ - - documented = {} - + documented = [] for filename in filenames: - current_title = [] - last_line = None - toctree = None - current_module = None - in_autosummary = False - f = open(filename, 'r') - for line in f: - try: - if in_autosummary: - m = toctree_arg_re.match(line) - if m: - toctree = m.group(1) - continue - - if line.strip().startswith(':'): - continue # skip options - - m = autosummary_item_re.match(line) - - if m: - name = m.group(1).strip() - if current_module and \ - not name.startswith(current_module + '.'): - name = '%s.%s' % (current_module, name) - documented.setdefault(name, []).append( - (filename, current_title, 'autosummary', toctree)) - continue - if line.strip() == '': - continue - in_autosummary = False - - m = autosummary_re.match(line) - if m: - in_autosummary = True - continue - - m = autodoc_re.search(line) - if m: - name = m.group(2).strip() - # XXX look in newer generate.py - if current_module and \ - not name.startswith(current_module + '.'): - name = '%s.%s' % (current_module, name) - if m.group(1) == 'module': - current_module = name - documented.setdefault(name, []).append( - (filename, current_title, 'auto' + m.group(1), None)) - continue - - m = title_underline_re.match(line) - if m and last_line: - current_title = last_line.strip() - continue - - m = module_re.match(line) - if m: - current_module = m.group(2) - continue - finally: - last_line = line + lines = f.read().splitlines() + documented.extend(find_autosummary_in_lines(lines, filename=filename)) + f.close() return documented - -def main(argv=sys.argv): - usage = 'usage: %s [-o output_dir] [-s suffix] sourcefile ...' % sys.argv[0] +def find_autosummary_in_docstring(name, module=None, filename=None): + """ + Find out what items are documented in the given object's docstring. + See `find_autosummary_in_lines`. + """ try: - opts, args = getopt.getopt(argv[1:], 'o:s:') - except getopt.error: - print >>sys.stderr, usage - return 1 - - output_dir = None - suffix = None - for opt, val in opts: - if opt == '-o': - output_dir = val - elif opt == '-s': - suffix = val + obj, real_name = import_by_name(name) + lines = pydoc.getdoc(obj).splitlines() + return find_autosummary_in_lines(lines, module=name, filename=filename) + except AttributeError: + pass + except ImportError, e: + print "Failed to import '%s': %s" % (name, e) + return [] + +def find_autosummary_in_lines(lines, module=None, filename=None): + """ + Find out what items appear in autosummary:: directives in the given lines. + + Returns a list of (name, toctree, template) where *name* is a name + of an object and *toctree* the :toctree: path of the corresponding + autosummary directive (relative to the root of the file name), and + *template* the value of the :template: option. *toctree* and + *template* ``None`` if the directive does not have the + corresponding options set. + """ + autosummary_re = re.compile(r'^\s*\.\.\s+autosummary::\s*') + automodule_re = re.compile( + r'^\s*\.\.\s+automodule::\s*([A-Za-z0-9_.]+)\s*$') + module_re = re.compile( + r'^\s*\.\.\s+(current)?module::\s*([a-zA-Z0-9_.]+)\s*$') + autosummary_item_re = re.compile(r'^\s+(~?[_a-zA-Z][a-zA-Z0-9_.]*)\s*.*?') + toctree_arg_re = re.compile(r'^\s+:toctree:\s*(.*?)\s*$') + template_arg_re = re.compile(r'^\s+:template:\s*(.*?)\s*$') + + documented = [] + + toctree = None + template = None + current_module = module + in_autosummary = False + + for line in lines: + if in_autosummary: + m = toctree_arg_re.match(line) + if m: + toctree = m.group(1) + if filename: + toctree = os.path.join(os.path.dirname(filename), + toctree) + continue + + m = template_arg_re.match(line) + if m: + template = m.group(1).strip() + continue + + if line.strip().startswith(':'): + continue # skip options + + m = autosummary_item_re.match(line) + if m: + name = m.group(1).strip() + if name.startswith('~'): + name = name[1:] + if current_module and \ + not name.startswith(current_module + '.'): + name = "%s.%s" % (current_module, name) + documented.append((name, toctree, template)) + continue + + if not line.strip(): + continue + + in_autosummary = False + + m = autosummary_re.match(line) + if m: + in_autosummary = True + toctree = None + template = None + continue - if len(args) < 1: - print >>sys.stderr, usage - return 1 + m = automodule_re.search(line) + if m: + current_module = m.group(1).strip() + # recurse into the automodule docstring + documented.extend(find_autosummary_in_docstring( + current_module, filename=filename)) + continue + + m = module_re.match(line) + if m: + current_module = m.group(2) + continue - generate_autosummary_docs(args, output_dir, suffix) + return documented if __name__ == '__main__': - main(sys.argv) + main() diff --git a/sphinx/ext/autosummary/templates/autosummary/base.rst b/sphinx/ext/autosummary/templates/autosummary/base.rst new file mode 100644 index 00000000..21a0ccd8 --- /dev/null +++ b/sphinx/ext/autosummary/templates/autosummary/base.rst @@ -0,0 +1,6 @@ +{{ fullname }} +{{ underline }} + +.. currentmodule:: {{ module }} + +.. auto{{ objtype }}:: {{ objname }} diff --git a/sphinx/ext/autosummary/templates/autosummary/class.rst b/sphinx/ext/autosummary/templates/autosummary/class.rst new file mode 100644 index 00000000..40494dad --- /dev/null +++ b/sphinx/ext/autosummary/templates/autosummary/class.rst @@ -0,0 +1,30 @@ +{{ fullname }} +{{ underline }} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + + {% block methods %} + .. automethod:: __init__ + + {% if methods %} + .. rubric:: Methods + + .. autosummary:: + {% for item in methods %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block attributes %} + {% if attributes %} + .. rubric:: Attributes + + .. autosummary:: + {% for item in attributes %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} diff --git a/sphinx/ext/autosummary/templates/autosummary/module.rst b/sphinx/ext/autosummary/templates/autosummary/module.rst new file mode 100644 index 00000000..c14456ba --- /dev/null +++ b/sphinx/ext/autosummary/templates/autosummary/module.rst @@ -0,0 +1,37 @@ +{{ fullname }} +{{ underline }} + +.. automodule:: {{ fullname }} + + {% block functions %} + {% if functions %} + .. rubric:: Functions + + .. autosummary:: + {% for item in functions %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block classes %} + {% if classes %} + .. rubric:: Classes + + .. autosummary:: + {% for item in classes %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block exceptions %} + {% if exceptions %} + .. rubric:: Exceptions + + .. autosummary:: + {% for item in exceptions %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} diff --git a/sphinx/ext/autosummary/templates/module b/sphinx/ext/autosummary/templates/module deleted file mode 100644 index 0cbc8266..00000000 --- a/sphinx/ext/autosummary/templates/module +++ /dev/null @@ -1,39 +0,0 @@ -:mod:`{{name}}` -======{{ underline }}= - - -.. automodule:: {{name}} - -{% if len_functions > 0 %} -Functions ----------- -{% for item in functions %} -.. autofunction:: {{item}} -{% endfor %} -{% endif %} - -{% if len_classes > 0 %} -Classes --------- -{% for item in classes %} -.. autoclass:: {{item}} - :show-inheritance: - :members: - :inherited-members: - :undoc-members: - -{% endfor %} -{% endif %} - -{% if len_exceptions > 0 %} -Exceptions ------------- -{% for item in exceptions %} -.. autoclass:: {{item}} - :show-inheritance: - :members: - :inherited-members: - :undoc-members: - -{% endfor %} -{% endif %} diff --git a/sphinx/ext/coverage.py b/sphinx/ext/coverage.py index 0d2487f0..4924d30b 100644 --- a/sphinx/ext/coverage.py +++ b/sphinx/ext/coverage.py @@ -79,6 +79,7 @@ class CoverageBuilder(Builder): def build_c_coverage(self): # Fetch all the info from the header files + c_objects = self.env.domaindata['c']['objects'] for filename in self.c_sourcefiles: undoc = [] f = open(filename, 'r') @@ -88,7 +89,7 @@ class CoverageBuilder(Builder): match = regex.match(line) if match: name = match.groups()[0] - if name not in self.env.descrefs: + if name not in c_objects: for exp in self.c_ignorexps.get(key, ()): if exp.match(name): break @@ -116,7 +117,10 @@ class CoverageBuilder(Builder): op.close() def build_py_coverage(self): - for mod_name in self.env.modules: + objects = self.env.domaindata['py']['objects'] + modules = self.env.domaindata['py']['modules'] + + for mod_name in modules: ignore = False for exp in self.mod_ignorexps: if exp.match(mod_name): @@ -151,7 +155,7 @@ class CoverageBuilder(Builder): full_name = '%s.%s' % (mod_name, name) if inspect.isfunction(obj): - if full_name not in self.env.descrefs: + if full_name not in objects: for exp in self.fun_ignorexps: if exp.match(name): break @@ -162,7 +166,7 @@ class CoverageBuilder(Builder): if exp.match(name): break else: - if full_name not in self.env.descrefs: + if full_name not in objects: # not documented at all classes[name] = [] continue @@ -176,7 +180,7 @@ class CoverageBuilder(Builder): continue full_attr_name = '%s.%s' % (full_name, attr_name) - if full_attr_name not in self.env.descrefs: + if full_attr_name not in objects: attrs.append(attr_name) if attrs: diff --git a/sphinx/ext/extlinks.py b/sphinx/ext/extlinks.py new file mode 100644 index 00000000..36f4d697 --- /dev/null +++ b/sphinx/ext/extlinks.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +""" + sphinx.ext.extlinks + ~~~~~~~~~~~~~~~~~~~ + + Extension to save typing and prevent hard-coding of base URLs in the reST + files. + + This adds a new config value called ``extlinks`` that is created like this:: + + extlinks = {'exmpl': ('http://example.com/%s.html', prefix), ...} + + Now you can use e.g. :exmpl:`foo` in your documents. This will create a + link to ``http://example.com/foo.html``. The link caption depends on the + *prefix* value given: + + - If it is ``None``, the caption will be the full URL. + - If it is a string (empty or not), the caption will be the prefix prepended + to the role content. + + You can also give an explicit caption, e.g. :exmpl:`Foo <foo>`. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from docutils import nodes, utils + +from sphinx.util.nodes import split_explicit_title + + +def make_link_role(base_url, prefix): + def role(typ, rawtext, text, lineno, inliner, options={}, content=[]): + text = utils.unescape(text) + has_explicit_title, title, part = split_explicit_title(text) + try: + full_url = base_url % part + except (TypeError, ValueError): + env = inliner.document.settings.env + env.warn(env.docname, 'unable to expand %s extlink with base ' + 'URL %r, please make sure the base contains \'%%s\' ' + 'exactly once' % (typ, base_url)) + full_url = base_url + part + if not has_explicit_title: + if prefix is None: + title = full_url + else: + title = prefix + part + pnode = nodes.reference(title, title, refuri=full_url) + return [pnode], [] + return role + +def setup_link_roles(app): + for name, (base_url, prefix) in app.config.extlinks.iteritems(): + app.add_role(name, make_link_role(base_url, prefix)) + +def setup(app): + app.add_config_value('extlinks', {}, 'env') + app.connect('builder-inited', setup_link_roles) diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py index b7cf93d2..106de7a6 100644 --- a/sphinx/ext/graphviz.py +++ b/sphinx/ext/graphviz.py @@ -13,6 +13,7 @@ import re import posixpath from os import path +from math import ceil from subprocess import Popen, PIPE try: from hashlib import sha1 as sha @@ -20,13 +21,15 @@ except ImportError: from sha import sha from docutils import nodes +from docutils.parsers.rst import directives from sphinx.errors import SphinxError -from sphinx.util import ensuredir, ENOENT, EPIPE +from sphinx.util.osutil import ensuredir, ENOENT, EPIPE from sphinx.util.compat import Directive mapname_re = re.compile(r'<map id="(.*?)"') +svg_dim_re = re.compile(r'<svg\swidth="(\d+)pt"\sheight="(\d+)pt"', re.M) class GraphvizError(SphinxError): @@ -45,7 +48,9 @@ class Graphviz(Directive): required_arguments = 0 optional_arguments = 0 final_argument_whitespace = False - option_spec = {} + option_spec = { + 'alt': directives.unchanged, + } def run(self): dotcode = '\n'.join(self.content) @@ -56,6 +61,8 @@ class Graphviz(Directive): node = graphviz() node['code'] = dotcode node['options'] = [] + if 'alt' in self.options: + node['alt'] = self.options['alt'] return [node] @@ -67,13 +74,17 @@ class GraphvizSimple(Directive): required_arguments = 1 optional_arguments = 0 final_argument_whitespace = False - option_spec = {} + option_spec = { + 'alt': directives.unchanged, + } def run(self): node = graphviz() node['code'] = '%s %s {\n%s\n}\n' % \ (self.name, self.arguments[0], '\n'.join(self.content)) node['options'] = [] + if 'alt' in self.options: + node['alt'] = self.options['alt'] return [node] @@ -139,10 +150,45 @@ def render_dot(self, code, options, format, prefix='graphviz'): return relfn, outfn +def get_svg_tag(svgref, svgfile, imgcls=None): + # Webkit can't figure out svg dimensions when using object tag + # so we need to get it from the svg file + fp = open(svgfile, 'r') + try: + for line in fp: + match = svg_dim_re.match(line) + if match: + dimensions = match.groups() + break + else: + dimensions = None + finally: + fp.close() + + # We need this hack to make WebKit show our object tag properly + def pt2px(x): + return int(ceil((96.0/72.0) * float(x))) + + if dimensions: + style = ' width="%s" height="%s"' % tuple(map(pt2px, dimensions)) + else: + style = '' + + # The object tag works fine on Firefox and WebKit + # Besides it's a hack, this strategy does not mess with templates. + imgcss = imgcls and ' class="%s"' % imgcls or '' + return '<object type="image/svg+xml" data="%s"%s%s/>\n' % \ + (svgref, imgcss, style) + + def render_dot_html(self, node, code, options, prefix='graphviz', imgcls=None, alt=None): + format = self.builder.config.graphviz_output_format try: - fname, outfn = render_dot(self, code, options, 'png', prefix) + if format not in ('png', 'svg'): + raise GraphvizError("graphviz_output_format must be one of 'png', " + "'svg', but is %r" % format) + fname, outfn = render_dot(self, code, options, format, prefix) except GraphvizError, exc: self.builder.warn('dot code %r: ' % code + str(exc)) raise nodes.SkipNode @@ -151,24 +197,29 @@ def render_dot_html(self, node, code, options, prefix='graphviz', if fname is None: self.body.append(self.encode(code)) else: - mapfile = open(outfn + '.map', 'rb') - try: - imgmap = mapfile.readlines() - finally: - mapfile.close() - imgcss = imgcls and 'class="%s"' % imgcls or '' if alt is None: - alt = self.encode(code).strip() - if len(imgmap) == 2: - # nothing in image map (the lines are <map> and </map>) - self.body.append('<img src="%s" alt="%s" %s/>\n' % - (fname, alt, imgcss)) + alt = node.get('alt', self.encode(code).strip()) + if format == 'svg': + svgtag = get_svg_tag(fname, outfn, imgcls) + self.body.append(svgtag) else: - # has a map: get the name of the map and connect the parts - mapname = mapname_re.match(imgmap[0]).group(1) - self.body.append('<img src="%s" alt="%s" usemap="#%s" %s/>\n' % - (fname, alt, mapname, imgcss)) - self.body.extend(imgmap) + mapfile = open(outfn + '.map', 'rb') + try: + imgmap = mapfile.readlines() + finally: + mapfile.close() + imgcss = imgcls and 'class="%s"' % imgcls or '' + if len(imgmap) == 2: + # nothing in image map (the lines are <map> and </map>) + self.body.append('<img src="%s" alt="%s" %s/>\n' % + (fname, alt, imgcss)) + else: + # has a map: get the name of the map and connect the parts + mapname = mapname_re.match(imgmap[0]).group(1) + self.body.append('<img src="%s" alt="%s" usemap="#%s" %s/>\n' % + (fname, alt, mapname, imgcss)) + self.body.extend(imgmap) + self.body.append('</p>\n') raise nodes.SkipNode @@ -201,3 +252,4 @@ def setup(app): app.add_directive('digraph', GraphvizSimple) app.add_config_value('graphviz_dot', 'dot', 'html') app.add_config_value('graphviz_dot_args', [], 'html') + app.add_config_value('graphviz_output_format', 'png', 'html') diff --git a/sphinx/ext/ifconfig.py b/sphinx/ext/ifconfig.py index 8129a8e1..cdb6e2c3 100644 --- a/sphinx/ext/ifconfig.py +++ b/sphinx/ext/ifconfig.py @@ -41,7 +41,8 @@ class IfConfig(Directive): node.document = self.state.document node.line = self.lineno node['expr'] = self.arguments[0] - self.state.nested_parse(self.content, self.content_offset, node) + self.state.nested_parse(self.content, self.content_offset, + node, match_titles=1) return [node] diff --git a/sphinx/ext/inheritance_diagram.py b/sphinx/ext/inheritance_diagram.py index a271e101..b930d8ca 100644 --- a/sphinx/ext/inheritance_diagram.py +++ b/sphinx/ext/inheritance_diagram.py @@ -47,7 +47,6 @@ except ImportError: from docutils import nodes from docutils.parsers.rst import directives -from sphinx.roles import xfileref_role from sphinx.ext.graphviz import render_dot_html, render_dot_latex from sphinx.util.compat import Directive @@ -97,7 +96,7 @@ class InheritanceGraph(object): # two possibilities: either it is a module, then import it try: - module = __import__(fullname) + __import__(fullname) todoc = sys.modules[fullname] except ImportError: # else it is a class, then import the module @@ -110,7 +109,7 @@ class InheritanceGraph(object): 'Could not import class %r specified for ' 'inheritance diagram' % base) try: - module = __import__(path) + __import__(path) todoc = getattr(sys.modules[path], base) except (ImportError, AttributeError): raise InheritanceException( @@ -280,10 +279,12 @@ class InheritanceDiagram(Directive): node.document = self.state.document env = self.state.document.settings.env class_names = self.arguments[0].split() + class_role = env.get_domain('py').role('class') # Create a graph starting with the list of classes try: - graph = InheritanceGraph(class_names, env.currmodule) + graph = InheritanceGraph(class_names, + env.temp_data.get('py:module')) except InheritanceException, err: return [node.document.reporter.warning(err.args[0], line=self.lineno)] @@ -293,7 +294,7 @@ class InheritanceDiagram(Directive): # references to real URLs later. These nodes will eventually be # removed from the doctree after we're done with them. for name in graph.get_all_class_names(): - refnodes, x = xfileref_role( + refnodes, x = class_role( 'class', ':class:`%s`' % name, name, 0, self.state) node.extend(refnodes) # Store the graph object so we can use it to generate the @@ -360,7 +361,8 @@ def setup(app): inheritance_diagram, latex=(latex_visit_inheritance_diagram, None), html=(html_visit_inheritance_diagram, None), - text=(skip, None)) + text=(skip, None), + man=(skip, None)) app.add_directive('inheritance-diagram', InheritanceDiagram) app.add_config_value('inheritance_graph_attrs', {}, False), app.add_config_value('inheritance_node_attrs', {}, False), diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py index e20cc266..67773009 100644 --- a/sphinx/ext/intersphinx.py +++ b/sphinx/ext/intersphinx.py @@ -3,17 +3,17 @@ sphinx.ext.intersphinx ~~~~~~~~~~~~~~~~~~~~~~ - Insert links to Python objects documented in remote Sphinx documentation. + Insert links to objects documented in remote Sphinx documentation. This works as follows: - * Each Sphinx HTML build creates a file named "objects.inv" that contains - a mapping from Python identifiers to URIs relative to the HTML set's root. + * Each Sphinx HTML build creates a file named "objects.inv" that contains a + mapping from object names to URIs relative to the HTML set's root. * Projects using the Intersphinx extension can specify links to such mapping files in the `intersphinx_mapping` config value. The mapping will then be - used to resolve otherwise missing references to Python objects into links - to the other documentation. + used to resolve otherwise missing references to objects into links to the + other documentation. * By default, the mapping file is assumed to be at the same location as the rest of the documentation; however, the location of the mapping file can @@ -25,6 +25,7 @@ """ import time +import zlib import urllib2 import posixpath from os import path @@ -41,12 +42,69 @@ if hasattr(urllib2, 'HTTPSHandler'): urllib2.install_opener(urllib2.build_opener(*handlers)) +def read_inventory_v1(f, uri, join): + invdata = {} + line = f.next() + projname = line.rstrip()[11:].decode('utf-8') + line = f.next() + version = line.rstrip()[11:] + for line in f: + name, type, location = line.rstrip().split(None, 2) + location = join(uri, location) + # version 1 did not add anchors to the location + if type == 'mod': + type = 'py:module' + location += '#module-' + name + else: + type = 'py:' + type + location += '#' + name + invdata.setdefault(type, {})[name] = (projname, version, location, '-') + return invdata + + +def read_inventory_v2(f, uri, join, bufsize=16*1024): + invdata = {} + line = f.readline() + projname = line.rstrip()[11:].decode('utf-8') + line = f.readline() + version = line.rstrip()[11:] + line = f.readline() + if 'zlib' not in line: + raise ValueError + + def read_chunks(): + decompressor = zlib.decompressobj() + for chunk in iter(lambda: f.read(bufsize), ''): + yield decompressor.decompress(chunk) + yield decompressor.flush() + + def split_lines(iter): + buf = '' + for chunk in iter: + buf += chunk + lineend = buf.find('\n') + while lineend != -1: + yield buf[:lineend] + buf = buf[lineend+1:] + lineend = buf.find('\n') + assert not buf + + for line in split_lines(read_chunks()): + name, type, prio, location, dispname = line.rstrip().split(None, 4) + if location.endswith('$'): + location = location[:-1] + name + location = join(uri, location) + invdata.setdefault(type, {})[name] = (projname, version, + location, dispname) + return invdata + + def fetch_inventory(app, uri, inv): """Fetch, parse and return an intersphinx inventory file.""" - invdata = {} # both *uri* (base URI of the links to generate) and *inv* (actual # location of the inventory file) can be local or remote URIs localuri = uri.find('://') == -1 + join = localuri and path.join or posixpath.join try: if inv.find('://') != -1: f = urllib2.urlopen(inv) @@ -57,24 +115,21 @@ def fetch_inventory(app, uri, inv): '%s: %s' % (inv, err.__class__, err)) return try: - line = f.next() - if line.rstrip() != '# Sphinx inventory version 1': - raise ValueError('unknown or unsupported inventory version') - line = f.next() - projname = line.rstrip()[11:].decode('utf-8') - line = f.next() - version = line.rstrip()[11:] - for line in f: - name, type, location = line.rstrip().split(None, 2) - if localuri: - location = path.join(uri, location) + line = f.readline().rstrip() + try: + if line == '# Sphinx inventory version 1': + invdata = read_inventory_v1(f, uri, join) + elif line == '# Sphinx inventory version 2': + invdata = read_inventory_v2(f, uri, join) else: - location = posixpath.join(uri, location) - invdata[name] = (type, projname, version, location) - f.close() + raise ValueError + f.close() + except ValueError: + f.close() + raise ValueError('unknown or unsupported inventory version') except Exception, err: app.warn('intersphinx inventory %r not readable due to ' - '%s: %s' % (inv, err.__class__, err)) + '%s: %s' % (inv, err.__class__.__name__, err)) else: return invdata @@ -88,7 +143,15 @@ def load_mappings(app): env.intersphinx_cache = {} cache = env.intersphinx_cache update = False - for uri, inv in app.config.intersphinx_mapping.iteritems(): + for key, value in app.config.intersphinx_mapping.iteritems(): + if isinstance(value, tuple): + # new format + name, (uri, inv) = key, value + if not name.isalnum(): + env.warn('intersphinx identifier %r is not alphanumeric' % name) + else: + # old format, no name + name, uri, inv = None, key, value # we can safely assume that the uri<->inv mapping is not changed # during partial rebuilds since a changed intersphinx_mapping # setting will cause a full environment reread @@ -98,47 +161,55 @@ def load_mappings(app): # files; remote ones only if the cache time is expired if '://' not in inv or uri not in cache \ or cache[uri][0] < cache_time: + app.info('loading intersphinx inventory from %s...' % inv) invdata = fetch_inventory(app, uri, inv) - cache[uri] = (now, invdata) + if invdata: + cache[uri] = (name, now, invdata) + else: + cache.pop(uri, None) update = True if update: env.intersphinx_inventory = {} - for _, invdata in cache.itervalues(): - if invdata: - env.intersphinx_inventory.update(invdata) + env.intersphinx_named_inventory = {} + for name, _, invdata in cache.itervalues(): + if name: + env.intersphinx_named_inventory[name] = invdata + for type, objects in invdata.iteritems(): + env.intersphinx_inventory.setdefault( + type, {}).update(objects) def missing_reference(app, env, node, contnode): """Attempt to resolve a missing reference via intersphinx references.""" - type = node['reftype'] + domain = node.get('refdomain') + if not domain: + # only objects in domains are in the inventory + return target = node['reftarget'] - if type == 'mod': - type, proj, version, uri = env.intersphinx_inventory.get(target, - ('','','','')) - if type != 'mod': - return None - target = 'module-' + target # for link anchor - else: - if target[-2:] == '()': - target = target[:-2] - target = target.rstrip(' *') - # special case: exceptions and object methods - if type == 'exc' and '.' not in target and \ - 'exceptions.' + target in env.intersphinx_inventory: - target = 'exceptions.' + target - elif type in ('func', 'meth') and '.' not in target and \ - 'object.' + target in env.intersphinx_inventory: - target = 'object.' + target - if target not in env.intersphinx_inventory: - return None - type, proj, version, uri = env.intersphinx_inventory[target] - # print "Intersphinx hit:", target, uri - newnode = nodes.reference('', '') - newnode['refuri'] = uri + '#' + target - newnode['reftitle'] = '(in %s v%s)' % (proj, version) - newnode['class'] = 'external-xref' - newnode.append(contnode) - return newnode + objtypes = env.domains[domain].objtypes_for_role(node['reftype']) + if not objtypes: + return + objtypes = ['%s:%s' % (domain, objtype) for objtype in objtypes] + to_try = [(env.intersphinx_inventory, target)] + if ':' in target: + # first part may be the foreign doc set name + setname, newtarget = target.split(':', 1) + if setname in env.intersphinx_named_inventory: + to_try.append((env.intersphinx_named_inventory[setname], newtarget)) + for inventory, target in to_try: + for objtype in objtypes: + if objtype not in inventory or target not in inventory[objtype]: + continue + proj, version, uri, dispname = inventory[objtype][target] + newnode = nodes.reference('', '') + newnode['refuri'] = uri + newnode['reftitle'] = '(in %s v%s)' % (proj, version) + newnode['class'] = 'external-xref' + if dispname == '-': + newnode.append(contnode) + else: + newnode.append(contnode.__class__(dispname, dispname)) + return newnode def setup(app): diff --git a/sphinx/ext/mathbase.py b/sphinx/ext/mathbase.py index 774f5608..8a5b75d3 100644 --- a/sphinx/ext/mathbase.py +++ b/sphinx/ext/mathbase.py @@ -108,6 +108,20 @@ def text_visit_eqref(self, node): raise nodes.SkipNode +def man_visit_math(self, node): + self.body.append(node['latex']) + raise nodes.SkipNode + +def man_visit_displaymath(self, node): + self.visit_centered(node) +def man_depart_displaymath(self, node): + self.depart_centered(node) + +def man_visit_eqref(self, node): + self.body.append(node['target']) + raise nodes.SkipNode + + def html_visit_eqref(self, node): self.body.append('<a href="#equation-%s">' % node['target']) @@ -136,14 +150,17 @@ def setup_math(app, htmlinlinevisitors, htmldisplayvisitors): app.add_node(math, latex=(latex_visit_math, None), text=(text_visit_math, None), + man=(man_visit_math, None), html=htmlinlinevisitors) app.add_node(displaymath, latex=(latex_visit_displaymath, None), text=(text_visit_displaymath, None), + man=(man_visit_displaymath, man_depart_displaymath), html=htmldisplayvisitors) app.add_node(eqref, latex=(latex_visit_eqref, None), text=(text_visit_eqref, None), + man=(man_visit_eqref, None), html=(html_visit_eqref, html_depart_eqref)) app.add_role('math', math_role) app.add_role('eq', eq_role) diff --git a/sphinx/ext/pngmath.py b/sphinx/ext/pngmath.py index d7a19ba4..7f399754 100644 --- a/sphinx/ext/pngmath.py +++ b/sphinx/ext/pngmath.py @@ -24,8 +24,8 @@ except ImportError: from docutils import nodes from sphinx.errors import SphinxError -from sphinx.util import ensuredir, ENOENT from sphinx.util.png import read_png_depth, write_png_depth +from sphinx.util.osutil import ensuredir, ENOENT from sphinx.ext.mathbase import setup_math as mathbase_setup, wrap_displaymath class MathExtError(SphinxError): diff --git a/sphinx/ext/refcounting.py b/sphinx/ext/refcounting.py index 398520b8..6ab9fe4b 100644 --- a/sphinx/ext/refcounting.py +++ b/sphinx/ext/refcounting.py @@ -69,7 +69,7 @@ class Refcounts(dict): def add_refcount_annotations(self, app, doctree): for node in doctree.traverse(addnodes.desc_content): par = node.parent - if par['desctype'] != 'cfunction': + if par['domain'] != 'c' or par['objtype'] != 'function': continue if not par[0].has_key('names') or not par[0]['names']: continue diff --git a/sphinx/ext/todo.py b/sphinx/ext/todo.py index 95246af3..ac362919 100644 --- a/sphinx/ext/todo.py +++ b/sphinx/ext/todo.py @@ -14,6 +14,7 @@ from docutils import nodes +from sphinx.locale import _ from sphinx.environment import NoUri from sphinx.util.compat import Directive, make_admonition @@ -34,9 +35,7 @@ class Todo(Directive): def run(self): env = self.state.document.settings.env - - targetid = "todo-%s" % env.index_num - env.index_num += 1 + targetid = 'index-%s' % env.new_serialno('index') targetnode = nodes.target('', '', ids=[targetid]) ad = make_admonition(todo_node, self.name, [_('Todo')], self.options, @@ -105,16 +104,17 @@ def process_todo_nodes(app, doctree, fromdocname): content = [] for todo_info in env.todo_all_todos: - para = nodes.paragraph() + para = nodes.paragraph(classes=['todo-source']) filename = env.doc2path(todo_info['docname'], base=None) - description = ( - _('(The original entry is located in %s, line %d and ' - 'can be found ') % (filename, todo_info['lineno'])) - para += nodes.Text(description, description) + description = _('(The <<original entry>> is located in ' + ' %s, line %d.)') % (filename, todo_info['lineno']) + desc1 = description[:description.find('<<')] + desc2 = description[description.find('>>')+2:] + para += nodes.Text(desc1, desc1) # Create a reference newnode = nodes.reference('', '') - innernode = nodes.emphasis(_('here'), _('here')) + innernode = nodes.emphasis(_('original entry'), _('original entry')) newnode['refdocname'] = todo_info['docname'] try: newnode['refuri'] = app.builder.get_relative_uri( @@ -125,7 +125,7 @@ def process_todo_nodes(app, doctree, fromdocname): pass newnode.append(innernode) para += newnode - para += nodes.Text('.)', '.)') + para += nodes.Text(desc2, desc2) # (Recursively) resolve references in the todo content todo_entry = todo_info['todo'] @@ -159,7 +159,8 @@ def setup(app): app.add_node(todo_node, html=(visit_todo_node, depart_todo_node), latex=(visit_todo_node, depart_todo_node), - text=(visit_todo_node, depart_todo_node)) + text=(visit_todo_node, depart_todo_node), + man=(visit_todo_node, depart_todo_node)) app.add_directive('todo', Todo) app.add_directive('todolist', TodoList) diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py new file mode 100644 index 00000000..ac2a957f --- /dev/null +++ b/sphinx/ext/viewcode.py @@ -0,0 +1,169 @@ +# -*- coding: utf-8 -*- +""" + sphinx.ext.viewcode + ~~~~~~~~~~~~~~~~~~~ + + Add links to module code in Python object descriptions. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from docutils import nodes + +from sphinx import addnodes +from sphinx.locale import _ +from sphinx.pycode import ModuleAnalyzer +from sphinx.util.nodes import make_refnode + + +def doctree_read(app, doctree): + env = app.builder.env + if not hasattr(env, '_viewcode_modules'): + env._viewcode_modules = {} + + def has_tag(modname, fullname, docname): + entry = env._viewcode_modules.get(modname, None) + if entry is None: + try: + analyzer = ModuleAnalyzer.for_module(modname) + except Exception: + env._viewcode_modules[modname] = False + return + analyzer.find_tags() + entry = analyzer.code, analyzer.tags, {} + env._viewcode_modules[modname] = entry + elif entry is False: + return + code, tags, used = entry + if fullname in tags: + used[fullname] = docname + return True + + for objnode in doctree.traverse(addnodes.desc): + if objnode['domain'] != 'py': + continue + names = set() + for signode in objnode: + if not isinstance(signode, addnodes.desc_signature): + continue + modname = signode['module'] + if not modname: + continue + fullname = signode['fullname'] + if not has_tag(modname, fullname, env.docname): + continue + if fullname in names: + # only one link per name, please + continue + names.add(fullname) + pagename = '_modules/' + modname.replace('.', '/') + onlynode = addnodes.only(expr='html') + onlynode += addnodes.pending_xref( + '', reftype='viewcode', refdomain='std', refexplicit=False, + reftarget=pagename, refid=fullname, + refdoc=env.docname) + onlynode[0] += nodes.inline('', _('[source]'), + classes=['viewcode-link']) + signode += onlynode + + +def missing_reference(app, env, node, contnode): + # resolve our "viewcode" reference nodes -- they need special treatment + if node['reftype'] == 'viewcode': + return make_refnode(app.builder, node['refdoc'], node['reftarget'], + node['refid'], contnode) + + +def collect_pages(app): + env = app.builder.env + if not hasattr(env, '_viewcode_modules'): + return + highlighter = app.builder.highlighter + urito = app.builder.get_relative_uri + + modnames = set(env._viewcode_modules) + + app.builder.info(' (%d module code pages)' % + len(env._viewcode_modules), nonl=1) + + for modname, (code, tags, used) in env._viewcode_modules.iteritems(): + # construct a page name for the highlighted source + pagename = '_modules/' + modname.replace('.', '/') + # highlight the source using the builder's highlighter + highlighted = highlighter.highlight_block(code, 'python', False) + # split the code into lines + lines = highlighted.splitlines() + # split off wrap markup from the first line of the actual code + before, after = lines[0].split('<pre>') + lines[0:1] = [before + '<pre>', after] + # nothing to do for the last line; it always starts with </pre> anyway + # now that we have code lines (starting at index 1), insert anchors for + # the collected tags (HACK: this only works if the tag boundaries are + # properly nested!) + for name, docname in used.iteritems(): + type, start, end = tags[name] + backlink = urito(pagename, docname) + '#' + modname + '.' + name + lines[start] = ( + '<div class="viewcode-block" id="%s"><a class="viewcode-back" ' + 'href="%s">%s</a>' % (name, backlink, _('[docs]')) + + lines[start]) + lines[end - 1] += '</div>' + # try to find parents (for submodules) + parents = [] + parent = modname + while '.' in parent: + parent = parent.rsplit('.', 1)[0] + if parent in modnames: + parents.append({ + 'link': urito(pagename, '_modules/' + + parent.replace('.', '/')), + 'title': parent}) + parents.append({'link': urito(pagename, '_modules/index'), + 'title': _('Module code')}) + parents.reverse() + # putting it all together + context = { + 'parents': parents, + 'title': modname, + 'body': _('<h1>Source code for %s</h1>') % modname + \ + '\n'.join(lines) + } + yield (pagename, context, 'page.html') + + if not modnames: + return + + app.builder.info(' _modules/index') + html = ['\n'] + # the stack logic is needed for using nested lists for submodules + stack = [''] + for modname in sorted(modnames): + if modname.startswith(stack[-1]): + stack.append(modname + '.') + html.append('<ul>') + else: + stack.pop() + while not modname.startswith(stack[-1]): + stack.pop() + html.append('</ul>') + stack.append(modname + '.') + html.append('<li><a href="%s">%s</a></li>\n' % ( + urito('_modules/index', '_modules/' + modname.replace('.', '/')), + modname)) + html.append('</ul>' * (len(stack) - 1)) + context = { + 'title': _('Overview: module code'), + 'body': _('<h1>All modules for which code is available</h1>') + \ + ''.join(html), + } + + yield ('_modules/index', context, 'page.html') + + +def setup(app): + app.connect('doctree-read', doctree_read) + app.connect('html-collect-pages', collect_pages) + app.connect('missing-reference', missing_reference) + #app.add_config_value('viewcode_include_modules', [], 'env') + #app.add_config_value('viewcode_exclude_modules', [], 'env') diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py index 0c48eadf..f5ea859c 100644 --- a/sphinx/highlighting.py +++ b/sphinx/highlighting.py @@ -84,6 +84,7 @@ _LATEX_STYLES = r''' \newcommand\PYGZrb{]} ''' +doctestopt_re = re.compile(r'#\s*doctest:.+$', re.MULTILINE) parsing_exceptions = (SyntaxError, UnicodeEncodeError) if sys.version_info < (2, 5): @@ -98,7 +99,8 @@ class PygmentsBridge(object): html_formatter = HtmlFormatter latex_formatter = LatexFormatter - def __init__(self, dest='html', stylename='sphinx'): + def __init__(self, dest='html', stylename='sphinx', + trim_doctest_flags=False): self.dest = dest if not pygments: return @@ -112,6 +114,7 @@ class PygmentsBridge(object): stylename) else: style = get_style_by_name(stylename) + self.trim_doctest_flags = trim_doctest_flags if dest == 'html': self.fmter = {False: self.html_formatter(style=style), True: self.html_formatter(style=style, linenos=True)} @@ -176,6 +179,8 @@ class PygmentsBridge(object): source = source.decode() if not pygments: return self.unhighlighted(source) + + # find out which lexer to use if lang in ('py', 'python'): if source.startswith('>>>'): # interactive session @@ -208,6 +213,12 @@ class PygmentsBridge(object): raise else: lexer.add_filter('raiseonerror') + + # trim doctest options if wanted + if isinstance(lexer, PythonConsoleLexer) and self.trim_doctest_flags: + source = doctestopt_re.sub('', source) + + # highlight via Pygments try: if self.dest == 'html': return highlight(source, lexer, self.fmter[bool(linenos)]) diff --git a/sphinx/jinja2glue.py b/sphinx/jinja2glue.py index baeb7c33..a6f1a853 100644 --- a/sphinx/jinja2glue.py +++ b/sphinx/jinja2glue.py @@ -17,8 +17,8 @@ from jinja2 import FileSystemLoader, BaseLoader, TemplateNotFound, \ from jinja2.utils import open_if_exists from jinja2.sandbox import SandboxedEnvironment -from sphinx.util import mtimes_of_files from sphinx.application import TemplateBridge +from sphinx.util.osutil import mtimes_of_files def _tobool(val): @@ -30,7 +30,7 @@ def accesskey(context, key): """Helper to output each access key only once.""" if '_accesskeys' not in context: context.vars['_accesskeys'] = {} - if key not in context.vars['_accesskeys']: + if key and key not in context.vars['_accesskeys']: context.vars['_accesskeys'][key] = 1 return 'accesskey="%s"' % key return '' @@ -93,7 +93,7 @@ class BuiltinTemplateLoader(TemplateBridge, BaseLoader): # make the paths into loaders self.loaders = map(SphinxFileSystemLoader, chain) - use_i18n = builder.translator is not None + use_i18n = builder.app.translator is not None extensions = use_i18n and ['jinja2.ext.i18n'] or [] self.environment = SandboxedEnvironment(loader=self, extensions=extensions) @@ -101,7 +101,8 @@ class BuiltinTemplateLoader(TemplateBridge, BaseLoader): self.environment.globals['debug'] = contextfunction(pformat) self.environment.globals['accesskey'] = contextfunction(accesskey) if use_i18n: - self.environment.install_gettext_translations(builder.translator) + self.environment.install_gettext_translations( + builder.app.translator) def render(self, template, context): return self.environment.get_template(template).render(context) diff --git a/sphinx/locale/__init__.py b/sphinx/locale/__init__.py index 4ad3f4c6..43e0942c 100644 --- a/sphinx/locale/__init__.py +++ b/sphinx/locale/__init__.py @@ -8,41 +8,183 @@ :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ +import gettext +import UserString + + +class _TranslationProxy(UserString.UserString, object): + """Class for proxy strings from gettext translations. This is a helper + for the lazy_* functions from this module. + + The proxy implementation attempts to be as complete as possible, so that + the lazy objects should mostly work as expected, for example for sorting. + + This inherits from UserString because some docutils versions use UserString + for their Text nodes, which then checks its argument for being either a + basestring or UserString, otherwise calls str() -- not unicode() -- on it. + This also inherits from object to make the __new__ method work. + """ + __slots__ = ('_func', '_args') + + def __new__(cls, func, *args): + if not args: + # not called with "function" and "arguments", but a plain string + return unicode(func) + return object.__new__(cls) + + def __getnewargs__(self): + return (self._func,) + self._args + + def __init__(self, func, *args): + self._func = func + self._args = args + + data = property(lambda x: x._func(*x._args)) + + def __contains__(self, key): + return key in self.data + + def __nonzero__(self): + return bool(self.data) + + def __dir__(self): + return dir(unicode) + + def __iter__(self): + return iter(self.data) + + def __len__(self): + return len(self.data) + + def __str__(self): + return str(self.data) + + def __unicode__(self): + return unicode(self.data) + + def __add__(self, other): + return self.data + other + + def __radd__(self, other): + return other + self.data + + def __mod__(self, other): + return self.data % other + + def __rmod__(self, other): + return other % self.data + + def __mul__(self, other): + return self.data * other + + def __rmul__(self, other): + return other * self.data + + def __lt__(self, other): + return self.data < other + + def __le__(self, other): + return self.data <= other + + def __eq__(self, other): + return self.data == other + + def __ne__(self, other): + return self.data != other + + def __gt__(self, other): + return self.data > other + + def __ge__(self, other): + return self.data >= other + + def __getattr__(self, name): + if name == '__members__': + return self.__dir__() + return getattr(self.data, name) + + def __getstate__(self): + return self._func, self._args + + def __setstate__(self, tup): + self._func, self._args = tup + + def __getitem__(self, key): + return self.data[key] + + def __copy__(self): + return self + + def __repr__(self): + try: + return 'i' + repr(unicode(self.data)) + except: + return '<%s broken>' % self.__class__.__name__ + +def mygettext(string): + """Used instead of _ when creating TranslationProxies, because _ is + not bound yet at that time.""" + return _(string) + +def lazy_gettext(string): + """A lazy version of `gettext`.""" + #if isinstance(string, _TranslationProxy): + # return string + return _TranslationProxy(mygettext, string) + +l_ = lazy_gettext -_ = lambda x: x admonitionlabels = { - 'attention': _('Attention'), - 'caution': _('Caution'), - 'danger': _('Danger'), - 'error': _('Error'), - 'hint': _('Hint'), - 'important': _('Important'), - 'note': _('Note'), - 'seealso': _('See Also'), - 'tip': _('Tip'), - 'warning': _('Warning'), + 'attention': l_('Attention'), + 'caution': l_('Caution'), + 'danger': l_('Danger'), + 'error': l_('Error'), + 'hint': l_('Hint'), + 'important': l_('Important'), + 'note': l_('Note'), + 'seealso': l_('See Also'), + 'tip': l_('Tip'), + 'warning': l_('Warning'), } versionlabels = { - 'versionadded': _('New in version %s'), - 'versionchanged': _('Changed in version %s'), - 'deprecated': _('Deprecated since version %s'), + 'versionadded': l_('New in version %s'), + 'versionchanged': l_('Changed in version %s'), + 'deprecated': l_('Deprecated since version %s'), } pairindextypes = { - 'module': _('module'), - 'keyword': _('keyword'), - 'operator': _('operator'), - 'object': _('object'), - 'exception': _('exception'), - 'statement': _('statement'), - 'builtin': _('built-in function'), + 'module': l_('module'), + 'keyword': l_('keyword'), + 'operator': l_('operator'), + 'object': l_('object'), + 'exception': l_('exception'), + 'statement': l_('statement'), + 'builtin': l_('built-in function'), } -del _ +translator = None + +def _(message): + return translator.gettext(message) -def init(): - for dct in (admonitionlabels, versionlabels, pairindextypes): - for key in dct: - dct[key] = _(dct[key]) +def init(locale_dirs, language): + global translator + # the None entry is the system's default locale path + has_translation = True + for dir_ in locale_dirs: + try: + trans = gettext.translation('sphinx', localedir=dir_, + languages=[language]) + if translator is None: + translator = trans + else: + translator._catalog.update(trans._catalog) + except Exception: + # Language couldn't be found in the specified path + pass + if translator is None: + translator = gettext.NullTranslations() + has_translation = False + return translator, has_translation diff --git a/sphinx/locale/ca/LC_MESSAGES/sphinx.js b/sphinx/locale/ca/LC_MESSAGES/sphinx.js new file mode 100644 index 00000000..8ad043b0 --- /dev/null +++ b/sphinx/locale/ca/LC_MESSAGES/sphinx.js @@ -0,0 +1 @@ +Documentation.addTranslations({"locale": "ca", "plural_expr": "(n != 1)", "messages": {"Search Results": "Resultats de la Cerca", "Preparing search...": "Preparant la cerca...", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "La teva cerca no ha donat resultats. Assegura't que totes les paraules estan ben escrites i que has seleccionat prou categories.", "Search finished, found %s page(s) matching the search query.": "Cerca finalitzada, s'han trobat %s p\u00e0gin(a/es) de resultats.", ", in ": ", a ", "Permalink to this headline": "Link permanent a aquest t\u00edtol", "Searching": "Cercant", "Permalink to this definition": "Link permanent a aquesta definici\u00f3", "module, in ": "m\u00f2dule, a ", "Hide Search Matches": "Oculta Resultats de Cerca"}});
\ No newline at end of file diff --git a/sphinx/locale/ca/LC_MESSAGES/sphinx.mo b/sphinx/locale/ca/LC_MESSAGES/sphinx.mo Binary files differnew file mode 100644 index 00000000..d88717c0 --- /dev/null +++ b/sphinx/locale/ca/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/ca/LC_MESSAGES/sphinx.po b/sphinx/locale/ca/LC_MESSAGES/sphinx.po new file mode 100644 index 00000000..440b0594 --- /dev/null +++ b/sphinx/locale/ca/LC_MESSAGES/sphinx.po @@ -0,0 +1,606 @@ +# Catalan 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 1.0\n" +"Report-Msgid-Bugs-To: pau.fernandez@upc.edu\n" +"POT-Creation-Date: 2009-05-22 18:51+0200\n" +"PO-Revision-Date: 2009-06-07 14:20+0200\n" +"Last-Translator: Pau Fernández <pau.fernandez@upc.edu>\n" +"Language-Team: ca <LL@li.org>\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:184 +#, python-format +msgid "%B %d, %Y" +msgstr "%d de %B de %Y" + +#: sphinx/environment.py:323 sphinx/themes/basic/genindex-single.html:2 +#: sphinx/themes/basic/genindex-split.html:2 +#: sphinx/themes/basic/genindex-split.html:5 +#: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 +#: sphinx/writers/latex.py:190 +msgid "Index" +msgstr "Índex" + +#: sphinx/environment.py:324 sphinx/writers/latex.py:189 +msgid "Module Index" +msgstr "Índex de Mòduls" + +#: sphinx/environment.py:325 sphinx/themes/basic/defindex.html:16 +msgid "Search Page" +msgstr "Pàgina de Cerca" + +#: sphinx/roles.py:55 sphinx/directives/desc.py:747 +#, python-format +msgid "environment variable; %s" +msgstr "variable d'entorn; %s" + +#: sphinx/roles.py:62 +#, python-format +msgid "Python Enhancement Proposals!PEP %s" +msgstr "Python Enhancement Proposals!PEP %s" + +#: sphinx/builders/changes.py:71 +msgid "Builtins" +msgstr "Mòduls Interns" + +#: sphinx/builders/changes.py:73 +msgid "Module level" +msgstr "Nivell de mòdul" + +#: sphinx/builders/html.py:219 +#, python-format +msgid "%b %d, %Y" +msgstr "%d %b, %Y" + +#: sphinx/builders/html.py:238 sphinx/themes/basic/defindex.html:21 +msgid "General Index" +msgstr "Índex General" + +#: sphinx/builders/html.py:238 +msgid "index" +msgstr "índex" + +#: sphinx/builders/html.py:240 sphinx/builders/htmlhelp.py:184 +#: sphinx/builders/qthelp.py:132 sphinx/themes/basic/defindex.html:19 +#: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 +msgid "Global Module Index" +msgstr "Índex Global de Mòduls" + +#: sphinx/builders/html.py:241 +msgid "modules" +msgstr "mòduls" + +#: sphinx/builders/html.py:296 +msgid "next" +msgstr "següent" + +#: sphinx/builders/html.py:305 +msgid "previous" +msgstr "anterior" + +#: sphinx/builders/latex.py:162 +msgid " (in " +msgstr " (a " + +#: sphinx/directives/desc.py:97 +msgid "Raises" +msgstr "Llença" + +#: sphinx/directives/desc.py:101 +msgid "Variable" +msgstr "Variable" + +#: sphinx/directives/desc.py:104 +msgid "Returns" +msgstr "Retorna" + +#: sphinx/directives/desc.py:113 +msgid "Return type" +msgstr "Tipus de retorn" + +#: sphinx/directives/desc.py:186 +msgid "Parameter" +msgstr "Paràmetre" + +#: sphinx/directives/desc.py:190 +msgid "Parameters" +msgstr "Paràmetres" + +#: sphinx/directives/desc.py:418 +#, python-format +msgid "%s() (built-in function)" +msgstr "%s() (funció interna)" + +#: sphinx/directives/desc.py:419 sphinx/directives/desc.py:476 +#: sphinx/directives/desc.py:488 +#, python-format +msgid "%s() (in module %s)" +msgstr "%s() (al mòdul %s)" + +#: sphinx/directives/desc.py:422 +#, python-format +msgid "%s (built-in variable)" +msgstr "%s (variable interna)" + +#: sphinx/directives/desc.py:423 sphinx/directives/desc.py:514 +#, python-format +msgid "%s (in module %s)" +msgstr "%s (al mòdul %s)" + +#: sphinx/directives/desc.py:439 +#, python-format +msgid "%s (built-in class)" +msgstr "%s (classe interna)" + +#: sphinx/directives/desc.py:440 +#, python-format +msgid "%s (class in %s)" +msgstr "%s (class a %s)" + +#: sphinx/directives/desc.py:480 +#, python-format +msgid "%s() (%s.%s method)" +msgstr "%s() (mètode %s.%s)" + +#: sphinx/directives/desc.py:482 +#, python-format +msgid "%s() (%s method)" +msgstr "%s() (mètode %s)" + +#: sphinx/directives/desc.py:492 +#, python-format +msgid "%s() (%s.%s static method)" +msgstr "%s() (mètode estàtic %s.%s)" + +#: sphinx/directives/desc.py:495 +#, python-format +msgid "%s() (%s static method)" +msgstr "%s() (mètode estàtic %s)" + +#: sphinx/directives/desc.py:518 +#, python-format +msgid "%s (%s.%s attribute)" +msgstr "%s (atribut %s.%s)" + +#: sphinx/directives/desc.py:520 +#, python-format +msgid "%s (%s attribute)" +msgstr "%s (atribut %s)" + +#: sphinx/directives/desc.py:609 +#, python-format +msgid "%s (C function)" +msgstr "%s (funció de C)" + +#: sphinx/directives/desc.py:611 +#, python-format +msgid "%s (C member)" +msgstr "%s (membre de C)" + +#: sphinx/directives/desc.py:613 +#, python-format +msgid "%s (C macro)" +msgstr "%s (macro de C)" + +#: sphinx/directives/desc.py:615 +#, python-format +msgid "%s (C type)" +msgstr "%s (tipus de C)" + +#: sphinx/directives/desc.py:617 +#, python-format +msgid "%s (C variable)" +msgstr "%s (variable de C)" + +#: sphinx/directives/desc.py:665 +#, python-format +msgid "%scommand line option; %s" +msgstr "opció de línia de comandes %s; %s" + +#: sphinx/directives/other.py:138 +msgid "Platforms: " +msgstr "Plataformes: " + +#: sphinx/directives/other.py:144 +#, python-format +msgid "%s (module)" +msgstr "%s (mòdul)" + +#: sphinx/directives/other.py:193 +msgid "Section author: " +msgstr "Autor de la secció:" + +#: sphinx/directives/other.py:195 +msgid "Module author: " +msgstr "Autor del mòdul: " + +#: sphinx/directives/other.py:197 +msgid "Author: " +msgstr "Autor: " + +#: sphinx/directives/other.py:317 +msgid "See also" +msgstr "Vegeu també" + +#: sphinx/ext/autodoc.py:888 +#, python-format +msgid " Bases: %s" +msgstr " Bases: %s" + +#: sphinx/ext/autodoc.py:919 +#, python-format +msgid "alias of :class:`%s`" +msgstr "àlies de :class:`%s`" + +#: sphinx/ext/todo.py:41 +msgid "Todo" +msgstr "Pendent" + +#: sphinx/ext/todo.py:99 +#, python-format +msgid "(The original entry is located in %s, line %d and can be found " +msgstr "(La entrada original està a %s, línia %d i es pot trobar " + +#: sphinx/ext/todo.py:105 +msgid "here" +msgstr "aquí" + +#: sphinx/locale/__init__.py:15 +msgid "Attention" +msgstr "Atenció" + +#: sphinx/locale/__init__.py:16 +msgid "Caution" +msgstr "Compte" + +#: sphinx/locale/__init__.py:17 +msgid "Danger" +msgstr "Perill" + +#: sphinx/locale/__init__.py:18 +msgid "Error" +msgstr "Error" + +#: sphinx/locale/__init__.py:19 +msgid "Hint" +msgstr "Suggerència" + +#: sphinx/locale/__init__.py:20 +msgid "Important" +msgstr "Important" + +#: sphinx/locale/__init__.py:21 +msgid "Note" +msgstr "Nota" + +#: sphinx/locale/__init__.py:22 +msgid "See Also" +msgstr "Vegeu També" + +#: sphinx/locale/__init__.py:23 +msgid "Tip" +msgstr "Truc" + +#: sphinx/locale/__init__.py:24 +msgid "Warning" +msgstr "Avís" + +#: sphinx/locale/__init__.py:28 +#, python-format +msgid "New in version %s" +msgstr "Novetat de la versió %s" + +#: sphinx/locale/__init__.py:29 +#, python-format +msgid "Changed in version %s" +msgstr "Canviat a la versió %s" + +#: sphinx/locale/__init__.py:30 +#, python-format +msgid "Deprecated since version %s" +msgstr "Obsolet desde la versió %s" + +#: sphinx/locale/__init__.py:34 +msgid "module" +msgstr "mòdul" + +#: sphinx/locale/__init__.py:35 +msgid "keyword" +msgstr "paraula clau" + +#: sphinx/locale/__init__.py:36 +msgid "operator" +msgstr "operador" + +#: sphinx/locale/__init__.py:37 +msgid "object" +msgstr "objecte" + +#: sphinx/locale/__init__.py:38 +msgid "exception" +msgstr "excepció" + +#: sphinx/locale/__init__.py:39 +msgid "statement" +msgstr "sentència" + +#: sphinx/locale/__init__.py:40 +msgid "built-in function" +msgstr "funció interna" + +#: sphinx/themes/basic/defindex.html:2 +msgid "Overview" +msgstr "Resum" + +#: sphinx/themes/basic/defindex.html:11 +msgid "Indices and tables:" +msgstr "Índexs i taules:" + +#: sphinx/themes/basic/defindex.html:14 +msgid "Complete Table of Contents" +msgstr "Taula de Contingut Completa" + +#: sphinx/themes/basic/defindex.html:15 +msgid "lists all sections and subsections" +msgstr "llista totes les seccions i subseccions" + +#: sphinx/themes/basic/defindex.html:17 +msgid "search this documentation" +msgstr "cerca aquesta documentació" + +#: sphinx/themes/basic/defindex.html:20 +msgid "quick access to all modules" +msgstr "accés ràpid a tots els mòduls" + +#: sphinx/themes/basic/defindex.html:22 +msgid "all functions, classes, terms" +msgstr "totes les funcions, classes, termes" + +#: sphinx/themes/basic/genindex-single.html:5 +#, python-format +msgid "Index – %(key)s" +msgstr "Índes – %(key)s" + +#: sphinx/themes/basic/genindex-single.html:44 +#: sphinx/themes/basic/genindex-split.html:14 +#: sphinx/themes/basic/genindex-split.html:27 +#: sphinx/themes/basic/genindex.html:54 +msgid "Full index on one page" +msgstr "Índex complet en una pàgina" + +#: sphinx/themes/basic/genindex-split.html:7 +msgid "Index pages by letter" +msgstr "Pàgines d'índex per lletra" + +#: sphinx/themes/basic/genindex-split.html:15 +msgid "can be huge" +msgstr "pot ser gegant" + +#: sphinx/themes/basic/layout.html:10 +msgid "Navigation" +msgstr "Navegació" + +#: sphinx/themes/basic/layout.html:42 +msgid "Table Of Contents" +msgstr "Taula de Contingut" + +#: sphinx/themes/basic/layout.html:48 +msgid "Previous topic" +msgstr "Tema anterior" + +#: sphinx/themes/basic/layout.html:50 +msgid "previous chapter" +msgstr "capítol anterior" + +#: sphinx/themes/basic/layout.html:53 +msgid "Next topic" +msgstr "Tema següent" + +#: sphinx/themes/basic/layout.html:55 +msgid "next chapter" +msgstr "capítol següent" + +#: sphinx/themes/basic/layout.html:60 +msgid "This Page" +msgstr "Aquesta Pàgina" + +#: sphinx/themes/basic/layout.html:63 +msgid "Show Source" +msgstr "Mostra Codi Font" + +#: sphinx/themes/basic/layout.html:73 +msgid "Quick search" +msgstr "Cerca ràpida" + +#: sphinx/themes/basic/layout.html:76 +msgid "Go" +msgstr "Ves a" + +#: sphinx/themes/basic/layout.html:81 +msgid "Enter search terms or a module, class or function name." +msgstr "Entra paraules de cerca o el nom d'un mòdul, classe o funció." + +#: sphinx/themes/basic/layout.html:119 +#, python-format +msgid "Search within %(docstitle)s" +msgstr "Cerca dins de %(docstitle)s" + +#: sphinx/themes/basic/layout.html:128 +msgid "About these documents" +msgstr "Quant a aquests documents" + +#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/search.html:5 +msgid "Search" +msgstr "Cerca" + +#: sphinx/themes/basic/layout.html:137 +msgid "Copyright" +msgstr "Copyright" + +#: sphinx/themes/basic/layout.html:184 +#, python-format +msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." +msgstr "© <a href=\\\"%(path)s\\\">Copyright</a> %(copyright)s." + +#: sphinx/themes/basic/layout.html:186 +#, python-format +msgid "© Copyright %(copyright)s." +msgstr "© Copyright %(copyright)s." + +#: sphinx/themes/basic/layout.html:190 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Última actualització el %(last_updated)s." + +#: sphinx/themes/basic/layout.html:193 +#, python-format +msgid "" +"Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " +"%(sphinx_version)s." +msgstr "" +"Creat amb <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " +"%(sphinx_version)s." + +#: sphinx/themes/basic/modindex.html:36 +msgid "Deprecated" +msgstr "Obsolet" + +#: sphinx/themes/basic/opensearch.xml:4 +#, python-format +msgid "Search %(docstitle)s" +msgstr "Cercar a %(docstitle)s" + +#: sphinx/themes/basic/search.html:9 +msgid "" +"Please activate JavaScript to enable the search\n" +" functionality." +msgstr "" +"Activa JavaScript per utilitzar la funcionalitat\n" +"de cerca." + +#: sphinx/themes/basic/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 "" +"Des d'aquí pots fer cerques en aquests documents. Entra les \n" +"paraules de la teva cerca i clica el botó \"cerca\". Tingues en compte\n" +"que la cerca inclourà totes les paraules que posis. Les pàgines que no\n" +"tenen totes les paraules no sortiràn." + +#: sphinx/themes/basic/search.html:21 +msgid "search" +msgstr "cerca" + +#: sphinx/themes/basic/search.html:25 +#: sphinx/themes/basic/static/searchtools.js:462 +msgid "Search Results" +msgstr "Resultats de la Cerca" + +#: sphinx/themes/basic/search.html:27 +msgid "Your search did not match any results." +msgstr "La teva cerca no té resultats." + +#: sphinx/themes/basic/changes/frameset.html:5 +#: sphinx/themes/basic/changes/versionchanges.html:12 +#, python-format +msgid "Changes in Version %(version)s — %(docstitle)s" +msgstr "Canvis a la Versió %(version)s — %(docstitle)s" + +#: sphinx/themes/basic/changes/rstsource.html:5 +#, python-format +msgid "%(filename)s — %(docstitle)s" +msgstr "%(filename)s — %(docstitle)s" + +#: sphinx/themes/basic/changes/versionchanges.html:17 +#, python-format +msgid "Automatically generated list of changes in version %(version)s" +msgstr "Llista de canvis de la versió %(version)s generada automàticament" + +#: sphinx/themes/basic/changes/versionchanges.html:18 +msgid "Library changes" +msgstr "Canvis a la llibreria" + +#: sphinx/themes/basic/changes/versionchanges.html:23 +msgid "C API changes" +msgstr "Canvis a la API de C" + +#: sphinx/themes/basic/changes/versionchanges.html:25 +msgid "Other changes" +msgstr "Altres canvis" + +#: sphinx/themes/basic/static/doctools.js:139 sphinx/writers/html.py:473 +#: sphinx/writers/html.py:478 +msgid "Permalink to this headline" +msgstr "Link permanent a aquest títol" + +#: sphinx/themes/basic/static/doctools.js:145 sphinx/writers/html.py:80 +msgid "Permalink to this definition" +msgstr "Link permanent a aquesta definició" + +#: sphinx/themes/basic/static/doctools.js:174 +msgid "Hide Search Matches" +msgstr "Oculta Resultats de Cerca" + +#: sphinx/themes/basic/static/searchtools.js:274 +msgid "Searching" +msgstr "Cercant" + +#: sphinx/themes/basic/static/searchtools.js:279 +msgid "Preparing search..." +msgstr "Preparant la cerca..." + +#: sphinx/themes/basic/static/searchtools.js:347 +msgid "module, in " +msgstr "mòdule, a " + +#: sphinx/themes/basic/static/searchtools.js:356 +msgid ", in " +msgstr ", a " + +#: sphinx/themes/basic/static/searchtools.js:464 +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 "" +"La teva cerca no ha donat resultats. Assegura't que totes les paraules " +"estan ben escrites i que has seleccionat prou categories." + +#: sphinx/themes/basic/static/searchtools.js:466 +#, python-format +msgid "Search finished, found %s page(s) matching the search query." +msgstr "Cerca finalitzada, s'han trobat %s pàgin(a/es) de resultats." + +#: sphinx/writers/latex.py:187 +msgid "Release" +msgstr "Versió" + +#: sphinx/writers/latex.py:639 +msgid "continued from previous page" +msgstr "ve de la pàgina anterior" + +#: sphinx/writers/latex.py:643 +msgid "Continued on next page" +msgstr "Continua a la pàgina següent" + +#: sphinx/writers/text.py:166 +#, python-format +msgid "Platform: %s" +msgstr "Plataforma: %s" + +#: sphinx/writers/text.py:428 +msgid "[image]" +msgstr "[imatge]" + diff --git a/sphinx/locale/cs/LC_MESSAGES/sphinx.mo b/sphinx/locale/cs/LC_MESSAGES/sphinx.mo Binary files differindex 2501ddca..af8b4776 100644 --- a/sphinx/locale/cs/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/cs/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/cs/LC_MESSAGES/sphinx.po b/sphinx/locale/cs/LC_MESSAGES/sphinx.po index c0557111..500bf1cc 100644 --- a/sphinx/locale/cs/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/cs/LC_MESSAGES/sphinx.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Sphinx 0.5\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2008-11-27 18:39+0100\n" -"PO-Revision-Date: 2009-08-06 22:48+0200\n" +"PO-Revision-Date: 2009-08-06 23:04+0200\n" "Last-Translator: Pavel Kosina <pavel.kosina@gmail.com>\n" "Language-Team: Pavel Kosina <pavel.kosina@gmail.com>\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 0.9.4\n" -#: sphinx/environment.py:103 sphinx/writers/latex.py:182 +#: sphinx/environment.py:103 sphinx/writers/latex.py:184 #, python-format msgid "%B %d, %Y" msgstr "%d.%m.%Y" @@ -27,12 +27,12 @@ msgstr "%d.%m.%Y" #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 #: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "Index" -#: sphinx/environment.py:325 sphinx/writers/latex.py:187 +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 msgid "Module Index" msgstr "Rejstřík modulů " @@ -58,34 +58,34 @@ msgstr "Vestavěné funkce " msgid "Module level" msgstr "Úroveň modulů" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:222 #, python-format msgid "%b %d, %Y" msgstr "%d.%m.%Y" -#: sphinx/builders/html.py:224 sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "Rejstřík indexů" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:241 msgid "index" msgstr "index" -#: sphinx/builders/html.py:226 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 #: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 #: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 msgid "Global Module Index" msgstr "Celkový rejstřík modulů" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:244 msgid "modules" msgstr "moduly" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:300 msgid "next" msgstr "další" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:309 msgid "previous" msgstr "předchozí" @@ -209,37 +209,37 @@ msgstr "%s (C proměnná)" msgid "%scommand line option; %s" msgstr "%s parametry příkazového řádku; %s" -#: sphinx/directives/other.py:138 +#: sphinx/directives/other.py:140 msgid "Platforms: " msgstr "Platformy: " -#: sphinx/directives/other.py:144 +#: sphinx/directives/other.py:146 #, python-format msgid "%s (module)" msgstr "%s (module)" -#: sphinx/directives/other.py:193 +#: sphinx/directives/other.py:195 msgid "Section author: " msgstr "Autor sekce: " -#: sphinx/directives/other.py:195 +#: sphinx/directives/other.py:197 msgid "Module author: " msgstr "Autor modulu: " -#: sphinx/directives/other.py:197 +#: sphinx/directives/other.py:199 msgid "Author: " msgstr "Autor: " -#: sphinx/directives/other.py:317 +#: sphinx/directives/other.py:319 msgid "See also" msgstr "Viz také" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:889 #, python-format msgid " Bases: %s" msgstr "" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:922 #, python-format msgid "alias of :class:`%s`" msgstr "" @@ -433,40 +433,40 @@ msgstr "hledej" msgid "Enter search terms or a module, class or function name." msgstr "Zadej jméno modulu, třídy nebo funkce." -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "Hledání uvnitř %(docstitle)s" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" msgstr "O těchto dokumentech" -#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "Hledání" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "Veškerá práva vyhrazena" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 #, python-format msgid "© Copyright %(copyright)s." msgstr "© Copyright %(copyright)s." -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 #, python-format msgid "Last updated on %(last_updated)s." msgstr "Aktualizováno dne %(last_updated)s." -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 #, python-format msgid "" "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " @@ -507,7 +507,7 @@ msgid "search" msgstr "hledej" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:462 msgid "Search Results" msgstr "Výsledky hledání" @@ -564,15 +564,15 @@ msgstr "Hledám" msgid "Preparing search..." msgstr "Připravuji vyhledávání...." -#: sphinx/themes/basic/static/searchtools.js:338 +#: sphinx/themes/basic/static/searchtools.js:347 msgid "module, in " msgstr "modul, v" -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:356 msgid ", in " msgstr ", v" -#: sphinx/themes/basic/static/searchtools.js:455 +#: sphinx/themes/basic/static/searchtools.js:464 msgid "" "Your search did not match any documents. Please make sure that all words " "are spelled correctly and that you've selected enough categories." @@ -580,24 +580,24 @@ msgstr "" "Nenalezli jsme žádný dokument. Ujistěte se prosím, že všechna slova jsou " "správně a že jste vybral dostatek kategorií." -#: sphinx/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:466 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "Vyhledávání skončilo, nalezeno %s stran." -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 msgid "Release" msgstr "Vydání" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:578 msgid "Footnotes" msgstr "" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:646 msgid "continued from previous page" msgstr "" -#: sphinx/writers/latex.py:644 +#: sphinx/writers/latex.py:651 #, fuzzy msgid "Continued on next page" msgstr "Plný index na jedné stránce" diff --git a/sphinx/locale/de/LC_MESSAGES/sphinx.mo b/sphinx/locale/de/LC_MESSAGES/sphinx.mo Binary files differindex 9b88a673..1fa7ae3d 100644 --- a/sphinx/locale/de/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/de/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/de/LC_MESSAGES/sphinx.po b/sphinx/locale/de/LC_MESSAGES/sphinx.po index d0f92296..9483de79 100644 --- a/sphinx/locale/de/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/de/LC_MESSAGES/sphinx.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2008-08-07 21:40+0200\n" -"PO-Revision-Date: 2009-08-06 22:49+0200\n" +"PO-Revision-Date: 2009-08-06 23:04+0200\n" "Last-Translator: Horst Gutmann <zerok@zerokspot.com>\n" "Language-Team: de <LL@li.org>\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 0.9.4\n" -#: sphinx/environment.py:103 sphinx/writers/latex.py:182 +#: sphinx/environment.py:103 sphinx/writers/latex.py:184 #, python-format msgid "%B %d, %Y" msgstr "%d. %m. %Y" @@ -25,12 +25,12 @@ msgstr "%d. %m. %Y" #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 #: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "Stichwortverzeichnis" -#: sphinx/environment.py:325 sphinx/writers/latex.py:187 +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 msgid "Module Index" msgstr "Modulindex" @@ -56,34 +56,34 @@ msgstr "Builtins" msgid "Module level" msgstr "Modulebene" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:222 #, python-format msgid "%b %d, %Y" msgstr "%d. %m. %Y" -#: sphinx/builders/html.py:224 sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "Allgemeiner Index" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:241 msgid "index" msgstr "Index" -#: sphinx/builders/html.py:226 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 #: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 #: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 msgid "Global Module Index" msgstr "Globaler Modulindex" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:244 msgid "modules" msgstr "Module" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:300 msgid "next" msgstr "weiter" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:309 msgid "previous" msgstr "zurück" @@ -206,37 +206,37 @@ msgstr "%s (C-Variable)" msgid "%scommand line option; %s" msgstr "%sKommandozeilenoption; %s" -#: sphinx/directives/other.py:138 +#: sphinx/directives/other.py:140 msgid "Platforms: " msgstr "Plattformen: " -#: sphinx/directives/other.py:144 +#: sphinx/directives/other.py:146 #, python-format msgid "%s (module)" msgstr "%s (Modul)" -#: sphinx/directives/other.py:193 +#: sphinx/directives/other.py:195 msgid "Section author: " msgstr "Autor des Abschnitts: " -#: sphinx/directives/other.py:195 +#: sphinx/directives/other.py:197 msgid "Module author: " msgstr "Autor des Moduls: " -#: sphinx/directives/other.py:197 +#: sphinx/directives/other.py:199 msgid "Author: " msgstr "Autor: " -#: sphinx/directives/other.py:317 +#: sphinx/directives/other.py:319 msgid "See also" msgstr "Siehe auch" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:889 #, python-format msgid " Bases: %s" msgstr " Basisklassen: %s" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:922 #, python-format msgid "alias of :class:`%s`" msgstr "Alias von :class:`%s`" @@ -431,40 +431,40 @@ msgstr "" "Geben Sie Suchbegriffe oder einen Modul-, Klassen- oder Funktionsnamen " "ein." -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "Suche in %(docstitle)s" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" msgstr "Über diese Dokumentation" -#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "Suche" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "Copyright" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 #, python-format msgid "© Copyright %(copyright)s." msgstr "© Copyright %(copyright)s." -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 #, python-format msgid "Last updated on %(last_updated)s." msgstr "Zuletzt aktualisiert am %(last_updated)s." -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 #, python-format msgid "" "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " @@ -506,7 +506,7 @@ msgid "search" msgstr "suchen" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:462 msgid "Search Results" msgstr "Suchergebnisse" @@ -563,15 +563,15 @@ msgstr "Suche..." msgid "Preparing search..." msgstr "Suche wird vorbereitet..." -#: sphinx/themes/basic/static/searchtools.js:338 +#: sphinx/themes/basic/static/searchtools.js:347 msgid "module, in " msgstr "Modul, in " -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:356 msgid ", in " msgstr ", in " -#: sphinx/themes/basic/static/searchtools.js:455 +#: sphinx/themes/basic/static/searchtools.js:464 msgid "" "Your search did not match any documents. Please make sure that all words " "are spelled correctly and that you've selected enough categories." @@ -579,24 +579,24 @@ msgstr "" "Es wurden keine zutreffenden Dokumente gefunden. Haben Sie alle " "Suchbegriffe richtig geschrieben und genügend Kategorien ausgewählt?" -#: sphinx/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:466 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "Suche beendet, %s zutreffende Seite(n) gefunden." -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 msgid "Release" msgstr "Release" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:578 msgid "Footnotes" -msgstr "Fußnoten" +msgstr "" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:646 msgid "continued from previous page" msgstr "Fortsetzung der vorherigen Seite" -#: sphinx/writers/latex.py:644 +#: sphinx/writers/latex.py:651 msgid "Continued on next page" msgstr "Fortsetzung auf der nächsten Seite" diff --git a/sphinx/locale/es/LC_MESSAGES/sphinx.mo b/sphinx/locale/es/LC_MESSAGES/sphinx.mo Binary files differindex 85c0b1b3..eda70a31 100644 --- a/sphinx/locale/es/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/es/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/es/LC_MESSAGES/sphinx.po b/sphinx/locale/es/LC_MESSAGES/sphinx.po index b7718a10..d73327cf 100644 --- a/sphinx/locale/es/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/es/LC_MESSAGES/sphinx.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Sphinx 0.5\n" "Report-Msgid-Bugs-To: guillem@torroja.dmt.upm.es\n" "POT-Creation-Date: 2008-09-11 23:58+0200\n" -"PO-Revision-Date: 2009-08-06 22:48+0200\n" +"PO-Revision-Date: 2009-08-06 23:04+0200\n" "Last-Translator: Guillem Borrell <guillem@torroja.dmt.upm.es>\n" "Language-Team: es <LL@li.org>\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 0.9.4\n" -#: sphinx/environment.py:103 sphinx/writers/latex.py:182 +#: sphinx/environment.py:103 sphinx/writers/latex.py:184 #, fuzzy, python-format msgid "%B %d, %Y" msgstr "%d de %B de %Y" @@ -26,12 +26,12 @@ msgstr "%d de %B de %Y" #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 #: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "Índice" -#: sphinx/environment.py:325 sphinx/writers/latex.py:187 +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 msgid "Module Index" msgstr "Índice de Módulos" @@ -59,34 +59,34 @@ msgstr "Funciones de base" msgid "Module level" msgstr "Módulos" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:222 #, python-format msgid "%b %d, %Y" msgstr "%d %b, %Y" -#: sphinx/builders/html.py:224 sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "Índice General" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:241 msgid "index" msgstr "índice" -#: sphinx/builders/html.py:226 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 #: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 #: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 msgid "Global Module Index" msgstr "Índice Global de Módulos" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:244 msgid "modules" msgstr "módulos" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:300 msgid "next" msgstr "siguiente" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:309 msgid "previous" msgstr "anterior" @@ -211,37 +211,37 @@ msgstr "%s (variable C)" msgid "%scommand line option; %s" msgstr "%sOpciones en línea de comandos; %s" -#: sphinx/directives/other.py:138 +#: sphinx/directives/other.py:140 msgid "Platforms: " msgstr "Plataformas:" -#: sphinx/directives/other.py:144 +#: sphinx/directives/other.py:146 #, python-format msgid "%s (module)" msgstr "%s (módulo)" -#: sphinx/directives/other.py:193 +#: sphinx/directives/other.py:195 msgid "Section author: " msgstr "Autor de la sección" -#: sphinx/directives/other.py:195 +#: sphinx/directives/other.py:197 msgid "Module author: " msgstr "Autor del módulo" -#: sphinx/directives/other.py:197 +#: sphinx/directives/other.py:199 msgid "Author: " msgstr "Autor:" -#: sphinx/directives/other.py:317 +#: sphinx/directives/other.py:319 msgid "See also" msgstr "Ver también" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:889 #, python-format msgid " Bases: %s" msgstr "" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:922 #, python-format msgid "alias of :class:`%s`" msgstr "" @@ -436,40 +436,40 @@ msgstr "Ir a" msgid "Enter search terms or a module, class or function name." msgstr "Introducir en nombre de un módulo, clase o función" -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "Buscar en %(docstitle)s" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" msgstr "Sobre este documento" -#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "Búsqueda" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "Copyright" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "© <a href=\\\"%(path)s\\\">Copyright</a> %(copyright)s." -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 #, python-format msgid "© Copyright %(copyright)s." msgstr "© Copyright %(copyright)s." -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 #, python-format msgid "Last updated on %(last_updated)s." msgstr "Actualizado por última vez en %(last_updated)s." -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 #, python-format msgid "" "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " @@ -511,7 +511,7 @@ msgid "search" msgstr "buscar" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:462 msgid "Search Results" msgstr "Resultados de la búsqueda" @@ -569,16 +569,16 @@ msgstr "Buscando" msgid "Preparing search..." msgstr "Preparando la búsqueda" -#: sphinx/themes/basic/static/searchtools.js:338 +#: sphinx/themes/basic/static/searchtools.js:347 #, fuzzy msgid "module, in " msgstr "módulo" -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:356 msgid ", in " msgstr "" -#: sphinx/themes/basic/static/searchtools.js:455 +#: sphinx/themes/basic/static/searchtools.js:464 msgid "" "Your search did not match any documents. Please make sure that all words " "are spelled correctly and that you've selected enough categories." @@ -587,27 +587,27 @@ msgstr "" "todas las palabras correctamente y que ha seleccionado suficientes " "categorías" -#: sphinx/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:466 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "" "Búsqueda finalizada, se han encontrado %s página(s) que concuerdan con su" " consulta" -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 #, fuzzy msgid "Release" msgstr "Versión" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:578 msgid "Footnotes" msgstr "" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:646 msgid "continued from previous page" msgstr "" -#: sphinx/writers/latex.py:644 +#: sphinx/writers/latex.py:651 #, fuzzy msgid "Continued on next page" msgstr "Índice completo en una página" diff --git a/sphinx/locale/fi/LC_MESSAGES/sphinx.mo b/sphinx/locale/fi/LC_MESSAGES/sphinx.mo Binary files differindex b5fdd710..61d8da8f 100644 --- a/sphinx/locale/fi/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/fi/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/fi/LC_MESSAGES/sphinx.po b/sphinx/locale/fi/LC_MESSAGES/sphinx.po index 1cbd8e74..5cad377e 100644 --- a/sphinx/locale/fi/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/fi/LC_MESSAGES/sphinx.po @@ -8,7 +8,7 @@ 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-08-06 22:48+0200\n" +"PO-Revision-Date: 2009-08-06 23:04+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" @@ -17,7 +17,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 0.9.4\n" -#: sphinx/environment.py:103 sphinx/writers/latex.py:182 +#: sphinx/environment.py:103 sphinx/writers/latex.py:184 #, python-format msgid "%B %d, %Y" msgstr "%d.%m.%Y" @@ -26,12 +26,12 @@ msgstr "%d.%m.%Y" #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 #: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "Sisällysluettelo" -#: sphinx/environment.py:325 sphinx/writers/latex.py:187 +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 msgid "Module Index" msgstr "Moduuli sisällysluettelo" @@ -57,34 +57,34 @@ msgstr "" msgid "Module level" msgstr "Moduulitaso" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:222 #, python-format msgid "%b %d, %Y" msgstr "%d.%m.%Y" -#: sphinx/builders/html.py:224 sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "Yleinen sisällysluettelo" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:241 msgid "index" msgstr "hakemisto" -#: sphinx/builders/html.py:226 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 #: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 #: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 msgid "Global Module Index" msgstr "Yleinen moduulien sisällysluettelo" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:244 msgid "modules" msgstr "moduulit" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:300 msgid "next" msgstr ">" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:309 msgid "previous" msgstr "<" @@ -207,37 +207,37 @@ msgstr "" msgid "%scommand line option; %s" msgstr "" -#: sphinx/directives/other.py:138 +#: sphinx/directives/other.py:140 msgid "Platforms: " msgstr "Ympäristö" -#: sphinx/directives/other.py:144 +#: sphinx/directives/other.py:146 #, python-format msgid "%s (module)" msgstr "%s (moduuli)" -#: sphinx/directives/other.py:193 +#: sphinx/directives/other.py:195 msgid "Section author: " msgstr "Luvun kirjoittaja: " -#: sphinx/directives/other.py:195 +#: sphinx/directives/other.py:197 msgid "Module author: " msgstr "Moduulin kirjoittaja: " -#: sphinx/directives/other.py:197 +#: sphinx/directives/other.py:199 msgid "Author: " msgstr "Tekijä: " -#: sphinx/directives/other.py:317 +#: sphinx/directives/other.py:319 msgid "See also" msgstr "Katso myös" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:889 #, python-format msgid " Bases: %s" msgstr "" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:922 #, python-format msgid "alias of :class:`%s`" msgstr "" @@ -430,40 +430,40 @@ msgstr "Siirry" msgid "Enter search terms or a module, class or function name." msgstr "Anna etsittävä termi tai moduuli, luokka tai funktio" -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" msgstr "Tietoja tästä documentistä" -#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "Etsi" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "" -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 #, python-format msgid "© Copyright %(copyright)s." msgstr "" -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 #, python-format msgid "Last updated on %(last_updated)s." msgstr "" -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 #, python-format msgid "" "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " @@ -498,7 +498,7 @@ msgid "search" msgstr "etsi" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:462 msgid "Search Results" msgstr "Etsinnän tulos" @@ -555,38 +555,38 @@ msgstr "Etsitään" msgid "Preparing search..." msgstr "Valmistellaan etsintää..." -#: sphinx/themes/basic/static/searchtools.js:338 +#: sphinx/themes/basic/static/searchtools.js:347 msgid "module, in " msgstr "" -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:356 msgid ", in " msgstr "" -#: sphinx/themes/basic/static/searchtools.js:455 +#: sphinx/themes/basic/static/searchtools.js:464 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/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:466 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "Etsintä tehty, löydetty %s sivu(a)." -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 msgid "Release" msgstr "" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:578 msgid "Footnotes" msgstr "" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:646 msgid "continued from previous page" msgstr "" -#: sphinx/writers/latex.py:644 +#: sphinx/writers/latex.py:651 #, fuzzy msgid "Continued on next page" msgstr "" diff --git a/sphinx/locale/fr/LC_MESSAGES/sphinx.mo b/sphinx/locale/fr/LC_MESSAGES/sphinx.mo Binary files differindex 0e420dfb..704ddef0 100644 --- a/sphinx/locale/fr/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/fr/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/fr/LC_MESSAGES/sphinx.po b/sphinx/locale/fr/LC_MESSAGES/sphinx.po index a8960ada..fb1f1984 100644 --- a/sphinx/locale/fr/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/fr/LC_MESSAGES/sphinx.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Sphinx 0.5\n" "Report-Msgid-Bugs-To: larlet@gmail.com\n" "POT-Creation-Date: 2008-08-08 12:39+0000\n" -"PO-Revision-Date: 2009-08-06 22:48+0200\n" +"PO-Revision-Date: 2009-08-06 23:04+0200\n" "Last-Translator: Sébastien Douche <sdouche@gmail.com>\n" "Language-Team: French Translation Team <sphinx-dev@googlegroups.com>\n" "Plural-Forms: nplurals=2; plural=(n > 1)\n" @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 0.9.4\n" -#: sphinx/environment.py:103 sphinx/writers/latex.py:182 +#: sphinx/environment.py:103 sphinx/writers/latex.py:184 #, python-format msgid "%B %d, %Y" msgstr "%d %B %Y" @@ -27,12 +27,12 @@ msgstr "%d %B %Y" #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 #: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "Index" -#: sphinx/environment.py:325 sphinx/writers/latex.py:187 +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 msgid "Module Index" msgstr "Index du module" @@ -58,34 +58,34 @@ msgstr "Fonctions de base" msgid "Module level" msgstr "Module" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:222 #, python-format msgid "%b %d, %Y" msgstr "%d %b %Y" -#: sphinx/builders/html.py:224 sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "Index général" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:241 msgid "index" msgstr "index" -#: sphinx/builders/html.py:226 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 #: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 #: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 msgid "Global Module Index" msgstr "Index général des modules" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:244 msgid "modules" msgstr "modules" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:300 msgid "next" msgstr "suivant" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:309 msgid "previous" msgstr "précédent" @@ -209,37 +209,37 @@ msgstr "%s (variable C)" msgid "%scommand line option; %s" msgstr "%soption de ligne de commande; %s" -#: sphinx/directives/other.py:138 +#: sphinx/directives/other.py:140 msgid "Platforms: " msgstr "Plateformes : " -#: sphinx/directives/other.py:144 +#: sphinx/directives/other.py:146 #, python-format msgid "%s (module)" msgstr "%s (module)" -#: sphinx/directives/other.py:193 +#: sphinx/directives/other.py:195 msgid "Section author: " msgstr "Auteur de la section : " -#: sphinx/directives/other.py:195 +#: sphinx/directives/other.py:197 msgid "Module author: " msgstr "Auteur du module : " -#: sphinx/directives/other.py:197 +#: sphinx/directives/other.py:199 msgid "Author: " msgstr "Auteur : " -#: sphinx/directives/other.py:317 +#: sphinx/directives/other.py:319 msgid "See also" msgstr "Voir aussi" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:889 #, python-format msgid " Bases: %s" msgstr "" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:922 #, python-format msgid "alias of :class:`%s`" msgstr "" @@ -433,40 +433,40 @@ msgstr "Go" msgid "Enter search terms or a module, class or function name." msgstr "Saisissez un nom de module, classe ou fonction." -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "Recherchez dans %(docstitle)s" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" msgstr "À propos de ces documents" -#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "Recherche" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "Copyright" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 #, python-format msgid "© Copyright %(copyright)s." msgstr "© Copyright %(copyright)s." -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 #, python-format msgid "Last updated on %(last_updated)s." msgstr "Mis à jour le %(last_updated)s." -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 #, python-format msgid "" "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " @@ -511,7 +511,7 @@ msgid "search" msgstr "rechercher" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:462 msgid "Search Results" msgstr "Résultats de la recherche" @@ -568,15 +568,15 @@ msgstr "En cours de recherche" msgid "Preparing search..." msgstr "Préparation de la recherche..." -#: sphinx/themes/basic/static/searchtools.js:338 +#: sphinx/themes/basic/static/searchtools.js:347 msgid "module, in " msgstr "module, dans" -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:356 msgid ", in " msgstr ", dans" -#: sphinx/themes/basic/static/searchtools.js:455 +#: sphinx/themes/basic/static/searchtools.js:464 msgid "" "Your search did not match any documents. Please make sure that all words " "are spelled correctly and that you've selected enough categories." @@ -585,24 +585,24 @@ msgstr "" "des termes de recherche et que vous avez sélectionné suffisamment de " "catégories." -#: sphinx/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:466 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "La recherche est terminée, %s page(s) correspond(ent) à la requête." -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 msgid "Release" msgstr "Version" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:578 msgid "Footnotes" msgstr "" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:646 msgid "continued from previous page" msgstr "" -#: sphinx/writers/latex.py:644 +#: sphinx/writers/latex.py:651 #, fuzzy msgid "Continued on next page" msgstr "Index complet sur une seule page" diff --git a/sphinx/locale/hr/LC_MESSAGES/sphinx.js b/sphinx/locale/hr/LC_MESSAGES/sphinx.js new file mode 100644 index 00000000..8db6b8f8 --- /dev/null +++ b/sphinx/locale/hr/LC_MESSAGES/sphinx.js @@ -0,0 +1 @@ +Documentation.addTranslations({"locale": "hr", "plural_expr": "0", "messages": {"Search Results": "Rezultati pretrage", "Preparing search...": "Pripremam pretra\u017eivanje...", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "Za va\u0161u pretragu nema rezultata. Molimo pregledajte da li so sve rije\u010di ispravno napisane i da li ste izbrali dovoljno kategorija.", "Search finished, found %s page(s) matching the search query.": "Pretra\u017eivanje je zaklju\u010deno, prona\u0111eno %s stranica, koje odgovaraju tra\u017eenom nizu.", ", in ": ", u ", "Permalink to this headline": "Link na taj naslov", "Searching": "Tra\u017eim", "Permalink to this definition": "Link na tu definiciju", "module, in ": "modul, u ", "Hide Search Matches": "Sakrij rezultate pretrage"}});
\ No newline at end of file diff --git a/sphinx/locale/hr/LC_MESSAGES/sphinx.mo b/sphinx/locale/hr/LC_MESSAGES/sphinx.mo Binary files differnew file mode 100644 index 00000000..b314dbd6 --- /dev/null +++ b/sphinx/locale/hr/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/hr/LC_MESSAGES/sphinx.po b/sphinx/locale/hr/LC_MESSAGES/sphinx.po new file mode 100644 index 00000000..d4b1fa3c --- /dev/null +++ b/sphinx/locale/hr/LC_MESSAGES/sphinx.po @@ -0,0 +1,606 @@ +msgid "" +msgstr "" +"Project-Id-Version: Sphinx\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2010-09-11 23:58+0200\n" +"PO-Revision-Date: 2009-08-06 23:04+0200\n" +"Last-Translator: Bojan Mihelač <bmihelac@mihelac.org>\n" +"Language-Team: Bojan Mihelač <bmihelac@mihelac.org>\n" +"Plural-Forms: nplurals=1; plural=0\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:103 sphinx/writers/latex.py:184 +#, python-format +msgid "%B %d, %Y" +msgstr "%d %B, %Y" + +#: sphinx/environment.py:324 sphinx/themes/basic/genindex-single.html:2 +#: sphinx/themes/basic/genindex-split.html:2 +#: sphinx/themes/basic/genindex-split.html:5 +#: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 +msgid "Index" +msgstr "Abecedni popis" + +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 +msgid "Module Index" +msgstr "Popis modula" + +#: sphinx/environment.py:326 sphinx/themes/basic/defindex.html:16 +msgid "Search Page" +msgstr "Tražilica" + +#: sphinx/roles.py:55 sphinx/directives/desc.py:747 +#, python-format +msgid "environment variable; %s" +msgstr "varijabla okruženja; %s" + +#: sphinx/roles.py:62 +#, python-format +msgid "Python Enhancement Proposals!PEP %s" +msgstr "Python Enhancement Proposals!PEP %s" + +#: sphinx/builders/changes.py:71 +msgid "Builtins" +msgstr "Ugrađeni dijelovi" + +#: sphinx/builders/changes.py:73 +msgid "Module level" +msgstr "Nivo modula" + +#: sphinx/builders/html.py:222 +#, python-format +msgid "%b %d, %Y" +msgstr "%d %b, %Y" + +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 +msgid "General Index" +msgstr "Opceniti abecedni indeks" + +#: sphinx/builders/html.py:241 +msgid "index" +msgstr "abecedni indeks" + +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 +#: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 +msgid "Global Module Index" +msgstr "Općeniti popis modula" + +#: sphinx/builders/html.py:244 +msgid "modules" +msgstr "Moduli" + +#: sphinx/builders/html.py:300 +msgid "next" +msgstr "naprijed" + +#: sphinx/builders/html.py:309 +msgid "previous" +msgstr "nazad" + +#: sphinx/builders/latex.py:162 +msgid " (in " +msgstr " (u " + +#: sphinx/directives/desc.py:97 +msgid "Raises" +msgstr "Podiže" + +#: sphinx/directives/desc.py:101 +msgid "Variable" +msgstr "Varijabla" + +#: sphinx/directives/desc.py:104 +msgid "Returns" +msgstr "Vraća" + +#: sphinx/directives/desc.py:113 +msgid "Return type" +msgstr "Vraća tip" + +#: sphinx/directives/desc.py:186 +msgid "Parameter" +msgstr "Parametar" + +#: sphinx/directives/desc.py:190 +msgid "Parameters" +msgstr "Parametri" + +#: sphinx/directives/desc.py:418 +#, python-format +msgid "%s() (built-in function)" +msgstr "%s() (ugrađene funkcije)" + +#: sphinx/directives/desc.py:419 sphinx/directives/desc.py:476 +#: sphinx/directives/desc.py:488 +#, python-format +msgid "%s() (in module %s)" +msgstr "%s() (u modulu %s)" + +#: sphinx/directives/desc.py:422 +#, python-format +msgid "%s (built-in variable)" +msgstr "%s (ugrađene variable)" + +#: sphinx/directives/desc.py:423 sphinx/directives/desc.py:514 +#, python-format +msgid "%s (in module %s)" +msgstr "%s (u modulu %s)" + +#: sphinx/directives/desc.py:439 +#, python-format +msgid "%s (built-in class)" +msgstr "%s (ugrađen razred)" + +#: sphinx/directives/desc.py:440 +#, python-format +msgid "%s (class in %s)" +msgstr "%s (razred u %s)" + +#: sphinx/directives/desc.py:480 +#, python-format +msgid "%s() (%s.%s method)" +msgstr "%s() (%s.%s metoda)" + +#: sphinx/directives/desc.py:482 +#, python-format +msgid "%s() (%s method)" +msgstr "%s() (%s metoda)" + +#: sphinx/directives/desc.py:492 +#, python-format +msgid "%s() (%s.%s static method)" +msgstr "%s() (%s.%s statična metoda)" + +#: sphinx/directives/desc.py:495 +#, python-format +msgid "%s() (%s static method)" +msgstr "%s() (%s statična metoda)" + +#: sphinx/directives/desc.py:518 +#, python-format +msgid "%s (%s.%s attribute)" +msgstr "%s (%s.%s atribut)" + +#: sphinx/directives/desc.py:520 +#, python-format +msgid "%s (%s attribute)" +msgstr "%s (%s atribut)" + +#: sphinx/directives/desc.py:609 +#, python-format +msgid "%s (C function)" +msgstr "%s (C funkcija)" + +#: sphinx/directives/desc.py:611 +#, python-format +msgid "%s (C member)" +msgstr "%s (C član)" + +#: sphinx/directives/desc.py:613 +#, python-format +msgid "%s (C macro)" +msgstr "%s (C makro)" + +#: sphinx/directives/desc.py:615 +#, python-format +msgid "%s (C type)" +msgstr "%s (C tip)" + +#: sphinx/directives/desc.py:617 +#, python-format +msgid "%s (C variable)" +msgstr "%s (C varijabla)" + +#: sphinx/directives/desc.py:665 +#, python-format +msgid "%scommand line option; %s" +msgstr "%scommand line parameter; %s" + +#: sphinx/directives/other.py:140 +msgid "Platforms: " +msgstr "Platforme:" + +#: sphinx/directives/other.py:146 +#, python-format +msgid "%s (module)" +msgstr "%s (modul)" + +#: sphinx/directives/other.py:195 +msgid "Section author: " +msgstr "Autor sekcije:" + +#: sphinx/directives/other.py:197 +msgid "Module author: " +msgstr "Autor modula:" + +#: sphinx/directives/other.py:199 +msgid "Author: " +msgstr "Autor:" + +#: sphinx/directives/other.py:319 +msgid "See also" +msgstr "Pogledaj i" + +#: sphinx/ext/autodoc.py:889 +#, python-format +msgid " Bases: %s" +msgstr " Osnove: %s" + +#: sphinx/ext/autodoc.py:922 +#, python-format +msgid "alias of :class:`%s`" +msgstr "nadimak za :class:`%s`" + +#: sphinx/ext/todo.py:41 +msgid "Todo" +msgstr "Todo" + +#: sphinx/ext/todo.py:99 +#, python-format +msgid "(The original entry is located in %s, line %d and can be found " +msgstr "(Originalan unos se nalazi u %s, u retku %d, i može biti pronađen " + +#: sphinx/ext/todo.py:105 +msgid "here" +msgstr "ovdje" + +#: sphinx/locale/__init__.py:15 +msgid "Attention" +msgstr "Pozor" + +#: sphinx/locale/__init__.py:16 +msgid "Caution" +msgstr "Pažnja" + +#: sphinx/locale/__init__.py:17 +msgid "Danger" +msgstr "Opasnost" + +#: sphinx/locale/__init__.py:18 +msgid "Error" +msgstr "Greška" + +#: sphinx/locale/__init__.py:19 +msgid "Hint" +msgstr "Savjet" + +#: sphinx/locale/__init__.py:20 +msgid "Important" +msgstr "Važno" + +#: sphinx/locale/__init__.py:21 +msgid "Note" +msgstr "Napomena" + +#: sphinx/locale/__init__.py:22 +msgid "See Also" +msgstr "Pogledaj i" + +#: sphinx/locale/__init__.py:23 +msgid "Tip" +msgstr "Savjet" + +#: sphinx/locale/__init__.py:24 +msgid "Warning" +msgstr "Upozorenje" + +#: sphinx/locale/__init__.py:28 +#, python-format +msgid "New in version %s" +msgstr "Novo u verziji %s" + +#: sphinx/locale/__init__.py:29 +#, python-format +msgid "Changed in version %s" +msgstr "Promijenjeno u verziji %s" + +#: sphinx/locale/__init__.py:30 +#, python-format +msgid "Deprecated since version %s" +msgstr "Zastarijelo od verzije %s" + +#: sphinx/locale/__init__.py:34 +msgid "module" +msgstr "modul" + +#: sphinx/locale/__init__.py:35 +msgid "keyword" +msgstr "ključna riječ" + +#: sphinx/locale/__init__.py:36 +msgid "operator" +msgstr "operator" + +#: sphinx/locale/__init__.py:37 +msgid "object" +msgstr "objekt" + +#: sphinx/locale/__init__.py:38 +msgid "exception" +msgstr "izuzetak" + +#: sphinx/locale/__init__.py:39 +msgid "statement" +msgstr "izjava" + +#: sphinx/locale/__init__.py:40 +msgid "built-in function" +msgstr "ugrađen funkcije" + +#: sphinx/themes/basic/defindex.html:2 +msgid "Overview" +msgstr "Pregled" + +#: sphinx/themes/basic/defindex.html:11 +msgid "Indices and tables:" +msgstr "Kazala i tabele:" + +#: sphinx/themes/basic/defindex.html:14 +msgid "Complete Table of Contents" +msgstr "Potpuna tabela sadržaja" + +#: sphinx/themes/basic/defindex.html:15 +msgid "lists all sections and subsections" +msgstr "prikaži sve sekcije i podsekcije" + +#: sphinx/themes/basic/defindex.html:17 +msgid "search this documentation" +msgstr "traži po dokumentaciji" + +#: sphinx/themes/basic/defindex.html:20 +msgid "quick access to all modules" +msgstr "brz dostup do svih modulov" + +#: sphinx/themes/basic/defindex.html:22 +msgid "all functions, classes, terms" +msgstr "sve funkcije, razredi, izrazi" + +#: sphinx/themes/basic/genindex-single.html:5 +#, python-format +msgid "Index – %(key)s" +msgstr "Index – %(key)s" + +#: sphinx/themes/basic/genindex-single.html:44 +#: sphinx/themes/basic/genindex-split.html:14 +#: sphinx/themes/basic/genindex-split.html:27 +#: sphinx/themes/basic/genindex.html:54 +msgid "Full index on one page" +msgstr "Potpun indeks na jednoj strani" + +#: sphinx/themes/basic/genindex-split.html:7 +msgid "Index pages by letter" +msgstr "Indeksiraj stranice po slovu" + +#: sphinx/themes/basic/genindex-split.html:15 +msgid "can be huge" +msgstr "može biti veliko" + +#: sphinx/themes/basic/layout.html:10 +msgid "Navigation" +msgstr "Navigacija" + +#: sphinx/themes/basic/layout.html:42 +msgid "Table Of Contents" +msgstr "Pregled sadržaja" + +#: sphinx/themes/basic/layout.html:48 +msgid "Previous topic" +msgstr "Prijašnja tema" + +#: sphinx/themes/basic/layout.html:50 +msgid "previous chapter" +msgstr "Prijašnje poglavje" + +#: sphinx/themes/basic/layout.html:53 +msgid "Next topic" +msgstr "Slijedeća tema" + +#: sphinx/themes/basic/layout.html:55 +msgid "next chapter" +msgstr "slijedeće poglavje" + +#: sphinx/themes/basic/layout.html:60 +msgid "This Page" +msgstr "Trenutna stranica" + +#: sphinx/themes/basic/layout.html:63 +msgid "Show Source" +msgstr "Prikaži izvorni kod" + +#: sphinx/themes/basic/layout.html:73 +msgid "Quick search" +msgstr "Brzo pretraživanje" + +#: sphinx/themes/basic/layout.html:76 +msgid "Go" +msgstr "Naprijed" + +#: sphinx/themes/basic/layout.html:81 +msgid "Enter search terms or a module, class or function name." +msgstr "Unesi ime modula, razreda ili funkcije." + +#: sphinx/themes/basic/layout.html:122 +#, python-format +msgid "Search within %(docstitle)s" +msgstr "Traži između %(docstitle)s" + +#: sphinx/themes/basic/layout.html:131 +msgid "About these documents" +msgstr "O ovim dokumentima" + +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/search.html:5 +msgid "Search" +msgstr "Traži" + +#: sphinx/themes/basic/layout.html:140 +msgid "Copyright" +msgstr "Sva prava zadržana" + +#: sphinx/themes/basic/layout.html:187 +#, python-format +msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." +msgstr "© <a href=\"%(path)s\">Sva prava zadržana</a> %(copyright)s." + +#: sphinx/themes/basic/layout.html:189 +#, python-format +msgid "© Copyright %(copyright)s." +msgstr "© Sva prava zadržana %(copyright)s." + +#: sphinx/themes/basic/layout.html:193 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Zadnji put ažurirano %(last_updated)s." + +#: sphinx/themes/basic/layout.html:196 +#, python-format +msgid "" +"Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " +"%(sphinx_version)s." +msgstr "" +"Izrađeno sa <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " +"%(sphinx_version)s." + +#: sphinx/themes/basic/modindex.html:36 +msgid "Deprecated" +msgstr "Zastarjelo" + +#: sphinx/themes/basic/opensearch.xml:4 +#, python-format +msgid "Search %(docstitle)s" +msgstr "Traži %(docstitle)s" + +#: sphinx/themes/basic/search.html:9 +msgid "" +"Please activate JavaScript to enable the search\n" +" functionality." +msgstr "" +"Molimo omogućite JavaScript\n" +" za djelovanje tražilice." + +#: sphinx/themes/basic/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 "" +"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." + +#: sphinx/themes/basic/search.html:21 +msgid "search" +msgstr "traži" + +#: sphinx/themes/basic/search.html:25 +#: sphinx/themes/basic/static/searchtools.js:462 +msgid "Search Results" +msgstr "Rezultati pretrage" + +#: sphinx/themes/basic/search.html:27 +msgid "Your search did not match any results." +msgstr "Your search did not match any results." + +#: sphinx/themes/basic/changes/frameset.html:5 +#: sphinx/themes/basic/changes/versionchanges.html:12 +#, python-format +msgid "Changes in Version %(version)s — %(docstitle)s" +msgstr "Changes in Version %(version)s — %(docstitle)s" + +#: sphinx/themes/basic/changes/rstsource.html:5 +#, python-format +msgid "%(filename)s — %(docstitle)s" +msgstr "%(filename)s — %(docstitle)s" + +#: sphinx/themes/basic/changes/versionchanges.html:17 +#, python-format +msgid "Automatically generated list of changes in version %(version)s" +msgstr "Automatically generated list of changes in version %(version)s" + +#: sphinx/themes/basic/changes/versionchanges.html:18 +msgid "Library changes" +msgstr "Library changes" + +#: sphinx/themes/basic/changes/versionchanges.html:23 +msgid "C API changes" +msgstr "C API changes" + +#: sphinx/themes/basic/changes/versionchanges.html:25 +msgid "Other changes" +msgstr "Ostale promjene" + +#: sphinx/themes/basic/static/doctools.js:139 sphinx/writers/html.py:473 +#: sphinx/writers/html.py:478 +msgid "Permalink to this headline" +msgstr "Link na taj naslov" + +#: sphinx/themes/basic/static/doctools.js:145 sphinx/writers/html.py:80 +msgid "Permalink to this definition" +msgstr "Link na tu definiciju" + +#: sphinx/themes/basic/static/doctools.js:174 +msgid "Hide Search Matches" +msgstr "Sakrij rezultate pretrage" + +#: sphinx/themes/basic/static/searchtools.js:274 +msgid "Searching" +msgstr "Tražim" + +#: sphinx/themes/basic/static/searchtools.js:279 +msgid "Preparing search..." +msgstr "Pripremam pretraživanje..." + +#: sphinx/themes/basic/static/searchtools.js:347 +msgid "module, in " +msgstr "modul, u " + +#: sphinx/themes/basic/static/searchtools.js:356 +msgid ", in " +msgstr ", u " + +#: sphinx/themes/basic/static/searchtools.js:464 +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 "" +"Za vašu pretragu nema rezultata. Molimo pregledajte da li so sve riječi " +"ispravno napisane i da li ste izbrali dovoljno kategorija." + +#: sphinx/themes/basic/static/searchtools.js:466 +#, python-format +msgid "Search finished, found %s page(s) matching the search query." +msgstr "Pretraživanje je zaključeno, pronađeno %s stranica, koje odgovaraju traženom nizu." + +#: sphinx/writers/latex.py:187 +msgid "Release" +msgstr "Distribucija" + +#: sphinx/writers/latex.py:578 +msgid "Footnotes" +msgstr "" + +#: sphinx/writers/latex.py:646 +msgid "continued from previous page" +msgstr "nastavak sa prethodne stranice" + +#: sphinx/writers/latex.py:651 +msgid "Continued on next page" +msgstr "nastavak na slijedećoj stranici" + +#: sphinx/writers/text.py:166 +#, python-format +msgid "Platform: %s" +msgstr "Platforma: %s" + +#: sphinx/writers/text.py:428 +msgid "[image]" +msgstr "[slika]" + diff --git a/sphinx/locale/it/LC_MESSAGES/sphinx.mo b/sphinx/locale/it/LC_MESSAGES/sphinx.mo Binary files differindex 6a55d16d..0a79fafe 100644 --- a/sphinx/locale/it/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/it/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/it/LC_MESSAGES/sphinx.po b/sphinx/locale/it/LC_MESSAGES/sphinx.po index f0e981c9..ec240872 100644 --- a/sphinx/locale/it/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/it/LC_MESSAGES/sphinx.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Sphinx 0.5\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2008-11-27 18:39+0100\n" -"PO-Revision-Date: 2009-08-06 22:48+0200\n" +"PO-Revision-Date: 2009-08-06 23:04+0200\n" "Last-Translator: Sandro Dentella <sandro@e-den.it>\n" "Language-Team: <sphinx-dev@googlegroups.com>\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 0.9.4\n" -#: sphinx/environment.py:103 sphinx/writers/latex.py:182 +#: sphinx/environment.py:103 sphinx/writers/latex.py:184 #, python-format msgid "%B %d, %Y" msgstr "%d %B %Y" @@ -25,12 +25,12 @@ msgstr "%d %B %Y" #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 #: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "Indice" -#: sphinx/environment.py:325 sphinx/writers/latex.py:187 +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 msgid "Module Index" msgstr "Indice dei Moduli" @@ -56,34 +56,34 @@ msgstr "Builtin" msgid "Module level" msgstr "Modulo" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:222 #, python-format msgid "%b %d, %Y" msgstr "%d/%b/%Y" -#: sphinx/builders/html.py:224 sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "Indice generale" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:241 msgid "index" msgstr "indice" -#: sphinx/builders/html.py:226 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 #: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 #: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 msgid "Global Module Index" msgstr "Indice dei moduli" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:244 msgid "modules" msgstr "moduli" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:300 msgid "next" msgstr "successivo" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:309 msgid "previous" msgstr "precedente" @@ -206,37 +206,37 @@ msgstr "%s (variabile C)" msgid "%scommand line option; %s" msgstr "%sopzione di linea di comando; %s" -#: sphinx/directives/other.py:138 +#: sphinx/directives/other.py:140 msgid "Platforms: " msgstr "Piattaforme:" -#: sphinx/directives/other.py:144 +#: sphinx/directives/other.py:146 #, python-format msgid "%s (module)" msgstr "%s (modulo)" -#: sphinx/directives/other.py:193 +#: sphinx/directives/other.py:195 msgid "Section author: " msgstr "Autore della sezione" -#: sphinx/directives/other.py:195 +#: sphinx/directives/other.py:197 msgid "Module author: " msgstr "Autore del modulo" -#: sphinx/directives/other.py:197 +#: sphinx/directives/other.py:199 msgid "Author: " msgstr "Autore: " -#: sphinx/directives/other.py:317 +#: sphinx/directives/other.py:319 msgid "See also" msgstr "Vedi anche" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:889 #, python-format msgid " Bases: %s" msgstr "" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:922 #, python-format msgid "alias of :class:`%s`" msgstr "alias per :class:`%s`" @@ -429,40 +429,40 @@ msgstr "Vai" msgid "Enter search terms or a module, class or function name." msgstr "Inserisci un termine di ricerca un modulo, classe o nome di funzione" -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "Cerca in %(docstitle)s" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" msgstr "A proposito di questi documenti" -#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "Cerca" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "Copyright" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 #, python-format msgid "© Copyright %(copyright)s." msgstr "© Copyright %(copyright)s." -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 #, python-format msgid "Last updated on %(last_updated)s." msgstr "Ultimo aggiornamento %(last_updated)s." -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 #, python-format msgid "" "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " @@ -505,7 +505,7 @@ msgid "search" msgstr "cerca" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:462 msgid "Search Results" msgstr "Risultati della ricerca" @@ -562,15 +562,15 @@ msgstr "Ricerca in corso" msgid "Preparing search..." msgstr "Preparazione della ricerca" -#: sphinx/themes/basic/static/searchtools.js:338 +#: sphinx/themes/basic/static/searchtools.js:347 msgid "module, in " msgstr "modulo, in" -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:356 msgid ", in " msgstr ", in " -#: sphinx/themes/basic/static/searchtools.js:455 +#: sphinx/themes/basic/static/searchtools.js:464 msgid "" "Your search did not match any documents. Please make sure that all words " "are spelled correctly and that you've selected enough categories." @@ -579,24 +579,24 @@ msgstr "" "dei termini di ricerca e di avere selezionato un numero sufficiente di " "categorie" -#: sphinx/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:466 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "Ricerca terminata, trovate %s pagine corrispondenti alla ricerca." -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 msgid "Release" msgstr "Release" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:578 msgid "Footnotes" msgstr "" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:646 msgid "continued from previous page" msgstr "" -#: sphinx/writers/latex.py:644 +#: sphinx/writers/latex.py:651 #, fuzzy msgid "Continued on next page" msgstr "Indice completo in una pagina" diff --git a/sphinx/locale/ja/LC_MESSAGES/sphinx.mo b/sphinx/locale/ja/LC_MESSAGES/sphinx.mo Binary files differindex fcfb0cba..c6a40e96 100644 --- a/sphinx/locale/ja/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/ja/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/ja/LC_MESSAGES/sphinx.po b/sphinx/locale/ja/LC_MESSAGES/sphinx.po index afaedfdc..3b0ce0f0 100644 --- a/sphinx/locale/ja/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/ja/LC_MESSAGES/sphinx.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Sphinx 0.5\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2008-09-11 23:58+0200\n" -"PO-Revision-Date: 2009-08-06 22:48+0200\n" +"PO-Revision-Date: 2009-08-06 23:04+0200\n" "Last-Translator: Yasushi MASUDA <whosaysni@gmail.com>\n" "Language-Team: ja <LL@li.org>\n" "Plural-Forms: nplurals=1; plural=0\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 0.9.4\n" -#: sphinx/environment.py:103 sphinx/writers/latex.py:182 +#: sphinx/environment.py:103 sphinx/writers/latex.py:184 #, python-format msgid "%B %d, %Y" msgstr "%Y 年 %m 月 %d 日" @@ -26,12 +26,12 @@ msgstr "%Y 年 %m 月 %d 日" #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 #: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "索引" -#: sphinx/environment.py:325 sphinx/writers/latex.py:187 +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 msgid "Module Index" msgstr "モジュール索引" @@ -57,34 +57,34 @@ msgstr "組み込み" msgid "Module level" msgstr "モジュールレベル" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:222 #, python-format msgid "%b %d, %Y" msgstr "%Y 年 %m 月 %d 日" -#: sphinx/builders/html.py:224 sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "総合索引" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:241 msgid "index" msgstr "索引" -#: sphinx/builders/html.py:226 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 #: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 #: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 msgid "Global Module Index" msgstr "モジュール総索引" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:244 msgid "modules" msgstr "モジュール" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:300 msgid "next" msgstr "次へ" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:309 msgid "previous" msgstr "前へ" @@ -208,37 +208,37 @@ msgstr "%s (C の変数)" msgid "%scommand line option; %s" msgstr "%sコマンドラインオプション; %s" -#: sphinx/directives/other.py:138 +#: sphinx/directives/other.py:140 msgid "Platforms: " msgstr "プラットフォーム: " -#: sphinx/directives/other.py:144 +#: sphinx/directives/other.py:146 #, python-format msgid "%s (module)" msgstr "%s (モジュール)" -#: sphinx/directives/other.py:193 +#: sphinx/directives/other.py:195 msgid "Section author: " msgstr "この節の作者: " -#: sphinx/directives/other.py:195 +#: sphinx/directives/other.py:197 msgid "Module author: " msgstr "モジュールの作者: " -#: sphinx/directives/other.py:197 +#: sphinx/directives/other.py:199 msgid "Author: " msgstr "作者: " -#: sphinx/directives/other.py:317 +#: sphinx/directives/other.py:319 msgid "See also" msgstr "参考" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:889 #, python-format msgid " Bases: %s" msgstr "" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:922 #, python-format msgid "alias of :class:`%s`" msgstr "" @@ -432,40 +432,40 @@ msgstr "検索" msgid "Enter search terms or a module, class or function name." msgstr "モジュール、クラス、または関数名を入力してください" -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "%(docstitle)s 内を検索" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" msgstr "このドキュメントについて" -#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "検索" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "著作権" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 #, python-format msgid "© Copyright %(copyright)s." msgstr "© Copyright %(copyright)s." -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 #, python-format msgid "Last updated on %(last_updated)s." msgstr "最終更新: %(last_updated)s" -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 #, python-format msgid "" "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " @@ -503,7 +503,7 @@ msgid "search" msgstr "検索" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:462 msgid "Search Results" msgstr "検索結果" @@ -560,39 +560,39 @@ msgstr "検索中" msgid "Preparing search..." msgstr "検索の準備中..." -#: sphinx/themes/basic/static/searchtools.js:338 +#: sphinx/themes/basic/static/searchtools.js:347 #, fuzzy msgid "module, in " msgstr "モジュール" -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:356 msgid ", in " msgstr "" -#: sphinx/themes/basic/static/searchtools.js:455 +#: sphinx/themes/basic/static/searchtools.js:464 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/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:466 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "検索が終了し、条件に一致するページが %s 個みつかりました。" -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 msgid "Release" msgstr "リリース" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:578 msgid "Footnotes" msgstr "" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:646 msgid "continued from previous page" msgstr "" -#: sphinx/writers/latex.py:644 +#: sphinx/writers/latex.py:651 #, fuzzy msgid "Continued on next page" msgstr "総索引" diff --git a/sphinx/locale/nl/LC_MESSAGES/sphinx.mo b/sphinx/locale/nl/LC_MESSAGES/sphinx.mo Binary files differindex d951b578..09ea107c 100644 --- a/sphinx/locale/nl/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/nl/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/pl/LC_MESSAGES/sphinx.js b/sphinx/locale/pl/LC_MESSAGES/sphinx.js index 2b7b66e0..60e0f269 100644 --- a/sphinx/locale/pl/LC_MESSAGES/sphinx.js +++ b/sphinx/locale/pl/LC_MESSAGES/sphinx.js @@ -1 +1 @@ -Documentation.addTranslations({"locale": "pl", "plural_expr": "(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)", "messages": {"Search Results": "Wyniki wyszukiwania", "Preparing search...": "Przygotowanie wyszukiwania...", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "Nie znaleziono \u017cadnych pasuj\u0105cych dokument\u00f3w. Upewnij si\u0119, \u017ce wszystkie s\u0142owa s\u0105 poprawnie wpisane i \u017ce wybra\u0142e\u015b wystarczaj\u0105c\u0105liczb\u0119 kategorii.", "Search finished, found %s page(s) matching the search query.": "Przeszukiwanie zako\u0144czone, znaleziono %s pasuj\u0105cych stron.", ", in ": "", "Permalink to this headline": "Sta\u0142y odno\u015bnik do tego nag\u0142\u00f3wka", "Searching": "Wyszukiwanie", "Permalink to this definition": "Sta\u0142y odno\u015bnik do tej definicji", "module, in ": "modu\u0142", "Hide Search Matches": "Ukryj wyniki wyszukiwania"}});
\ No newline at end of file +Documentation.addTranslations({"locale": "pl", "plural_expr": "(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)", "messages": {"Search Results": "Wyniki wyszukiwania", "Preparing search...": "Przygotowanie wyszukiwania...", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "Nie znaleziono \u017cadnych pasuj\u0105cych dokument\u00f3w. Upewnij si\u0119, \u017ce wszystkie s\u0142owa s\u0105 poprawnie wpisane i \u017ce wybra\u0142e\u015b wystarczaj\u0105c\u0105liczb\u0119 kategorii.", "Search finished, found %s page(s) matching the search query.": "Przeszukiwanie zako\u0144czone, znaleziono %s pasuj\u0105cych stron.", ", in ": ", w ", "Permalink to this headline": "Sta\u0142y odno\u015bnik do tego nag\u0142\u00f3wka", "Searching": "Wyszukiwanie", "Permalink to this definition": "Sta\u0142y odno\u015bnik do tej definicji", "module, in ": "modu\u0142, w ", "Hide Search Matches": "Ukryj wyniki wyszukiwania"}});
\ No newline at end of file diff --git a/sphinx/locale/pl/LC_MESSAGES/sphinx.mo b/sphinx/locale/pl/LC_MESSAGES/sphinx.mo Binary files differindex 56ecb26f..1abf2801 100644 --- a/sphinx/locale/pl/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/pl/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/pl/LC_MESSAGES/sphinx.po b/sphinx/locale/pl/LC_MESSAGES/sphinx.po index 350280b3..60638b1d 100644 --- a/sphinx/locale/pl/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/pl/LC_MESSAGES/sphinx.po @@ -1,42 +1,47 @@ - msgid "" msgstr "" "Project-Id-Version: Sphinx 0.5\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2008-08-10 11:43+0000\n" -"PO-Revision-Date: 2009-08-06 22:48+0200\n" +"PO-Revision-Date: 2009-09-07 10:28+0100\n" "Last-Translator: Michał Kandulski <Michal.Kandulski@poczta.onet.pl>\n" "Language-Team: \n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && " -"(n%100<10 || n%100>=20) ? 1 : 2)\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 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:103 sphinx/writers/latex.py:182 +#: sphinx/environment.py:103 +#: sphinx/writers/latex.py:184 #, python-format msgid "%B %d, %Y" msgstr "%B %d %Y" -#: sphinx/environment.py:324 sphinx/themes/basic/genindex-single.html:2 +#: sphinx/environment.py:324 +#: sphinx/themes/basic/genindex-single.html:2 #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 -#: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:2 +#: sphinx/themes/basic/genindex.html:5 +#: sphinx/themes/basic/genindex.html:48 +#: sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "Indeks" -#: sphinx/environment.py:325 sphinx/writers/latex.py:187 +#: sphinx/environment.py:325 +#: sphinx/writers/latex.py:189 msgid "Module Index" msgstr "Indeks modułów" -#: sphinx/environment.py:326 sphinx/themes/basic/defindex.html:16 +#: sphinx/environment.py:326 +#: sphinx/themes/basic/defindex.html:16 msgid "Search Page" msgstr "Wyszukiwanie" -#: sphinx/roles.py:55 sphinx/directives/desc.py:747 +#: sphinx/roles.py:55 +#: sphinx/directives/desc.py:747 #, python-format msgid "environment variable; %s" msgstr "zmienna środowiskowa; %s" @@ -54,40 +59,44 @@ msgstr "Wbudowane" msgid "Module level" msgstr "Poziom modułu" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:222 #, python-format msgid "%b %d, %Y" msgstr "%b %d %Y" -#: sphinx/builders/html.py:224 sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:241 +#: sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "Indeks ogólny" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:241 msgid "index" msgstr "indeks" -#: sphinx/builders/html.py:226 sphinx/builders/htmlhelp.py:219 -#: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 -#: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 +#: sphinx/builders/html.py:243 +#: sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/qthelp.py:133 +#: sphinx/themes/basic/defindex.html:19 +#: sphinx/themes/basic/modindex.html:2 +#: sphinx/themes/basic/modindex.html:13 msgid "Global Module Index" msgstr "Indeks modułów" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:244 msgid "modules" msgstr "moduły" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:300 msgid "next" msgstr "dalej" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:309 msgid "previous" msgstr "wstecz" #: sphinx/builders/latex.py:162 msgid " (in " -msgstr "" +msgstr " (w " #: sphinx/directives/desc.py:97 msgid "Raises" @@ -106,9 +115,8 @@ msgid "Return type" msgstr "Typ zwracany" #: sphinx/directives/desc.py:186 -#, fuzzy msgid "Parameter" -msgstr "Parametry" +msgstr "Parametr" #: sphinx/directives/desc.py:190 msgid "Parameters" @@ -119,7 +127,8 @@ msgstr "Parametry" msgid "%s() (built-in function)" msgstr "%s() (funkcja wbudowana)" -#: sphinx/directives/desc.py:419 sphinx/directives/desc.py:476 +#: sphinx/directives/desc.py:419 +#: sphinx/directives/desc.py:476 #: sphinx/directives/desc.py:488 #, python-format msgid "%s() (in module %s)" @@ -130,15 +139,16 @@ msgstr "%s() (w module %s)" msgid "%s (built-in variable)" msgstr "%s (zmienna wbudowana)" -#: sphinx/directives/desc.py:423 sphinx/directives/desc.py:514 +#: sphinx/directives/desc.py:423 +#: sphinx/directives/desc.py:514 #, python-format msgid "%s (in module %s)" msgstr "%s (w module %s)" #: sphinx/directives/desc.py:439 -#, fuzzy, python-format +#, python-format msgid "%s (built-in class)" -msgstr "%s (zmienna wbudowana)" +msgstr "%s (klasa wbudowana)" #: sphinx/directives/desc.py:440 #, python-format @@ -201,57 +211,57 @@ msgid "%s (C variable)" msgstr "%s (zmienna C)" #: sphinx/directives/desc.py:665 -#, fuzzy, python-format +#, python-format msgid "%scommand line option; %s" msgstr "%sopcja linii komend; %s" -#: sphinx/directives/other.py:138 +#: sphinx/directives/other.py:140 msgid "Platforms: " msgstr "Platformy: " -#: sphinx/directives/other.py:144 +#: sphinx/directives/other.py:146 #, python-format msgid "%s (module)" msgstr "%s (moduł)" -#: sphinx/directives/other.py:193 +#: sphinx/directives/other.py:195 msgid "Section author: " msgstr "Autor rozdziału: " -#: sphinx/directives/other.py:195 +#: sphinx/directives/other.py:197 msgid "Module author: " msgstr "Autor modułu: " -#: sphinx/directives/other.py:197 +#: sphinx/directives/other.py:199 msgid "Author: " msgstr "Autor: " -#: sphinx/directives/other.py:317 +#: sphinx/directives/other.py:319 msgid "See also" msgstr "Zobacz także" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:889 #, python-format msgid " Bases: %s" -msgstr "" +msgstr " Klasy bazowe: %s" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:922 #, python-format msgid "alias of :class:`%s`" -msgstr "" +msgstr "alias klasy :class:`%s`" #: sphinx/ext/todo.py:41 msgid "Todo" -msgstr "" +msgstr "Do zrobienia" #: sphinx/ext/todo.py:99 #, python-format msgid "(The original entry is located in %s, line %d and can be found " -msgstr "" +msgstr "(Oryginalny wpis znajduje się w pliku %s, w linii %d i może być odnaleziony " #: sphinx/ext/todo.py:105 msgid "here" -msgstr "" +msgstr "tutaj" #: sphinx/locale/__init__.py:15 msgid "Attention" @@ -425,51 +435,47 @@ msgid "Go" msgstr "Szukaj" #: sphinx/themes/basic/layout.html:81 -#, fuzzy msgid "Enter search terms or a module, class or function name." -msgstr "Wprowadź nazwę modułu, klasy lub funkcji." +msgstr "Wprowadź szukany termin lub nazwę modułu, klasy lub funkcji." -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "Szukaj pośród %(docstitle)s" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" msgstr "O tych dokumentach" -#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "Szukaj" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "Copyright" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 #, python-format msgid "© Copyright %(copyright)s." msgstr "© Copyright %(copyright)s." -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 #, python-format msgid "Last updated on %(last_updated)s." msgstr "Ostatnia modyfikacja %(last_updated)s." -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 #, python-format -msgid "" -"Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " -"%(sphinx_version)s." -msgstr "" -"Utworzone przy pomocy <a href=\"http://sphinx.pocoo.org/\">Sphinx</a>'a " -"%(sphinx_version)s." +msgid "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> %(sphinx_version)s." +msgstr "Utworzone przy pomocy <a href=\"http://sphinx.pocoo.org/\">Sphinx</a>'a %(sphinx_version)s." #: sphinx/themes/basic/modindex.html:36 msgid "Deprecated" @@ -484,10 +490,9 @@ msgstr "Przeszukaj %(docstitle)s" msgid "" "Please activate JavaScript to enable the search\n" " functionality." -msgstr "" +msgstr "Aby umożliwić wuszukiwanie, proszę włączyć JavaScript." #: sphinx/themes/basic/search.html:14 -#, fuzzy 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" @@ -496,16 +501,15 @@ msgid "" msgstr "" "Stąd możesz przeszukać dokumentację. Wprowadź szukane\n" " słowa w poniższym okienku i kliknij \"Szukaj\". Zwróć uwagę, że\n" -" funkcja szukająca będzie automatycznie szukała wszystkich słów. " -"Strony nie zawierające wszystkich słów nie znajdą się na wynikowej " -"liście." +" funkcja szukająca będzie automatycznie szukała wszystkich słów. Strony\n" +" nie zawierające wszystkich wpisanych słów nie znajdą się na wynikowej liście." #: sphinx/themes/basic/search.html:21 msgid "search" msgstr "Szukaj" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:462 msgid "Search Results" msgstr "Wyniki wyszukiwania" @@ -541,12 +545,14 @@ msgstr "Zmiany w C API" msgid "Other changes" msgstr "Inne zmiany" -#: sphinx/themes/basic/static/doctools.js:139 sphinx/writers/html.py:473 +#: sphinx/themes/basic/static/doctools.js:139 +#: sphinx/writers/html.py:473 #: sphinx/writers/html.py:478 msgid "Permalink to this headline" msgstr "Stały odnośnik do tego nagłówka" -#: sphinx/themes/basic/static/doctools.js:145 sphinx/writers/html.py:80 +#: sphinx/themes/basic/static/doctools.js:145 +#: sphinx/writers/html.py:80 msgid "Permalink to this definition" msgstr "Stały odnośnik do tej definicji" @@ -562,44 +568,38 @@ msgstr "Wyszukiwanie" msgid "Preparing search..." msgstr "Przygotowanie wyszukiwania..." -#: sphinx/themes/basic/static/searchtools.js:338 -#, fuzzy +#: sphinx/themes/basic/static/searchtools.js:347 msgid "module, in " -msgstr "moduł" +msgstr "moduł, w " -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:356 msgid ", in " -msgstr "" +msgstr ", w " -#: sphinx/themes/basic/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 "" -"Nie znaleziono żadnych pasujących dokumentów. Upewnij się, że wszystkie " -"słowa są poprawnie wpisane i że wybrałeś wystarczającąliczbę kategorii." +#: sphinx/themes/basic/static/searchtools.js:464 +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 "Nie znaleziono żadnych pasujących dokumentów. Upewnij się, że wszystkie słowa są poprawnie wpisane i że wybrałeś wystarczającąliczbę kategorii." -#: sphinx/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:466 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "Przeszukiwanie zakończone, znaleziono %s pasujących stron." -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 msgid "Release" msgstr "Wydanie" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:578 msgid "Footnotes" -msgstr "" +msgstr "Przypisy" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:646 msgid "continued from previous page" -msgstr "" +msgstr "kontynuacja poprzedniej strony" -#: sphinx/writers/latex.py:644 -#, fuzzy +#: sphinx/writers/latex.py:651 msgid "Continued on next page" -msgstr "Cały indeks na jednej stronie" +msgstr "Kontynuacja na następnej stronie" #: sphinx/writers/text.py:166 #, python-format diff --git a/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo b/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo Binary files differindex 5b8901f5..472809ee 100644 --- a/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po b/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po index 1d63841f..443967ed 100644 --- a/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Sphinx 0.5\n" "Report-Msgid-Bugs-To: roger.demetrescu@gmail.com\n" "POT-Creation-Date: 2008-11-09 19:46+0100\n" -"PO-Revision-Date: 2009-08-06 22:48+0200\n" +"PO-Revision-Date: 2009-08-06 23:04+0200\n" "Last-Translator: Roger Demetrescu <roger.demetrescu@gmail.com>\n" "Language-Team: pt_BR <roger.demetrescu@gmail.com>\n" "Plural-Forms: nplurals=2; plural=(n > 1)\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 0.9.4\n" -#: sphinx/environment.py:103 sphinx/writers/latex.py:182 +#: sphinx/environment.py:103 sphinx/writers/latex.py:184 #, python-format msgid "%B %d, %Y" msgstr "%d/%m/%Y" @@ -26,12 +26,12 @@ msgstr "%d/%m/%Y" #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 #: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "Índice" -#: sphinx/environment.py:325 sphinx/writers/latex.py:187 +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 msgid "Module Index" msgstr "Índice do Módulo" @@ -57,34 +57,34 @@ msgstr "Internos" msgid "Module level" msgstr "Módulo" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:222 #, python-format msgid "%b %d, %Y" msgstr "%d/%m/%Y" -#: sphinx/builders/html.py:224 sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "Índice Geral" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:241 msgid "index" msgstr "índice" -#: sphinx/builders/html.py:226 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 #: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 #: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 msgid "Global Module Index" msgstr "Índice Global de Módulos" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:244 msgid "modules" msgstr "módulos" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:300 msgid "next" msgstr "próximo" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:309 msgid "previous" msgstr "anterior" @@ -208,37 +208,37 @@ msgstr "%s (variável C)" msgid "%scommand line option; %s" msgstr "%sopção de linha de comando; %s" -#: sphinx/directives/other.py:138 +#: sphinx/directives/other.py:140 msgid "Platforms: " msgstr "Plataformas: " -#: sphinx/directives/other.py:144 +#: sphinx/directives/other.py:146 #, python-format msgid "%s (module)" msgstr "%s (módulo)" -#: sphinx/directives/other.py:193 +#: sphinx/directives/other.py:195 msgid "Section author: " msgstr "Autor da seção: " -#: sphinx/directives/other.py:195 +#: sphinx/directives/other.py:197 msgid "Module author: " msgstr "Autor do módulo: " -#: sphinx/directives/other.py:197 +#: sphinx/directives/other.py:199 msgid "Author: " msgstr "Autor: " -#: sphinx/directives/other.py:317 +#: sphinx/directives/other.py:319 msgid "See also" msgstr "Veja também" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:889 #, python-format msgid " Bases: %s" msgstr "" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:922 #, python-format msgid "alias of :class:`%s`" msgstr "" @@ -432,40 +432,40 @@ msgstr "Ir" msgid "Enter search terms or a module, class or function name." msgstr "Informe o nome de um módulo, classe ou função." -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "Pesquisar dentro de %(docstitle)s" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" msgstr "Sobre estes documentos" -#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "Pesquisar" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "Copyright" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 #, python-format msgid "© Copyright %(copyright)s." msgstr "© Copyright %(copyright)s." -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 #, python-format msgid "Last updated on %(last_updated)s." msgstr "Última atualização em %(last_updated)s." -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 #, python-format msgid "" "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " @@ -509,7 +509,7 @@ msgid "search" msgstr "pesquisar" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:462 msgid "Search Results" msgstr "Resultados da Pesquisa" @@ -566,15 +566,15 @@ msgstr "Pesquisando" msgid "Preparing search..." msgstr "Preparando pesquisa..." -#: sphinx/themes/basic/static/searchtools.js:338 +#: sphinx/themes/basic/static/searchtools.js:347 msgid "module, in " msgstr "módulo, em " -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:356 msgid ", in " msgstr ", em " -#: sphinx/themes/basic/static/searchtools.js:455 +#: sphinx/themes/basic/static/searchtools.js:464 msgid "" "Your search did not match any documents. Please make sure that all words " "are spelled correctly and that you've selected enough categories." @@ -583,26 +583,26 @@ msgstr "" " todas as palavras foram digitadas corretamente e de que você tenha " "selecionado o mínimo de categorias." -#: sphinx/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:466 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "" "Pesquisa finalizada, foram encontrada(s) %s página(s) que conferem com o " "critério de pesquisa." -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 msgid "Release" msgstr "Versão" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:578 msgid "Footnotes" msgstr "" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:646 msgid "continued from previous page" msgstr "" -#: sphinx/writers/latex.py:644 +#: sphinx/writers/latex.py:651 #, fuzzy msgid "Continued on next page" msgstr "Índice completo em uma página" diff --git a/sphinx/locale/ru/LC_MESSAGES/sphinx.mo b/sphinx/locale/ru/LC_MESSAGES/sphinx.mo Binary files differindex 9beac94c..63d91873 100644 --- a/sphinx/locale/ru/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/ru/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/ru/LC_MESSAGES/sphinx.po b/sphinx/locale/ru/LC_MESSAGES/sphinx.po index cf466c7e..05594cc5 100644 --- a/sphinx/locale/ru/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/ru/LC_MESSAGES/sphinx.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Sphinx 0.6b1\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2009-01-24 18:39+0000\n" -"PO-Revision-Date: 2009-08-06 22:48+0200\n" +"PO-Revision-Date: 2009-08-06 23:04+0200\n" "Last-Translator: alexander smishlajev <alex@tycobka.lv>\n" "Language-Team: ru <LL@li.org>\n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " @@ -17,7 +17,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 0.9.4\n" -#: sphinx/environment.py:103 sphinx/writers/latex.py:182 +#: sphinx/environment.py:103 sphinx/writers/latex.py:184 #, python-format msgid "%B %d, %Y" msgstr "%d %B %Y" @@ -26,12 +26,12 @@ msgstr "%d %B %Y" #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 #: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "Алфавитный указатель" -#: sphinx/environment.py:325 sphinx/writers/latex.py:187 +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 msgid "Module Index" msgstr "Состав модуля" @@ -57,34 +57,34 @@ msgstr "Встроенные функции" msgid "Module level" msgstr "Модуль" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:222 #, python-format msgid "%b %d, %Y" msgstr "%d %b %Y" -#: sphinx/builders/html.py:224 sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "Словарь-указатель" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:241 msgid "index" msgstr "словарь" -#: sphinx/builders/html.py:226 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 #: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 #: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 msgid "Global Module Index" msgstr "Алфавитный указатель модулей" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:244 msgid "modules" msgstr "модули" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:300 msgid "next" msgstr "следующий" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:309 msgid "previous" msgstr "предыдущий" @@ -207,37 +207,37 @@ msgstr "%s (переменная C)" msgid "%scommand line option; %s" msgstr "Опция командной строки %s; %s" -#: sphinx/directives/other.py:138 +#: sphinx/directives/other.py:140 msgid "Platforms: " msgstr "Платформы: " -#: sphinx/directives/other.py:144 +#: sphinx/directives/other.py:146 #, python-format msgid "%s (module)" msgstr "%s (модуль)" -#: sphinx/directives/other.py:193 +#: sphinx/directives/other.py:195 msgid "Section author: " msgstr "Автор секции: " -#: sphinx/directives/other.py:195 +#: sphinx/directives/other.py:197 msgid "Module author: " msgstr "Автор модуля: " -#: sphinx/directives/other.py:197 +#: sphinx/directives/other.py:199 msgid "Author: " msgstr "Автор: " -#: sphinx/directives/other.py:317 +#: sphinx/directives/other.py:319 msgid "See also" msgstr "См.также" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:889 #, python-format msgid " Bases: %s" msgstr " Базовые классы: %s" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:922 #, python-format msgid "alias of :class:`%s`" msgstr "псевдоним класса :class:`%s`" @@ -430,40 +430,40 @@ msgstr "Искать" msgid "Enter search terms or a module, class or function name." msgstr "Введите слова для поиска или имя модуля, класса или функции." -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "Поиск в документе «%(docstitle)s»" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" msgstr "Об этих документах…" -#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "Поиск" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "Copyright" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 #, python-format msgid "© Copyright %(copyright)s." msgstr "© Copyright %(copyright)s." -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 #, python-format msgid "Last updated on %(last_updated)s." msgstr "Дата последнего обновления: %(last_updated)s." -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 #, python-format msgid "" "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " @@ -505,7 +505,7 @@ msgid "search" msgstr "искать" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:462 msgid "Search Results" msgstr "Результаты поиска" @@ -562,15 +562,15 @@ msgstr "Поиск" msgid "Preparing search..." msgstr "Подготовка к поиску..." -#: sphinx/themes/basic/static/searchtools.js:338 +#: sphinx/themes/basic/static/searchtools.js:347 msgid "module, in " msgstr ", модуль в " -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:356 msgid ", in " msgstr ", в " -#: sphinx/themes/basic/static/searchtools.js:455 +#: sphinx/themes/basic/static/searchtools.js:464 msgid "" "Your search did not match any documents. Please make sure that all words " "are spelled correctly and that you've selected enough categories." @@ -578,24 +578,24 @@ msgstr "" "Нет документов, соответствующих вашему запросу. Проверьте, правильно ли " "выбраны категории и нет ли опечаток в запросе." -#: sphinx/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:466 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "Поиск окончен, найдено страниц: %s." -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 msgid "Release" msgstr "Выпуск" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:578 msgid "Footnotes" msgstr "" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:646 msgid "continued from previous page" msgstr "" -#: sphinx/writers/latex.py:644 +#: sphinx/writers/latex.py:651 #, fuzzy msgid "Continued on next page" msgstr "Полный алфавитный указатель на одной странице" diff --git a/sphinx/locale/sl/LC_MESSAGES/sphinx.js b/sphinx/locale/sl/LC_MESSAGES/sphinx.js index 46b1b7b7..a0936a57 100644 --- a/sphinx/locale/sl/LC_MESSAGES/sphinx.js +++ b/sphinx/locale/sl/LC_MESSAGES/sphinx.js @@ -1 +1 @@ -Documentation.addTranslations({"locale": "sl", "plural_expr": "0", "messages": {"Search Results": "Rezultati Iskanja", "Preparing search...": "Pripravljam iskanje...", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "Za va\u0161e iskanje ni rezultatov. Prosimo preglejte ali so vse besede pravilno \u010drkovane in ali ste izbrali dovolj kategorij.", "Search finished, found %s page(s) matching the search query.": "Iskanje kon\u010dano, najdeno %s strani, ki ustrezajo iskalnemu nizu.", ", in ": ", v ", "Permalink to this headline": "Povezava na naslov", "Searching": "I\u0161\u010dem", "Permalink to this definition": "Povezava na to definicijo", "module, in ": "modul, v ", "Hide Search Matches": "Skrij Resultate Iskanja"}});
\ No newline at end of file +Documentation.addTranslations({"locale": "sl", "plural_expr": "0", "messages": {"Search Results": "Rezultati Iskanja", "Preparing search...": "Pripravljam iskanje...", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "Za va\u0161e iskanje ni rezultatov. Prosimo preglejte ali so vse besede pravilno \u010drkovane in ali ste izbrali dovolj kategorij.", "Search finished, found %s page(s) matching the search query.": "Iskanje kon\u010dano, najdeno %s strani, ki ustrezajo iskalnemu nizu.", ", in ": ", v ", "Permalink to this headline": "Povezava na naslov", "Searching": "I\u0161\u010dem", "Permalink to this definition": "Povezava na to definicijo", "module, in ": "modul, v ", "Hide Search Matches": "Skrij resultate iskanja"}});
\ No newline at end of file diff --git a/sphinx/locale/sl/LC_MESSAGES/sphinx.mo b/sphinx/locale/sl/LC_MESSAGES/sphinx.mo Binary files differindex eb48b659..6d8fde06 100644 --- a/sphinx/locale/sl/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/sl/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/sl/LC_MESSAGES/sphinx.po b/sphinx/locale/sl/LC_MESSAGES/sphinx.po index 866610c9..47a807d7 100644 --- a/sphinx/locale/sl/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/sl/LC_MESSAGES/sphinx.po @@ -12,8 +12,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 0.9.4\n" -#: sphinx/environment.py:103 -#: sphinx/writers/latex.py:182 +#: sphinx/environment.py:103 sphinx/writers/latex.py:184 #, python-format msgid "%B %d, %Y" msgstr "%d %B, %Y" @@ -22,29 +21,26 @@ msgstr "%d %B, %Y" #: sphinx/themes/basic/genindex-single.html:2 #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 -#: sphinx/themes/basic/genindex.html:2 -#: sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 -#: sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "Abecedni seznam" -#: sphinx/environment.py:325 -#: sphinx/writers/latex.py:187 +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 msgid "Module Index" msgstr "Seznam modulov" #: sphinx/environment.py:326 #: sphinx/themes/basic/defindex.html:16 msgid "Search Page" -msgstr "Iskalna stran" +msgstr "Iskalnik" #: sphinx/roles.py:55 #: sphinx/directives/desc.py:747 #, python-format msgid "environment variable; %s" -msgstr "globalna spremenljivka; %s" +msgstr "okoljska spremenljivka; %s" #: sphinx/roles.py:62 #, python-format @@ -59,48 +55,44 @@ msgstr "Vgrajeni deli" msgid "Module level" msgstr "Nivo modula" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:222 #, python-format msgid "%b %d, %Y" msgstr "%d %b, %Y" -#: sphinx/builders/html.py:224 -#: sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "Splošni abecedni seznam" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:241 msgid "index" msgstr "abecedni seznam" -#: sphinx/builders/html.py:226 -#: sphinx/builders/htmlhelp.py:219 -#: sphinx/builders/qthelp.py:133 -#: sphinx/themes/basic/defindex.html:19 -#: sphinx/themes/basic/modindex.html:2 -#: sphinx/themes/basic/modindex.html:13 +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 +#: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 msgid "Global Module Index" -msgstr "Splošen Seznam Modulov" +msgstr "Splošen seznam modulov" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:244 msgid "modules" msgstr "Moduli" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:300 msgid "next" msgstr "naprej" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:309 msgid "previous" msgstr "nazaj" #: sphinx/builders/latex.py:162 msgid " (in " -msgstr "(v " +msgstr " (v " #: sphinx/directives/desc.py:97 msgid "Raises" -msgstr "Javi" +msgstr "Sproži izjemo" #: sphinx/directives/desc.py:101 msgid "Variable" @@ -213,51 +205,51 @@ msgstr "%s (C spremenljivka)" #: sphinx/directives/desc.py:665 #, python-format msgid "%scommand line option; %s" -msgstr "%sopcija komandne linije; %s" +msgstr "%scommand line parameter; %s" -#: sphinx/directives/other.py:138 +#: sphinx/directives/other.py:140 msgid "Platforms: " -msgstr "Platforma:" +msgstr "Platforme:" -#: sphinx/directives/other.py:144 +#: sphinx/directives/other.py:146 #, python-format msgid "%s (module)" msgstr "%s (modul)" -#: sphinx/directives/other.py:193 +#: sphinx/directives/other.py:195 msgid "Section author: " msgstr "Avtor sekcije:" -#: sphinx/directives/other.py:195 +#: sphinx/directives/other.py:197 msgid "Module author: " msgstr "Avtor modula:" -#: sphinx/directives/other.py:197 +#: sphinx/directives/other.py:199 msgid "Author: " msgstr "Avtor:" -#: sphinx/directives/other.py:317 +#: sphinx/directives/other.py:319 msgid "See also" -msgstr "Poglej tudi" +msgstr "Poglej Tudi" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:889 #, python-format msgid " Bases: %s" -msgstr "Baza: %s" +msgstr " Baza: %s" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:922 #, python-format msgid "alias of :class:`%s`" -msgstr "alias od :class:`%s`" +msgstr "vzdevek za :class:`%s`" #: sphinx/ext/todo.py:41 msgid "Todo" -msgstr "Naredi" +msgstr "Todo" #: sphinx/ext/todo.py:99 #, python-format msgid "(The original entry is located in %s, line %d and can be found " -msgstr "(Originalen vnos se nahajana v %s, vrstica %d in jo je moč poiskati " +msgstr "(Originalen vnos se nahaja v %s, v vrstici %d, in ga je moč poiskati " #: sphinx/ext/todo.py:105 msgid "here" @@ -273,7 +265,7 @@ msgstr "Previdno" #: sphinx/locale/__init__.py:17 msgid "Danger" -msgstr "Navarno" +msgstr "Nevarno" #: sphinx/locale/__init__.py:18 msgid "Error" @@ -311,7 +303,7 @@ msgstr "Novo v verziji %s" #: sphinx/locale/__init__.py:29 #, python-format msgid "Changed in version %s" -msgstr "Spemenjeno v verziji %s" +msgstr "Spremenjeno v verziji %s" #: sphinx/locale/__init__.py:30 #, python-format @@ -324,7 +316,7 @@ msgstr "modul" #: sphinx/locale/__init__.py:35 msgid "keyword" -msgstr "kllučna beseda" +msgstr "ključna beseda" #: sphinx/locale/__init__.py:36 msgid "operator" @@ -352,7 +344,7 @@ msgstr "Pregled" #: sphinx/themes/basic/defindex.html:11 msgid "Indices and tables:" -msgstr "Kazalo in tabele:" +msgstr "Kazalo in seznami:" #: sphinx/themes/basic/defindex.html:14 msgid "Complete Table of Contents" @@ -364,7 +356,7 @@ msgstr "prikazi vse sekcije in podsekcije" #: sphinx/themes/basic/defindex.html:17 msgid "search this documentation" -msgstr "isči po dokumentaciji" +msgstr "išči po dokumentaciji" #: sphinx/themes/basic/defindex.html:20 msgid "quick access to all modules" @@ -372,7 +364,7 @@ msgstr "hiter dostop do vseh modulov" #: sphinx/themes/basic/defindex.html:22 msgid "all functions, classes, terms" -msgstr "vse funkcije, rezredi, termini" +msgstr "vse funkcije, razredi, izrazi" #: sphinx/themes/basic/genindex-single.html:5 #, python-format @@ -420,7 +412,7 @@ msgstr "naslednje poglavje" #: sphinx/themes/basic/layout.html:60 msgid "This Page" -msgstr "Ta stran" +msgstr "Trenutna stran" #: sphinx/themes/basic/layout.html:63 msgid "Show Source" @@ -438,41 +430,40 @@ msgstr "Potrdi" msgid "Enter search terms or a module, class or function name." msgstr "Vnesi ime modula, razreda ali funkcije." -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "Išči med %(docstitle)s" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" -msgstr "O teh dokumentih" +msgstr "O dokumentih" -#: sphinx/themes/basic/layout.html:134 -#: sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "Išči" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "Vse pravice pridržane" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "© <a href=\"%(path)s\">Vse pravice pridržane</a> %(copyright)s." -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 #, python-format msgid "© Copyright %(copyright)s." msgstr "© Vse pravice pridržane %(copyright)s." -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 #, python-format msgid "Last updated on %(last_updated)s." -msgstr "Zadnjič posodobljeno na %(last_updated)s." +msgstr "Zadnjič posodobljeno %(last_updated)s." -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 #, python-format msgid "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> %(sphinx_version)s." msgstr "Narejeno s <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> %(sphinx_version)s." @@ -492,7 +483,7 @@ msgid "" " functionality." msgstr "" "Za pravilno delovanje Iskanja morete vklopiti\n" -" JavaScrip." +" JavaScript." #: sphinx/themes/basic/search.html:14 msgid "" @@ -501,7 +492,7 @@ msgid "" " function will automatically search for all of the words. Pages\n" " containing fewer words won't appear in the result list." msgstr "" -"O tukaj lahko isčete dokumente. Vnesite iskalni\n" +"Tukaj lahko iščete dokumente. Vnesite iskalni\n" " niz v polje spodaj in pritisnite \"išči\". Sproženo iskanje\n" " bo iskalo po vseh besedah v iskalnem nizu. Strani, ki ne\n" " vsebujejo vseh besed ne bodo prikazane na seznamu rezultatov." @@ -511,7 +502,7 @@ msgid "search" msgstr "išči" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:462 msgid "Search Results" msgstr "Rezultati Iskanja" @@ -560,7 +551,7 @@ msgstr "Povezava na to definicijo" #: sphinx/themes/basic/static/doctools.js:174 msgid "Hide Search Matches" -msgstr "Skrij Resultate Iskanja" +msgstr "Skrij resultate iskanja" #: sphinx/themes/basic/static/searchtools.js:274 msgid "Searching" @@ -570,36 +561,36 @@ msgstr "Iščem" msgid "Preparing search..." msgstr "Pripravljam iskanje..." -#: sphinx/themes/basic/static/searchtools.js:338 +#: sphinx/themes/basic/static/searchtools.js:347 msgid "module, in " msgstr "modul, v " -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:356 msgid ", in " msgstr ", v " -#: sphinx/themes/basic/static/searchtools.js:455 +#: sphinx/themes/basic/static/searchtools.js:464 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 "Za vaše iskanje ni rezultatov. Prosimo preglejte ali so vse besede pravilno črkovane in ali ste izbrali dovolj kategorij." -#: sphinx/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:466 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "Iskanje končano, najdeno %s strani, ki ustrezajo iskalnemu nizu." -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 msgid "Release" msgstr "Izdaja" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:578 msgid "Footnotes" msgstr "Opombe" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:646 msgid "continued from previous page" msgstr "nadaljevanje iz prejšnje strani" -#: sphinx/writers/latex.py:644 +#: sphinx/writers/latex.py:651 msgid "Continued on next page" msgstr "Nadaljevanje na naslednji strani" diff --git a/sphinx/locale/sphinx.pot b/sphinx/locale/sphinx.pot index eff6e983..64bc69dd 100644 --- a/sphinx/locale/sphinx.pot +++ b/sphinx/locale/sphinx.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Sphinx 0.6.2+/6b02a19ccf31\n" +"Project-Id-Version: Sphinx 1.0pre/[?1034h2e1ab15e035e\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2009-08-06 22:48+0200\n" +"POT-Creation-Date: 2009-11-08 16:28+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -17,74 +17,70 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 0.9.4\n" -#: sphinx/environment.py:103 sphinx/writers/latex.py:182 +#: sphinx/environment.py:130 sphinx/writers/latex.py:184 #, python-format msgid "%B %d, %Y" msgstr "" -#: sphinx/environment.py:324 sphinx/themes/basic/genindex-single.html:2 +#: sphinx/environment.py:348 sphinx/themes/basic/genindex-single.html:2 #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 #: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "" -#: sphinx/environment.py:325 sphinx/writers/latex.py:187 +#: sphinx/environment.py:349 sphinx/writers/latex.py:189 msgid "Module Index" msgstr "" -#: sphinx/environment.py:326 sphinx/themes/basic/defindex.html:16 +#: sphinx/environment.py:350 sphinx/themes/basic/defindex.html:16 msgid "Search Page" msgstr "" -#: sphinx/roles.py:55 sphinx/directives/desc.py:747 -#, python-format -msgid "environment variable; %s" -msgstr "" - -#: sphinx/roles.py:62 +#: sphinx/roles.py:167 #, python-format msgid "Python Enhancement Proposals!PEP %s" msgstr "" -#: sphinx/builders/changes.py:71 +#: sphinx/builders/changes.py:70 msgid "Builtins" msgstr "" -#: sphinx/builders/changes.py:73 +#: sphinx/builders/changes.py:72 msgid "Module level" msgstr "" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:224 #, python-format msgid "%b %d, %Y" msgstr "" -#: sphinx/builders/html.py:224 sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:243 sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:243 msgid "index" msgstr "" -#: sphinx/builders/html.py:226 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/html.py:247 sphinx/builders/htmlhelp.py:220 #: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 #: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 +#: sphinx/themes/scrolls/modindex.html:2 sphinx/themes/scrolls/modindex.html:13 msgid "Global Module Index" msgstr "" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:248 msgid "modules" msgstr "" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:304 msgid "next" msgstr "" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:313 msgid "previous" msgstr "" @@ -92,249 +88,323 @@ msgstr "" msgid " (in " msgstr "" -#: sphinx/directives/desc.py:97 +#: sphinx/directives/__init__.py:78 sphinx/directives/__init__.py:79 +#: sphinx/directives/__init__.py:80 sphinx/directives/__init__.py:81 msgid "Raises" msgstr "" -#: sphinx/directives/desc.py:101 +#: sphinx/directives/__init__.py:82 sphinx/directives/__init__.py:83 +#: sphinx/directives/__init__.py:84 msgid "Variable" msgstr "" -#: sphinx/directives/desc.py:104 +#: sphinx/directives/__init__.py:85 sphinx/directives/__init__.py:86 +#: sphinx/directives/__init__.py:92 sphinx/directives/__init__.py:93 msgid "Returns" msgstr "" -#: sphinx/directives/desc.py:113 +#: sphinx/directives/__init__.py:94 msgid "Return type" msgstr "" -#: sphinx/directives/desc.py:186 +#: sphinx/directives/__init__.py:169 msgid "Parameter" msgstr "" -#: sphinx/directives/desc.py:190 +#: sphinx/directives/__init__.py:173 msgid "Parameters" msgstr "" -#: sphinx/directives/desc.py:418 +#: sphinx/directives/other.py:127 +msgid "Section author: " +msgstr "" + +#: sphinx/directives/other.py:129 +msgid "Module author: " +msgstr "" + +#: sphinx/directives/other.py:131 +msgid "Author: " +msgstr "" + +#: sphinx/directives/other.py:233 +msgid "See also" +msgstr "" + +#: sphinx/domains/c.py:124 +#, python-format +msgid "%s (C function)" +msgstr "" + +#: sphinx/domains/c.py:126 +#, python-format +msgid "%s (C member)" +msgstr "" + +#: sphinx/domains/c.py:128 +#, python-format +msgid "%s (C macro)" +msgstr "" + +#: sphinx/domains/c.py:130 +#, python-format +msgid "%s (C type)" +msgstr "" + +#: sphinx/domains/c.py:132 +#, python-format +msgid "%s (C variable)" +msgstr "" + +#: sphinx/domains/c.py:162 +msgid "C function" +msgstr "" + +#: sphinx/domains/c.py:163 +msgid "C member" +msgstr "" + +#: sphinx/domains/c.py:164 +msgid "C macro" +msgstr "" + +#: sphinx/domains/c.py:165 +msgid "C type" +msgstr "" + +#: sphinx/domains/c.py:166 +msgid "C variable" +msgstr "" + +#: sphinx/domains/python.py:186 #, python-format msgid "%s() (built-in function)" msgstr "" -#: sphinx/directives/desc.py:419 sphinx/directives/desc.py:476 -#: sphinx/directives/desc.py:488 +#: sphinx/domains/python.py:187 sphinx/domains/python.py:244 +#: sphinx/domains/python.py:256 sphinx/domains/python.py:269 #, python-format msgid "%s() (in module %s)" msgstr "" -#: sphinx/directives/desc.py:422 +#: sphinx/domains/python.py:190 #, python-format msgid "%s (built-in variable)" msgstr "" -#: sphinx/directives/desc.py:423 sphinx/directives/desc.py:514 +#: sphinx/domains/python.py:191 sphinx/domains/python.py:282 #, python-format msgid "%s (in module %s)" msgstr "" -#: sphinx/directives/desc.py:439 +#: sphinx/domains/python.py:207 #, python-format msgid "%s (built-in class)" msgstr "" -#: sphinx/directives/desc.py:440 +#: sphinx/domains/python.py:208 #, python-format msgid "%s (class in %s)" msgstr "" -#: sphinx/directives/desc.py:480 +#: sphinx/domains/python.py:248 #, python-format msgid "%s() (%s.%s method)" msgstr "" -#: sphinx/directives/desc.py:482 +#: sphinx/domains/python.py:250 #, python-format msgid "%s() (%s method)" msgstr "" -#: sphinx/directives/desc.py:492 +#: sphinx/domains/python.py:260 #, python-format msgid "%s() (%s.%s static method)" msgstr "" -#: sphinx/directives/desc.py:495 +#: sphinx/domains/python.py:263 #, python-format msgid "%s() (%s static method)" msgstr "" -#: sphinx/directives/desc.py:518 +#: sphinx/domains/python.py:273 #, python-format -msgid "%s (%s.%s attribute)" +msgid "%s() (%s.%s class method)" msgstr "" -#: sphinx/directives/desc.py:520 +#: sphinx/domains/python.py:276 #, python-format -msgid "%s (%s attribute)" +msgid "%s() (%s class method)" msgstr "" -#: sphinx/directives/desc.py:609 +#: sphinx/domains/python.py:286 #, python-format -msgid "%s (C function)" +msgid "%s (%s.%s attribute)" msgstr "" -#: sphinx/directives/desc.py:611 +#: sphinx/domains/python.py:288 #, python-format -msgid "%s (C member)" +msgid "%s (%s attribute)" msgstr "" -#: sphinx/directives/desc.py:613 -#, python-format -msgid "%s (C macro)" +#: sphinx/domains/python.py:334 +msgid "Platforms: " msgstr "" -#: sphinx/directives/desc.py:615 +#: sphinx/domains/python.py:340 #, python-format -msgid "%s (C type)" +msgid "%s (module)" msgstr "" -#: sphinx/directives/desc.py:617 -#, python-format -msgid "%s (C variable)" +#: sphinx/domains/python.py:396 +msgid "function" msgstr "" -#: sphinx/directives/desc.py:665 -#, python-format -msgid "%scommand line option; %s" +#: sphinx/domains/python.py:397 +msgid "data" msgstr "" -#: sphinx/directives/other.py:138 -msgid "Platforms: " +#: sphinx/domains/python.py:398 +msgid "class" +msgstr "" + +#: sphinx/domains/python.py:399 sphinx/locale/__init__.py:161 +msgid "exception" +msgstr "" + +#: sphinx/domains/python.py:400 +msgid "method" msgstr "" -#: sphinx/directives/other.py:144 +#: sphinx/domains/python.py:401 +msgid "attribute" +msgstr "" + +#: sphinx/domains/python.py:402 sphinx/locale/__init__.py:157 +msgid "module" +msgstr "" + +#: sphinx/domains/std.py:67 sphinx/domains/std.py:83 #, python-format -msgid "%s (module)" +msgid "environment variable; %s" msgstr "" -#: sphinx/directives/other.py:193 -msgid "Section author: " +#: sphinx/domains/std.py:156 +#, python-format +msgid "%scommand line option; %s" msgstr "" -#: sphinx/directives/other.py:195 -msgid "Module author: " +#: sphinx/domains/std.py:324 +msgid "glossary term" msgstr "" -#: sphinx/directives/other.py:197 -msgid "Author: " +#: sphinx/domains/std.py:325 +msgid "grammar token" msgstr "" -#: sphinx/directives/other.py:317 -msgid "See also" +#: sphinx/domains/std.py:326 +msgid "environment variable" +msgstr "" + +#: sphinx/domains/std.py:327 +msgid "program option" msgstr "" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:892 #, python-format msgid " Bases: %s" msgstr "" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:925 #, python-format msgid "alias of :class:`%s`" msgstr "" -#: sphinx/ext/todo.py:41 +#: sphinx/ext/todo.py:40 msgid "Todo" msgstr "" -#: sphinx/ext/todo.py:99 +#: sphinx/ext/todo.py:98 #, python-format msgid "(The original entry is located in %s, line %d and can be found " msgstr "" -#: sphinx/ext/todo.py:105 +#: sphinx/ext/todo.py:104 msgid "here" msgstr "" -#: sphinx/locale/__init__.py:15 +#: sphinx/locale/__init__.py:138 msgid "Attention" msgstr "" -#: sphinx/locale/__init__.py:16 +#: sphinx/locale/__init__.py:139 msgid "Caution" msgstr "" -#: sphinx/locale/__init__.py:17 +#: sphinx/locale/__init__.py:140 msgid "Danger" msgstr "" -#: sphinx/locale/__init__.py:18 +#: sphinx/locale/__init__.py:141 msgid "Error" msgstr "" -#: sphinx/locale/__init__.py:19 +#: sphinx/locale/__init__.py:142 msgid "Hint" msgstr "" -#: sphinx/locale/__init__.py:20 +#: sphinx/locale/__init__.py:143 msgid "Important" msgstr "" -#: sphinx/locale/__init__.py:21 +#: sphinx/locale/__init__.py:144 msgid "Note" msgstr "" -#: sphinx/locale/__init__.py:22 +#: sphinx/locale/__init__.py:145 msgid "See Also" msgstr "" -#: sphinx/locale/__init__.py:23 +#: sphinx/locale/__init__.py:146 msgid "Tip" msgstr "" -#: sphinx/locale/__init__.py:24 +#: sphinx/locale/__init__.py:147 msgid "Warning" msgstr "" -#: sphinx/locale/__init__.py:28 +#: sphinx/locale/__init__.py:151 #, python-format msgid "New in version %s" msgstr "" -#: sphinx/locale/__init__.py:29 +#: sphinx/locale/__init__.py:152 #, python-format msgid "Changed in version %s" msgstr "" -#: sphinx/locale/__init__.py:30 +#: sphinx/locale/__init__.py:153 #, python-format msgid "Deprecated since version %s" msgstr "" -#: sphinx/locale/__init__.py:34 -msgid "module" -msgstr "" - -#: sphinx/locale/__init__.py:35 +#: sphinx/locale/__init__.py:158 msgid "keyword" msgstr "" -#: sphinx/locale/__init__.py:36 +#: sphinx/locale/__init__.py:159 msgid "operator" msgstr "" -#: sphinx/locale/__init__.py:37 +#: sphinx/locale/__init__.py:160 msgid "object" msgstr "" -#: sphinx/locale/__init__.py:38 -msgid "exception" -msgstr "" - -#: sphinx/locale/__init__.py:39 +#: sphinx/locale/__init__.py:162 msgid "statement" msgstr "" -#: sphinx/locale/__init__.py:40 +#: sphinx/locale/__init__.py:163 msgid "built-in function" msgstr "" @@ -430,47 +500,47 @@ msgstr "" msgid "Enter search terms or a module, class or function name." msgstr "" -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" msgstr "" -#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 sphinx/themes/scrolls/layout.html:83 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "" -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 sphinx/themes/scrolls/layout.html:85 #, python-format msgid "© Copyright %(copyright)s." msgstr "" -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 sphinx/themes/scrolls/layout.html:89 #, python-format msgid "Last updated on %(last_updated)s." msgstr "" -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 sphinx/themes/scrolls/layout.html:92 #, python-format msgid "" "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " "%(sphinx_version)s." msgstr "" -#: sphinx/themes/basic/modindex.html:36 +#: sphinx/themes/basic/modindex.html:36 sphinx/themes/scrolls/modindex.html:37 msgid "Deprecated" msgstr "" @@ -498,7 +568,7 @@ msgid "search" msgstr "" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:473 msgid "Search Results" msgstr "" @@ -534,16 +604,16 @@ msgstr "" msgid "Other changes" msgstr "" -#: sphinx/themes/basic/static/doctools.js:139 sphinx/writers/html.py:473 -#: sphinx/writers/html.py:478 +#: sphinx/themes/basic/static/doctools.js:138 sphinx/writers/html.py:462 +#: sphinx/writers/html.py:467 msgid "Permalink to this headline" msgstr "" -#: sphinx/themes/basic/static/doctools.js:145 sphinx/writers/html.py:80 +#: sphinx/themes/basic/static/doctools.js:144 sphinx/writers/html.py:80 msgid "Permalink to this definition" msgstr "" -#: sphinx/themes/basic/static/doctools.js:174 +#: sphinx/themes/basic/static/doctools.js:173 msgid "Hide Search Matches" msgstr "" @@ -555,38 +625,34 @@ msgstr "" msgid "Preparing search..." msgstr "" -#: sphinx/themes/basic/static/searchtools.js:338 -msgid "module, in " -msgstr "" - -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:352 msgid ", in " msgstr "" -#: sphinx/themes/basic/static/searchtools.js:455 +#: sphinx/themes/basic/static/searchtools.js:475 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/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:477 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "" -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 msgid "Release" msgstr "" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:579 msgid "Footnotes" msgstr "" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:647 msgid "continued from previous page" msgstr "" -#: sphinx/writers/latex.py:644 +#: sphinx/writers/latex.py:652 msgid "Continued on next page" msgstr "" diff --git a/sphinx/locale/tr/LC_MESSAGES/sphinx.js b/sphinx/locale/tr/LC_MESSAGES/sphinx.js new file mode 100644 index 00000000..e5898d54 --- /dev/null +++ b/sphinx/locale/tr/LC_MESSAGES/sphinx.js @@ -0,0 +1 @@ +Documentation.addTranslations({"locale": "tr", "plural_expr": "0", "messages": {"Search Results": "Arama Sonu\u00e7lar\u0131", "Preparing search...": "Aramaya haz\u0131rlan\u0131yor...", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "Arama sonucunda hi\u00e7bir belge bulunamad\u0131. B\u00fct\u00fcn kelimeleri do\u011fru yazd\u0131\u011f\u0131n\u0131zda ve yeterli kategori se\u00e7imi yapt\u0131\u011f\u0131n\u0131zdan emin olun.", "Search finished, found %s page(s) matching the search query.": "Arama sonu\u00e7land\u0131, aramayla e\u015fle\u015fen %s sayfa bulundu.", ", in ": ", \u015funun i\u00e7inde:", "Permalink to this headline": "Bu ba\u015fl\u0131\u011f\u0131n kal\u0131c\u0131 ba\u011flant\u0131s\u0131", "Searching": "Ar\u0131yor", "Permalink to this definition": "Bu tan\u0131m\u0131n kal\u0131c\u0131 ba\u011flant\u0131s\u0131", "module, in ": "mod\u00fcl \u015funun i\u00e7inde:", "Hide Search Matches": "Arama Sonu\u00e7lar\u0131n\u0131 Gizle"}});
\ No newline at end of file diff --git a/sphinx/locale/tr/LC_MESSAGES/sphinx.mo b/sphinx/locale/tr/LC_MESSAGES/sphinx.mo Binary files differnew file mode 100644 index 00000000..186a2fe3 --- /dev/null +++ b/sphinx/locale/tr/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/tr/LC_MESSAGES/sphinx.po b/sphinx/locale/tr/LC_MESSAGES/sphinx.po new file mode 100644 index 00000000..f24efdcb --- /dev/null +++ b/sphinx/locale/tr/LC_MESSAGES/sphinx.po @@ -0,0 +1,618 @@ +# Translations template 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.2+/6b02a19ccf31\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2009-08-06 22:48+0200\n" +"PO-Revision-Date: 2010-03-07 16:01+0200\n" +"Last-Translator: Firat Ozgul <kistihza@yahoo.com>\n" +"Language-Team: Turkish <kistihza@yahoo.com>\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:103 +#: sphinx/writers/latex.py:182 +#, python-format +msgid "%B %d, %Y" +msgstr "%d %B %Y" + +#: sphinx/environment.py:324 +#: sphinx/themes/basic/genindex-single.html:2 +#: sphinx/themes/basic/genindex-split.html:2 +#: sphinx/themes/basic/genindex-split.html:5 +#: sphinx/themes/basic/genindex.html:2 +#: sphinx/themes/basic/genindex.html:5 +#: sphinx/themes/basic/genindex.html:48 +#: sphinx/themes/basic/layout.html:131 +#: sphinx/writers/latex.py:188 +msgid "Index" +msgstr "Dizin" + +#: sphinx/environment.py:325 +#: sphinx/writers/latex.py:187 +msgid "Module Index" +msgstr "Modül Dizini" + +#: sphinx/environment.py:326 +#: sphinx/themes/basic/defindex.html:16 +msgid "Search Page" +msgstr "Arama Sayfası" + +#: sphinx/roles.py:55 +#: sphinx/directives/desc.py:747 +#, python-format +msgid "environment variable; %s" +msgstr "çevre değişkeni; %s" + +#: sphinx/roles.py:62 +#, python-format +msgid "Python Enhancement Proposals!PEP %s" +msgstr "Python'u İyileştirme Önerileri!PEP %s" + +#: sphinx/builders/changes.py:71 +msgid "Builtins" +msgstr "Gömülü" + +#: sphinx/builders/changes.py:73 +msgid "Module level" +msgstr "Modül düzeyi" + +#: sphinx/builders/html.py:205 +#, python-format +msgid "%b %d, %Y" +msgstr "%d %b %Y" + +#: sphinx/builders/html.py:224 +#: sphinx/themes/basic/defindex.html:21 +msgid "General Index" +msgstr "Genel Dizin" + +#: sphinx/builders/html.py:224 +msgid "index" +msgstr "dizin" + +#: sphinx/builders/html.py:226 +#: sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/qthelp.py:133 +#: sphinx/themes/basic/defindex.html:19 +#: sphinx/themes/basic/modindex.html:2 +#: sphinx/themes/basic/modindex.html:13 +msgid "Global Module Index" +msgstr "Global Modül Dizini" + +#: sphinx/builders/html.py:227 +msgid "modules" +msgstr "modüller" + +#: sphinx/builders/html.py:281 +msgid "next" +msgstr "sonraki" + +#: sphinx/builders/html.py:290 +msgid "previous" +msgstr "önceki" + +#: sphinx/builders/latex.py:162 +msgid " (in " +msgstr " (şunun içinde: " + +#: sphinx/directives/desc.py:97 +msgid "Raises" +msgstr "Şunu üretir:" + +#: sphinx/directives/desc.py:101 +msgid "Variable" +msgstr "Değişken" + +#: sphinx/directives/desc.py:104 +msgid "Returns" +msgstr "Şunu döndürür:" + +#: sphinx/directives/desc.py:113 +msgid "Return type" +msgstr "Dönüş tipi" + +#: sphinx/directives/desc.py:186 +msgid "Parameter" +msgstr "Parametre" + +#: sphinx/directives/desc.py:190 +msgid "Parameters" +msgstr "Parametreler" + +#: sphinx/directives/desc.py:418 +#, python-format +msgid "%s() (built-in function)" +msgstr "%s() (gömülü fonksiyon)" + +#: sphinx/directives/desc.py:419 +#: sphinx/directives/desc.py:476 +#: sphinx/directives/desc.py:488 +#, python-format +msgid "%s() (in module %s)" +msgstr "%s() (%s modülü içinde)" + +#: sphinx/directives/desc.py:422 +#, python-format +msgid "%s (built-in variable)" +msgstr "%s (gömülü değişken)" + +#: sphinx/directives/desc.py:423 +#: sphinx/directives/desc.py:514 +#, python-format +msgid "%s (in module %s)" +msgstr "%s (%s modülü içinde)" + +#: sphinx/directives/desc.py:439 +#, python-format +msgid "%s (built-in class)" +msgstr "%s (gömülü sınıf)" + +#: sphinx/directives/desc.py:440 +#, python-format +msgid "%s (class in %s)" +msgstr "%s (sınıf %s içinde)" + +#: sphinx/directives/desc.py:480 +#, python-format +msgid "%s() (%s.%s method)" +msgstr "%s() (%s.%s metodu)" + +#: sphinx/directives/desc.py:482 +#, python-format +msgid "%s() (%s method)" +msgstr "%s() (%s metodu)" + +#: sphinx/directives/desc.py:492 +#, python-format +msgid "%s() (%s.%s static method)" +msgstr "%s() (%s.%s statik metodu)" + +#: sphinx/directives/desc.py:495 +#, python-format +msgid "%s() (%s static method)" +msgstr "%s() (%s statik metodu)" + +#: sphinx/directives/desc.py:518 +#, python-format +msgid "%s (%s.%s attribute)" +msgstr "%s (%s.%s niteliği)" + +#: sphinx/directives/desc.py:520 +#, python-format +msgid "%s (%s attribute)" +msgstr "%s (%s niteliği)" + +#: sphinx/directives/desc.py:609 +#, python-format +msgid "%s (C function)" +msgstr "%s (C fonksiyonu)" + +#: sphinx/directives/desc.py:611 +#, python-format +msgid "%s (C member)" +msgstr "%s (C öğesi)" + +#: sphinx/directives/desc.py:613 +#, python-format +msgid "%s (C macro)" +msgstr "%s (C makrosu)" + +#: sphinx/directives/desc.py:615 +#, python-format +msgid "%s (C type)" +msgstr "%s (C tipi)" + +#: sphinx/directives/desc.py:617 +#, python-format +msgid "%s (C variable)" +msgstr "%s (C değişkeni)" + +#: sphinx/directives/desc.py:665 +#, python-format +msgid "%scommand line option; %s" +msgstr "%skomut satırı seçeneği; %s" + +#: sphinx/directives/other.py:138 +msgid "Platforms: " +msgstr "Platformlar:" + +#: sphinx/directives/other.py:144 +#, python-format +msgid "%s (module)" +msgstr "%s (modül)" + +#: sphinx/directives/other.py:193 +msgid "Section author: " +msgstr "Bölüm yazarı:" + +#: sphinx/directives/other.py:195 +msgid "Module author: " +msgstr "Modül yazarı:" + +#: sphinx/directives/other.py:197 +msgid "Author: " +msgstr "Yazarı:" + +#: sphinx/directives/other.py:317 +msgid "See also" +msgstr "Ayrıca bkz." + +#: sphinx/ext/autodoc.py:883 +#, python-format +msgid " Bases: %s" +msgstr " Taban: %s" + +#: sphinx/ext/autodoc.py:916 +#, python-format +msgid "alias of :class:`%s`" +msgstr "şunun takma adı: :class:`%s`" + +#: sphinx/ext/todo.py:41 +msgid "Todo" +msgstr "Yapılacaklar" + +#: sphinx/ext/todo.py:99 +#, python-format +msgid "(The original entry is located in %s, line %d and can be found " +msgstr "(%s içinde ve %d satırındaki özgün girdi şurada bulunuyor " + +#: sphinx/ext/todo.py:105 +msgid "here" +msgstr " " + +#: sphinx/locale/__init__.py:15 +msgid "Attention" +msgstr "Dikkat" + +#: sphinx/locale/__init__.py:16 +msgid "Caution" +msgstr "Uyarı" + +#: sphinx/locale/__init__.py:17 +msgid "Danger" +msgstr "Tehlike" + +#: sphinx/locale/__init__.py:18 +msgid "Error" +msgstr "Hata" + +#: sphinx/locale/__init__.py:19 +msgid "Hint" +msgstr "İpucu" + +#: sphinx/locale/__init__.py:20 +msgid "Important" +msgstr "Önemli" + +#: sphinx/locale/__init__.py:21 +msgid "Note" +msgstr "Not" + +#: sphinx/locale/__init__.py:22 +msgid "See Also" +msgstr "Ayrıca bkz." + +#: sphinx/locale/__init__.py:23 +msgid "Tip" +msgstr "Tüyo" + +#: sphinx/locale/__init__.py:24 +msgid "Warning" +msgstr "Uyarı" + +#: sphinx/locale/__init__.py:28 +#, python-format +msgid "New in version %s" +msgstr "%s sürümüyle geldi" + +#: sphinx/locale/__init__.py:29 +#, python-format +msgid "Changed in version %s" +msgstr "%s sürümünde değişti" + +#: sphinx/locale/__init__.py:30 +#, python-format +msgid "Deprecated since version %s" +msgstr "%s sürümünden beri önerilmiyor" + +#: sphinx/locale/__init__.py:34 +msgid "module" +msgstr "modül" + +#: sphinx/locale/__init__.py:35 +msgid "keyword" +msgstr "anahtar kelime" + +#: sphinx/locale/__init__.py:36 +msgid "operator" +msgstr "işleç" + +#: sphinx/locale/__init__.py:37 +msgid "object" +msgstr "nesne" + +#: sphinx/locale/__init__.py:38 +msgid "exception" +msgstr "istisna" + +#: sphinx/locale/__init__.py:39 +msgid "statement" +msgstr "deyim" + +#: sphinx/locale/__init__.py:40 +msgid "built-in function" +msgstr "gömülü fonksiyon" + +#: sphinx/themes/basic/defindex.html:2 +msgid "Overview" +msgstr "Genel Bakış" + +#: sphinx/themes/basic/defindex.html:11 +msgid "Indices and tables:" +msgstr "Dizinler ve tablolar" + +#: sphinx/themes/basic/defindex.html:14 +msgid "Complete Table of Contents" +msgstr "Ayrıntılı İçindekiler Tablosu" + +#: sphinx/themes/basic/defindex.html:15 +msgid "lists all sections and subsections" +msgstr "bütün bölümler ve alt bölümler listelenir" + +#: sphinx/themes/basic/defindex.html:17 +msgid "search this documentation" +msgstr "Bu belgelerde ara" + +#: sphinx/themes/basic/defindex.html:20 +msgid "quick access to all modules" +msgstr "bütün modüllere hızlı erişim" + +#: sphinx/themes/basic/defindex.html:22 +msgid "all functions, classes, terms" +msgstr "bütün fonksiyonlar, sınıflar, terimler" + +#: sphinx/themes/basic/genindex-single.html:5 +#, python-format +msgid "Index – %(key)s" +msgstr "Dizin – %(key)s" + +#: sphinx/themes/basic/genindex-single.html:44 +#: sphinx/themes/basic/genindex-split.html:14 +#: sphinx/themes/basic/genindex-split.html:27 +#: sphinx/themes/basic/genindex.html:54 +msgid "Full index on one page" +msgstr "Bütün dizin tek sayfada" + +#: sphinx/themes/basic/genindex-split.html:7 +msgid "Index pages by letter" +msgstr "Harfe göre dizin sayfaları" + +#: sphinx/themes/basic/genindex-split.html:15 +msgid "can be huge" +msgstr "çok büyük olabilir" + +#: sphinx/themes/basic/layout.html:10 +msgid "Navigation" +msgstr "Gezinti" + +#: sphinx/themes/basic/layout.html:42 +msgid "Table Of Contents" +msgstr "İçindekiler Tablosu" + +#: sphinx/themes/basic/layout.html:48 +msgid "Previous topic" +msgstr "Önceki konu" + +#: sphinx/themes/basic/layout.html:50 +msgid "previous chapter" +msgstr "önceki bölüm" + +#: sphinx/themes/basic/layout.html:53 +msgid "Next topic" +msgstr "Sonraki konu" + +#: sphinx/themes/basic/layout.html:55 +msgid "next chapter" +msgstr "sonraki bölüm" + +#: sphinx/themes/basic/layout.html:60 +msgid "This Page" +msgstr "Bu Sayfa" + +#: sphinx/themes/basic/layout.html:63 +msgid "Show Source" +msgstr "Kaynağı Göster" + +#: sphinx/themes/basic/layout.html:73 +msgid "Quick search" +msgstr "Hızlı Arama" + +#: sphinx/themes/basic/layout.html:76 +msgid "Go" +msgstr "Git" + +#: sphinx/themes/basic/layout.html:81 +msgid "Enter search terms or a module, class or function name." +msgstr "Aranacak terimleri veya modül, sınıf ya da fonksiyon adını giriniz." + +#: sphinx/themes/basic/layout.html:119 +#, python-format +msgid "Search within %(docstitle)s" +msgstr "%(docstitle)s içinde ara" + +#: sphinx/themes/basic/layout.html:128 +msgid "About these documents" +msgstr "Bu belgeler hakkında" + +#: sphinx/themes/basic/layout.html:134 +#: sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/search.html:5 +msgid "Search" +msgstr "Ara" + +#: sphinx/themes/basic/layout.html:137 +msgid "Copyright" +msgstr "Copyright" + +#: sphinx/themes/basic/layout.html:183 +#, python-format +msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." +msgstr "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." + +#: sphinx/themes/basic/layout.html:185 +#, python-format +msgid "© Copyright %(copyright)s." +msgstr "© Copyright %(copyright)s." + +#: sphinx/themes/basic/layout.html:188 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Son güncelleme: %(last_updated)s." + +#: sphinx/themes/basic/layout.html:191 +#, 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 ile oluşturulmuştur." + +#: sphinx/themes/basic/modindex.html:36 +msgid "Deprecated" +msgstr "Önerilmiyor" + +#: sphinx/themes/basic/opensearch.xml:4 +#, python-format +msgid "Search %(docstitle)s" +msgstr "Ara: %(docstitle)s" + +#: sphinx/themes/basic/search.html:9 +msgid "" +"Please activate JavaScript to enable the search\n" +" functionality." +msgstr "" +"Arama işlevini kullanabilmek için lütfen JavaScript'i\n" +" etkinleştirin." + +#: sphinx/themes/basic/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 "" +"Burada belgeler içinde arama yapabilirsiniz. Aradığınız kelimeyi \n" +"aşağıdaki kutuya yazıp \"ara\" düğmesine basınız. Arama işlevi \n" +"otomatik olarak bütün kelimeleri arayacaktır. Eksik kelime içeren \n" +"sayfalar sonuç listesinde görünmez." + +#: sphinx/themes/basic/search.html:21 +msgid "search" +msgstr "ara" + +#: sphinx/themes/basic/search.html:25 +#: sphinx/themes/basic/static/searchtools.js:453 +msgid "Search Results" +msgstr "Arama Sonuçları" + +#: sphinx/themes/basic/search.html:27 +msgid "Your search did not match any results." +msgstr "Arama sonucunda herhangi bir belge bulunamadı." + +#: sphinx/themes/basic/changes/frameset.html:5 +#: sphinx/themes/basic/changes/versionchanges.html:12 +#, python-format +msgid "Changes in Version %(version)s — %(docstitle)s" +msgstr "Sürüm %(version)s — %(docstitle)s içindeki Değişiklikler" + +#: sphinx/themes/basic/changes/rstsource.html:5 +#, python-format +msgid "%(filename)s — %(docstitle)s" +msgstr "%(filename)s — %(docstitle)s" + +#: sphinx/themes/basic/changes/versionchanges.html:17 +#, python-format +msgid "Automatically generated list of changes in version %(version)s" +msgstr "%(version)s numaralı sürümdeki değişikliklerin otomatik olarak üretilmiş listesi" + +#: sphinx/themes/basic/changes/versionchanges.html:18 +msgid "Library changes" +msgstr "Kütüphane değişiklikleri" + +#: sphinx/themes/basic/changes/versionchanges.html:23 +msgid "C API changes" +msgstr "C API'sindeki değişiklikler" + +#: sphinx/themes/basic/changes/versionchanges.html:25 +msgid "Other changes" +msgstr "Diğer değişiklikler" + +#: sphinx/themes/basic/static/doctools.js:139 +#: sphinx/writers/html.py:473 +#: sphinx/writers/html.py:478 +msgid "Permalink to this headline" +msgstr "Bu başlığın kalıcı bağlantısı" + +#: sphinx/themes/basic/static/doctools.js:145 +#: sphinx/writers/html.py:80 +msgid "Permalink to this definition" +msgstr "Bu tanımın kalıcı bağlantısı" + +#: sphinx/themes/basic/static/doctools.js:174 +msgid "Hide Search Matches" +msgstr "Arama Sonuçlarını Gizle" + +#: sphinx/themes/basic/static/searchtools.js:274 +msgid "Searching" +msgstr "Arıyor" + +#: sphinx/themes/basic/static/searchtools.js:279 +msgid "Preparing search..." +msgstr "Aramaya hazırlanıyor..." + +#: sphinx/themes/basic/static/searchtools.js:338 +msgid "module, in " +msgstr "modül şunun içinde:" + +#: sphinx/themes/basic/static/searchtools.js:347 +msgid ", in " +msgstr ", şunun içinde:" + +#: sphinx/themes/basic/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 "Arama sonucunda hiçbir belge bulunamadı. Bütün kelimeleri doğru yazdığınızda ve yeterli kategori seçimi yaptığınızdan emin olun." + +#: sphinx/themes/basic/static/searchtools.js:457 +#, python-format +msgid "Search finished, found %s page(s) matching the search query." +msgstr "Arama sonuçlandı, aramayla eşleşen %s sayfa bulundu." + +#: sphinx/writers/latex.py:185 +msgid "Release" +msgstr "Sürüm" + +#: sphinx/writers/latex.py:571 +msgid "Footnotes" +msgstr "Dipnotları" + +#: sphinx/writers/latex.py:639 +msgid "continued from previous page" +msgstr "önceki sayfadan devam" + +#: sphinx/writers/latex.py:644 +msgid "Continued on next page" +msgstr "Devamı sonraki sayfada" + +#: sphinx/writers/text.py:166 +#, python-format +msgid "Platform: %s" +msgstr "Platform: %s" + +#: sphinx/writers/text.py:428 +msgid "[image]" +msgstr "[resim]" + diff --git a/sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo b/sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo Binary files differindex 310536f1..c401ab26 100644 --- a/sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po b/sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po index 75c933a2..16f6f022 100644 --- a/sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po @@ -8,7 +8,7 @@ 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-08-06 22:48+0200\n" +"PO-Revision-Date: 2009-08-06 23:04+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 && " @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 0.9.4\n" -#: sphinx/environment.py:103 sphinx/writers/latex.py:182 +#: sphinx/environment.py:103 sphinx/writers/latex.py:184 #, python-format msgid "%B %d, %Y" msgstr "" @@ -27,12 +27,12 @@ msgstr "" #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 #: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "Індекс" -#: sphinx/environment.py:325 sphinx/writers/latex.py:187 +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 msgid "Module Index" msgstr "Індекс модулів" @@ -58,34 +58,34 @@ msgstr "Вбудовані елементи" msgid "Module level" msgstr "Рівень модуля" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:222 #, python-format msgid "%b %d, %Y" msgstr "%b %d, %Y" -#: sphinx/builders/html.py:224 sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "Загальний індекс" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:241 msgid "index" msgstr "індекс" -#: sphinx/builders/html.py:226 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 #: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 #: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 msgid "Global Module Index" msgstr "Загальний індекс модулів" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:244 msgid "modules" msgstr "модулі" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:300 msgid "next" msgstr "наступний" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:309 msgid "previous" msgstr "попередній" @@ -208,37 +208,37 @@ msgstr "%s (C змінна)" msgid "%scommand line option; %s" msgstr "%sопція командного рядка; %s" -#: sphinx/directives/other.py:138 +#: sphinx/directives/other.py:140 msgid "Platforms: " msgstr "Платформи: " -#: sphinx/directives/other.py:144 +#: sphinx/directives/other.py:146 #, python-format msgid "%s (module)" msgstr "%s (модуль)" -#: sphinx/directives/other.py:193 +#: sphinx/directives/other.py:195 msgid "Section author: " msgstr "Автор секції: " -#: sphinx/directives/other.py:195 +#: sphinx/directives/other.py:197 msgid "Module author: " msgstr "Автор модуля: " -#: sphinx/directives/other.py:197 +#: sphinx/directives/other.py:199 msgid "Author: " msgstr "Автор: " -#: sphinx/directives/other.py:317 +#: sphinx/directives/other.py:319 msgid "See also" msgstr "Дивись також" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:889 #, python-format msgid " Bases: %s" msgstr " Базовий: %s" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:922 #, python-format msgid "alias of :class:`%s`" msgstr "синонім :class:`%s`" @@ -431,40 +431,40 @@ msgstr "Вперед" msgid "Enter search terms or a module, class or function name." msgstr "Введіть пошуковий термін, модуль, клас чи назву функції." -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "Шукати в %(docstitle)s" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" msgstr "Про ці документи" -#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "Пошук" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "Авторські права" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 #, python-format msgid "© Copyright %(copyright)s." msgstr "© Copyright %(copyright)s." -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 #, python-format msgid "Last updated on %(last_updated)s." msgstr "Востаннє оновлено %(last_updated)s." -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 #, python-format msgid "" "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " @@ -508,7 +508,7 @@ msgid "search" msgstr "пошук" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:462 msgid "Search Results" msgstr "Результати пошуку" @@ -565,15 +565,15 @@ msgstr "Шукаю" msgid "Preparing search..." msgstr "Підготовка до пошуку..." -#: sphinx/themes/basic/static/searchtools.js:338 +#: sphinx/themes/basic/static/searchtools.js:347 msgid "module, in " msgstr "модуль, в " -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:356 msgid ", in " msgstr ", в " -#: sphinx/themes/basic/static/searchtools.js:455 +#: sphinx/themes/basic/static/searchtools.js:464 msgid "" "Your search did not match any documents. Please make sure that all words " "are spelled correctly and that you've selected enough categories." @@ -581,24 +581,24 @@ msgstr "" "Ваш пошук не виявив жодного співпадіння. Будь-ласка переконайтеся що всі " "слова набрані правильно і ви обрали достатньо категорій." -#: sphinx/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:466 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "Пошук закінчено, знайдено %s сторінок які співпали з пошуковим запитом." -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 msgid "Release" msgstr "Реліз" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:578 msgid "Footnotes" msgstr "" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:646 msgid "continued from previous page" msgstr "" -#: sphinx/writers/latex.py:644 +#: sphinx/writers/latex.py:651 #, fuzzy msgid "Continued on next page" msgstr "Повний індекс на одній сторінці" diff --git a/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.js b/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.js new file mode 100644 index 00000000..d35c9aca --- /dev/null +++ b/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.js @@ -0,0 +1 @@ +Documentation.addTranslations({"locale": "zh_CN", "plural_expr": "0", "messages": {"Search Results": "\u641c\u7d22\u7ed3\u679c", "Preparing search...": "\u51c6\u5907\u641c\u7d22...", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "\u4f60\u7684\u641c\u7d22\u6ca1\u6709\u5339\u914d\u5230\u4efb\u4f55\u6587\u6863\u3002\u8bf7\u786e\u8ba4\u4f60\u6240\u641c\u7d22\u7684\u5173\u952e\u5b57.", "Search finished, found %s page(s) matching the search query.": "\u641c\u7d22\u5b8c\u6210\uff0c \u627e\u5230\u4e86 %s \u9875\u5339\u914d\u6240\u641c\u7d22\u7684\u5173\u952e\u5b57", ", in ": ", \u4f4d\u4e8e", "Permalink to this headline": "\u6c38\u4e45\u94fe\u63a5\u81f3\u6807\u9898", "Searching": "\u641c\u7d22\u4e2d", "Permalink to this definition": "\u6c38\u4e45\u94fe\u63a5\u81f3\u76ee\u6807", "module, in ": "\u6a21\u5757\uff0c\u4f4d\u4e8e", "Hide Search Matches": "\u9690\u85cf\u641c\u7d22\u7ed3\u679c"}});
\ No newline at end of file diff --git a/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.mo b/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.mo Binary files differnew file mode 100644 index 00000000..fc39d483 --- /dev/null +++ b/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po b/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po new file mode 100644 index 00000000..5b13794d --- /dev/null +++ b/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po @@ -0,0 +1,604 @@ +# Chinese (Simplified Chinese) translations for Sphinx. +# Copyright (C) 2009 Tower Joo +# This file is distributed under the same license as the Sphinx project. +# Tower Joo<zhutao.iscas@gmail.com>, 2009. +# My homepage is at http://sites.google.com/site/towerjooeng +# +msgid "" +msgstr "" +"Project-Id-Version: Sphinx 0.6\n" +"Report-Msgid-Bugs-To: zhutao.iscas@gmail.com\n" +"POT-Creation-Date: 2009-03-09 19:46+0120\n" +"PO-Revision-Date: 2009-08-06 23:04+0200\n" +"Last-Translator: Tower Joo<zhutao.iscas@gmail.com>\n" +"Language-Team: cn <LL@li.org>\n" +"Plural-Forms: nplurals=1; plural=0\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:103 sphinx/writers/latex.py:184 +#, python-format +msgid "%B %d, %Y" +msgstr "%Y 年 %m 月 %d 日" + +#: sphinx/environment.py:324 sphinx/themes/basic/genindex-single.html:2 +#: sphinx/themes/basic/genindex-split.html:2 +#: sphinx/themes/basic/genindex-split.html:5 +#: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 +msgid "Index" +msgstr "索引" + +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 +msgid "Module Index" +msgstr "模块索引" + +#: sphinx/environment.py:326 sphinx/themes/basic/defindex.html:16 +msgid "Search Page" +msgstr "搜索页面" + +#: sphinx/roles.py:55 sphinx/directives/desc.py:747 +#, python-format +msgid "environment variable; %s" +msgstr "环境变量; %s" + +#: sphinx/roles.py:62 +#, python-format +msgid "Python Enhancement Proposals!PEP %s" +msgstr "Python 建议文件!PEP %s" + +#: sphinx/builders/changes.py:71 +msgid "Builtins" +msgstr "内置" + +#: sphinx/builders/changes.py:73 +msgid "Module level" +msgstr "模块级别" + +#: sphinx/builders/html.py:222 +#, python-format +msgid "%b %d, %Y" +msgstr "%Y 年 %m 月 %d 日" + +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 +msgid "General Index" +msgstr "总目录" + +#: sphinx/builders/html.py:241 +msgid "index" +msgstr "索引" + +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 +#: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 +msgid "Global Module Index" +msgstr "全局模块索引" + +#: sphinx/builders/html.py:244 +msgid "modules" +msgstr "模块" + +#: sphinx/builders/html.py:300 +msgid "next" +msgstr "下一页" + +#: sphinx/builders/html.py:309 +msgid "previous" +msgstr "上一页" + +#: sphinx/builders/latex.py:162 +msgid " (in " +msgstr "" + +#: sphinx/directives/desc.py:97 +msgid "Raises" +msgstr "引发" + +#: sphinx/directives/desc.py:101 +msgid "Variable" +msgstr "变量" + +#: sphinx/directives/desc.py:104 +msgid "Returns" +msgstr "返回" + +#: sphinx/directives/desc.py:113 +msgid "Return type" +msgstr "返回类型" + +#: sphinx/directives/desc.py:186 +#, fuzzy +msgid "Parameter" +msgstr "参数" + +#: sphinx/directives/desc.py:190 +msgid "Parameters" +msgstr "参数" + +#: sphinx/directives/desc.py:418 +#, python-format +msgid "%s() (built-in function)" +msgstr "%s() (內置函数)" + +#: sphinx/directives/desc.py:419 sphinx/directives/desc.py:476 +#: sphinx/directives/desc.py:488 +#, python-format +msgid "%s() (in module %s)" +msgstr "%s() (在 %s 模块中)" + +#: sphinx/directives/desc.py:422 +#, python-format +msgid "%s (built-in variable)" +msgstr "%s (內置变量)" + +#: sphinx/directives/desc.py:423 sphinx/directives/desc.py:514 +#, python-format +msgid "%s (in module %s)" +msgstr "%s() (在 %s 模块中)" + +#: sphinx/directives/desc.py:439 +#, python-format +msgid "%s (built-in class)" +msgstr "%s (內置类)" + +#: sphinx/directives/desc.py:440 +#, python-format +msgid "%s (class in %s)" +msgstr "" + +#: sphinx/directives/desc.py:480 +#, python-format +msgid "%s() (%s.%s method)" +msgstr "%s() (%s.%s 方法)" + +#: sphinx/directives/desc.py:482 +#, python-format +msgid "%s() (%s method)" +msgstr "%s() (%s 方法)" + +#: sphinx/directives/desc.py:492 +#, python-format +msgid "%s() (%s.%s static method)" +msgstr "%s() (%s.%s 静态方法)" + +#: sphinx/directives/desc.py:495 +#, python-format +msgid "%s() (%s static method)" +msgstr "%s() (%s 静态方法)" + +#: sphinx/directives/desc.py:518 +#, python-format +msgid "%s (%s.%s attribute)" +msgstr "%s (%s.%s 属性)" + +#: sphinx/directives/desc.py:520 +#, python-format +msgid "%s (%s attribute)" +msgstr "%s (%s 属性)" + +#: sphinx/directives/desc.py:609 +#, python-format +msgid "%s (C function)" +msgstr "%s (C 函数)" + +#: sphinx/directives/desc.py:611 +#, python-format +msgid "%s (C member)" +msgstr "%s (C 成员)" + +#: sphinx/directives/desc.py:613 +#, python-format +msgid "%s (C macro)" +msgstr "%s (C 宏)" + +#: sphinx/directives/desc.py:615 +#, python-format +msgid "%s (C type)" +msgstr "%s (C 类型)" + +#: sphinx/directives/desc.py:617 +#, python-format +msgid "%s (C variable)" +msgstr "%s (C 变量)" + +#: sphinx/directives/desc.py:665 +#, python-format +msgid "%scommand line option; %s" +msgstr "%s命令行选项; %s" + +#: sphinx/directives/other.py:140 +msgid "Platforms: " +msgstr "平台" + +#: sphinx/directives/other.py:146 +#, python-format +msgid "%s (module)" +msgstr "%s (模块)" + +#: sphinx/directives/other.py:195 +msgid "Section author: " +msgstr "Section 作者:" + +#: sphinx/directives/other.py:197 +msgid "Module author: " +msgstr "模块作者:" + +#: sphinx/directives/other.py:199 +msgid "Author: " +msgstr "作者:" + +#: sphinx/directives/other.py:319 +msgid "See also" +msgstr "也可以参考" + +#: sphinx/ext/autodoc.py:889 +#, python-format +msgid " Bases: %s" +msgstr "" + +#: sphinx/ext/autodoc.py:922 +#, python-format +msgid "alias of :class:`%s`" +msgstr "" + +#: sphinx/ext/todo.py:41 +msgid "Todo" +msgstr "待处理" + +#: sphinx/ext/todo.py:99 +#, python-format +msgid "(The original entry is located in %s, line %d and can be found " +msgstr "(最初的入口位于%s 的第%d行" + +#: sphinx/ext/todo.py:105 +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/themes/basic/defindex.html:2 +msgid "Overview" +msgstr "概述" + +#: sphinx/themes/basic/defindex.html:11 +msgid "Indices and tables:" +msgstr "索引和表格" + +#: sphinx/themes/basic/defindex.html:14 +msgid "Complete Table of Contents" +msgstr "完整的内容表" + +#: sphinx/themes/basic/defindex.html:15 +msgid "lists all sections and subsections" +msgstr "列出所有的章节和部分" + +#: sphinx/themes/basic/defindex.html:17 +msgid "search this documentation" +msgstr "搜索文档" + +#: sphinx/themes/basic/defindex.html:20 +msgid "quick access to all modules" +msgstr "快速查看所有的模块" + +#: sphinx/themes/basic/defindex.html:22 +msgid "all functions, classes, terms" +msgstr "所的函数,类,术语" + +#: sphinx/themes/basic/genindex-single.html:5 +#, python-format +msgid "Index – %(key)s" +msgstr "索引 – %(key)s" + +#: sphinx/themes/basic/genindex-single.html:44 +#: sphinx/themes/basic/genindex-split.html:14 +#: sphinx/themes/basic/genindex-split.html:27 +#: sphinx/themes/basic/genindex.html:54 +msgid "Full index on one page" +msgstr "一页的全部索引" + +#: sphinx/themes/basic/genindex-split.html:7 +msgid "Index pages by letter" +msgstr "按照字母的索引页" + +#: sphinx/themes/basic/genindex-split.html:15 +msgid "can be huge" +msgstr "可能会很多" + +#: sphinx/themes/basic/layout.html:10 +msgid "Navigation" +msgstr "导航" + +#: sphinx/themes/basic/layout.html:42 +msgid "Table Of Contents" +msgstr "內容目录" + +#: sphinx/themes/basic/layout.html:48 +msgid "Previous topic" +msgstr "上一个主题" + +#: sphinx/themes/basic/layout.html:50 +msgid "previous chapter" +msgstr "上一章" + +#: sphinx/themes/basic/layout.html:53 +msgid "Next topic" +msgstr "下一个主题" + +#: sphinx/themes/basic/layout.html:55 +msgid "next chapter" +msgstr "下一章" + +#: sphinx/themes/basic/layout.html:60 +msgid "This Page" +msgstr "本页" + +#: sphinx/themes/basic/layout.html:63 +msgid "Show Source" +msgstr "显示源代码" + +#: sphinx/themes/basic/layout.html:73 +msgid "Quick search" +msgstr "快速搜索" + +#: sphinx/themes/basic/layout.html:76 +msgid "Go" +msgstr "搜索" + +#: sphinx/themes/basic/layout.html:81 +msgid "Enter search terms or a module, class or function name." +msgstr "输入相关的模块,术语,类或者函数名称进行搜索" + +#: sphinx/themes/basic/layout.html:122 +#, python-format +msgid "Search within %(docstitle)s" +msgstr "在 %(docstitle)s 中搜索" + +#: sphinx/themes/basic/layout.html:131 +msgid "About these documents" +msgstr "关于这些文档" + +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/search.html:5 +msgid "Search" +msgstr "搜索" + +#: sphinx/themes/basic/layout.html:140 +msgid "Copyright" +msgstr "版权所有" + +#: sphinx/themes/basic/layout.html:187 +#, python-format +msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." +msgstr "© <a href=\"%(path)s\">版权所有</a> % (copyright)s." + +#: sphinx/themes/basic/layout.html:189 +#, python-format +msgid "© Copyright %(copyright)s." +msgstr "© 版权所有 %(copyright)s." + +#: sphinx/themes/basic/layout.html:193 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "最后更新日期是 %(last_updated)s." + +#: sphinx/themes/basic/layout.html:196 +#, 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/themes/basic/modindex.html:36 +msgid "Deprecated" +msgstr "已移除" + +#: sphinx/themes/basic/opensearch.xml:4 +#, python-format +msgid "Search %(docstitle)s" +msgstr "搜索 %(docstitle)s" + +#: sphinx/themes/basic/search.html:9 +msgid "" +"Please activate JavaScript to enable the search\n" +" functionality." +msgstr "" + +#: sphinx/themes/basic/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 "在这儿,你可以对这些文档进行搜索。向搜索框中输入你所要搜索的关键字并点击\"搜索\"。注意:搜索引擎会自动搜索所有的关键字。将不会搜索到部分关键字的页面." + +#: sphinx/themes/basic/search.html:21 +msgid "search" +msgstr "搜索" + +#: sphinx/themes/basic/search.html:25 +#: sphinx/themes/basic/static/searchtools.js:462 +msgid "Search Results" +msgstr "搜索结果" + +#: sphinx/themes/basic/search.html:27 +msgid "Your search did not match any results." +msgstr "你的搜索没有找到任何的结果." + +#: sphinx/themes/basic/changes/frameset.html:5 +#: sphinx/themes/basic/changes/versionchanges.html:12 +#, python-format +msgid "Changes in Version %(version)s — %(docstitle)s" +msgstr "更改发生在版本 %(version)s — %(docstitle)s" + +#: sphinx/themes/basic/changes/rstsource.html:5 +#, python-format +msgid "%(filename)s — %(docstitle)s" +msgstr "" + +#: sphinx/themes/basic/changes/versionchanges.html:17 +#, python-format +msgid "Automatically generated list of changes in version %(version)s" +msgstr "自动生成的版本 %(version)s中的更改列表" + +#: sphinx/themes/basic/changes/versionchanges.html:18 +msgid "Library changes" +msgstr "库更改" + +#: sphinx/themes/basic/changes/versionchanges.html:23 +msgid "C API changes" +msgstr "C API 更改" + +#: sphinx/themes/basic/changes/versionchanges.html:25 +msgid "Other changes" +msgstr "其他更改" + +#: sphinx/themes/basic/static/doctools.js:139 sphinx/writers/html.py:473 +#: sphinx/writers/html.py:478 +msgid "Permalink to this headline" +msgstr "永久链接至标题" + +#: sphinx/themes/basic/static/doctools.js:145 sphinx/writers/html.py:80 +msgid "Permalink to this definition" +msgstr "永久链接至目标" + +#: sphinx/themes/basic/static/doctools.js:174 +msgid "Hide Search Matches" +msgstr "隐藏搜索结果" + +#: sphinx/themes/basic/static/searchtools.js:274 +msgid "Searching" +msgstr "搜索中" + +#: sphinx/themes/basic/static/searchtools.js:279 +msgid "Preparing search..." +msgstr "准备搜索..." + +#: sphinx/themes/basic/static/searchtools.js:347 +msgid "module, in " +msgstr "模块,位于" + +#: sphinx/themes/basic/static/searchtools.js:356 +msgid ", in " +msgstr ", 位于" + +#: sphinx/themes/basic/static/searchtools.js:464 +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/themes/basic/static/searchtools.js:466 +#, python-format +msgid "Search finished, found %s page(s) matching the search query." +msgstr "搜索完成, 找到了 %s 页匹配所搜索的关键字" + +#: sphinx/writers/latex.py:187 +msgid "Release" +msgstr "发布" + +#: sphinx/writers/latex.py:578 +msgid "Footnotes" +msgstr "" + +#: sphinx/writers/latex.py:646 +msgid "continued from previous page" +msgstr "" + +#: sphinx/writers/latex.py:651 +#, fuzzy +msgid "Continued on next page" +msgstr "一页的全部索引" + +#: sphinx/writers/text.py:166 +#, python-format +msgid "Platform: %s" +msgstr "平台:%s" + +#: sphinx/writers/text.py:428 +msgid "[image]" +msgstr "[图片]" + diff --git a/sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo b/sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo Binary files differindex c0a2e950..aa24573b 100644 --- a/sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po b/sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po index 6b86de79..53d1731d 100644 --- a/sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Sphinx 0.5\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2008-11-09 19:46+0100\n" -"PO-Revision-Date: 2009-08-06 22:48+0200\n" +"PO-Revision-Date: 2009-08-06 23:04+0200\n" "Last-Translator: Fred Lin <gasolin@gmail.com>\n" "Language-Team: tw <LL@li.org>\n" "Plural-Forms: nplurals=1; plural=0\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 0.9.4\n" -#: sphinx/environment.py:103 sphinx/writers/latex.py:182 +#: sphinx/environment.py:103 sphinx/writers/latex.py:184 #, python-format msgid "%B %d, %Y" msgstr "%Y 年 %m 月 %d 日" @@ -26,12 +26,12 @@ msgstr "%Y 年 %m 月 %d 日" #: sphinx/themes/basic/genindex-split.html:2 #: sphinx/themes/basic/genindex-split.html:5 #: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5 -#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:131 -#: sphinx/writers/latex.py:188 +#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134 +#: sphinx/writers/latex.py:190 msgid "Index" msgstr "索引" -#: sphinx/environment.py:325 sphinx/writers/latex.py:187 +#: sphinx/environment.py:325 sphinx/writers/latex.py:189 msgid "Module Index" msgstr "模組索引" @@ -57,34 +57,34 @@ msgstr "" msgid "Module level" msgstr "" -#: sphinx/builders/html.py:205 +#: sphinx/builders/html.py:222 #, python-format msgid "%b %d, %Y" msgstr "%Y 年 %m 月 %d 日" -#: sphinx/builders/html.py:224 sphinx/themes/basic/defindex.html:21 +#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21 msgid "General Index" msgstr "總索引" -#: sphinx/builders/html.py:224 +#: sphinx/builders/html.py:241 msgid "index" msgstr "索引" -#: sphinx/builders/html.py:226 sphinx/builders/htmlhelp.py:219 +#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219 #: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19 #: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13 msgid "Global Module Index" msgstr "" -#: sphinx/builders/html.py:227 +#: sphinx/builders/html.py:244 msgid "modules" msgstr "模組" -#: sphinx/builders/html.py:281 +#: sphinx/builders/html.py:300 msgid "next" msgstr "下一頁" -#: sphinx/builders/html.py:290 +#: sphinx/builders/html.py:309 msgid "previous" msgstr "上一頁" @@ -208,37 +208,37 @@ msgstr "%s (C 變數)" msgid "%scommand line option; %s" msgstr "%s命令列選項; %s" -#: sphinx/directives/other.py:138 +#: sphinx/directives/other.py:140 msgid "Platforms: " msgstr "平台" -#: sphinx/directives/other.py:144 +#: sphinx/directives/other.py:146 #, python-format msgid "%s (module)" msgstr "%s (模組)" -#: sphinx/directives/other.py:193 +#: sphinx/directives/other.py:195 msgid "Section author: " msgstr "Section 作者:" -#: sphinx/directives/other.py:195 +#: sphinx/directives/other.py:197 msgid "Module author: " msgstr "模組作者:" -#: sphinx/directives/other.py:197 +#: sphinx/directives/other.py:199 msgid "Author: " msgstr "作者:" -#: sphinx/directives/other.py:317 +#: sphinx/directives/other.py:319 msgid "See also" msgstr "" -#: sphinx/ext/autodoc.py:883 +#: sphinx/ext/autodoc.py:889 #, python-format msgid " Bases: %s" msgstr "" -#: sphinx/ext/autodoc.py:916 +#: sphinx/ext/autodoc.py:922 #, python-format msgid "alias of :class:`%s`" msgstr "" @@ -432,40 +432,40 @@ msgstr "" msgid "Enter search terms or a module, class or function name." msgstr "輸入一個模組、類別、或是函式名稱." -#: sphinx/themes/basic/layout.html:119 +#: sphinx/themes/basic/layout.html:122 #, python-format msgid "Search within %(docstitle)s" msgstr "在 %(docstitle)s 中搜尋" -#: sphinx/themes/basic/layout.html:128 +#: sphinx/themes/basic/layout.html:131 msgid "About these documents" msgstr "" -#: sphinx/themes/basic/layout.html:134 sphinx/themes/basic/search.html:2 +#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2 #: sphinx/themes/basic/search.html:5 msgid "Search" msgstr "搜尋" -#: sphinx/themes/basic/layout.html:137 +#: sphinx/themes/basic/layout.html:140 msgid "Copyright" msgstr "版權所有" -#: sphinx/themes/basic/layout.html:183 +#: sphinx/themes/basic/layout.html:187 #, python-format msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s." msgstr "" -#: sphinx/themes/basic/layout.html:185 +#: sphinx/themes/basic/layout.html:189 #, python-format msgid "© Copyright %(copyright)s." msgstr "" -#: sphinx/themes/basic/layout.html:188 +#: sphinx/themes/basic/layout.html:193 #, python-format msgid "Last updated on %(last_updated)s." msgstr "最後更新日期是 %(last_updated)s." -#: sphinx/themes/basic/layout.html:191 +#: sphinx/themes/basic/layout.html:196 #, python-format msgid "" "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> " @@ -500,7 +500,7 @@ msgid "search" msgstr "搜尋" #: sphinx/themes/basic/search.html:25 -#: sphinx/themes/basic/static/searchtools.js:453 +#: sphinx/themes/basic/static/searchtools.js:462 msgid "Search Results" msgstr "搜尋結果" @@ -557,38 +557,38 @@ msgstr "搜尋中" msgid "Preparing search..." msgstr "準備搜尋..." -#: sphinx/themes/basic/static/searchtools.js:338 +#: sphinx/themes/basic/static/searchtools.js:347 msgid "module, in " msgstr "" -#: sphinx/themes/basic/static/searchtools.js:347 +#: sphinx/themes/basic/static/searchtools.js:356 msgid ", in " msgstr "" -#: sphinx/themes/basic/static/searchtools.js:455 +#: sphinx/themes/basic/static/searchtools.js:464 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/themes/basic/static/searchtools.js:457 +#: sphinx/themes/basic/static/searchtools.js:466 #, python-format msgid "Search finished, found %s page(s) matching the search query." msgstr "" -#: sphinx/writers/latex.py:185 +#: sphinx/writers/latex.py:187 msgid "Release" msgstr "釋出" -#: sphinx/writers/latex.py:571 +#: sphinx/writers/latex.py:578 msgid "Footnotes" msgstr "" -#: sphinx/writers/latex.py:639 +#: sphinx/writers/latex.py:646 msgid "continued from previous page" msgstr "" -#: sphinx/writers/latex.py:644 +#: sphinx/writers/latex.py:651 msgid "Continued on next page" msgstr "" diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py index b7473bf2..63303a85 100644 --- a/sphinx/pycode/__init__.py +++ b/sphinx/pycode/__init__.py @@ -14,8 +14,10 @@ import sys from os import path from cStringIO import StringIO +from sphinx.errors import PycodeError from sphinx.pycode import nodes from sphinx.pycode.pgen2 import driver, token, tokenize, parse, literals +from sphinx.util import get_module_source from sphinx.util.docstrings import prepare_docstring, prepare_commentdoc @@ -45,22 +47,42 @@ _eq = nodes.Leaf(token.EQUAL, '=') class AttrDocVisitor(nodes.NodeVisitor): """ Visitor that collects docstrings for attribute assignments on toplevel and - in classes. + in classes (class attributes and attributes set in __init__). The docstrings can either be in special '#:' comments before the assignment or in a docstring after it. """ def init(self, scope, encoding): self.scope = scope + self.in_init = 0 self.encoding = encoding self.namespace = [] self.collected = {} + self.tagnumber = 0 + self.tagorder = {} + + def add_tag(self, name): + name = '.'.join(self.namespace + [name]) + self.tagorder[name] = self.tagnumber + self.tagnumber += 1 def visit_classdef(self, node): + """Visit a class.""" + self.add_tag(node[1].value) self.namespace.append(node[1].value) self.generic_visit(node) self.namespace.pop() + def visit_funcdef(self, node): + """Visit a function (or method).""" + # usually, don't descend into functions -- nothing interesting there + self.add_tag(node[1].value) + if node[1].value == '__init__': + # however, collect attributes set in __init__ methods + self.in_init += 1 + self.generic_visit(node) + self.in_init -= 1 + def visit_expr_stmt(self, node): """Visit an assignment which may have a special comment before it.""" if _eq not in node.children: @@ -78,8 +100,7 @@ class AttrDocVisitor(nodes.NodeVisitor): prefix = pnode.get_prefix() prefix = prefix.decode(self.encoding) docstring = prepare_commentdoc(prefix) - if docstring: - self.add_docstring(node, docstring) + self.add_docstring(node, docstring) def visit_simple_stmt(self, node): """Visit a docstring statement which may have an assignment before.""" @@ -97,28 +118,34 @@ class AttrDocVisitor(nodes.NodeVisitor): docstring = prepare_docstring(docstring) self.add_docstring(prev[0], docstring) - def visit_funcdef(self, node): - # don't descend into functions -- nothing interesting there - return - def add_docstring(self, node, docstring): # add an item for each assignment target for i in range(0, len(node) - 1, 2): target = node[i] - if target.type != token.NAME: - # don't care about complex targets + if self.in_init and self.number2name[target.type] == 'power': + # maybe an attribute assignment -- check necessary conditions + if (# node must have two children + len(target) != 2 or + # first child must be "self" + target[0].type != token.NAME or target[0].value != 'self' or + # second child must be a "trailer" with two children + self.number2name[target[1].type] != 'trailer' or + len(target[1]) != 2 or + # first child must be a dot, second child a name + target[1][0].type != token.DOT or + target[1][1].type != token.NAME): + continue + name = target[1][1].value + elif target.type != token.NAME: + # don't care about other complex targets continue - namespace = '.'.join(self.namespace) - if namespace.startswith(self.scope): - self.collected[namespace, target.value] = docstring - - -class PycodeError(Exception): - def __str__(self): - res = self.args[0] - if len(self.args) > 1: - res += ' (exception was: %r)' % self.args[1] - return res + else: + name = target.value + self.add_tag(name) + if docstring: + namespace = '.'.join(self.namespace) + if namespace.startswith(self.scope): + self.collected[namespace, name] = docstring class ModuleAnalyzer(object): @@ -150,33 +177,11 @@ class ModuleAnalyzer(object): return entry try: - if modname not in sys.modules: - try: - __import__(modname) - except ImportError, err: - raise PycodeError('error importing %r' % modname, err) - mod = sys.modules[modname] - if hasattr(mod, '__loader__'): - try: - source = mod.__loader__.get_source(modname) - except Exception, err: - raise PycodeError('error getting source for %r' % modname, - err) + type, source = get_module_source(modname) + if type == 'string': obj = cls.for_string(source, modname) - cls.cache['module', modname] = obj - return obj - filename = getattr(mod, '__file__', None) - if filename is None: - raise PycodeError('no source found for module %r' % modname) - filename = path.normpath(path.abspath(filename)) - lfilename = filename.lower() - if lfilename.endswith('.pyo') or lfilename.endswith('.pyc'): - filename = filename[:-1] - elif not lfilename.endswith('.py'): - raise PycodeError('source is not a .py file: %r' % filename) - if not path.isfile(filename): - raise PycodeError('source file is not present: %r' % filename) - obj = cls.for_file(filename, modname) + else: + obj = cls.for_file(source, modname) except PycodeError, err: cls.cache['module', modname] = err raise @@ -191,12 +196,18 @@ class ModuleAnalyzer(object): # file-like object yielding source lines self.source = source + # cache the source code as well + pos = self.source.tell() + self.code = self.source.read() + self.source.seek(pos) + # will be filled by tokenize() self.tokens = None # will be filled by parse() self.parsetree = None # will be filled by find_attr_docs() self.attr_docs = None + self.tagorder = None # will be filled by find_tags() self.tags = None @@ -234,6 +245,7 @@ class ModuleAnalyzer(object): attr_visitor = AttrDocVisitor(number2name, scope, self.encoding) attr_visitor.visit(self.parsetree) self.attr_docs = attr_visitor.collected + self.tagorder = attr_visitor.tagorder # now that we found everything we could in the tree, throw it away # (it takes quite a bit of memory for large modules) self.parsetree = None @@ -298,8 +310,8 @@ if __name__ == '__main__': import time, pprint x0 = time.time() #ma = ModuleAnalyzer.for_file(__file__.rstrip('c'), 'sphinx.builders.html') - ma = ModuleAnalyzer.for_file('sphinx/builders/html.py', - 'sphinx.builders.html') + ma = ModuleAnalyzer.for_file('sphinx/environment.py', + 'sphinx.environment') ma.tokenize() x1 = time.time() ma.parse() diff --git a/sphinx/pycode/pgen2/driver.py b/sphinx/pycode/pgen2/driver.py index edc882fa..39e347b7 100644 --- a/sphinx/pycode/pgen2/driver.py +++ b/sphinx/pycode/pgen2/driver.py @@ -35,7 +35,7 @@ class Driver(object): def parse_tokens(self, tokens, debug=False): """Parse a series of tokens and return the syntax tree.""" - # XXX Move the prefix computation into a wrapper around tokenize. + # X X X Move the prefix computation into a wrapper around tokenize. p = parse.Parser(self.grammar, self.convert) p.setup() lineno = 1 diff --git a/sphinx/pycode/pgen2/grammar.py b/sphinx/pycode/pgen2/grammar.py index 381d80e8..5a433578 100644 --- a/sphinx/pycode/pgen2/grammar.py +++ b/sphinx/pycode/pgen2/grammar.py @@ -16,7 +16,7 @@ fallback token code OP, but the parser needs the actual token code. import pickle # Local imports -from sphinx.pycode.pgen2 import token, tokenize +from sphinx.pycode.pgen2 import token class Grammar(object): diff --git a/sphinx/pycode/pgen2/parse.c b/sphinx/pycode/pgen2/parse.c index fd0e9ff9..e09f5058 100644 --- a/sphinx/pycode/pgen2/parse.c +++ b/sphinx/pycode/pgen2/parse.c @@ -1,8 +1,11 @@ -/* Generated by Cython 0.9.8.1 on Thu Jan 1 23:45:38 2009 */ +/* Generated by Cython 0.12 on Fri Jan 22 10:39:58 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #include "structmember.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -11,11 +14,14 @@ #endif #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) @@ -31,20 +37,20 @@ typedef struct { void *buf; + PyObject *obj; Py_ssize_t len; + Py_ssize_t itemsize; int readonly; - const char *format; int ndim; + char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; - Py_ssize_t itemsize; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 - #define PyBUF_LOCK 0x0002 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) @@ -63,9 +69,18 @@ #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type - #define PyString_Type PyBytes_Type + #define PyString_Type PyUnicode_Type + #define PyString_CheckExact PyUnicode_CheckExact +#else + #define PyBytes_Type PyString_Type + #define PyBytes_CheckExact PyString_CheckExact +#endif +#if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -80,9 +95,10 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define PyBytes_Type PyString_Type + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) @@ -94,9 +110,28 @@ #ifndef __cdecl #define __cdecl #endif + #ifndef __fastcall + #define __fastcall + #endif #else #define _USE_MATH_DEFINES #endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else @@ -105,7 +140,6 @@ #include <math.h> #define __PYX_HAVE_API__sphinx__pycode__pgen2__parse - #ifdef __GNUC__ #define INLINE __inline__ #elif _WIN32 @@ -114,43 +148,97 @@ #define INLINE #endif -typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ - - - -static int __pyx_skip_dispatch = 0; +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ #if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_AsString PyString_AsString +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString #else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_AsString PyBytes_AsString +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString #endif +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) + #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x); -static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x); -static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x); -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b); +static INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif + + +#if !defined(T_ULONGLONG) +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) +#else +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) +#endif +#if !defined(T_LONGLONG) +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) +#else +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : \ + ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) +#endif + +#define __Pyx_T_FLOATING(x) \ + ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ + ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) + +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) +#else +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) +#endif +#endif + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); -#define __pyx_PyInt_AsLong(x) (PyInt_CheckExact(x) ? PyInt_AS_LONG(x) : PyInt_AsLong(x)) #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x); -static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x); -static INLINE char __pyx_PyInt_char(PyObject* x); -static INLINE short __pyx_PyInt_short(PyObject* x); -static INLINE int __pyx_PyInt_int(PyObject* x); -static INLINE long __pyx_PyInt_long(PyObject* x); -static INLINE signed char __pyx_PyInt_signed_char(PyObject* x); -static INLINE signed short __pyx_PyInt_signed_short(PyObject* x); -static INLINE signed int __pyx_PyInt_signed_int(PyObject* x); -static INLINE signed long __pyx_PyInt_signed_long(PyObject* x); -static INLINE long double __pyx_PyInt_long_double(PyObject* x); + #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) @@ -168,184 +256,468 @@ static INLINE long double __pyx_PyInt_long_double(PyObject* x); static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char **__pyx_f; -static INLINE void __Pyx_RaiseArgtupleTooLong(Py_ssize_t num_expected, Py_ssize_t num_found); /*proto*/ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +/* Type declarations */ -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ +/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":31 + * + * + * cdef class Parser: # <<<<<<<<<<<<<< + * cdef public object grammar + * cdef public object rootnode + */ -static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/ +struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser { + PyObject_HEAD + struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *__pyx_vtab; + PyObject *grammar; + PyObject *rootnode; + PyObject *stack; + PyObject *used_names; + int _grammar_start; + PyObject *_grammar_labels; + PyObject *_grammar_dfas; + PyObject *_grammar_keywords; + PyObject *_grammar_tokens; + PyObject *_grammar_number2symbol; +}; + + +struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser { + int (*classify)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *, int, PyObject *, PyObject *); + void (*shift)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *, PyObject *, PyObject *, PyObject *, PyObject *); + void (*push)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *, PyObject *, PyObject *, PyObject *, PyObject *); + void (*pop)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *); + PyObject *(*convert)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *, PyObject *); +}; +static struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *__pyx_vtabptr_6sphinx_6pycode_5pgen2_5parse_Parser; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +#if PY_VERSION_HEX < 0x02050000 +#ifndef PyAnySet_CheckExact + +#define PyAnySet_CheckExact(ob) \ + ((ob)->ob_type == &PySet_Type || \ + (ob)->ob_type == &PyFrozenSet_Type) -static INLINE PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i, int is_unsigned) { +#define PySet_New(iterable) \ + PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL) + +#define Pyx_PyFrozenSet_New(iterable) \ + PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL) + +#define PySet_Size(anyset) \ + PyObject_Size((anyset)) + +#define PySet_Contains(anyset, key) \ + PySequence_Contains((anyset), (key)) + +#define PySet_Pop(set) \ + PyObject_CallMethod(set, (char *)"pop", NULL) + +static INLINE int PySet_Clear(PyObject *set) { + PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} + +static INLINE int PySet_Discard(PyObject *set, PyObject *key) { + PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} + +static INLINE int PySet_Add(PyObject *set, PyObject *key) { + PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} + +#endif /* PyAnySet_CheckExact (<= Py2.4) */ + +#if PY_VERSION_HEX < 0x02040000 +#ifndef Py_SETOBJECT_H +#define Py_SETOBJECT_H + +static PyTypeObject *__Pyx_PySet_Type = NULL; +static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL; + +#define PySet_Type (*__Pyx_PySet_Type) +#define PyFrozenSet_Type (*__Pyx_PyFrozenSet_Type) + +#define PyAnySet_Check(ob) \ + (PyAnySet_CheckExact(ob) || \ + PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \ + PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type)) + +#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type) + +static int __Pyx_Py23SetsImport(void) { + PyObject *sets=0, *Set=0, *ImmutableSet=0; + + sets = PyImport_ImportModule((char *)"sets"); + if (!sets) goto bad; + Set = PyObject_GetAttrString(sets, (char *)"Set"); + if (!Set) goto bad; + ImmutableSet = PyObject_GetAttrString(sets, (char *)"ImmutableSet"); + if (!ImmutableSet) goto bad; + Py_DECREF(sets); + + __Pyx_PySet_Type = (PyTypeObject*) Set; + __Pyx_PyFrozenSet_Type = (PyTypeObject*) ImmutableSet; + + return 0; + + bad: + Py_XDECREF(sets); + Py_XDECREF(Set); + Py_XDECREF(ImmutableSet); + return -1; +} + +#else +static int __Pyx_Py23SetsImport(void) { return 0; } +#endif /* !Py_SETOBJECT_H */ +#endif /* < Py2.4 */ +#endif /* < Py2.5 */ + + +static INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; - if (PyList_CheckExact(o) && 0 <= i && i < PyList_GET_SIZE(o)) { + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { r = PyList_GET_ITEM(o, i); Py_INCREF(r); } - else if (PyTuple_CheckExact(o) && 0 <= i && i < PyTuple_GET_SIZE(o)) { + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0) || !is_unsigned)) + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { r = PySequence_GetItem(o, i); + } else { - PyObject *j = (likely(i >= 0) || !is_unsigned) ? PyInt_FromLong(i) : PyLong_FromUnsignedLongLong((sizeof(unsigned long long) > sizeof(Py_ssize_t) ? (1ULL << (sizeof(Py_ssize_t)*8)) : 0) + i); - if (!j) - return 0; - r = PyObject_GetItem(o, j); - Py_DECREF(j); + r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); } return r; } +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static INLINE void __Pyx_RaiseTooManyValuesError(void); + static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_EndUnpack(PyObject *); /*proto*/ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; } +static INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) { + return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b); +} + +static INLINE void __Pyx_RaiseNoneNotIterableError(void); static INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { if (likely(PyList_CheckExact(L))) { if (PyList_Append(L, x) < 0) return NULL; Py_INCREF(Py_None); - return Py_None; // this is just to have an accurate signature + return Py_None; /* this is just to have an accurate signature */ } else { - return PyObject_CallMethod(L, "append", "(O)", x); + PyObject *r, *m; + m = __Pyx_GetAttrString(L, "append"); + if (!m) return NULL; + r = PyObject_CallFunctionObjArgs(m, x, NULL); + Py_DECREF(m); + return r; } } -static INLINE int __Pyx_SetItemInt(PyObject *o, Py_ssize_t i, PyObject *v, int is_unsigned) { +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) + +static INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; - if (PyList_CheckExact(o) && 0 <= i && i < PyList_GET_SIZE(o)) { - Py_DECREF(PyList_GET_ITEM(o, i)); + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} + +static INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) { + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { Py_INCREF(v); + Py_DECREF(PyList_GET_ITEM(o, i)); PyList_SET_ITEM(o, i, v); return 1; } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0) || !is_unsigned)) - r = PySequence_SetItem(o, i, v); + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) + return PySequence_SetItem(o, i, v); else { - PyObject *j = (likely(i >= 0) || !is_unsigned) ? PyInt_FromLong(i) : PyLong_FromUnsignedLongLong((sizeof(unsigned long long) > sizeof(Py_ssize_t) ? (1ULL << (sizeof(Py_ssize_t)*8)) : 0) + i); - if (!j) - return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); + PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i); + return __Pyx_SetItemInt_Generic(o, j, v); } - return r; } -static void __Pyx_WriteUnraisable(const char *name); /*proto*/ +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, const char *modname); /*proto*/ -/* Type declarations */ +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":31 - * - * - * cdef class Parser: # <<<<<<<<<<<<<< - * cdef public grammar, stack, rootnode, used_names - * cdef _grammar_dfas, _grammar_labels, _grammar_keywords, _grammar_tokens - */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser { - PyObject_HEAD - struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *__pyx_vtab; - PyObject *grammar; - PyObject *stack; - PyObject *rootnode; - PyObject *used_names; - PyObject *_grammar_dfas; - PyObject *_grammar_labels; - PyObject *_grammar_keywords; - PyObject *_grammar_tokens; - PyObject *_grammar_number2symbol; -}; +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); -struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser { - int (*classify)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *, PyObject *, PyObject *, PyObject *); - void (*shift)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *, PyObject *, PyObject *, PyObject *, PyObject *); - void (*push)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *, PyObject *, PyObject *, PyObject *, PyObject *); - void (*pop)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *); - PyObject *(*convert)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *, PyObject *); -}; -static struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *__pyx_vtabptr_6sphinx_6pycode_5pgen2_5parse_Parser; +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from sphinx.pycode.pgen2.parse */ static PyTypeObject *__pyx_ptype_6sphinx_6pycode_5pgen2_5parse_Parser = 0; - +#define __Pyx_MODULE_NAME "sphinx.pycode.pgen2.parse" +int __pyx_module_is_main_sphinx__pycode__pgen2__parse = 0; /* Implementation of sphinx.pycode.pgen2.parse */ -static char __pyx_k_2[] = "Exception to signal the parser is stuck."; -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static char __pyx_k___init__[] = "__init__"; -static PyObject *__pyx_kp___init__; -static char __pyx_k_setup[] = "setup"; -static PyObject *__pyx_kp_setup; -static char __pyx_k_addtoken[] = "addtoken"; -static PyObject *__pyx_kp_addtoken; -static char __pyx_k_1[] = "sphinx.pycode.nodes"; -static PyObject *__pyx_kp_1; -static char __pyx_k_Node[] = "Node"; -static PyObject *__pyx_kp_Node; -static char __pyx_k_Leaf[] = "Leaf"; -static PyObject *__pyx_kp_Leaf; -static char __pyx_k_ParseError[] = "ParseError"; -static PyObject *__pyx_kp_ParseError; -static char __pyx_k_Exception[] = "Exception"; -static PyObject *__pyx_kp_Exception; -static char __pyx_k_msg[] = "msg"; -static PyObject *__pyx_kp_msg; -static char __pyx_k_type[] = "type"; -static PyObject *__pyx_kp_type; -static char __pyx_k_value[] = "value"; -static PyObject *__pyx_kp_value; -static char __pyx_k_context[] = "context"; -static PyObject *__pyx_kp_context; -static char __pyx_k_dfas[] = "dfas"; -static PyObject *__pyx_kp_dfas; -static char __pyx_k_labels[] = "labels"; -static PyObject *__pyx_kp_labels; -static char __pyx_k_keywords[] = "keywords"; -static PyObject *__pyx_kp_keywords; -static char __pyx_k_tokens[] = "tokens"; -static PyObject *__pyx_kp_tokens; -static char __pyx_k_4[] = "number2symbol"; -static PyObject *__pyx_kp_4; -static char __pyx_k_start[] = "start"; -static PyObject *__pyx_kp_start; -static char __pyx_k_add[] = "add"; -static PyObject *__pyx_kp_add; -static char __pyx_k_get[] = "get"; -static PyObject *__pyx_kp_get; -static char __pyx_k_append[] = "append"; -static PyObject *__pyx_kp_append; -static char __pyx_k_pop[] = "pop"; -static PyObject *__pyx_kp_pop; -static char __pyx_k_used_names[] = "used_names"; -static PyObject *__pyx_kp_used_names; -static PyObject *__pyx_kp_2; static PyObject *__pyx_builtin_Exception; -static PyObject *__pyx_kp_3; -static char __pyx_k_3[] = "%s: type=%r, value=%r, context=%r"; -static PyObject *__pyx_kp_5; -static PyObject *__pyx_kp_6; -static char __pyx_k_5[] = "too much input"; -static char __pyx_k_6[] = "bad input"; -static PyObject *__pyx_kp_7; -static char __pyx_k_7[] = "bad token"; +static char __pyx_k_1[] = "%s: type=%r, value=%r, context=%r"; +static char __pyx_k_2[] = "_grammar_number2symbol"; +static char __pyx_k_3[] = "too much input"; +static char __pyx_k_4[] = "bad input"; +static char __pyx_k_5[] = "bad token"; +static char __pyx_k_6[] = "Parser engine for the grammar tables generated by pgen.\n\nThe grammar table must be loaded first.\n\nSee Parser/parser.c in the Python distribution for additional info on\nhow this parsing engine works.\n\n"; +static char __pyx_k_7[] = "sphinx.pycode.nodes"; +static char __pyx_k_8[] = "Exception to signal the parser is stuck."; +static char __pyx_k_9[] = "Parser.addtoken (line 66)"; +static char __pyx_k__add[] = "add"; +static char __pyx_k__msg[] = "msg"; +static char __pyx_k__pop[] = "pop"; +static char __pyx_k__Leaf[] = "Leaf"; +static char __pyx_k__Node[] = "Node"; +static char __pyx_k__dfas[] = "dfas"; +static char __pyx_k__push[] = "push"; +static char __pyx_k__self[] = "self"; +static char __pyx_k__type[] = "type"; +static char __pyx_k__shift[] = "shift"; +static char __pyx_k__stack[] = "stack"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__value[] = "value"; +static char __pyx_k__Parser[] = "Parser"; +static char __pyx_k__labels[] = "labels"; +static char __pyx_k__tokens[] = "tokens"; +static char __pyx_k__context[] = "context"; +static char __pyx_k__convert[] = "convert"; +static char __pyx_k__grammar[] = "grammar"; +static char __pyx_k____init__[] = "__init__"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__addtoken[] = "addtoken"; +static char __pyx_k__classify[] = "classify"; +static char __pyx_k__keywords[] = "keywords"; +static char __pyx_k__rootnode[] = "rootnode"; +static char __pyx_k__Exception[] = "Exception"; +static char __pyx_k__ParseError[] = "ParseError"; +static char __pyx_k__used_names[] = "used_names"; +static char __pyx_k___grammar_dfas[] = "_grammar_dfas"; +static char __pyx_k__number2symbol[] = "number2symbol"; +static char __pyx_k___grammar_start[] = "_grammar_start"; +static char __pyx_k___grammar_labels[] = "_grammar_labels"; +static char __pyx_k___grammar_tokens[] = "_grammar_tokens"; +static char __pyx_k___grammar_keywords[] = "_grammar_keywords"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_n_s_2; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_s_5; +static PyObject *__pyx_n_s_7; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_u_9; +static PyObject *__pyx_n_s__Exception; +static PyObject *__pyx_n_s__Leaf; +static PyObject *__pyx_n_s__Node; +static PyObject *__pyx_n_s__ParseError; +static PyObject *__pyx_n_s__Parser; +static PyObject *__pyx_n_s____init__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s___grammar_dfas; +static PyObject *__pyx_n_s___grammar_keywords; +static PyObject *__pyx_n_s___grammar_labels; +static PyObject *__pyx_n_s___grammar_start; +static PyObject *__pyx_n_s___grammar_tokens; +static PyObject *__pyx_n_s__add; +static PyObject *__pyx_n_s__addtoken; +static PyObject *__pyx_n_s__classify; +static PyObject *__pyx_n_s__context; +static PyObject *__pyx_n_s__convert; +static PyObject *__pyx_n_s__dfas; +static PyObject *__pyx_n_s__grammar; +static PyObject *__pyx_n_s__keywords; +static PyObject *__pyx_n_s__labels; +static PyObject *__pyx_n_s__msg; +static PyObject *__pyx_n_s__number2symbol; +static PyObject *__pyx_n_s__pop; +static PyObject *__pyx_n_s__push; +static PyObject *__pyx_n_s__rootnode; +static PyObject *__pyx_n_s__self; +static PyObject *__pyx_n_s__shift; +static PyObject *__pyx_n_s__stack; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__tokens; +static PyObject *__pyx_n_s__type; +static PyObject *__pyx_n_s__used_names; +static PyObject *__pyx_n_s__value; +static PyObject *__pyx_int_0; /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":22 * """Exception to signal the parser is stuck.""" @@ -356,34 +728,86 @@ static char __pyx_k_7[] = "bad token"; */ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__ = {"__init__", (PyCFunction)__pyx_pf_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyMethodDef __pyx_mdef_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_msg = 0; PyObject *__pyx_v_type = 0; PyObject *__pyx_v_value = 0; PyObject *__pyx_v_context = 0; - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - static char *__pyx_argnames[] = {"self","msg","type","value","context",0}; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__msg,&__pyx_n_s__type,&__pyx_n_s__value,&__pyx_n_s__context,0}; + __Pyx_RefNannySetupContext("__init__"); __pyx_self = __pyx_self; - if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 5)) { + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__msg); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__type); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_msg = values[1]; + __pyx_v_type = values[2]; + __pyx_v_value = values[3]; + __pyx_v_context = values[4]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); __pyx_v_msg = PyTuple_GET_ITEM(__pyx_args, 1); __pyx_v_type = PyTuple_GET_ITEM(__pyx_args, 2); __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 3); __pyx_v_context = PyTuple_GET_ITEM(__pyx_args, 4); } - else { - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOOO", __pyx_argnames, &__pyx_v_self, &__pyx_v_msg, &__pyx_v_type, &__pyx_v_value, &__pyx_v_context))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sphinx.pycode.pgen2.parse.ParseError.__init__"); return NULL; - __pyx_L4:; + __pyx_L4_argument_unpacking_done:; /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":23 * @@ -392,7 +816,8 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__(Py * (msg, type, value, context)) * self.msg = msg */ - __pyx_1 = PyObject_GetAttr(__pyx_builtin_Exception, __pyx_kp___init__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_builtin_Exception, __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":24 * def __init__(self, msg, type, value, context): @@ -401,26 +826,36 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__(Py * self.msg = msg * self.type = type */ - __pyx_2 = PyTuple_New(4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_msg); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_msg); - Py_INCREF(__pyx_v_type); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_type); - Py_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_2, 2, __pyx_v_value); - Py_INCREF(__pyx_v_context); - PyTuple_SET_ITEM(__pyx_2, 3, __pyx_v_context); - __pyx_3 = PyNumber_Remainder(__pyx_kp_3, ((PyObject *)__pyx_2)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_3); - __pyx_3 = 0; - __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_msg); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_msg); + __Pyx_GIVEREF(__pyx_v_msg); + __Pyx_INCREF(__pyx_v_type); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_type); + __Pyx_GIVEREF(__pyx_v_type); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_context); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_context); + __Pyx_GIVEREF(__pyx_v_context); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":25 * Exception.__init__(self, "%s: type=%r, value=%r, context=%r" % @@ -429,7 +864,7 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__(Py * self.type = type * self.value = value */ - if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_msg, __pyx_v_msg) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__msg, __pyx_v_msg) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":26 * (msg, type, value, context)) @@ -438,7 +873,7 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__(Py * self.value = value * self.context = context */ - if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_type, __pyx_v_type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__type, __pyx_v_type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":27 * self.msg = msg @@ -447,7 +882,7 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__(Py * self.context = context * */ - if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_value, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__value, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":28 * self.type = type @@ -456,22 +891,114 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__(Py * * */ - if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_context, __pyx_v_context) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__context, __pyx_v_context) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("sphinx.pycode.pgen2.parse.ParseError.__init__"); __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":36 - * cdef _grammar_number2symbol +/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":34 + * cdef public object grammar + * cdef public object rootnode + * cdef public list stack # <<<<<<<<<<<<<< + * cdef public set used_names + * cdef int _grammar_start + */ + +static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_5stack___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_5stack___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack)); + __pyx_r = ((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_5stack___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_5stack___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack)); + ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack = ((PyObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("sphinx.pycode.pgen2.parse.Parser.stack.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":35 + * cdef public object rootnode + * cdef public list stack + * cdef public set used_names # <<<<<<<<<<<<<< + * cdef int _grammar_start + * cdef list _grammar_labels + */ + +static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_10used_names___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_10used_names___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->used_names)); + __pyx_r = ((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->used_names); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_10used_names___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_10used_names___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + if (!(likely(PyAnySet_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected set, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->used_names); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->used_names)); + ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->used_names = ((PyObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("sphinx.pycode.pgen2.parse.Parser.used_names.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":43 + * cdef dict _grammar_number2symbol * * def __init__(self, grammar, convert=None): # <<<<<<<<<<<<<< * self.grammar = grammar @@ -483,111 +1010,176 @@ static int __pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser___init__(PyObject *__p PyObject *__pyx_v_grammar = 0; PyObject *__pyx_v_convert = 0; int __pyx_r; - PyObject *__pyx_1 = 0; - static char *__pyx_argnames[] = {"grammar","convert",0}; - __pyx_v_convert = Py_None; - if (likely(!__pyx_kwds) && likely(1 <= PyTuple_GET_SIZE(__pyx_args)) && likely(PyTuple_GET_SIZE(__pyx_args) <= 2)) { - __pyx_v_grammar = PyTuple_GET_ITEM(__pyx_args, 0); - if (PyTuple_GET_SIZE(__pyx_args) > 1) { - __pyx_v_convert = PyTuple_GET_ITEM(__pyx_args, 1); + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__grammar,&__pyx_n_s__convert,0}; + __Pyx_RefNannySetupContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grammar); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__convert); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_grammar = values[0]; + __pyx_v_convert = values[1]; + } else { + __pyx_v_convert = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: __pyx_v_convert = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_grammar = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - else { - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_grammar, &__pyx_v_convert))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sphinx.pycode.pgen2.parse.Parser.__init__"); return -1; - __pyx_L4:; + __pyx_L4_argument_unpacking_done:; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":37 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":44 * * def __init__(self, grammar, convert=None): * self.grammar = grammar # <<<<<<<<<<<<<< * #self.convert = convert or noconvert * */ - Py_INCREF(__pyx_v_grammar); - Py_DECREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->grammar); + __Pyx_INCREF(__pyx_v_grammar); + __Pyx_GIVEREF(__pyx_v_grammar); + __Pyx_GOTREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->grammar); + __Pyx_DECREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->grammar); ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->grammar = __pyx_v_grammar; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":40 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":47 * #self.convert = convert or noconvert * * self._grammar_dfas = grammar.dfas # <<<<<<<<<<<<<< * self._grammar_labels = grammar.labels * self._grammar_keywords = grammar.keywords */ - __pyx_1 = PyObject_GetAttr(__pyx_v_grammar, __pyx_kp_dfas); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_dfas); - ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_dfas = __pyx_1; - __pyx_1 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":41 + __pyx_t_1 = PyObject_GetAttr(__pyx_v_grammar, __pyx_n_s__dfas); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_dfas); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_dfas)); + ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_dfas = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":48 * * self._grammar_dfas = grammar.dfas * self._grammar_labels = grammar.labels # <<<<<<<<<<<<<< * self._grammar_keywords = grammar.keywords * self._grammar_tokens = grammar.tokens */ - __pyx_1 = PyObject_GetAttr(__pyx_v_grammar, __pyx_kp_labels); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_labels); - ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_labels = __pyx_1; - __pyx_1 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":42 + __pyx_t_1 = PyObject_GetAttr(__pyx_v_grammar, __pyx_n_s__labels); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_labels); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_labels)); + ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_labels = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":49 * self._grammar_dfas = grammar.dfas * self._grammar_labels = grammar.labels * self._grammar_keywords = grammar.keywords # <<<<<<<<<<<<<< * self._grammar_tokens = grammar.tokens * self._grammar_number2symbol = grammar.number2symbol */ - __pyx_1 = PyObject_GetAttr(__pyx_v_grammar, __pyx_kp_keywords); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_keywords); - ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_keywords = __pyx_1; - __pyx_1 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":43 + __pyx_t_1 = PyObject_GetAttr(__pyx_v_grammar, __pyx_n_s__keywords); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_keywords); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_keywords)); + ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_keywords = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":50 * self._grammar_labels = grammar.labels * self._grammar_keywords = grammar.keywords * self._grammar_tokens = grammar.tokens # <<<<<<<<<<<<<< * self._grammar_number2symbol = grammar.number2symbol - * + * self._grammar_start = grammar.start */ - __pyx_1 = PyObject_GetAttr(__pyx_v_grammar, __pyx_kp_tokens); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_tokens); - ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_tokens = __pyx_1; - __pyx_1 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":44 + __pyx_t_1 = PyObject_GetAttr(__pyx_v_grammar, __pyx_n_s__tokens); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_tokens); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_tokens)); + ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_tokens = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":51 * self._grammar_keywords = grammar.keywords * self._grammar_tokens = grammar.tokens * self._grammar_number2symbol = grammar.number2symbol # <<<<<<<<<<<<<< + * self._grammar_start = grammar.start + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_grammar, __pyx_n_s__number2symbol); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_number2symbol); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_number2symbol)); + ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_number2symbol = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":52 + * self._grammar_tokens = grammar.tokens + * self._grammar_number2symbol = grammar.number2symbol + * self._grammar_start = grammar.start # <<<<<<<<<<<<<< * * def setup(self, start=None): */ - __pyx_1 = PyObject_GetAttr(__pyx_v_grammar, __pyx_kp_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_number2symbol); - ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_number2symbol = __pyx_1; - __pyx_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_grammar, __pyx_n_s__start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_start = __pyx_t_2; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sphinx.pycode.pgen2.parse.Parser.__init__"); __pyx_r = -1; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":46 - * self._grammar_number2symbol = grammar.number2symbol +/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":54 + * self._grammar_start = grammar.start * * def setup(self, start=None): # <<<<<<<<<<<<<< * if start is None: - * start = self.grammar.start + * start = self._grammar_start */ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_setup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ @@ -595,149 +1187,197 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_setup(PyObject * PyObject *__pyx_v_start = 0; PyObject *__pyx_v_newnode; PyObject *__pyx_v_stackentry; - PyObject *__pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - static char *__pyx_argnames[] = {"start",0}; - __pyx_v_start = Py_None; - if (likely(!__pyx_kwds) && likely(0 <= PyTuple_GET_SIZE(__pyx_args)) && likely(PyTuple_GET_SIZE(__pyx_args) <= 1)) { - if (PyTuple_GET_SIZE(__pyx_args) > 0) { - __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 0); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,0}; + __Pyx_RefNannySetupContext("setup"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + values[0] = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setup") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_start = values[0]; + } else { + __pyx_v_start = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } } - else { - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_start))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setup", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sphinx.pycode.pgen2.parse.Parser.setup"); return NULL; - __pyx_L4:; - Py_INCREF(__pyx_v_start); - __pyx_v_newnode = Py_None; Py_INCREF(Py_None); - __pyx_v_stackentry = Py_None; Py_INCREF(Py_None); + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_start); + __pyx_v_newnode = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_stackentry = Py_None; __Pyx_INCREF(Py_None); - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":47 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":55 * * def setup(self, start=None): * if start is None: # <<<<<<<<<<<<<< - * start = self.grammar.start + * start = self._grammar_start * # Each stack entry is a tuple: (dfa, state, node). */ - __pyx_1 = (__pyx_v_start == Py_None); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_start == Py_None); + if (__pyx_t_1) { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":48 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":56 * def setup(self, start=None): * if start is None: - * start = self.grammar.start # <<<<<<<<<<<<<< + * start = self._grammar_start # <<<<<<<<<<<<<< * # Each stack entry is a tuple: (dfa, state, node). * # A node is a tuple: (type, value, context, children), */ - __pyx_2 = PyObject_GetAttr(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->grammar, __pyx_kp_start); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_start); - __pyx_v_start = __pyx_2; - __pyx_2 = 0; - goto __pyx_L5; + __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_start); + __pyx_v_start = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L6; } - __pyx_L5:; + __pyx_L6:; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":52 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":60 * # A node is a tuple: (type, value, context, children), * # where children is a list of nodes or None, and context may be None. * newnode = (start, None, None, []) # <<<<<<<<<<<<<< * stackentry = (self._grammar_dfas[start], 0, newnode) * self.stack = [stackentry] */ - __pyx_2 = PyList_New(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_start); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_start); - Py_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_3, 1, Py_None); - Py_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_3, 2, Py_None); - PyTuple_SET_ITEM(__pyx_3, 3, ((PyObject *)__pyx_2)); - __pyx_2 = 0; - Py_DECREF(__pyx_v_newnode); - __pyx_v_newnode = ((PyObject *)__pyx_3); - __pyx_3 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":53 + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None); + __Pyx_GIVEREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_newnode); + __pyx_v_newnode = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":61 * # where children is a list of nodes or None, and context may be None. * newnode = (start, None, None, []) * stackentry = (self._grammar_dfas[start], 0, newnode) # <<<<<<<<<<<<<< * self.stack = [stackentry] * self.rootnode = None */ - __pyx_2 = PyObject_GetItem(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_dfas, __pyx_v_start); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); - Py_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_int_0); - Py_INCREF(__pyx_v_newnode); - PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_newnode); - __pyx_2 = 0; - Py_DECREF(__pyx_v_stackentry); - __pyx_v_stackentry = ((PyObject *)__pyx_3); - __pyx_3 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":54 + __pyx_t_3 = PyObject_GetItem(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_dfas), __pyx_v_start); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_v_newnode); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_newnode); + __Pyx_GIVEREF(__pyx_v_newnode); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_stackentry); + __pyx_v_stackentry = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":62 * newnode = (start, None, None, []) * stackentry = (self._grammar_dfas[start], 0, newnode) * self.stack = [stackentry] # <<<<<<<<<<<<<< * self.rootnode = None * self.used_names = set() # Aliased to self.rootnode.used_names in pop() */ - __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_stackentry); - PyList_SET_ITEM(__pyx_2, 0, __pyx_v_stackentry); - Py_DECREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack); - ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack = ((PyObject *)__pyx_2); - __pyx_2 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":55 + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_stackentry); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_stackentry); + __Pyx_GIVEREF(__pyx_v_stackentry); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack)); + ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":63 * stackentry = (self._grammar_dfas[start], 0, newnode) * self.stack = [stackentry] * self.rootnode = None # <<<<<<<<<<<<<< * self.used_names = set() # Aliased to self.rootnode.used_names in pop() * */ - Py_INCREF(Py_None); - Py_DECREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->rootnode); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->rootnode); + __Pyx_DECREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->rootnode); ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->rootnode = Py_None; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":56 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":64 * self.stack = [stackentry] * self.rootnode = None * self.used_names = set() # Aliased to self.rootnode.used_names in pop() # <<<<<<<<<<<<<< * - * def addtoken(self, type, value, context): + * def addtoken(self, int type, value, context): */ - __pyx_3 = PyObject_Call(((PyObject*)&PySet_Type), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->used_names); - ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->used_names = __pyx_3; - __pyx_3 = 0; - - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (!(likely(PyAnySet_CheckExact(((PyObject *)__pyx_t_2)))||((((PyObject *)__pyx_t_2)) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected set, got %.200s", Py_TYPE(((PyObject *)__pyx_t_2))->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->used_names); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->used_names)); + ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->used_names = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("sphinx.pycode.pgen2.parse.Parser.setup"); __pyx_r = NULL; __pyx_L0:; - Py_DECREF(__pyx_v_newnode); - Py_DECREF(__pyx_v_stackentry); - Py_DECREF(__pyx_v_start); + __Pyx_DECREF(__pyx_v_newnode); + __Pyx_DECREF(__pyx_v_stackentry); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_start); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":58 +/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":66 * self.used_names = set() # Aliased to self.rootnode.used_names in pop() * - * def addtoken(self, type, value, context): # <<<<<<<<<<<<<< + * def addtoken(self, int type, value, context): # <<<<<<<<<<<<<< * """Add a token; return True iff this is the end of the program.""" * cdef int ilabel, i, t, state, newstate */ @@ -745,7 +1385,7 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_setup(PyObject * static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken[] = "Add a token; return True iff this is the end of the program."; static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_type = 0; + int __pyx_v_type; PyObject *__pyx_v_value = 0; PyObject *__pyx_v_context = 0; int __pyx_v_ilabel; @@ -762,40 +1402,82 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken(PyObjec PyObject *__pyx_v_itsdfa; PyObject *__pyx_v_itsstates; PyObject *__pyx_v_itsfirst; - PyObject *__pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - int __pyx_5; - Py_ssize_t __pyx_6 = 0; - PyObject *__pyx_7 = 0; - int __pyx_8; - static char *__pyx_argnames[] = {"type","value","context",0}; - if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 3)) { - __pyx_v_type = PyTuple_GET_ITEM(__pyx_args, 0); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__type,&__pyx_n_s__value,&__pyx_n_s__context,0}; + __Pyx_RefNannySetupContext("addtoken"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__type); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("addtoken", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("addtoken", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "addtoken") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_type = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_value = values[1]; + __pyx_v_context = values[2]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 1); __pyx_v_context = PyTuple_GET_ITEM(__pyx_args, 2); } - else { - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_type, &__pyx_v_value, &__pyx_v_context))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("addtoken", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sphinx.pycode.pgen2.parse.Parser.addtoken"); return NULL; - __pyx_L4:; - __pyx_v_dfa = Py_None; Py_INCREF(Py_None); - __pyx_v_node = Py_None; Py_INCREF(Py_None); - __pyx_v_states = Py_None; Py_INCREF(Py_None); - __pyx_v_first = Py_None; Py_INCREF(Py_None); - __pyx_v_arcs = Py_None; Py_INCREF(Py_None); - __pyx_v_v = Py_None; Py_INCREF(Py_None); - __pyx_v_itsdfa = Py_None; Py_INCREF(Py_None); - __pyx_v_itsstates = Py_None; Py_INCREF(Py_None); - __pyx_v_itsfirst = Py_None; Py_INCREF(Py_None); - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":62 + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_context); + __pyx_v_dfa = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_node = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_states = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_first = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_arcs = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_v = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_itsdfa = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_itsstates = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_itsfirst = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":70 * cdef int ilabel, i, t, state, newstate * # Map from token to label * ilabel = self.classify(type, value, context) # <<<<<<<<<<<<<< @@ -804,7 +1486,7 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken(PyObjec */ __pyx_v_ilabel = ((struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->__pyx_vtab)->classify(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_context); - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":64 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":72 * ilabel = self.classify(type, value, context) * # Loop until the token is shifted; may raise exceptions * while True: # <<<<<<<<<<<<<< @@ -812,102 +1494,104 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken(PyObjec * states, first = dfa */ while (1) { - __pyx_1 = 1; - if (!__pyx_1) break; + __pyx_t_1 = 1; + if (!__pyx_t_1) break; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":65 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":73 * # Loop until the token is shifted; may raise exceptions * while True: * dfa, state, node = self.stack[-1] # <<<<<<<<<<<<<< * states, first = dfa * arcs = states[state] */ - __pyx_2 = __Pyx_GetItemInt(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack, -1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyTuple_CheckExact(__pyx_2) && PyTuple_GET_SIZE(__pyx_2) == 3) { - PyObject* tuple = __pyx_2; - __pyx_4 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_4); - Py_DECREF(__pyx_v_dfa); - __pyx_v_dfa = __pyx_4; - __pyx_4 = 0; - __pyx_4 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_4); - __pyx_5 = __pyx_PyInt_int(__pyx_4); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_v_state = __pyx_5; - __pyx_4 = PyTuple_GET_ITEM(tuple, 2); - Py_INCREF(__pyx_4); - Py_DECREF(__pyx_v_node); - __pyx_v_node = __pyx_4; - __pyx_4 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 3)) { + PyObject* tuple = __pyx_t_2; + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_dfa); + __pyx_v_dfa = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_state = __pyx_t_6; + __Pyx_DECREF(__pyx_v_node); + __pyx_v_node = __pyx_t_5; + __pyx_t_5 = 0; + } else { + __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_EndUnpack(__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_dfa); + __pyx_v_dfa = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_state = __pyx_t_6; + __Pyx_DECREF(__pyx_v_node); + __pyx_v_node = __pyx_t_5; + __pyx_t_5 = 0; } - else { - __pyx_3 = PyObject_GetIter(__pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_4 = __Pyx_UnpackItem(__pyx_3, 0); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_dfa); - __pyx_v_dfa = __pyx_4; - __pyx_4 = 0; - __pyx_4 = __Pyx_UnpackItem(__pyx_3, 1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __pyx_PyInt_int(__pyx_4); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_v_state = __pyx_5; - __pyx_4 = __Pyx_UnpackItem(__pyx_3, 2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_node); - __pyx_v_node = __pyx_4; - __pyx_4 = 0; - if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - } - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":66 + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":74 * while True: * dfa, state, node = self.stack[-1] * states, first = dfa # <<<<<<<<<<<<<< * arcs = states[state] * # Look for a state with this label */ - if (PyTuple_CheckExact(__pyx_v_dfa) && PyTuple_GET_SIZE(__pyx_v_dfa) == 2) { + if (PyTuple_CheckExact(__pyx_v_dfa) && likely(PyTuple_GET_SIZE(__pyx_v_dfa) == 2)) { PyObject* tuple = __pyx_v_dfa; - __pyx_2 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_2); - Py_DECREF(__pyx_v_states); - __pyx_v_states = __pyx_2; - __pyx_2 = 0; - __pyx_3 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_3); - Py_DECREF(__pyx_v_first); - __pyx_v_first = __pyx_3; - __pyx_3 = 0; + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_states); + __pyx_v_states = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_first); + __pyx_v_first = __pyx_t_5; + __pyx_t_5 = 0; + } else { + __pyx_t_4 = PyObject_GetIter(__pyx_v_dfa); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_EndUnpack(__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_states); + __pyx_v_states = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_first); + __pyx_v_first = __pyx_t_5; + __pyx_t_5 = 0; } - else { - __pyx_4 = PyObject_GetIter(__pyx_v_dfa); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_states); - __pyx_v_states = __pyx_2; - __pyx_2 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_first); - __pyx_v_first = __pyx_3; - __pyx_3 = 0; - if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - } - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":67 + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":75 * dfa, state, node = self.stack[-1] * states, first = dfa * arcs = states[state] # <<<<<<<<<<<<<< * # Look for a state with this label * for i, newstate in arcs: */ - __pyx_2 = __Pyx_GetItemInt(__pyx_v_states, __pyx_v_state, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_arcs); - __pyx_v_arcs = __pyx_2; - __pyx_2 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_states, __pyx_v_state, sizeof(int), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_arcs); + __pyx_v_arcs = __pyx_t_5; + __pyx_t_5 = 0; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":69 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":77 * arcs = states[state] * # Look for a state with this label * for i, newstate in arcs: # <<<<<<<<<<<<<< @@ -915,112 +1599,119 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken(PyObjec * if ilabel == i: */ if (PyList_CheckExact(__pyx_v_arcs) || PyTuple_CheckExact(__pyx_v_arcs)) { - __pyx_6 = 0; __pyx_3 = __pyx_v_arcs; Py_INCREF(__pyx_3); + __pyx_t_8 = 0; __pyx_t_5 = __pyx_v_arcs; __Pyx_INCREF(__pyx_t_5); } else { - __pyx_6 = -1; __pyx_3 = PyObject_GetIter(__pyx_v_arcs); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_arcs); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); } for (;;) { - if (likely(PyList_CheckExact(__pyx_3))) { - if (__pyx_6 >= PyList_GET_SIZE(__pyx_3)) break; - __pyx_4 = PyList_GET_ITEM(__pyx_3, __pyx_6); Py_INCREF(__pyx_4); __pyx_6++; - } else if (likely(PyTuple_CheckExact(__pyx_3))) { - if (__pyx_6 >= PyTuple_GET_SIZE(__pyx_3)) break; - __pyx_4 = PyTuple_GET_ITEM(__pyx_3, __pyx_6); Py_INCREF(__pyx_4); __pyx_6++; + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; + } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; } else { - __pyx_4 = PyIter_Next(__pyx_3); - if (!__pyx_4) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyIter_Next(__pyx_t_5); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } + __Pyx_GOTREF(__pyx_t_2); } - if (PyTuple_CheckExact(__pyx_4) && PyTuple_GET_SIZE(__pyx_4) == 2) { - PyObject* tuple = __pyx_4; - __pyx_7 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_7); - __pyx_5 = __pyx_PyInt_int(__pyx_7); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - __pyx_v_i = __pyx_5; - __pyx_7 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_7); - __pyx_5 = __pyx_PyInt_int(__pyx_7); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - __pyx_v_newstate = __pyx_5; - Py_DECREF(__pyx_4); __pyx_4 = 0; - } - else { - __pyx_2 = PyObject_GetIter(__pyx_4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_7 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __pyx_PyInt_int(__pyx_7); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - __pyx_v_i = __pyx_5; - __pyx_7 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __pyx_PyInt_int(__pyx_7); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - __pyx_v_newstate = __pyx_5; - if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_i = __pyx_t_6; + __pyx_v_newstate = __pyx_t_9; + } else { + __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_EndUnpack(__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_i = __pyx_t_9; + __pyx_v_newstate = __pyx_t_6; } - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":70 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":78 * # Look for a state with this label * for i, newstate in arcs: * t, v = self._grammar_labels[i] # <<<<<<<<<<<<<< * if ilabel == i: * # Look it up in the list of labels */ - __pyx_7 = __Pyx_GetItemInt(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_labels, __pyx_v_i, 0); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyTuple_CheckExact(__pyx_7) && PyTuple_GET_SIZE(__pyx_7) == 2) { - PyObject* tuple = __pyx_7; - __pyx_2 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_2); - __pyx_5 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_v_t = __pyx_5; - __pyx_2 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_2); - Py_DECREF(__pyx_v_v); - __pyx_v_v = __pyx_2; - __pyx_2 = 0; - Py_DECREF(__pyx_7); __pyx_7 = 0; - } - else { - __pyx_4 = PyObject_GetIter(__pyx_7); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_v_t = __pyx_5; - __pyx_2 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_v); - __pyx_v_v = __pyx_2; - __pyx_2 = 0; - if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_labels), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_t = __pyx_t_6; + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_EndUnpack(__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_t = __pyx_t_6; + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_4; + __pyx_t_4 = 0; } - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":71 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":79 * for i, newstate in arcs: * t, v = self._grammar_labels[i] * if ilabel == i: # <<<<<<<<<<<<<< * # Look it up in the list of labels * ## assert t < 256 */ - __pyx_1 = (__pyx_v_ilabel == __pyx_v_i); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_ilabel == __pyx_v_i); + if (__pyx_t_1) { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":75 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":83 * ## assert t < 256 * # Shift a token; we're done with it * self.shift(type, value, newstate, context) # <<<<<<<<<<<<<< * # Pop while we are in an accept-only state * state = newstate */ - __pyx_2 = PyInt_FromLong(__pyx_v_newstate); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->__pyx_vtab)->shift(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_2, __pyx_v_context); - Py_DECREF(__pyx_2); __pyx_2 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":77 + __pyx_t_2 = PyInt_FromLong(__pyx_v_type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyInt_FromLong(__pyx_v_newstate); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + ((struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->__pyx_vtab)->shift(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self), __pyx_t_2, __pyx_v_value, __pyx_t_4, __pyx_v_context); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":85 * self.shift(type, value, newstate, context) * # Pop while we are in an accept-only state * state = newstate # <<<<<<<<<<<<<< @@ -1029,7 +1720,7 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken(PyObjec */ __pyx_v_state = __pyx_v_newstate; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":78 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":86 * # Pop while we are in an accept-only state * state = newstate * while states[state] == [(0, state)]: # <<<<<<<<<<<<<< @@ -1037,24 +1728,32 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken(PyObjec * if not self.stack: */ while (1) { - __pyx_7 = __Pyx_GetItemInt(__pyx_v_states, __pyx_v_state, 0); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyInt_FromLong(__pyx_v_state); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_int_0); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); - __pyx_4 = 0; - __pyx_4 = PyList_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyList_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_2)); - __pyx_2 = 0; - __pyx_2 = PyObject_RichCompare(__pyx_7, ((PyObject *)__pyx_4), Py_EQ); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (!__pyx_1) break; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":79 + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_states, __pyx_v_state, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyInt_FromLong(__pyx_v_state); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_t_2), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_1) break; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":87 * state = newstate * while states[state] == [(0, state)]: * self.pop() # <<<<<<<<<<<<<< @@ -1063,245 +1762,258 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken(PyObjec */ ((struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->__pyx_vtab)->pop(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)); - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":80 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":88 * while states[state] == [(0, state)]: * self.pop() * if not self.stack: # <<<<<<<<<<<<<< * # Done parsing! * return True */ - __pyx_1 = __Pyx_PyObject_IsTrue(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_8 = (!__pyx_1); - if (__pyx_8) { + __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = (!__pyx_t_1); + if (__pyx_t_10) { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":82 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":90 * if not self.stack: * # Done parsing! * return True # <<<<<<<<<<<<<< * dfa, state, node = self.stack[-1] * states, first = dfa */ - __pyx_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_7; - __pyx_7 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0; - goto __pyx_L12; + goto __pyx_L13; } - __pyx_L12:; + __pyx_L13:; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":83 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":91 * # Done parsing! * return True * dfa, state, node = self.stack[-1] # <<<<<<<<<<<<<< * states, first = dfa * # Done with this token */ - __pyx_4 = __Pyx_GetItemInt(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack, -1, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyTuple_CheckExact(__pyx_4) && PyTuple_GET_SIZE(__pyx_4) == 3) { - PyObject* tuple = __pyx_4; - __pyx_7 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_7); - Py_DECREF(__pyx_v_dfa); - __pyx_v_dfa = __pyx_7; - __pyx_7 = 0; - __pyx_7 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_7); - __pyx_5 = __pyx_PyInt_int(__pyx_7); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - __pyx_v_state = __pyx_5; - __pyx_7 = PyTuple_GET_ITEM(tuple, 2); - Py_INCREF(__pyx_7); - Py_DECREF(__pyx_v_node); - __pyx_v_node = __pyx_7; - __pyx_7 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - } - else { - __pyx_2 = PyObject_GetIter(__pyx_4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_7 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_dfa); - __pyx_v_dfa = __pyx_7; - __pyx_7 = 0; - __pyx_7 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __pyx_PyInt_int(__pyx_7); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - __pyx_v_state = __pyx_5; - __pyx_7 = __Pyx_UnpackItem(__pyx_2, 2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_node); - __pyx_v_node = __pyx_7; - __pyx_7 = 0; - if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 3)) { + PyObject* tuple = __pyx_t_3; + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_dfa); + __pyx_v_dfa = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_v_state = __pyx_t_6; + __Pyx_DECREF(__pyx_v_node); + __pyx_v_node = __pyx_t_7; + __pyx_t_7 = 0; + } else { + __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_11, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_11, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_11, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_EndUnpack(__pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_v_dfa); + __pyx_v_dfa = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_v_state = __pyx_t_6; + __Pyx_DECREF(__pyx_v_node); + __pyx_v_node = __pyx_t_7; + __pyx_t_7 = 0; } - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":84 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":92 * return True * dfa, state, node = self.stack[-1] * states, first = dfa # <<<<<<<<<<<<<< * # Done with this token * return False */ - if (PyTuple_CheckExact(__pyx_v_dfa) && PyTuple_GET_SIZE(__pyx_v_dfa) == 2) { + if (PyTuple_CheckExact(__pyx_v_dfa) && likely(PyTuple_GET_SIZE(__pyx_v_dfa) == 2)) { PyObject* tuple = __pyx_v_dfa; - __pyx_4 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_4); - Py_DECREF(__pyx_v_states); - __pyx_v_states = __pyx_4; - __pyx_4 = 0; - __pyx_2 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_2); - Py_DECREF(__pyx_v_first); - __pyx_v_first = __pyx_2; - __pyx_2 = 0; - } - else { - __pyx_7 = PyObject_GetIter(__pyx_v_dfa); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = __Pyx_UnpackItem(__pyx_7, 0); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_states); - __pyx_v_states = __pyx_4; - __pyx_4 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_7, 1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_first); - __pyx_v_first = __pyx_2; - __pyx_2 = 0; - if (__Pyx_EndUnpack(__pyx_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + __pyx_t_7 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_7); + __Pyx_DECREF(__pyx_v_states); + __pyx_v_states = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_first); + __pyx_v_first = __pyx_t_7; + __pyx_t_7 = 0; + } else { + __pyx_t_4 = PyObject_GetIter(__pyx_v_dfa); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_EndUnpack(__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_states); + __pyx_v_states = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_first); + __pyx_v_first = __pyx_t_7; + __pyx_t_7 = 0; } } - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":86 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":94 * states, first = dfa * # Done with this token * return False # <<<<<<<<<<<<<< * elif t >= 256: * # See if it's a symbol and if we're in its first set */ - __pyx_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_4; - __pyx_4 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0; - goto __pyx_L9; + goto __pyx_L10; } - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":87 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":95 * # Done with this token * return False * elif t >= 256: # <<<<<<<<<<<<<< * # See if it's a symbol and if we're in its first set * itsdfa = self._grammar_dfas[t] */ - __pyx_1 = (__pyx_v_t >= 256); - if (__pyx_1) { + __pyx_t_10 = (__pyx_v_t >= 256); + if (__pyx_t_10) { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":89 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":97 * elif t >= 256: * # See if it's a symbol and if we're in its first set * itsdfa = self._grammar_dfas[t] # <<<<<<<<<<<<<< * itsstates, itsfirst = itsdfa * if ilabel in itsfirst: */ - __pyx_2 = __Pyx_GetItemInt(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_dfas, __pyx_v_t, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_itsdfa); - __pyx_v_itsdfa = __pyx_2; - __pyx_2 = 0; + __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->_grammar_dfas), __pyx_v_t, sizeof(int), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_v_itsdfa); + __pyx_v_itsdfa = __pyx_t_7; + __pyx_t_7 = 0; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":90 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":98 * # See if it's a symbol and if we're in its first set * itsdfa = self._grammar_dfas[t] * itsstates, itsfirst = itsdfa # <<<<<<<<<<<<<< * if ilabel in itsfirst: * # Push a symbol */ - if (PyTuple_CheckExact(__pyx_v_itsdfa) && PyTuple_GET_SIZE(__pyx_v_itsdfa) == 2) { + if (PyTuple_CheckExact(__pyx_v_itsdfa) && likely(PyTuple_GET_SIZE(__pyx_v_itsdfa) == 2)) { PyObject* tuple = __pyx_v_itsdfa; - __pyx_4 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_4); - Py_DECREF(__pyx_v_itsstates); - __pyx_v_itsstates = __pyx_4; - __pyx_4 = 0; - __pyx_2 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_2); - Py_DECREF(__pyx_v_itsfirst); - __pyx_v_itsfirst = __pyx_2; - __pyx_2 = 0; - } - else { - __pyx_7 = PyObject_GetIter(__pyx_v_itsdfa); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = __Pyx_UnpackItem(__pyx_7, 0); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_itsstates); - __pyx_v_itsstates = __pyx_4; - __pyx_4 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_7, 1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_itsfirst); - __pyx_v_itsfirst = __pyx_2; - __pyx_2 = 0; - if (__Pyx_EndUnpack(__pyx_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; + __pyx_t_7 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_7); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_itsstates); + __pyx_v_itsstates = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_itsfirst); + __pyx_v_itsfirst = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_4 = PyObject_GetIter(__pyx_v_itsdfa); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_itsstates); + __pyx_v_itsstates = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_itsfirst); + __pyx_v_itsfirst = __pyx_t_3; + __pyx_t_3 = 0; } - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":91 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":99 * itsdfa = self._grammar_dfas[t] * itsstates, itsfirst = itsdfa * if ilabel in itsfirst: # <<<<<<<<<<<<<< * # Push a symbol * self.push(t, itsdfa, newstate, context) */ - __pyx_4 = PyInt_FromLong(__pyx_v_ilabel); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_8 = (PySequence_Contains(__pyx_v_itsfirst, __pyx_4)); if (unlikely(__pyx_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - if (__pyx_8) { + __pyx_t_3 = PyInt_FromLong(__pyx_v_ilabel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = ((PySequence_Contains(__pyx_v_itsfirst, __pyx_t_3))); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_10) { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":93 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":101 * if ilabel in itsfirst: * # Push a symbol * self.push(t, itsdfa, newstate, context) # <<<<<<<<<<<<<< * break # To continue the outer while loop * else: */ - __pyx_2 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_7 = PyInt_FromLong(__pyx_v_newstate); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->__pyx_vtab)->push(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self), __pyx_2, __pyx_v_itsdfa, __pyx_7, __pyx_v_context); - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_7); __pyx_7 = 0; + __pyx_t_3 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyInt_FromLong(__pyx_v_newstate); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + ((struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->__pyx_vtab)->push(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self), __pyx_t_3, __pyx_v_itsdfa, __pyx_t_7, __pyx_v_context); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":94 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":102 * # Push a symbol * self.push(t, itsdfa, newstate, context) * break # To continue the outer while loop # <<<<<<<<<<<<<< * else: * if (0, state) in arcs: */ - goto __pyx_L8; - goto __pyx_L13; + goto __pyx_L9_break; + goto __pyx_L14; } - __pyx_L13:; - goto __pyx_L9; + __pyx_L14:; + goto __pyx_L10; } - __pyx_L9:; + __pyx_L10:; } /*else*/ { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":96 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":104 * break # To continue the outer while loop * else: * if (0, state) in arcs: # <<<<<<<<<<<<<< * # An accepting state, pop it and try something else * self.pop() */ - __pyx_4 = PyInt_FromLong(__pyx_v_state); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_int_0); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); - __pyx_4 = 0; - __pyx_1 = (PySequence_Contains(__pyx_v_arcs, ((PyObject *)__pyx_2))); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - if (__pyx_1) { - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":98 + __pyx_t_7 = PyInt_FromLong(__pyx_v_state); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_10 = ((PySequence_Contains(__pyx_v_arcs, __pyx_t_3))); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_10) { + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":106 * if (0, state) in arcs: * # An accepting state, pop it and try something else * self.pop() # <<<<<<<<<<<<<< @@ -1310,190 +2022,197 @@ static PyObject *__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken(PyObjec */ ((struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->__pyx_vtab)->pop(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)); - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":99 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":107 * # An accepting state, pop it and try something else * self.pop() * if not self.stack: # <<<<<<<<<<<<<< * # Done parsing, but another token is input * raise ParseError("too much input", */ - __pyx_8 = __Pyx_PyObject_IsTrue(((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack); if (unlikely(__pyx_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = (!__pyx_8); - if (__pyx_1) { + __pyx_t_10 = __Pyx_PyObject_IsTrue(((PyObject *)((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self)->stack)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (!__pyx_t_10); + if (__pyx_t_1) { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":101 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":109 * if not self.stack: * # Done parsing, but another token is input * raise ParseError("too much input", # <<<<<<<<<<<<<< * type, value, context) * else: */ - __pyx_7 = __Pyx_GetName(__pyx_m, __pyx_kp_ParseError); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":102 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":110 * # Done parsing, but another token is input * raise ParseError("too much input", * type, value, context) # <<<<<<<<<<<<<< * else: * # No success finding a transition */ - __pyx_4 = PyTuple_New(4); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_5); - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_kp_5); - Py_INCREF(__pyx_v_type); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_v_type); - Py_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_4, 2, __pyx_v_value); - Py_INCREF(__pyx_v_context); - PyTuple_SET_ITEM(__pyx_4, 3, __pyx_v_context); - __pyx_2 = PyObject_Call(__pyx_7, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __Pyx_Raise(__pyx_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L15; + __pyx_t_7 = PyInt_FromLong(__pyx_v_type); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_context); + PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_context); + __Pyx_GIVEREF(__pyx_v_context); + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L16; } - __pyx_L15:; - goto __pyx_L14; + __pyx_L16:; + goto __pyx_L15; } /*else*/ { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":105 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":113 * else: * # No success finding a transition * raise ParseError("bad input", type, value, context) # <<<<<<<<<<<<<< * - * cdef int classify(self, type, value, context): - */ - __pyx_7 = __Pyx_GetName(__pyx_m, __pyx_kp_ParseError); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyTuple_New(4); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_6); - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_kp_6); - Py_INCREF(__pyx_v_type); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_v_type); - Py_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_4, 2, __pyx_v_value); - Py_INCREF(__pyx_v_context); - PyTuple_SET_ITEM(__pyx_4, 3, __pyx_v_context); - __pyx_2 = PyObject_Call(__pyx_7, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __Pyx_Raise(__pyx_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + * cdef int classify(self, int type, value, context): + */ + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PyInt_FromLong(__pyx_v_type); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_context); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_context); + __Pyx_GIVEREF(__pyx_v_context); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L14:; + __pyx_L15:; } - __pyx_L8:; - Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_L9_break:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); - Py_XDECREF(__pyx_7); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("sphinx.pycode.pgen2.parse.Parser.addtoken"); __pyx_r = NULL; __pyx_L0:; - Py_DECREF(__pyx_v_dfa); - Py_DECREF(__pyx_v_node); - Py_DECREF(__pyx_v_states); - Py_DECREF(__pyx_v_first); - Py_DECREF(__pyx_v_arcs); - Py_DECREF(__pyx_v_v); - Py_DECREF(__pyx_v_itsdfa); - Py_DECREF(__pyx_v_itsstates); - Py_DECREF(__pyx_v_itsfirst); + __Pyx_DECREF(__pyx_v_dfa); + __Pyx_DECREF(__pyx_v_node); + __Pyx_DECREF(__pyx_v_states); + __Pyx_DECREF(__pyx_v_first); + __Pyx_DECREF(__pyx_v_arcs); + __Pyx_DECREF(__pyx_v_v); + __Pyx_DECREF(__pyx_v_itsdfa); + __Pyx_DECREF(__pyx_v_itsstates); + __Pyx_DECREF(__pyx_v_itsfirst); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF(__pyx_v_context); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":107 +/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":115 * raise ParseError("bad input", type, value, context) * - * cdef int classify(self, type, value, context): # <<<<<<<<<<<<<< + * cdef int classify(self, int type, value, context): # <<<<<<<<<<<<<< * """Turn a token into a label. (Internal)""" * if type == NAME: */ -static int __pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_classify(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *__pyx_v_self, PyObject *__pyx_v_type, PyObject *__pyx_v_value, PyObject *__pyx_v_context) { - PyObject *__pyx_v_ilabel; +static int __pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_classify(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *__pyx_v_self, int __pyx_v_type, PyObject *__pyx_v_value, PyObject *__pyx_v_context) { int __pyx_r; - PyObject *__pyx_1 = 0; - int __pyx_2; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - int __pyx_5; - __pyx_v_ilabel = Py_None; Py_INCREF(Py_None); - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":109 - * cdef int classify(self, type, value, context): + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("classify"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_context); + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":117 + * cdef int classify(self, int type, value, context): * """Turn a token into a label. (Internal)""" * if type == NAME: # <<<<<<<<<<<<<< * # Keep a listing of all used names * self.used_names.add(value) */ - __pyx_1 = PyObject_RichCompare(__pyx_v_type, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - if (__pyx_2) { + __pyx_t_1 = (__pyx_v_type == 1); + if (__pyx_t_1) { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":111 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":119 * if type == NAME: * # Keep a listing of all used names * self.used_names.add(value) # <<<<<<<<<<<<<< * # Check for reserved words - * ilabel = self._grammar_keywords.get(value) - */ - __pyx_1 = PyObject_GetAttr(__pyx_v_self->used_names, __pyx_kp_add); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_value); - __pyx_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":113 + * if value in self._grammar_keywords: + */ + __pyx_t_2 = PySet_Add(((PyObject *)__pyx_v_self->used_names), __pyx_v_value); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":121 * self.used_names.add(value) * # Check for reserved words - * ilabel = self._grammar_keywords.get(value) # <<<<<<<<<<<<<< - * if ilabel is not None: - * return ilabel - */ - __pyx_1 = PyObject_GetAttr(__pyx_v_self->_grammar_keywords, __pyx_kp_get); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_value); - __pyx_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(__pyx_v_ilabel); - __pyx_v_ilabel = __pyx_4; - __pyx_4 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":114 + * if value in self._grammar_keywords: # <<<<<<<<<<<<<< + * return self._grammar_keywords[value] + * if type not in self._grammar_tokens: + */ + if (unlikely(((PyObject *)__pyx_v_self->_grammar_keywords) == Py_None)) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else { + __pyx_t_1 = ((PyDict_Contains(((PyObject *)__pyx_v_self->_grammar_keywords), __pyx_v_value))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (__pyx_t_1) { + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":122 * # Check for reserved words - * ilabel = self._grammar_keywords.get(value) - * if ilabel is not None: # <<<<<<<<<<<<<< - * return ilabel - * ilabel = self._grammar_tokens.get(type) - */ - __pyx_2 = (__pyx_v_ilabel != Py_None); - if (__pyx_2) { - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":115 - * ilabel = self._grammar_keywords.get(value) - * if ilabel is not None: - * return ilabel # <<<<<<<<<<<<<< - * ilabel = self._grammar_tokens.get(type) - * if ilabel is None: - */ - __pyx_5 = __pyx_PyInt_int(__pyx_v_ilabel); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_5; + * if value in self._grammar_keywords: + * return self._grammar_keywords[value] # <<<<<<<<<<<<<< + * if type not in self._grammar_tokens: + * raise ParseError("bad token", type, value, context) + */ + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self->_grammar_keywords), __pyx_v_value); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; goto __pyx_L0; goto __pyx_L4; } @@ -1502,241 +2221,277 @@ static int __pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_classify(struct __pyx_ } __pyx_L3:; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":116 - * if ilabel is not None: - * return ilabel - * ilabel = self._grammar_tokens.get(type) # <<<<<<<<<<<<<< - * if ilabel is None: - * raise ParseError("bad token", type, value, context) - */ - __pyx_1 = PyObject_GetAttr(__pyx_v_self->_grammar_tokens, __pyx_kp_get); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_type); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_type); - __pyx_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(__pyx_v_ilabel); - __pyx_v_ilabel = __pyx_4; - __pyx_4 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":117 - * return ilabel - * ilabel = self._grammar_tokens.get(type) - * if ilabel is None: # <<<<<<<<<<<<<< + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":123 + * if value in self._grammar_keywords: + * return self._grammar_keywords[value] + * if type not in self._grammar_tokens: # <<<<<<<<<<<<<< * raise ParseError("bad token", type, value, context) - * return ilabel + * return self._grammar_tokens[type] */ - __pyx_2 = (__pyx_v_ilabel == Py_None); - if (__pyx_2) { + __pyx_t_3 = PyInt_FromLong(__pyx_v_type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(((PyObject *)__pyx_v_self->_grammar_tokens) == Py_None)) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else { + __pyx_t_1 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_self->_grammar_tokens), __pyx_t_3))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":118 - * ilabel = self._grammar_tokens.get(type) - * if ilabel is None: + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":124 + * return self._grammar_keywords[value] + * if type not in self._grammar_tokens: * raise ParseError("bad token", type, value, context) # <<<<<<<<<<<<<< - * return ilabel + * return self._grammar_tokens[type] * */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_ParseError); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_7); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_kp_7); - Py_INCREF(__pyx_v_type); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_type); - Py_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_value); - Py_INCREF(__pyx_v_context); - PyTuple_SET_ITEM(__pyx_3, 3, __pyx_v_context); - __pyx_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __Pyx_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ParseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong(__pyx_v_type); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5)); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_context); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_context); + __Pyx_GIVEREF(__pyx_v_context); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":119 - * if ilabel is None: + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":125 + * if type not in self._grammar_tokens: * raise ParseError("bad token", type, value, context) - * return ilabel # <<<<<<<<<<<<<< + * return self._grammar_tokens[type] # <<<<<<<<<<<<<< * * cdef void shift(self, type, value, newstate, context): */ - __pyx_5 = __pyx_PyInt_int(__pyx_v_ilabel); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_5; + __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_grammar_tokens), __pyx_v_type, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_2; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("sphinx.pycode.pgen2.parse.Parser.classify"); __pyx_r = 0; __pyx_L0:; - Py_DECREF(__pyx_v_ilabel); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF(__pyx_v_context); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":121 - * return ilabel +/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":127 + * return self._grammar_tokens[type] * * cdef void shift(self, type, value, newstate, context): # <<<<<<<<<<<<<< * """Shift a token. (Internal)""" - * dfa, state, node = self.stack[-1] + * cdef tuple node */ static void __pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_shift(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *__pyx_v_self, PyObject *__pyx_v_type, PyObject *__pyx_v_value, PyObject *__pyx_v_newstate, PyObject *__pyx_v_context) { + PyObject *__pyx_v_node; PyObject *__pyx_v_dfa; PyObject *__pyx_v_state; - PyObject *__pyx_v_node; PyObject *__pyx_v_newnode; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - int __pyx_4; - __pyx_v_dfa = Py_None; Py_INCREF(Py_None); - __pyx_v_state = Py_None; Py_INCREF(Py_None); - __pyx_v_node = Py_None; Py_INCREF(Py_None); - __pyx_v_newnode = Py_None; Py_INCREF(Py_None); - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":123 - * cdef void shift(self, type, value, newstate, context): + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_RefNannySetupContext("shift"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_type); + __Pyx_INCREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_newstate); + __Pyx_INCREF(__pyx_v_context); + __pyx_v_node = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_dfa = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_state = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_newnode = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":130 * """Shift a token. (Internal)""" + * cdef tuple node * dfa, state, node = self.stack[-1] # <<<<<<<<<<<<<< * newnode = (type, value, context, None) * newnode = self.convert(newnode) */ - __pyx_1 = __Pyx_GetItemInt(__pyx_v_self->stack, -1, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyTuple_CheckExact(__pyx_1) && PyTuple_GET_SIZE(__pyx_1) == 3) { - PyObject* tuple = __pyx_1; - __pyx_3 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_3); - Py_DECREF(__pyx_v_dfa); - __pyx_v_dfa = __pyx_3; - __pyx_3 = 0; - __pyx_3 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_3); - Py_DECREF(__pyx_v_state); - __pyx_v_state = __pyx_3; - __pyx_3 = 0; - __pyx_3 = PyTuple_GET_ITEM(tuple, 2); - Py_INCREF(__pyx_3); - Py_DECREF(__pyx_v_node); - __pyx_v_node = __pyx_3; - __pyx_3 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - } - else { - __pyx_2 = PyObject_GetIter(__pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_dfa); - __pyx_v_dfa = __pyx_3; - __pyx_3 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_state); - __pyx_v_state = __pyx_3; - __pyx_3 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_2, 2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_node); - __pyx_v_node = __pyx_3; - __pyx_3 = 0; - if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_self->stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 3)) { + PyObject* tuple = __pyx_t_1; + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_4); + if (!(likely(PyTuple_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_dfa); + __pyx_v_dfa = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_state); + __pyx_v_state = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_node)); + __pyx_v_node = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + } else { + __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(likely(PyTuple_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_EndUnpack(__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_dfa); + __pyx_v_dfa = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_state); + __pyx_v_state = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_node)); + __pyx_v_node = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; } - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":124 - * """Shift a token. (Internal)""" + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":131 + * cdef tuple node * dfa, state, node = self.stack[-1] * newnode = (type, value, context, None) # <<<<<<<<<<<<<< * newnode = self.convert(newnode) * if newnode is not None: */ - __pyx_3 = PyTuple_New(4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_type); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_type); - Py_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_value); - Py_INCREF(__pyx_v_context); - PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_context); - Py_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_3, 3, Py_None); - Py_DECREF(__pyx_v_newnode); - __pyx_v_newnode = ((PyObject *)__pyx_3); - __pyx_3 = 0; + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_type); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_type); + __Pyx_GIVEREF(__pyx_v_type); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_context); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_context); + __Pyx_GIVEREF(__pyx_v_context); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_1, 3, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_DECREF(__pyx_v_newnode); + __pyx_v_newnode = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":125 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":132 * dfa, state, node = self.stack[-1] * newnode = (type, value, context, None) * newnode = self.convert(newnode) # <<<<<<<<<<<<<< * if newnode is not None: * node[-1].append(newnode) */ - __pyx_1 = ((struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self->__pyx_vtab)->convert(__pyx_v_self, __pyx_v_newnode); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_newnode); - __pyx_v_newnode = __pyx_1; - __pyx_1 = 0; + if (!(likely(PyTuple_CheckExact(__pyx_v_newnode))||((__pyx_v_newnode) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_newnode)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self->__pyx_vtab)->convert(__pyx_v_self, ((PyObject *)__pyx_v_newnode)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_newnode); + __pyx_v_newnode = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":126 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":133 * newnode = (type, value, context, None) * newnode = self.convert(newnode) * if newnode is not None: # <<<<<<<<<<<<<< * node[-1].append(newnode) * self.stack[-1] = (dfa, newstate, node) */ - __pyx_4 = (__pyx_v_newnode != Py_None); - if (__pyx_4) { + __pyx_t_6 = (__pyx_v_newnode != Py_None); + if (__pyx_t_6) { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":127 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":134 * newnode = self.convert(newnode) * if newnode is not None: * node[-1].append(newnode) # <<<<<<<<<<<<<< * self.stack[-1] = (dfa, newstate, node) * */ - __pyx_2 = __Pyx_GetItemInt(__pyx_v_node, -1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = __Pyx_PyObject_Append(__pyx_2, __pyx_v_newnode); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_node), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_newnode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L3; } __pyx_L3:; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":128 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":135 * if newnode is not None: * node[-1].append(newnode) * self.stack[-1] = (dfa, newstate, node) # <<<<<<<<<<<<<< * * cdef void push(self, type, newdfa, newstate, context): */ - __pyx_1 = PyTuple_New(3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_dfa); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_dfa); - Py_INCREF(__pyx_v_newstate); - PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_newstate); - Py_INCREF(__pyx_v_node); - PyTuple_SET_ITEM(__pyx_1, 2, __pyx_v_node); - if (__Pyx_SetItemInt(__pyx_v_self->stack, -1, ((PyObject *)__pyx_1), 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_dfa); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dfa); + __Pyx_GIVEREF(__pyx_v_dfa); + __Pyx_INCREF(__pyx_v_newstate); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_newstate); + __Pyx_GIVEREF(__pyx_v_newstate); + __Pyx_INCREF(((PyObject *)__pyx_v_node)); + PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_node)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_node)); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->stack), -1, __pyx_t_4, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("sphinx.pycode.pgen2.parse.Parser.shift"); __pyx_L0:; - Py_DECREF(__pyx_v_dfa); - Py_DECREF(__pyx_v_state); - Py_DECREF(__pyx_v_node); - Py_DECREF(__pyx_v_newnode); + __Pyx_DECREF(__pyx_v_node); + __Pyx_DECREF(__pyx_v_dfa); + __Pyx_DECREF(__pyx_v_state); + __Pyx_DECREF(__pyx_v_newnode); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_type); + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF(__pyx_v_newstate); + __Pyx_DECREF(__pyx_v_context); + __Pyx_RefNannyFinishContext(); } -/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":130 +/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":137 * self.stack[-1] = (dfa, newstate, node) * * cdef void push(self, type, newdfa, newstate, context): # <<<<<<<<<<<<<< @@ -1749,130 +2504,154 @@ static void __pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_push(struct __pyx_obj PyObject *__pyx_v_state; PyObject *__pyx_v_node; PyObject *__pyx_v_newnode; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - __pyx_v_dfa = Py_None; Py_INCREF(Py_None); - __pyx_v_state = Py_None; Py_INCREF(Py_None); - __pyx_v_node = Py_None; Py_INCREF(Py_None); - __pyx_v_newnode = Py_None; Py_INCREF(Py_None); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_RefNannySetupContext("push"); + __pyx_v_dfa = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_state = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_node = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_newnode = Py_None; __Pyx_INCREF(Py_None); - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":132 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":139 * cdef void push(self, type, newdfa, newstate, context): * """Push a nonterminal. (Internal)""" * dfa, state, node = self.stack[-1] # <<<<<<<<<<<<<< * newnode = (type, None, context, []) * self.stack[-1] = (dfa, newstate, node) */ - __pyx_1 = __Pyx_GetItemInt(__pyx_v_self->stack, -1, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyTuple_CheckExact(__pyx_1) && PyTuple_GET_SIZE(__pyx_1) == 3) { - PyObject* tuple = __pyx_1; - __pyx_3 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_3); - Py_DECREF(__pyx_v_dfa); - __pyx_v_dfa = __pyx_3; - __pyx_3 = 0; - __pyx_3 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_3); - Py_DECREF(__pyx_v_state); - __pyx_v_state = __pyx_3; - __pyx_3 = 0; - __pyx_3 = PyTuple_GET_ITEM(tuple, 2); - Py_INCREF(__pyx_3); - Py_DECREF(__pyx_v_node); - __pyx_v_node = __pyx_3; - __pyx_3 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - } - else { - __pyx_2 = PyObject_GetIter(__pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_dfa); - __pyx_v_dfa = __pyx_3; - __pyx_3 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_state); - __pyx_v_state = __pyx_3; - __pyx_3 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_2, 2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_node); - __pyx_v_node = __pyx_3; - __pyx_3 = 0; - if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_self->stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 3)) { + PyObject* tuple = __pyx_t_1; + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_dfa); + __pyx_v_dfa = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_state); + __pyx_v_state = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_node); + __pyx_v_node = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_EndUnpack(__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_dfa); + __pyx_v_dfa = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_state); + __pyx_v_state = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_node); + __pyx_v_node = __pyx_t_4; + __pyx_t_4 = 0; } - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":133 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":140 * """Push a nonterminal. (Internal)""" * dfa, state, node = self.stack[-1] * newnode = (type, None, context, []) # <<<<<<<<<<<<<< * self.stack[-1] = (dfa, newstate, node) * self.stack.append((newdfa, 0, newnode)) */ - __pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyTuple_New(4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_type); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_type); - Py_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_1, 1, Py_None); - Py_INCREF(__pyx_v_context); - PyTuple_SET_ITEM(__pyx_1, 2, __pyx_v_context); - PyTuple_SET_ITEM(__pyx_1, 3, ((PyObject *)__pyx_3)); - __pyx_3 = 0; - Py_DECREF(__pyx_v_newnode); - __pyx_v_newnode = ((PyObject *)__pyx_1); - __pyx_1 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":134 + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_type); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_type); + __Pyx_GIVEREF(__pyx_v_type); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(__pyx_v_context); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_context); + __Pyx_GIVEREF(__pyx_v_context); + PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_newnode); + __pyx_v_newnode = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":141 * dfa, state, node = self.stack[-1] * newnode = (type, None, context, []) * self.stack[-1] = (dfa, newstate, node) # <<<<<<<<<<<<<< * self.stack.append((newdfa, 0, newnode)) * */ - __pyx_2 = PyTuple_New(3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_dfa); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_dfa); - Py_INCREF(__pyx_v_newstate); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_newstate); - Py_INCREF(__pyx_v_node); - PyTuple_SET_ITEM(__pyx_2, 2, __pyx_v_node); - if (__Pyx_SetItemInt(__pyx_v_self->stack, -1, ((PyObject *)__pyx_2), 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":135 + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_dfa); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dfa); + __Pyx_GIVEREF(__pyx_v_dfa); + __Pyx_INCREF(__pyx_v_newstate); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_newstate); + __Pyx_GIVEREF(__pyx_v_newstate); + __Pyx_INCREF(__pyx_v_node); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_node); + __Pyx_GIVEREF(__pyx_v_node); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->stack), -1, __pyx_t_4, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":142 * newnode = (type, None, context, []) * self.stack[-1] = (dfa, newstate, node) * self.stack.append((newdfa, 0, newnode)) # <<<<<<<<<<<<<< * * cdef void pop(self): */ - __pyx_3 = PyTuple_New(3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_newdfa); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_newdfa); - Py_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_int_0); - Py_INCREF(__pyx_v_newnode); - PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_newnode); - __pyx_1 = __Pyx_PyObject_Append(__pyx_v_self->stack, ((PyObject *)__pyx_3)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; + if (unlikely(__pyx_v_self->stack == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_newdfa); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_newdfa); + __Pyx_GIVEREF(__pyx_v_newdfa); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_v_newnode); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_newnode); + __Pyx_GIVEREF(__pyx_v_newnode); + __pyx_t_6 = PyList_Append(((PyObject *)__pyx_v_self->stack), __pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("sphinx.pycode.pgen2.parse.Parser.push"); __pyx_L0:; - Py_DECREF(__pyx_v_dfa); - Py_DECREF(__pyx_v_state); - Py_DECREF(__pyx_v_node); - Py_DECREF(__pyx_v_newnode); + __Pyx_DECREF(__pyx_v_dfa); + __Pyx_DECREF(__pyx_v_state); + __Pyx_DECREF(__pyx_v_node); + __Pyx_DECREF(__pyx_v_newnode); + __Pyx_RefNannyFinishContext(); } -/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":137 +/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":144 * self.stack.append((newdfa, 0, newnode)) * * cdef void pop(self): # <<<<<<<<<<<<<< @@ -1888,178 +2667,191 @@ static void __pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_pop(struct __pyx_obj_ PyObject *__pyx_v_dfa; PyObject *__pyx_v_state; PyObject *__pyx_v_node; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - int __pyx_4; - __pyx_v_popdfa = Py_None; Py_INCREF(Py_None); - __pyx_v_popstate = Py_None; Py_INCREF(Py_None); - __pyx_v_popnode = Py_None; Py_INCREF(Py_None); - __pyx_v_newnode = Py_None; Py_INCREF(Py_None); - __pyx_v_dfa = Py_None; Py_INCREF(Py_None); - __pyx_v_state = Py_None; Py_INCREF(Py_None); - __pyx_v_node = Py_None; Py_INCREF(Py_None); - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":139 + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_RefNannySetupContext("pop"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_v_popdfa = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_popstate = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_popnode = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_newnode = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_dfa = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_state = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_node = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":146 * cdef void pop(self): * """Pop a nonterminal. (Internal)""" * popdfa, popstate, popnode = self.stack.pop() # <<<<<<<<<<<<<< * newnode = self.convert(popnode) * if newnode is not None: */ - __pyx_1 = PyObject_GetAttr(__pyx_v_self->stack, __pyx_kp_pop); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - if (PyTuple_CheckExact(__pyx_2) && PyTuple_GET_SIZE(__pyx_2) == 3) { - PyObject* tuple = __pyx_2; - __pyx_3 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_3); - Py_DECREF(__pyx_v_popdfa); - __pyx_v_popdfa = __pyx_3; - __pyx_3 = 0; - __pyx_3 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_3); - Py_DECREF(__pyx_v_popstate); - __pyx_v_popstate = __pyx_3; - __pyx_3 = 0; - __pyx_3 = PyTuple_GET_ITEM(tuple, 2); - Py_INCREF(__pyx_3); - Py_DECREF(__pyx_v_popnode); - __pyx_v_popnode = __pyx_3; - __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - } - else { - __pyx_1 = PyObject_GetIter(__pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_popdfa); - __pyx_v_popdfa = __pyx_3; - __pyx_3 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_popstate); - __pyx_v_popstate = __pyx_3; - __pyx_3 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_1, 2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_popnode); - __pyx_v_popnode = __pyx_3; - __pyx_3 = 0; - if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->stack), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 3)) { + PyObject* tuple = __pyx_t_2; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_popdfa); + __pyx_v_popdfa = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_popstate); + __pyx_v_popstate = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_popnode); + __pyx_v_popnode = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_EndUnpack(__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_popdfa); + __pyx_v_popdfa = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_popstate); + __pyx_v_popstate = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_popnode); + __pyx_v_popnode = __pyx_t_4; + __pyx_t_4 = 0; } - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":140 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":147 * """Pop a nonterminal. (Internal)""" * popdfa, popstate, popnode = self.stack.pop() * newnode = self.convert(popnode) # <<<<<<<<<<<<<< * if newnode is not None: * if self.stack: */ - __pyx_3 = ((struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self->__pyx_vtab)->convert(__pyx_v_self, __pyx_v_popnode); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_newnode); - __pyx_v_newnode = __pyx_3; - __pyx_3 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":141 + if (!(likely(PyTuple_CheckExact(__pyx_v_popnode))||((__pyx_v_popnode) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_popnode)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser *)__pyx_v_self->__pyx_vtab)->convert(__pyx_v_self, ((PyObject *)__pyx_v_popnode)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_newnode); + __pyx_v_newnode = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":148 * popdfa, popstate, popnode = self.stack.pop() * newnode = self.convert(popnode) * if newnode is not None: # <<<<<<<<<<<<<< * if self.stack: * dfa, state, node = self.stack[-1] */ - __pyx_4 = (__pyx_v_newnode != Py_None); - if (__pyx_4) { + __pyx_t_6 = (__pyx_v_newnode != Py_None); + if (__pyx_t_6) { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":142 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":149 * newnode = self.convert(popnode) * if newnode is not None: * if self.stack: # <<<<<<<<<<<<<< * dfa, state, node = self.stack[-1] * node[-1].append(newnode) */ - __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_v_self->stack); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_4) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->stack)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_6) { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":143 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":150 * if newnode is not None: * if self.stack: * dfa, state, node = self.stack[-1] # <<<<<<<<<<<<<< * node[-1].append(newnode) * else: */ - __pyx_2 = __Pyx_GetItemInt(__pyx_v_self->stack, -1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyTuple_CheckExact(__pyx_2) && PyTuple_GET_SIZE(__pyx_2) == 3) { - PyObject* tuple = __pyx_2; - __pyx_3 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_3); - Py_DECREF(__pyx_v_dfa); - __pyx_v_dfa = __pyx_3; - __pyx_3 = 0; - __pyx_3 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_3); - Py_DECREF(__pyx_v_state); - __pyx_v_state = __pyx_3; - __pyx_3 = 0; - __pyx_3 = PyTuple_GET_ITEM(tuple, 2); - Py_INCREF(__pyx_3); - Py_DECREF(__pyx_v_node); - __pyx_v_node = __pyx_3; - __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - } - else { - __pyx_1 = PyObject_GetIter(__pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_dfa); - __pyx_v_dfa = __pyx_3; - __pyx_3 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_state); - __pyx_v_state = __pyx_3; - __pyx_3 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_1, 2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_node); - __pyx_v_node = __pyx_3; - __pyx_3 = 0; - if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_self->stack), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 3)) { + PyObject* tuple = __pyx_t_2; + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_dfa); + __pyx_v_dfa = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_state); + __pyx_v_state = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_node); + __pyx_v_node = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_5, 2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_EndUnpack(__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_dfa); + __pyx_v_dfa = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_state); + __pyx_v_state = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_node); + __pyx_v_node = __pyx_t_1; + __pyx_t_1 = 0; } - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":144 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":151 * if self.stack: * dfa, state, node = self.stack[-1] * node[-1].append(newnode) # <<<<<<<<<<<<<< * else: * self.rootnode = newnode */ - __pyx_3 = __Pyx_GetItemInt(__pyx_v_node, -1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_PyObject_Append(__pyx_3, __pyx_v_newnode); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_node, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Append(__pyx_t_2, __pyx_v_newnode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L4; } /*else*/ { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":146 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":153 * node[-1].append(newnode) * else: * self.rootnode = newnode # <<<<<<<<<<<<<< * self.rootnode.used_names = self.used_names * */ - Py_INCREF(__pyx_v_newnode); - Py_DECREF(__pyx_v_self->rootnode); + __Pyx_INCREF(__pyx_v_newnode); + __Pyx_GIVEREF(__pyx_v_newnode); + __Pyx_GOTREF(__pyx_v_self->rootnode); + __Pyx_DECREF(__pyx_v_self->rootnode); __pyx_v_self->rootnode = __pyx_v_newnode; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":147 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":154 * else: * self.rootnode = newnode * self.rootnode.used_names = self.used_names # <<<<<<<<<<<<<< * - * cdef convert(self, raw_node): + * cdef convert(self, tuple raw_node): */ - if (PyObject_SetAttr(__pyx_v_self->rootnode, __pyx_kp_used_names, __pyx_v_self->used_names) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_v_self->rootnode, __pyx_n_s__used_names, ((PyObject *)__pyx_v_self->used_names)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L4:; goto __pyx_L3; @@ -2068,24 +2860,28 @@ static void __pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_pop(struct __pyx_obj_ goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("sphinx.pycode.pgen2.parse.Parser.pop"); __pyx_L0:; - Py_DECREF(__pyx_v_popdfa); - Py_DECREF(__pyx_v_popstate); - Py_DECREF(__pyx_v_popnode); - Py_DECREF(__pyx_v_newnode); - Py_DECREF(__pyx_v_dfa); - Py_DECREF(__pyx_v_state); - Py_DECREF(__pyx_v_node); + __Pyx_DECREF(__pyx_v_popdfa); + __Pyx_DECREF(__pyx_v_popstate); + __Pyx_DECREF(__pyx_v_popnode); + __Pyx_DECREF(__pyx_v_newnode); + __Pyx_DECREF(__pyx_v_dfa); + __Pyx_DECREF(__pyx_v_state); + __Pyx_DECREF(__pyx_v_node); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); } -/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":149 +/* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":156 * self.rootnode.used_names = self.used_names * - * cdef convert(self, raw_node): # <<<<<<<<<<<<<< + * cdef convert(self, tuple raw_node): # <<<<<<<<<<<<<< * type, value, context, children = raw_node * if children or type in self._grammar_number2symbol: */ @@ -2095,178 +2891,182 @@ static PyObject *__pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_convert(struct _ PyObject *__pyx_v_value; PyObject *__pyx_v_context; PyObject *__pyx_v_children; - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - int __pyx_3; - Py_ssize_t __pyx_4 = 0; - PyObject *__pyx_5 = 0; - PyObject *__pyx_6 = 0; - __pyx_v_type = Py_None; Py_INCREF(Py_None); - __pyx_v_value = Py_None; Py_INCREF(Py_None); - __pyx_v_context = Py_None; Py_INCREF(Py_None); - __pyx_v_children = Py_None; Py_INCREF(Py_None); - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":150 + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + __Pyx_RefNannySetupContext("convert"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_raw_node); + __pyx_v_type = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_context = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_children = Py_None; __Pyx_INCREF(Py_None); + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":157 * - * cdef convert(self, raw_node): + * cdef convert(self, tuple raw_node): * type, value, context, children = raw_node # <<<<<<<<<<<<<< * if children or type in self._grammar_number2symbol: * # If there's exactly one child, return that child instead of */ - if (PyTuple_CheckExact(__pyx_v_raw_node) && PyTuple_GET_SIZE(__pyx_v_raw_node) == 4) { - PyObject* tuple = __pyx_v_raw_node; - __pyx_2 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_2); - Py_DECREF(__pyx_v_type); - __pyx_v_type = __pyx_2; - __pyx_2 = 0; - __pyx_2 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_2); - Py_DECREF(__pyx_v_value); - __pyx_v_value = __pyx_2; - __pyx_2 = 0; - __pyx_2 = PyTuple_GET_ITEM(tuple, 2); - Py_INCREF(__pyx_2); - Py_DECREF(__pyx_v_context); - __pyx_v_context = __pyx_2; - __pyx_2 = 0; - __pyx_2 = PyTuple_GET_ITEM(tuple, 3); - Py_INCREF(__pyx_2); - Py_DECREF(__pyx_v_children); - __pyx_v_children = __pyx_2; - __pyx_2 = 0; - } - else { - __pyx_1 = PyObject_GetIter(__pyx_v_raw_node); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_type); - __pyx_v_type = __pyx_2; - __pyx_2 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_value); - __pyx_v_value = __pyx_2; - __pyx_2 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_1, 2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_context); - __pyx_v_context = __pyx_2; - __pyx_2 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_1, 3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_children); - __pyx_v_children = __pyx_2; - __pyx_2 = 0; - if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + if (likely(((PyObject *)__pyx_v_raw_node) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_raw_node)) == 4)) { + PyObject* tuple = ((PyObject *)__pyx_v_raw_node); + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_type); + __pyx_v_type = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_context); + __pyx_v_context = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_children); + __pyx_v_children = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_raw_node), 4); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":151 - * cdef convert(self, raw_node): + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":158 + * cdef convert(self, tuple raw_node): * type, value, context, children = raw_node * if children or type in self._grammar_number2symbol: # <<<<<<<<<<<<<< * # If there's exactly one child, return that child instead of * # creating a new node. */ - __pyx_2 = __pyx_v_children; - Py_INCREF(__pyx_2); - __pyx_3 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_3) { - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = (PySequence_Contains(__pyx_v_self->_grammar_number2symbol, __pyx_v_type)); if (unlikely(__pyx_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_PyBool_FromLong(__pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_children); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_5) { + if (unlikely(((PyObject *)__pyx_v_self->_grammar_number2symbol) == Py_None)) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else { + __pyx_t_6 = ((PyDict_Contains(((PyObject *)__pyx_v_self->_grammar_number2symbol), __pyx_v_type))); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_7 = __pyx_t_6; + } else { + __pyx_t_7 = __pyx_t_5; } - __pyx_3 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (__pyx_3) { + if (__pyx_t_7) { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":154 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":161 * # If there's exactly one child, return that child instead of * # creating a new node. * if len(children) == 1: # <<<<<<<<<<<<<< * return children[0] * return Node(type, children, context=context) */ - __pyx_4 = PyObject_Length(__pyx_v_children); if (unlikely(__pyx_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = (__pyx_4 == 1); - if (__pyx_3) { + __pyx_t_8 = PyObject_Length(__pyx_v_children); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__pyx_t_8 == 1); + if (__pyx_t_7) { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":155 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":162 * # creating a new node. * if len(children) == 1: * return children[0] # <<<<<<<<<<<<<< * return Node(type, children, context=context) * else: */ - __pyx_1 = __Pyx_GetItemInt(__pyx_v_children, 0, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_1; - __pyx_1 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_children, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; goto __pyx_L4; } __pyx_L4:; - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":156 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":163 * if len(children) == 1: * return children[0] * return Node(type, children, context=context) # <<<<<<<<<<<<<< * else: * return Leaf(type, value, context=context) */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_Node); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyTuple_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_type); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_type); - Py_INCREF(__pyx_v_children); - PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_children); - __pyx_5 = PyDict_New(); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_5, __pyx_kp_context, __pyx_v_context) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_1), ((PyObject *)__pyx_5)); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - __pyx_r = __pyx_6; - __pyx_6 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_type); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_type); + __Pyx_GIVEREF(__pyx_v_type); + __Pyx_INCREF(__pyx_v_children); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_children); + __Pyx_GIVEREF(__pyx_v_children); + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__context), __pyx_v_context) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_4, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; goto __pyx_L3; } /*else*/ { - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":158 + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":165 * return Node(type, children, context=context) * else: * return Leaf(type, value, context=context) # <<<<<<<<<<<<<< */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_Leaf); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyTuple_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_type); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_type); - Py_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_value); - __pyx_5 = PyDict_New(); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_5, __pyx_kp_context, __pyx_v_context) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_1), ((PyObject *)__pyx_5)); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - __pyx_r = __pyx_6; - __pyx_6 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__Leaf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_type); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_type); + __Pyx_GIVEREF(__pyx_v_type); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__context), __pyx_v_context) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; } __pyx_L3:; - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_5); - Py_XDECREF(__pyx_6); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("sphinx.pycode.pgen2.parse.Parser.convert"); __pyx_r = 0; __pyx_L0:; - Py_DECREF(__pyx_v_type); - Py_DECREF(__pyx_v_value); - Py_DECREF(__pyx_v_context); - Py_DECREF(__pyx_v_children); + __Pyx_DECREF(__pyx_v_type); + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF(__pyx_v_context); + __Pyx_DECREF(__pyx_v_children); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_raw_node); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_vtabstruct_6sphinx_6pycode_5pgen2_5parse_Parser __pyx_vtable_6sphinx_6pycode_5pgen2_5parse_Parser; @@ -2278,28 +3078,28 @@ static PyObject *__pyx_tp_new_6sphinx_6pycode_5pgen2_5parse_Parser(PyTypeObject p = ((struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)o); p->__pyx_vtab = __pyx_vtabptr_6sphinx_6pycode_5pgen2_5parse_Parser; p->grammar = Py_None; Py_INCREF(Py_None); - p->stack = Py_None; Py_INCREF(Py_None); p->rootnode = Py_None; Py_INCREF(Py_None); - p->used_names = Py_None; Py_INCREF(Py_None); - p->_grammar_dfas = Py_None; Py_INCREF(Py_None); - p->_grammar_labels = Py_None; Py_INCREF(Py_None); - p->_grammar_keywords = Py_None; Py_INCREF(Py_None); - p->_grammar_tokens = Py_None; Py_INCREF(Py_None); - p->_grammar_number2symbol = Py_None; Py_INCREF(Py_None); + p->stack = ((PyObject *)Py_None); Py_INCREF(Py_None); + p->used_names = ((PyObject *)Py_None); Py_INCREF(Py_None); + p->_grammar_labels = ((PyObject *)Py_None); Py_INCREF(Py_None); + p->_grammar_dfas = ((PyObject *)Py_None); Py_INCREF(Py_None); + p->_grammar_keywords = ((PyObject *)Py_None); Py_INCREF(Py_None); + p->_grammar_tokens = ((PyObject *)Py_None); Py_INCREF(Py_None); + p->_grammar_number2symbol = ((PyObject *)Py_None); Py_INCREF(Py_None); return o; } static void __pyx_tp_dealloc_6sphinx_6pycode_5pgen2_5parse_Parser(PyObject *o) { struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *p = (struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *)o; Py_XDECREF(p->grammar); - Py_XDECREF(p->stack); Py_XDECREF(p->rootnode); - Py_XDECREF(p->used_names); - Py_XDECREF(p->_grammar_dfas); - Py_XDECREF(p->_grammar_labels); - Py_XDECREF(p->_grammar_keywords); - Py_XDECREF(p->_grammar_tokens); - Py_XDECREF(p->_grammar_number2symbol); + Py_XDECREF(((PyObject *)p->stack)); + Py_XDECREF(((PyObject *)p->used_names)); + Py_XDECREF(((PyObject *)p->_grammar_labels)); + Py_XDECREF(((PyObject *)p->_grammar_dfas)); + Py_XDECREF(((PyObject *)p->_grammar_keywords)); + Py_XDECREF(((PyObject *)p->_grammar_tokens)); + Py_XDECREF(((PyObject *)p->_grammar_number2symbol)); (*Py_TYPE(o)->tp_free)(o); } @@ -2309,21 +3109,21 @@ static int __pyx_tp_traverse_6sphinx_6pycode_5pgen2_5parse_Parser(PyObject *o, v if (p->grammar) { e = (*v)(p->grammar, a); if (e) return e; } - if (p->stack) { - e = (*v)(p->stack, a); if (e) return e; - } if (p->rootnode) { e = (*v)(p->rootnode, a); if (e) return e; } + if (p->stack) { + e = (*v)(p->stack, a); if (e) return e; + } if (p->used_names) { e = (*v)(p->used_names, a); if (e) return e; } - if (p->_grammar_dfas) { - e = (*v)(p->_grammar_dfas, a); if (e) return e; - } if (p->_grammar_labels) { e = (*v)(p->_grammar_labels, a); if (e) return e; } + if (p->_grammar_dfas) { + e = (*v)(p->_grammar_dfas, a); if (e) return e; + } if (p->_grammar_keywords) { e = (*v)(p->_grammar_keywords, a); if (e) return e; } @@ -2342,44 +3142,76 @@ static int __pyx_tp_clear_6sphinx_6pycode_5pgen2_5parse_Parser(PyObject *o) { tmp = ((PyObject*)p->grammar); p->grammar = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->stack); - p->stack = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); tmp = ((PyObject*)p->rootnode); p->rootnode = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->used_names); - p->used_names = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->stack); + p->stack = ((PyObject *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->_grammar_dfas); - p->_grammar_dfas = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->used_names); + p->used_names = ((PyObject *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->_grammar_labels); - p->_grammar_labels = Py_None; Py_INCREF(Py_None); + p->_grammar_labels = ((PyObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_grammar_dfas); + p->_grammar_dfas = ((PyObject *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->_grammar_keywords); - p->_grammar_keywords = Py_None; Py_INCREF(Py_None); + p->_grammar_keywords = ((PyObject *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->_grammar_tokens); - p->_grammar_tokens = Py_None; Py_INCREF(Py_None); + p->_grammar_tokens = ((PyObject *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->_grammar_number2symbol); - p->_grammar_number2symbol = Py_None; Py_INCREF(Py_None); + p->_grammar_number2symbol = ((PyObject *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } +static PyObject *__pyx_getprop_6sphinx_6pycode_5pgen2_5parse_6Parser_stack(PyObject *o, void *x) { + return __pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_5stack___get__(o); +} + +static int __pyx_setprop_6sphinx_6pycode_5pgen2_5parse_6Parser_stack(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_5stack___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6sphinx_6pycode_5pgen2_5parse_6Parser_used_names(PyObject *o, void *x) { + return __pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_10used_names___get__(o); +} + +static int __pyx_setprop_6sphinx_6pycode_5pgen2_5parse_6Parser_used_names(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_10used_names___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + static struct PyMethodDef __pyx_methods_6sphinx_6pycode_5pgen2_5parse_Parser[] = { - {"setup", (PyCFunction)__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_setup, METH_VARARGS|METH_KEYWORDS, 0}, - {"addtoken", (PyCFunction)__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken}, + {__Pyx_NAMESTR("setup"), (PyCFunction)__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_setup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("addtoken"), (PyCFunction)__pyx_pf_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6sphinx_6pycode_5pgen2_5parse_6Parser_addtoken)}, {0, 0, 0, 0} }; static struct PyMemberDef __pyx_members_6sphinx_6pycode_5pgen2_5parse_Parser[] = { - {"grammar", T_OBJECT, offsetof(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser, grammar), 0, 0}, - {"stack", T_OBJECT, offsetof(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser, stack), 0, 0}, - {"rootnode", T_OBJECT, offsetof(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser, rootnode), 0, 0}, - {"used_names", T_OBJECT, offsetof(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser, used_names), 0, 0}, + {(char *)"grammar", T_OBJECT, offsetof(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser, grammar), 0, 0}, + {(char *)"rootnode", T_OBJECT, offsetof(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser, rootnode), 0, 0}, + {0, 0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6sphinx_6pycode_5pgen2_5parse_Parser[] = { + {(char *)"stack", __pyx_getprop_6sphinx_6pycode_5pgen2_5parse_6Parser_stack, __pyx_setprop_6sphinx_6pycode_5pgen2_5parse_6Parser_stack, 0, 0}, + {(char *)"used_names", __pyx_getprop_6sphinx_6pycode_5pgen2_5parse_6Parser_used_names, __pyx_setprop_6sphinx_6pycode_5pgen2_5parse_6Parser_used_names, 0, 0}, {0, 0, 0, 0, 0} }; @@ -2407,7 +3239,11 @@ static PyNumberMethods __pyx_tp_as_number_Parser = { 0, /*nb_coerce*/ #endif 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else 0, /*nb_long*/ + #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ @@ -2469,17 +3305,17 @@ static PyBufferProcs __pyx_tp_as_buffer_Parser = { #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif - #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_NEWBUFFER) + #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif - #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_NEWBUFFER) + #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; PyTypeObject __pyx_type_6sphinx_6pycode_5pgen2_5parse_Parser = { PyVarObject_HEAD_INIT(0, 0) - "sphinx.pycode.pgen2.parse.Parser", /*tp_name*/ + __Pyx_NAMESTR("sphinx.pycode.pgen2.parse.Parser"), /*tp_name*/ sizeof(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6sphinx_6pycode_5pgen2_5parse_Parser, /*tp_dealloc*/ @@ -2497,7 +3333,7 @@ PyTypeObject __pyx_type_6sphinx_6pycode_5pgen2_5parse_Parser = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_Parser, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_6sphinx_6pycode_5pgen2_5parse_Parser, /*tp_traverse*/ __pyx_tp_clear_6sphinx_6pycode_5pgen2_5parse_Parser, /*tp_clear*/ @@ -2507,7 +3343,7 @@ PyTypeObject __pyx_type_6sphinx_6pycode_5pgen2_5parse_Parser = { 0, /*tp_iternext*/ __pyx_methods_6sphinx_6pycode_5pgen2_5parse_Parser, /*tp_methods*/ __pyx_members_6sphinx_6pycode_5pgen2_5parse_Parser, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_6sphinx_6pycode_5pgen2_5parse_Parser, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -2523,6 +3359,10 @@ PyTypeObject __pyx_type_6sphinx_6pycode_5pgen2_5parse_Parser = { 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif }; static struct PyMethodDef __pyx_methods[] = { @@ -2534,8 +3374,8 @@ static void __pyx_init_filenames(void); /*proto*/ #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, - "parse", - 0, /* m_doc */ + __Pyx_NAMESTR("parse"), + __Pyx_DOCSTR(__pyx_k_6), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -2546,47 +3386,64 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 0, 1, 1}, - {&__pyx_kp_setup, __pyx_k_setup, sizeof(__pyx_k_setup), 0, 1, 1}, - {&__pyx_kp_addtoken, __pyx_k_addtoken, sizeof(__pyx_k_addtoken), 0, 1, 1}, - {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 1, 1, 1}, - {&__pyx_kp_Node, __pyx_k_Node, sizeof(__pyx_k_Node), 1, 1, 1}, - {&__pyx_kp_Leaf, __pyx_k_Leaf, sizeof(__pyx_k_Leaf), 1, 1, 1}, - {&__pyx_kp_ParseError, __pyx_k_ParseError, sizeof(__pyx_k_ParseError), 0, 1, 1}, - {&__pyx_kp_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 1, 1, 1}, - {&__pyx_kp_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 1, 1, 1}, - {&__pyx_kp_type, __pyx_k_type, sizeof(__pyx_k_type), 1, 1, 1}, - {&__pyx_kp_value, __pyx_k_value, sizeof(__pyx_k_value), 1, 1, 1}, - {&__pyx_kp_context, __pyx_k_context, sizeof(__pyx_k_context), 1, 1, 1}, - {&__pyx_kp_dfas, __pyx_k_dfas, sizeof(__pyx_k_dfas), 1, 1, 1}, - {&__pyx_kp_labels, __pyx_k_labels, sizeof(__pyx_k_labels), 1, 1, 1}, - {&__pyx_kp_keywords, __pyx_k_keywords, sizeof(__pyx_k_keywords), 1, 1, 1}, - {&__pyx_kp_tokens, __pyx_k_tokens, sizeof(__pyx_k_tokens), 1, 1, 1}, - {&__pyx_kp_4, __pyx_k_4, sizeof(__pyx_k_4), 1, 1, 1}, - {&__pyx_kp_start, __pyx_k_start, sizeof(__pyx_k_start), 1, 1, 1}, - {&__pyx_kp_add, __pyx_k_add, sizeof(__pyx_k_add), 1, 1, 1}, - {&__pyx_kp_get, __pyx_k_get, sizeof(__pyx_k_get), 1, 1, 1}, - {&__pyx_kp_append, __pyx_k_append, sizeof(__pyx_k_append), 1, 1, 1}, - {&__pyx_kp_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 1, 1, 1}, - {&__pyx_kp_used_names, __pyx_k_used_names, sizeof(__pyx_k_used_names), 1, 1, 1}, - {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, - {&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 0}, - {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0}, - {&__pyx_kp_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 0}, - {&__pyx_kp_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 0}, - {0, 0, 0, 0, 0, 0} + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_n_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 1}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_n_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 1}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, + {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1}, + {&__pyx_n_s__Leaf, __pyx_k__Leaf, sizeof(__pyx_k__Leaf), 0, 0, 1, 1}, + {&__pyx_n_s__Node, __pyx_k__Node, sizeof(__pyx_k__Node), 0, 0, 1, 1}, + {&__pyx_n_s__ParseError, __pyx_k__ParseError, sizeof(__pyx_k__ParseError), 0, 0, 1, 1}, + {&__pyx_n_s__Parser, __pyx_k__Parser, sizeof(__pyx_k__Parser), 0, 0, 1, 1}, + {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s___grammar_dfas, __pyx_k___grammar_dfas, sizeof(__pyx_k___grammar_dfas), 0, 0, 1, 1}, + {&__pyx_n_s___grammar_keywords, __pyx_k___grammar_keywords, sizeof(__pyx_k___grammar_keywords), 0, 0, 1, 1}, + {&__pyx_n_s___grammar_labels, __pyx_k___grammar_labels, sizeof(__pyx_k___grammar_labels), 0, 0, 1, 1}, + {&__pyx_n_s___grammar_start, __pyx_k___grammar_start, sizeof(__pyx_k___grammar_start), 0, 0, 1, 1}, + {&__pyx_n_s___grammar_tokens, __pyx_k___grammar_tokens, sizeof(__pyx_k___grammar_tokens), 0, 0, 1, 1}, + {&__pyx_n_s__add, __pyx_k__add, sizeof(__pyx_k__add), 0, 0, 1, 1}, + {&__pyx_n_s__addtoken, __pyx_k__addtoken, sizeof(__pyx_k__addtoken), 0, 0, 1, 1}, + {&__pyx_n_s__classify, __pyx_k__classify, sizeof(__pyx_k__classify), 0, 0, 1, 1}, + {&__pyx_n_s__context, __pyx_k__context, sizeof(__pyx_k__context), 0, 0, 1, 1}, + {&__pyx_n_s__convert, __pyx_k__convert, sizeof(__pyx_k__convert), 0, 0, 1, 1}, + {&__pyx_n_s__dfas, __pyx_k__dfas, sizeof(__pyx_k__dfas), 0, 0, 1, 1}, + {&__pyx_n_s__grammar, __pyx_k__grammar, sizeof(__pyx_k__grammar), 0, 0, 1, 1}, + {&__pyx_n_s__keywords, __pyx_k__keywords, sizeof(__pyx_k__keywords), 0, 0, 1, 1}, + {&__pyx_n_s__labels, __pyx_k__labels, sizeof(__pyx_k__labels), 0, 0, 1, 1}, + {&__pyx_n_s__msg, __pyx_k__msg, sizeof(__pyx_k__msg), 0, 0, 1, 1}, + {&__pyx_n_s__number2symbol, __pyx_k__number2symbol, sizeof(__pyx_k__number2symbol), 0, 0, 1, 1}, + {&__pyx_n_s__pop, __pyx_k__pop, sizeof(__pyx_k__pop), 0, 0, 1, 1}, + {&__pyx_n_s__push, __pyx_k__push, sizeof(__pyx_k__push), 0, 0, 1, 1}, + {&__pyx_n_s__rootnode, __pyx_k__rootnode, sizeof(__pyx_k__rootnode), 0, 0, 1, 1}, + {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1}, + {&__pyx_n_s__shift, __pyx_k__shift, sizeof(__pyx_k__shift), 0, 0, 1, 1}, + {&__pyx_n_s__stack, __pyx_k__stack, sizeof(__pyx_k__stack), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__tokens, __pyx_k__tokens, sizeof(__pyx_k__tokens), 0, 0, 1, 1}, + {&__pyx_n_s__type, __pyx_k__type, sizeof(__pyx_k__type), 0, 0, 1, 1}, + {&__pyx_n_s__used_names, __pyx_k__used_names, sizeof(__pyx_k__used_names), 0, 0, 1, 1}, + {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_kp_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitGlobals(void) { - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_VERSION_HEX < 0x02040000 + if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; @@ -2600,18 +3457,38 @@ PyMODINIT_FUNC PyInit_parse(void); /*proto*/ PyMODINIT_FUNC PyInit_parse(void) #endif { - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Libary function declarations ---*/ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_parse(void)", __LINE__, __FILE__); + #endif __pyx_init_filenames(); - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 + __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("parse", __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("parse"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_6), 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -2619,24 +3496,36 @@ PyMODINIT_FUNC PyInit_parse(void) #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_sphinx__pycode__pgen2__parse) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_skip_dispatch = 0; /*--- Global init code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ __pyx_vtabptr_6sphinx_6pycode_5pgen2_5parse_Parser = &__pyx_vtable_6sphinx_6pycode_5pgen2_5parse_Parser; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_6sphinx_6pycode_5pgen2_5parse_Parser.classify = (int (*)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *, int, PyObject *, PyObject *))__pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_classify; + __pyx_vtable_6sphinx_6pycode_5pgen2_5parse_Parser.shift = (void (*)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *, PyObject *, PyObject *, PyObject *, PyObject *))__pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_shift; + __pyx_vtable_6sphinx_6pycode_5pgen2_5parse_Parser.push = (void (*)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *, PyObject *, PyObject *, PyObject *, PyObject *))__pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_push; + __pyx_vtable_6sphinx_6pycode_5pgen2_5parse_Parser.pop = (void (*)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *))__pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_pop; + __pyx_vtable_6sphinx_6pycode_5pgen2_5parse_Parser.convert = (PyObject *(*)(struct __pyx_obj_6sphinx_6pycode_5pgen2_5parse_Parser *, PyObject *))__pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_convert; + #else *(void(**)(void))&__pyx_vtable_6sphinx_6pycode_5pgen2_5parse_Parser.classify = (void(*)(void))__pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_classify; *(void(**)(void))&__pyx_vtable_6sphinx_6pycode_5pgen2_5parse_Parser.shift = (void(*)(void))__pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_shift; *(void(**)(void))&__pyx_vtable_6sphinx_6pycode_5pgen2_5parse_Parser.push = (void(*)(void))__pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_push; *(void(**)(void))&__pyx_vtable_6sphinx_6pycode_5pgen2_5parse_Parser.pop = (void(*)(void))__pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_pop; *(void(**)(void))&__pyx_vtable_6sphinx_6pycode_5pgen2_5parse_Parser.convert = (void(*)(void))__pyx_f_6sphinx_6pycode_5pgen2_5parse_6Parser_convert; + #endif if (PyType_Ready(&__pyx_type_6sphinx_6pycode_5pgen2_5parse_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_6sphinx_6pycode_5pgen2_5parse_Parser.tp_dict, __pyx_vtabptr_6sphinx_6pycode_5pgen2_5parse_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttrString(__pyx_m, "Parser", (PyObject *)&__pyx_type_6sphinx_6pycode_5pgen2_5parse_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Parser", (PyObject *)&__pyx_type_6sphinx_6pycode_5pgen2_5parse_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_6sphinx_6pycode_5pgen2_5parse_Parser = &__pyx_type_6sphinx_6pycode_5pgen2_5parse_Parser; /*--- Type import code ---*/ /*--- Function import code ---*/ @@ -2649,20 +3538,26 @@ PyMODINIT_FUNC PyInit_parse(void) * * DEF NAME = 1 */ - __pyx_1 = PyList_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_Node); - PyList_SET_ITEM(__pyx_1, 0, __pyx_kp_Node); - Py_INCREF(__pyx_kp_Leaf); - PyList_SET_ITEM(__pyx_1, 1, __pyx_kp_Leaf); - __pyx_2 = __Pyx_Import(__pyx_kp_1, ((PyObject *)__pyx_1)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_Node); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_Node, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_Leaf); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_Leaf, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Node)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Node)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Node)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Leaf)); + PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__Leaf)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Leaf)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_7), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Node, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Leaf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Leaf, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":19 * DEF NAME = 1 @@ -2671,13 +3566,17 @@ PyMODINIT_FUNC PyInit_parse(void) * """Exception to signal the parser is stuck.""" * */ - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_builtin_Exception); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_builtin_Exception); - if (PyDict_SetItemString(((PyObject *)__pyx_2), "__doc__", __pyx_kp_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_1), ((PyObject *)__pyx_2), __pyx_kp_ParseError, "sphinx.pycode.pgen2.parse"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_builtin_Exception); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_Exception); + __Pyx_GIVEREF(__pyx_builtin_Exception); + if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_CreateClass(__pyx_t_1, ((PyObject *)__pyx_t_2), __pyx_n_s__ParseError, "sphinx.pycode.pgen2.parse"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":22 * """Exception to signal the parser is stuck.""" @@ -2686,36 +3585,55 @@ PyMODINIT_FUNC PyInit_parse(void) * Exception.__init__(self, "%s: type=%r, value=%r, context=%r" % * (msg, type, value, context)) */ - __pyx_1 = PyCFunction_New(&__pyx_mdef_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyMethod_New(__pyx_1, 0, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - if (PyObject_SetAttr(__pyx_3, __pyx_kp___init__, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_kp_ParseError, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - - /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":149 - * self.rootnode.used_names = self.used_names + __pyx_t_1 = PyCFunction_New(&__pyx_mdef_6sphinx_6pycode_5pgen2_5parse_10ParseError___init__, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyMethod_New(__pyx_t_1, 0, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ParseError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/home/gbr/devel/sphinx/sphinx/pycode/pgen2/parse.pyx":1 + * # Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # <<<<<<<<<<<<<< + * # Licensed to PSF under a Contributor Agreement. * - * cdef convert(self, raw_node): # <<<<<<<<<<<<<< - * type, value, context, children = raw_node - * if children or type in self._grammar_number2symbol: */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Parser); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__addtoken); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_9), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + if (__pyx_m) { + __Pyx_AddTraceback("init sphinx.pycode.pgen2.parse"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init sphinx.pycode.pgen2.parse"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif - __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); - __Pyx_AddTraceback("sphinx.pycode.pgen2.parse"); - #if PY_MAJOR_VERSION >= 3 - return NULL; - #endif } static const char *__pyx_filenames[] = { @@ -2728,17 +3646,179 @@ static void __pyx_init_filenames(void) { __pyx_f = __pyx_filenames; } -static INLINE void __Pyx_RaiseArgtupleTooLong( - Py_ssize_t num_expected, +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, Py_ssize_t num_found) { - const char* error_message = - #if PY_VERSION_HEX < 0x02050000 - "function takes at most %d positional arguments (%d given)"; + Py_ssize_t num_expected; + const char *number, *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + number = (num_expected == 1) ? "" : "s"; + PyErr_Format(PyExc_TypeError, + #if PY_VERSION_HEX < 0x02050000 + "%s() takes %s %d positional argument%s (%d given)", + #else + "%s() takes %s %zd positional argument%s (%zd given)", + #endif + func_name, more_or_less, num_expected, number, num_found); +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); #else - "function takes at most %zd positional arguments (%zd given)"; + "%s() got an unexpected keyword argument '%U'", + function_name, key); #endif - PyErr_Format(PyExc_TypeError, error_message, num_expected, num_found); +bad: + return -1; +} + + +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +} + +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } + } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(); + } } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { @@ -2748,7 +3828,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = PyObject_GetAttrString(__pyx_b, "__import__"); + __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!__import__) goto bad; if (from_list) @@ -2765,8 +3845,8 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { empty_dict = PyDict_New(); if (!empty_dict) goto bad; - module = PyObject_CallFunction(__import__, "OOOO", - name, global_dict, empty_dict, list); + module = PyObject_CallFunctionObjArgs(__import__, + name, global_dict, empty_dict, list, NULL); bad: Py_XDECREF(empty_list); Py_XDECREF(__import__); @@ -2783,7 +3863,7 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { } static PyObject *__Pyx_CreateClass( - PyObject *bases, PyObject *dict, PyObject *name, char *modname) + PyObject *bases, PyObject *dict, PyObject *name, const char *modname) { PyObject *py_modname; PyObject *result = 0; @@ -2807,35 +3887,34 @@ bad: return result; } - -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d values to unpack", (int)index); - #else - "need more than %zd values to unpack", index); - #endif - } - } - return item; +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); } -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); - return -1; - } - else if (!PyErr_Occurred()) - return 0; - else - return -1; +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; } + +#if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); @@ -2891,7 +3970,8 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { } #endif } - PyErr_Restore(type, value, tb); + + __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); @@ -2900,39 +3980,464 @@ raise_error: return; } +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} static void __Pyx_WriteUnraisable(const char *name) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; - PyErr_Fetch(&old_exc, &old_val, &old_tb); + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); #if PY_MAJOR_VERSION < 3 ctx = PyString_FromString(name); #else ctx = PyUnicode_FromString(name); #endif - PyErr_Restore(old_exc, old_val, old_tb); - if (!ctx) - ctx = Py_None; - PyErr_WriteUnraisable(ctx); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } } static int __Pyx_SetVtable(PyObject *dict, void *vtable) { - PyObject *pycobj = 0; - int result; - - pycobj = PyCObject_FromVoidPtr(vtable, 0); - if (!pycobj) +#if PY_VERSION_HEX < 0x03010000 + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#else + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#endif + if (!ob) goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0) + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) goto bad; - result = 0; - goto done; - + Py_DECREF(ob); + return 0; bad: - result = -1; -done: - Py_XDECREF(pycobj); - return result; + Py_XDECREF(ob); + return -1; } #include "compile.h" @@ -2943,7 +4448,6 @@ static void __Pyx_AddTraceback(const char *funcname) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; - PyObject *empty_string = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; @@ -2970,12 +4474,6 @@ static void __Pyx_AddTraceback(const char *funcname) { if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; - #if PY_MAJOR_VERSION < 3 - empty_string = PyString_FromStringAndSize("", 0); - #else - empty_string = PyBytes_FromStringAndSize("", 0); - #endif - if (!empty_string) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ #if PY_MAJOR_VERSION >= 3 @@ -2984,7 +4482,7 @@ static void __Pyx_AddTraceback(const char *funcname) { 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ - empty_string, /*PyObject *code,*/ + __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ @@ -2993,11 +4491,11 @@ static void __Pyx_AddTraceback(const char *funcname) { py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ - empty_string /*PyObject *lnotab*/ + __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( - PyThreadState_Get(), /*PyThreadState *tstate,*/ + PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ @@ -3008,7 +4506,6 @@ static void __Pyx_AddTraceback(const char *funcname) { bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); - Py_XDECREF(empty_string); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -3016,7 +4513,7 @@ bad: static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 - if (t->is_unicode && (!t->is_identifier)) { + if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); @@ -3024,10 +4521,14 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ - if (t->is_identifier || (t->is_unicode && t->intern)) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->is_unicode) { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } @@ -3041,221 +4542,92 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { /* Type Conversion Functions */ -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} - static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; - else if (x == Py_False) return 0; + else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) { - if (PyInt_CheckExact(x)) { - return PyInt_AS_LONG(x); - } - else if (PyLong_CheckExact(x)) { - return PyLong_AsLongLong(x); - } - else { - PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; - val = __pyx_PyInt_AsLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) { - if (PyInt_CheckExact(x)) { - long val = PyInt_AS_LONG(x); - if (unlikely(val < 0)) { - PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type."); - return (unsigned PY_LONG_LONG)-1; - } - return val; - } - else if (PyLong_CheckExact(x)) { - return PyLong_AsUnsignedLongLong(x); - } - else { - PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; - val = __pyx_PyInt_AsUnsignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - - -static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) { - if (sizeof(unsigned char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - unsigned char val = (unsigned char)long_val; - if (unlikely((val != long_val) || (long_val < 0))) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char"); - return (unsigned char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) { - if (sizeof(unsigned short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - unsigned short val = (unsigned short)long_val; - if (unlikely((val != long_val) || (long_val < 0))) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short"); - return (unsigned short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE char __pyx_PyInt_char(PyObject* x) { - if (sizeof(char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - char val = (char)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to char"); - return (char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE short __pyx_PyInt_short(PyObject* x) { - if (sizeof(short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - short val = (short)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to short"); - return (short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE int __pyx_PyInt_int(PyObject* x) { - if (sizeof(int) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - int val = (int)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); - return (int)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE long __pyx_PyInt_long(PyObject* x) { - if (sizeof(long) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - long val = (long)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); - return (long)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed char __pyx_PyInt_signed_char(PyObject* x) { - if (sizeof(signed char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed char val = (signed char)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed char"); - return (signed char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; } -static INLINE signed short __pyx_PyInt_signed_short(PyObject* x) { - if (sizeof(signed short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed short val = (signed short)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed short"); - return (signed short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; } -static INLINE signed int __pyx_PyInt_signed_int(PyObject* x) { - if (sizeof(signed int) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed int val = (signed int)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed int"); - return (signed int)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif } -static INLINE signed long __pyx_PyInt_signed_long(PyObject* x) { - if (sizeof(signed long) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed long val = (signed long)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed long"); - return (signed long)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; } -static INLINE long double __pyx_PyInt_long_double(PyObject* x) { - if (sizeof(long double) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - long double val = (long double)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to long double"); - return (long double)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} +#endif /* Py_PYTHON_H */ diff --git a/sphinx/pycode/pgen2/parse.pyx b/sphinx/pycode/pgen2/parse.pyx index 537d7393..9c97a453 100644 --- a/sphinx/pycode/pgen2/parse.pyx +++ b/sphinx/pycode/pgen2/parse.pyx @@ -29,9 +29,16 @@ class ParseError(Exception): cdef class Parser: - cdef public grammar, stack, rootnode, used_names - cdef _grammar_dfas, _grammar_labels, _grammar_keywords, _grammar_tokens - cdef _grammar_number2symbol + cdef public object grammar + cdef public object rootnode + cdef public list stack + cdef public set used_names + cdef int _grammar_start + cdef list _grammar_labels + cdef dict _grammar_dfas + cdef dict _grammar_keywords + cdef dict _grammar_tokens + cdef dict _grammar_number2symbol def __init__(self, grammar, convert=None): self.grammar = grammar @@ -42,10 +49,11 @@ cdef class Parser: self._grammar_keywords = grammar.keywords self._grammar_tokens = grammar.tokens self._grammar_number2symbol = grammar.number2symbol + self._grammar_start = grammar.start def setup(self, start=None): if start is None: - start = self.grammar.start + start = self._grammar_start # Each stack entry is a tuple: (dfa, state, node). # A node is a tuple: (type, value, context, children), # where children is a list of nodes or None, and context may be None. @@ -55,7 +63,7 @@ cdef class Parser: self.rootnode = None self.used_names = set() # Aliased to self.rootnode.used_names in pop() - def addtoken(self, type, value, context): + def addtoken(self, int type, value, context): """Add a token; return True iff this is the end of the program.""" cdef int ilabel, i, t, state, newstate # Map from token to label @@ -104,22 +112,21 @@ cdef class Parser: # No success finding a transition raise ParseError("bad input", type, value, context) - cdef int classify(self, type, value, context): + cdef int classify(self, int type, value, context): """Turn a token into a label. (Internal)""" if type == NAME: # Keep a listing of all used names self.used_names.add(value) # Check for reserved words - ilabel = self._grammar_keywords.get(value) - if ilabel is not None: - return ilabel - ilabel = self._grammar_tokens.get(type) - if ilabel is None: + if value in self._grammar_keywords: + return self._grammar_keywords[value] + if type not in self._grammar_tokens: raise ParseError("bad token", type, value, context) - return ilabel + return self._grammar_tokens[type] cdef void shift(self, type, value, newstate, context): """Shift a token. (Internal)""" + cdef tuple node dfa, state, node = self.stack[-1] newnode = (type, value, context, None) newnode = self.convert(newnode) @@ -146,7 +153,7 @@ cdef class Parser: self.rootnode = newnode self.rootnode.used_names = self.used_names - cdef convert(self, raw_node): + cdef convert(self, tuple raw_node): type, value, context, children = raw_node if children or type in self._grammar_number2symbol: # If there's exactly one child, return that child instead of diff --git a/sphinx/pycode/pgen2/pgen.py b/sphinx/pycode/pgen2/pgen.py index d6895eae..0a04447d 100644 --- a/sphinx/pycode/pgen2/pgen.py +++ b/sphinx/pycode/pgen2/pgen.py @@ -54,12 +54,12 @@ class ParserGenerator(object): first = {} for label in rawfirst: ilabel = self.make_label(c, label) - ##assert ilabel not in first # XXX failed on <> ... != + ##assert ilabel not in first # X X X failed on <> ... != first[ilabel] = 1 return first def make_label(self, c, label): - # XXX Maybe this should be a method on a subclass of converter? + # X X X Maybe this should be a method on a subclass of converter? ilabel = len(c.labels) if label[0].isalpha(): # Either a symbol name or a named token @@ -157,9 +157,9 @@ class ParserGenerator(object): #self.dump_nfa(name, a, z) dfa = self.make_dfa(a, z) #self.dump_dfa(name, dfa) - oldlen = len(dfa) + #oldlen = len(dfa) self.simplify_dfa(dfa) - newlen = len(dfa) + #newlen = len(dfa) dfas[name] = dfa #print name, oldlen, newlen if startsymbol is None: diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index af1132d5..97ddfc32 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -14,7 +14,8 @@ from os import path TERM_ENCODING = getattr(sys.stdin, 'encoding', None) -from sphinx.util import make_filename +from sphinx import __version__ +from sphinx.util.osutil import make_filename from sphinx.util.console import purple, bold, red, turquoise, \ nocolor, color_terminal from sphinx.util import texescape @@ -45,6 +46,9 @@ import sys, os # -- General configuration ----------------------------------------------------- +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [%(extensions)s] @@ -56,7 +60,7 @@ templates_path = ['%(dot)stemplates'] source_suffix = '%(suffix)s' # The encoding of source files. -#source_encoding = 'utf-8' +#source_encoding = 'utf-8-sig' # The master toctree document. master_doc = '%(master_str)s' @@ -84,12 +88,9 @@ release = '%(release_str)s' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%%B %%d, %%Y' -# List of documents that shouldn't be included in the build. -#unused_docs = [] - -# List of directories, relative to source directory, that shouldn't be searched -# for source files. -exclude_trees = [%(exclude_trees)s] +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = [%(exclude_patterns)s] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None @@ -163,7 +164,7 @@ html_static_path = ['%(dot)sstatic'] #html_additional_pages = {} # If false, no module index is generated. -#html_use_modindex = True +#html_domain_indices = True # If false, no index is generated. #html_use_index = True @@ -174,6 +175,12 @@ html_static_path = ['%(dot)sstatic'] # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. @@ -216,7 +223,56 @@ latex_documents = [ #latex_appendices = [] # If false, no module index is generated. -#latex_use_modindex = True +#latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('%(master_str)s', '%(project_manpage)s', u'%(project_doc)s', + [u'%(author_str)s'], 1) +] +''' + +EPUB_CONFIG = ''' + +# -- Options for Epub output --------------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = u'%(project_str)s' +epub_author = u'%(author_str)s' +epub_publisher = u'%(author_str)s' +epub_copyright = u'%(copyright_str)s' + +# The language of the text. It defaults to the language option +# or en if the language is not set. +#epub_language = '' + +# The scheme of the identifier. Typical schemes are ISBN or URL. +#epub_scheme = '' + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +#epub_identifier = '' + +# A unique identification for the text. +#epub_uid = '' + +# HTML files that should be inserted before the pages created by sphinx. +# The format is a list of tuples containing the path and title. +#epub_pre_files = [] + +# HTML files shat should be inserted after the pages created by sphinx. +# The format is a list of tuples containing the path and title. +#epub_post_files = [] + +# A list of files that should not be packed into the epub file. +#epub_exclude_files = [] + +# The depth of the table of contents in toc.ncx. +#epub_tocdepth = 3 ''' INTERSPHINX_CONFIG = ''' @@ -264,21 +320,27 @@ PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) \ $(SPHINXOPTS) %(rsrcdir)s -.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes \ -linkcheck doctest +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp \ +epub latex latexpdf text man changes linkcheck doctest help: \t@echo "Please use \\`make <target>' where <target> is one of" -\t@echo " html to make standalone HTML files" -\t@echo " dirhtml to make HTML files named index.html in directories" -\t@echo " pickle to make pickle files" -\t@echo " json to make JSON files" -\t@echo " htmlhelp to make HTML files and a HTML help project" -\t@echo " qthelp to make HTML files and a qthelp project" -\t@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" -\t@echo " changes to make an overview of all changed/added/deprecated items" -\t@echo " linkcheck to check all external links for integrity" -\t@echo " doctest to run all doctests embedded in the documentation \ +\t@echo " html to make standalone HTML files" +\t@echo " dirhtml to make HTML files named index.html in directories" +\t@echo " singlehtml to make a single large HTML file" +\t@echo " pickle to make pickle files" +\t@echo " json to make JSON files" +\t@echo " htmlhelp to make HTML files and a HTML help project" +\t@echo " qthelp to make HTML files and a qthelp project" +\t@echo " devhelp to make HTML files and a Devhelp project" +\t@echo " epub to make an epub" +\t@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" +\t@echo " latexpdf to make LaTeX files and run them through pdflatex" +\t@echo " text to make text files" +\t@echo " man to make manual pages" +\t@echo " changes to make an overview of all changed/added/deprecated items" +\t@echo " linkcheck to check all external links for integrity" +\t@echo " doctest to run all doctests embedded in the documentation \ (if enabled)" clean: @@ -294,6 +356,11 @@ dirhtml: \t@echo \t@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." +singlehtml: +\t$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml +\t@echo +\t@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + pickle: \t$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle \t@echo @@ -319,12 +386,43 @@ qthelp: \t@echo "To view the help file:" \t@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/%(project_fn)s.qhc" +devhelp: +\t$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp +\t@echo +\t@echo "Build finished." +\t@echo "To view the help file:" +\t@echo "# mkdir -p $$HOME/.local/share/devhelp/%(project_fn)s" +\t@echo "# ln -s $(BUILDDIR)/devhelp\ + $$HOME/.local/share/devhelp/%(project_fn)s" +\t@echo "# devhelp" + +epub: +\t$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub +\t@echo +\t@echo "Build finished. The epub file is in $(BUILDDIR)/epub." + latex: \t$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex \t@echo \t@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." -\t@echo "Run \\`make all-pdf' or \\`make all-ps' in that directory to" \\ -\t "run these through (pdf)latex." +\t@echo "Run \\`make' in that directory to run these through (pdf)latex" \\ +\t "(use \\`make latexpdf' here to do that automatically)." + +latexpdf: latex +\t$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex +\t@echo "Running LaTeX files through pdflatex..." +\tmake -C $(BUILDDIR)/latex all-pdf +\t@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: +\t$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text +\t@echo +\t@echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: +\t$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man +\t@echo +\t@echo "Build finished. The manual pages are in $(BUILDDIR)/man." changes: \t$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @@ -348,7 +446,9 @@ BATCHFILE = '''\ REM Command file for Sphinx documentation -set SPHINXBUILD=sphinx-build +if "%%SPHINXBUILD%%" == "" ( +\tset SPHINXBUILD=sphinx-build +) set BUILDDIR=%(rbuilddir)s set ALLSPHINXOPTS=-d %%BUILDDIR%%/doctrees %%SPHINXOPTS%% %(rsrcdir)s if NOT "%%PAPER%%" == "" ( @@ -360,16 +460,21 @@ if "%%1" == "" goto help if "%%1" == "help" ( \t:help \techo.Please use `make ^<target^>` where ^<target^> is one of -\techo. html to make standalone HTML files -\techo. dirhtml to make HTML files named index.html in directories -\techo. pickle to make pickle files -\techo. json to make JSON files -\techo. htmlhelp to make HTML files and a HTML help project -\techo. qthelp to make HTML files and a qthelp project -\techo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter -\techo. changes to make an overview over all changed/added/deprecated items -\techo. linkcheck to check all external links for integrity -\techo. doctest to run all doctests embedded in the documentation if enabled +\techo. html to make standalone HTML files +\techo. dirhtml to make HTML files named index.html in directories +\techo. singlehtml to make a single large HTML file +\techo. pickle to make pickle files +\techo. json to make JSON files +\techo. htmlhelp to make HTML files and a HTML help project +\techo. qthelp to make HTML files and a qthelp project +\techo. devhelp to make HTML files and a Devhelp project +\techo. epub to make an epub +\techo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter +\techo. text to make text files +\techo. man to make manual pages +\techo. changes to make an overview over all changed/added/deprecated items +\techo. linkcheck to check all external links for integrity +\techo. doctest to run all doctests embedded in the documentation if enabled \tgoto end ) @@ -393,6 +498,13 @@ if "%%1" == "dirhtml" ( \tgoto end ) +if "%%1" == "singlehtml" ( +\t%%SPHINXBUILD%% -b singlehtml %%ALLSPHINXOPTS%% %%BUILDDIR%%/singlehtml +\techo. +\techo.Build finished. The HTML pages are in %%BUILDDIR%%/singlehtml. +\tgoto end +) + if "%%1" == "pickle" ( \t%%SPHINXBUILD%% -b pickle %%ALLSPHINXOPTS%% %%BUILDDIR%%/pickle \techo. @@ -426,6 +538,20 @@ if "%%1" == "qthelp" ( \tgoto end ) +if "%%1" == "devhelp" ( +\t%%SPHINXBUILD%% -b devhelp %%ALLSPHINXOPTS%% %%BUILDDIR%%/devhelp +\techo. +\techo.Build finished. +\tgoto end +) + +if "%%1" == "epub" ( +\t%%SPHINXBUILD%% -b epub %%ALLSPHINXOPTS%% %%BUILDDIR%%/epub +\techo. +\techo.Build finished. The epub file is in %%BUILDDIR%%/epub. +\tgoto end +) + if "%%1" == "latex" ( \t%%SPHINXBUILD%% -b latex %%ALLSPHINXOPTS%% %%BUILDDIR%%/latex \techo. @@ -433,6 +559,20 @@ if "%%1" == "latex" ( \tgoto end ) +if "%%1" == "text" ( +\t%%SPHINXBUILD%% -b text %%ALLSPHINXOPTS%% %%BUILDDIR%%/text +\techo. +\techo.Build finished. The text files are in %%BUILDDIR%%/text. +\tgoto end +) + +if "%%1" == "man" ( +\t%%SPHINXBUILD%% -b man %%ALLSPHINXOPTS%% %%BUILDDIR%%/man +\techo. +\techo.Build finished. The manual pages are in %%BUILDDIR%%/man. +\tgoto end +) + if "%%1" == "changes" ( \t%%SPHINXBUILD%% -b changes %%ALLSPHINXOPTS%% %%BUILDDIR%%/changes \techo. @@ -537,7 +677,7 @@ def inner_main(args): if not color_terminal(): nocolor() - print bold('Welcome to the Sphinx quickstart utility.') + print bold('Welcome to the Sphinx %s quickstart utility.') % __version__ print ''' Please enter values for the following settings (just press Enter to accept a default value, if one is given in brackets).''' @@ -606,6 +746,11 @@ document is a custom template, you can also set this to another filename.''' 'existing file and press Enter', d['master']) print ''' +Sphinx can also add configuration for epub output:''' + do_prompt(d, 'epub', 'Do you want to use the epub builder (y/N)', + 'n', boolean) + + print ''' Please indicate if you want to use one of the following Sphinx extensions:''' do_prompt(d, 'ext_autodoc', 'autodoc: automatically insert docstrings ' 'from modules (y/N)', 'n', boolean) @@ -626,6 +771,8 @@ Please indicate if you want to use one of the following Sphinx extensions:''' pngmath has been deselected.''' do_prompt(d, 'ext_ifconfig', 'ifconfig: conditional inclusion of ' 'content based on config values (y/N)', 'n', boolean) + do_prompt(d, 'ext_viewcode', 'viewcode: include links to the source code ' + 'of documented Python objects (y/N)', 'n', boolean) print ''' A Makefile and a Windows command file can be generated for you so that you only have to run e.g. `make html' instead of invoking sphinx-build @@ -635,12 +782,13 @@ directly.''' 'y', boolean) d['project_fn'] = make_filename(d['project']) + d['project_manpage'] = d['project_fn'].lower() d['now'] = time.asctime() d['underline'] = len(d['project']) * '=' d['extensions'] = ', '.join( repr('sphinx.ext.' + name) for name in ('autodoc', 'doctest', 'intersphinx', 'todo', 'coverage', - 'pngmath', 'jsmath', 'ifconfig') + 'pngmath', 'jsmath', 'ifconfig', 'viewcode') if d['ext_' + name]) d['copyright'] = time.strftime('%Y') + ', ' + d['author'] d['author_texescaped'] = unicode(d['author']).\ @@ -651,7 +799,7 @@ directly.''' # escape backslashes and single quotes in strings that are put into # a Python string literal - for key in ('project', 'copyright', 'author_texescaped', + for key in ('project', 'copyright', 'author', 'author_texescaped', 'project_doc_texescaped', 'version', 'release', 'master'): d[key + '_str'] = d[key].replace('\\', '\\\\').replace("'", "\\'") @@ -663,15 +811,17 @@ directly.''' mkdir_p(srcdir) if d['sep']: builddir = path.join(d['path'], 'build') - d['exclude_trees'] = '' + d['exclude_patterns'] = '' else: builddir = path.join(srcdir, d['dot'] + 'build') - d['exclude_trees'] = repr(d['dot'] + 'build') + d['exclude_patterns'] = repr(d['dot'] + 'build') mkdir_p(builddir) mkdir_p(path.join(srcdir, d['dot'] + 'templates')) mkdir_p(path.join(srcdir, d['dot'] + 'static')) conf_text = QUICKSTART_CONF % d + if d['epub']: + conf_text += EPUB_CONFIG % d if d['ext_intersphinx']: conf_text += INTERSPHINX_CONFIG diff --git a/sphinx/roles.py b/sphinx/roles.py index 599de3c7..489d6ae8 100644 --- a/sphinx/roles.py +++ b/sphinx/roles.py @@ -10,12 +10,15 @@ """ import re +import warnings from docutils import nodes, utils from docutils.parsers.rst import roles from sphinx import addnodes -from sphinx.util import ws_re, caption_ref_re +from sphinx.locale import _ +from sphinx.util import ws_re +from sphinx.util.nodes import split_explicit_title generic_docroles = { @@ -28,36 +31,147 @@ generic_docroles = { 'manpage' : addnodes.literal_emphasis, 'mimetype' : addnodes.literal_emphasis, 'newsgroup' : addnodes.literal_emphasis, - 'program' : nodes.strong, + 'program' : nodes.strong, # XXX should be an x-ref 'regexp' : nodes.literal, } for rolename, nodeclass in generic_docroles.iteritems(): - role = roles.GenericRole(rolename, nodeclass) + generic = roles.GenericRole(rolename, nodeclass) + role = roles.CustomRole(rolename, generic, {'classes': [rolename]}) roles.register_local_role(rolename, role) +# -- generic cross-reference role ---------------------------------------------- + +class XRefRole(object): + """ + A generic cross-referencing role. To create a callable that can be used as + a role function, create an instance of this class. + + The general features of this role are: + + * Automatic creation of a reference and a content node. + * Optional separation of title and target with `title <target>`. + * The implementation is a class rather than a function to make + customization easier. + + Customization can be done in two ways: + + * Supplying constructor parameters: + * `fix_parens` to normalize parentheses (strip from target, and add to + title if configured) + * `lowercase` to lowercase the target + * `nodeclass` and `innernodeclass` select the node classes for + the reference and the content node + + * Subclassing and overwriting `process_link()` and/or `result_nodes()`. + """ + + nodeclass = addnodes.pending_xref + innernodeclass = nodes.literal + + def __init__(self, fix_parens=False, lowercase=False, + nodeclass=None, innernodeclass=None): + self.fix_parens = fix_parens + self.lowercase = lowercase + if nodeclass is not None: + self.nodeclass = nodeclass + if innernodeclass is not None: + self.innernodeclass = innernodeclass + + def _fix_parens(self, env, has_explicit_title, title, target): + if not has_explicit_title: + if title.endswith('()'): + # remove parentheses + title = title[:-2] + if env.config.add_function_parentheses: + # add them back to all occurrences if configured + title += '()' + # remove parentheses from the target too + if target.endswith('()'): + target = target[:-2] + return title, target + + def __call__(self, typ, rawtext, text, lineno, inliner, + options={}, content=[]): + env = inliner.document.settings.env + if not typ: + typ = env.config.default_role + else: + typ = typ.lower() + if ':' not in typ: + domain, role = '', typ + classes = ['xref', role] + else: + domain, role = typ.split(':', 1) + classes = ['xref', domain, '%s-%s' % (domain, role)] + # if the first character is a bang, don't cross-reference at all + if text[0:1] == '!': + text = utils.unescape(text) + if self.fix_parens: + text, tgt = self._fix_parens(env, False, text[1:], "") + innernode = self.innernodeclass(rawtext, text, classes=classes) + return self.result_nodes(inliner.document, env, innernode, + is_ref=False) + # split title and target in role content + has_explicit_title, title, target = split_explicit_title(text) + title = utils.unescape(title) + target = utils.unescape(target) + # fix-up title and target + if self.lowercase: + target = target.lower() + if self.fix_parens: + title, target = self._fix_parens( + env, has_explicit_title, title, target) + # create the reference node + refnode = self.nodeclass(rawtext, reftype=role, refdomain=domain, + refexplicit=has_explicit_title) + # we may need the line number for warnings + refnode.line = lineno + title, target = self.process_link( + env, refnode, has_explicit_title, title, target) + # now that the target and title are finally determined, set them + refnode['reftarget'] = target + refnode += self.innernodeclass(rawtext, title, classes=classes) + # we also need the source document + refnode['refdoc'] = env.docname + # result_nodes allow further modification of return values + return self.result_nodes(inliner.document, env, refnode, is_ref=True) + + # methods that can be overwritten + + def process_link(self, env, refnode, has_explicit_title, title, target): + """ + Called after parsing title and target text, and creating the reference + node (given in *refnode*). This method can alter the reference node and + must return a new (or the same) ``(title, target)`` tuple. + """ + return title, ws_re.sub(' ', target) + + def result_nodes(self, document, env, node, is_ref): + """ + Called before returning the finished nodes. *node* is the reference + node if one was created (*is_ref* is then true), else the content node. + This method can add other nodes and must return a ``(nodes, messages)`` + tuple (the usual return value of a role function). + """ + return [node], [] + + def indexmarkup_role(typ, rawtext, etext, lineno, inliner, options={}, content=[]): + """Role for PEP/RFC references that generate an index entry.""" env = inliner.document.settings.env if not typ: typ = env.config.default_role else: typ = typ.lower() text = utils.unescape(etext) - targetid = 'index-%s' % env.index_num - env.index_num += 1 + targetid = 'index-%s' % env.new_serialno('index') indexnode = addnodes.index() targetnode = nodes.target('', '', ids=[targetid]) inliner.document.note_explicit_target(targetnode) - if typ == 'envvar': - indexnode['entries'] = [('single', text, targetid, text), - ('single', _('environment variable; %s') % text, - targetid, text)] - xref_nodes = xfileref_role(typ, rawtext, etext, lineno, inliner, - options, content)[0] - return [indexnode, targetnode] + xref_nodes, [] - elif typ == 'pep': + if typ == 'pep': indexnode['entries'] = [ ('single', _('Python Enhancement Proposals!PEP %s') % text, targetid, 'PEP %s' % text)] @@ -70,7 +184,7 @@ def indexmarkup_role(typ, rawtext, etext, lineno, inliner, return [prb], [msg] ref = inliner.document.settings.pep_base_url + 'pep-%04d' % pepnum sn = nodes.strong('PEP '+text, 'PEP '+text) - rn = nodes.reference('', '', refuri=ref) + rn = nodes.reference('', '', refuri=ref, classes=[typ]) rn += sn return [indexnode, targetnode, rn], [] elif typ == 'rfc': @@ -85,135 +199,16 @@ def indexmarkup_role(typ, rawtext, etext, lineno, inliner, return [prb], [msg] ref = inliner.document.settings.rfc_base_url + inliner.rfc_url % rfcnum sn = nodes.strong('RFC '+text, 'RFC '+text) - rn = nodes.reference('', '', refuri=ref) + rn = nodes.reference('', '', refuri=ref, classes=[typ]) rn += sn return [indexnode, targetnode, rn], [] -roles.register_local_role('envvar', indexmarkup_role) -roles.register_local_role('pep', indexmarkup_role) -roles.register_local_role('rfc', indexmarkup_role) - - -# default is `literal` -innernodetypes = { - 'ref': nodes.emphasis, - 'term': nodes.emphasis, - 'token': nodes.strong, - 'envvar': nodes.strong, - 'download': nodes.strong, - 'option': addnodes.literal_emphasis, -} - -def _fix_parens(typ, text, env): - if typ in ('func', 'meth', 'cfunc'): - if text.endswith('()'): - # remove parentheses - text = text[:-2] - if env.config.add_function_parentheses: - # add them back to all occurrences if configured - text += '()' - return text - -def xfileref_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): - env = inliner.document.settings.env - if not typ: - typ = env.config.default_role - else: - typ = typ.lower() - text = utils.unescape(text) - # if the first character is a bang, don't cross-reference at all - if text[0:1] == '!': - text = _fix_parens(typ, text[1:], env) - return [innernodetypes.get(typ, nodes.literal)( - rawtext, text, classes=['xref'])], [] - # we want a cross-reference, create the reference node - nodeclass = (typ == 'download') and addnodes.download_reference or \ - addnodes.pending_xref - pnode = nodeclass(rawtext, reftype=typ, refcaption=False, - modname=env.currmodule, classname=env.currclass) - # we may need the line number for warnings - pnode.line = lineno - # the link title may differ from the target, but by default - # they are the same - title = target = text - titleistarget = True - # look if explicit title and target are given with `foo <bar>` syntax - brace = text.find('<') - if brace != -1: - titleistarget = False - pnode['refcaption'] = True - m = caption_ref_re.match(text) - if m: - target = m.group(2) - title = m.group(1) - else: - # fallback: everything after '<' is the target - target = text[brace+1:] - title = text[:brace] - # special target for Python object cross-references - if typ in ('data', 'exc', 'func', 'class', 'const', 'attr', - 'meth', 'mod', 'obj'): - # fix-up parentheses in link title - if titleistarget: - title = title.lstrip('.') # only has a meaning for the target - target = target.lstrip('~') # only has a meaning for the title - title = _fix_parens(typ, title, env) - # if the first character is a tilde, don't display the module/class - # parts of the contents - if title[0:1] == '~': - title = title[1:] - dot = title.rfind('.') - if dot != -1: - title = title[dot+1:] - # remove parentheses from the target too - if target.endswith('()'): - target = target[:-2] - # if the first character is a dot, search more specific namespaces first - # else search builtins first - if target[0:1] == '.': - target = target[1:] - pnode['refspecific'] = True - # some other special cases for the target - elif typ == 'option': - program = env.currprogram - if titleistarget: - if ' ' in title and not (title.startswith('/') or - title.startswith('-')): - program, target = re.split(' (?=-|--|/)', title, 1) - program = ws_re.sub('-', program) - target = target.strip() - elif ' ' in target: - program, target = re.split(' (?=-|--|/)', target, 1) - program = ws_re.sub('-', program) - pnode['refprogram'] = program - elif typ == 'term': - # normalize whitespace in definition terms (if the term reference is - # broken over a line, a newline will be in target) - target = ws_re.sub(' ', target).lower() - elif typ == 'ref': - # reST label names are always lowercased - target = ws_re.sub('', target).lower() - elif typ == 'cfunc': - # fix-up parens for C functions too - if titleistarget: - title = _fix_parens(typ, title, env) - # remove parentheses from the target too - if target.endswith('()'): - target = target[:-2] - else: - # remove all whitespace to avoid referencing problems - target = ws_re.sub('', target) - pnode['refdoc'] = env.docname - pnode['reftarget'] = target - pnode += innernodetypes.get(typ, nodes.literal)(rawtext, title, - classes=['xref']) - return [pnode], [] - def menusel_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): return [nodes.emphasis( - rawtext, - utils.unescape(text).replace('-->', u'\N{TRIANGULAR BULLET}'))], [] + rawtext, utils.unescape(text).replace('-->', u'\N{TRIANGULAR BULLET}'), + classes=[typ])], [] + return role _litvar_re = re.compile('{([^}]+)}') @@ -222,7 +217,7 @@ def emph_literal_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): text = utils.unescape(text) pos = 0 - retnode = nodes.literal(role=typ.lower()) + retnode = nodes.literal(role=typ.lower(), classes=[typ]) for m in _litvar_re.finditer(text): if m.start() > pos: txt = text[pos:m.start()] @@ -247,30 +242,13 @@ def abbr_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): specific_docroles = { - 'data': xfileref_role, - 'exc': xfileref_role, - 'func': xfileref_role, - 'class': xfileref_role, - 'const': xfileref_role, - 'attr': xfileref_role, - 'meth': xfileref_role, - 'obj': xfileref_role, - 'cfunc' : xfileref_role, - 'cmember': xfileref_role, - 'cdata': xfileref_role, - 'ctype': xfileref_role, - 'cmacro': xfileref_role, - - 'mod': xfileref_role, - - 'keyword': xfileref_role, - 'ref': xfileref_role, - 'token': xfileref_role, - 'term': xfileref_role, - 'option': xfileref_role, - 'doc': xfileref_role, - 'download': xfileref_role, + # links to download references + 'download': XRefRole(nodeclass=addnodes.download_reference), + # links to documents + 'doc': XRefRole(), + 'pep': indexmarkup_role, + 'rfc': indexmarkup_role, 'menuselection': menusel_role, 'file': emph_literal_role, 'samp': emph_literal_role, @@ -279,3 +257,10 @@ specific_docroles = { for rolename, func in specific_docroles.iteritems(): roles.register_local_role(rolename, func) + + +# backwards compatibility alias +def xfileref_role(*args, **kwds): + warnings.warn('xfileref_role is deprecated, use XRefRole', + DeprecationWarning, stacklevel=2) + return XRefRole()(*args, **kwds) diff --git a/sphinx/search.py b/sphinx/search.py index c0d3ab3c..f37d9402 100644 --- a/sphinx/search.py +++ b/sphinx/search.py @@ -13,8 +13,14 @@ import cPickle as pickle from docutils.nodes import comment, Text, NodeVisitor, SkipNode -from sphinx.util.stemmer import PorterStemmer from sphinx.util import jsdump, rpartition +try: + # http://bitbucket.org/methane/porterstemmer/ + from porterstemmer import Stemmer as CStemmer + CSTEMMER = True +except ImportError: + from sphinx.util.stemmer import PorterStemmer + CSTEMMER = False word_re = re.compile(r'\w+(?u)') @@ -61,15 +67,23 @@ class _JavaScriptIndex(object): js_index = _JavaScriptIndex() -class Stemmer(PorterStemmer): - """ - All those porter stemmer implementations look hideous. - make at least the stem method nicer. - """ +if CSTEMMER: + class Stemmer(CStemmer): + + def stem(self, word): + return self(word.lower()) + +else: + class Stemmer(PorterStemmer): + """ + All those porter stemmer implementations look hideous. + make at least the stem method nicer. + """ + + def stem(self, word): + word = word.lower() + return PorterStemmer.stem(self, word, 0, len(word) - 1) - def stem(self, word): - word = word.lower() - return PorterStemmer.stem(self, word, 0, len(word) - 1) class WordCollector(NodeVisitor): @@ -105,8 +119,10 @@ class IndexBuilder(object): self._titles = {} # stemmed word -> set(filenames) self._mapping = {} - # desctypes -> index - self._desctypes = {} + # objtype -> index + self._objtypes = {} + # objtype index -> objname (localized) + self._objnames = {} def load(self, stream, format): """Reconstruct from frozen data.""" @@ -124,7 +140,7 @@ class IndexBuilder(object): self._mapping[k] = set([index2fn[v]]) else: self._mapping[k] = set(index2fn[i] for i in v) - # no need to load keywords/desctypes + # no need to load keywords/objtypes def dump(self, stream, format): """Dump the frozen index to a stream.""" @@ -132,27 +148,32 @@ class IndexBuilder(object): format = self.formats[format] format.dump(self.freeze(), stream) - def get_modules(self, fn2index): - rv = {} - for name, (doc, _, _, _) in self.env.modules.iteritems(): - if doc in fn2index: - rv[name] = fn2index[doc] - return rv - - def get_descrefs(self, fn2index): + def get_objects(self, fn2index): rv = {} - dt = self._desctypes - for fullname, (doc, desctype) in self.env.descrefs.iteritems(): - if doc not in fn2index: - continue - prefix, name = rpartition(fullname, '.') - pdict = rv.setdefault(prefix, {}) - try: - i = dt[desctype] - except KeyError: - i = len(dt) - dt[desctype] = i - pdict[name] = (fn2index[doc], i) + otypes = self._objtypes + onames = self._objnames + for domainname, domain in self.env.domains.iteritems(): + for fullname, dispname, type, docname, anchor, prio in \ + domain.get_objects(): + # XXX use dispname? + if docname not in fn2index: + continue + if prio < 0: + continue + # XXX splitting at dot is kind of Python specific + prefix, name = rpartition(fullname, '.') + pdict = rv.setdefault(prefix, {}) + try: + i = otypes[domainname, type] + except KeyError: + i = len(otypes) + otypes[domainname, type] = i + otype = domain.object_types.get(type) + if otype: + onames[i] = str(otype.lname) # fire translation proxies + else: + onames[i] = type + pdict[name] = (fn2index[docname], i, prio) return rv def get_terms(self, fn2index): @@ -171,14 +192,13 @@ class IndexBuilder(object): filenames = self._titles.keys() titles = self._titles.values() fn2index = dict((f, i) for (i, f) in enumerate(filenames)) - return dict( - filenames=filenames, - titles=titles, - terms=self.get_terms(fn2index), - descrefs=self.get_descrefs(fn2index), - modules=self.get_modules(fn2index), - desctypes=dict((v, k) for (k, v) in self._desctypes.items()), - ) + terms = self.get_terms(fn2index) + objects = self.get_objects(fn2index) # populates _objtypes + objtypes = dict((v, k[0] + ':' + k[1]) + for (k, v) in self._objtypes.iteritems()) + objnames = self._objnames + return dict(filenames=filenames, titles=titles, terms=terms, + objects=objects, objtypes=objtypes, objnames=objnames) def prune(self, filenames): """Remove data for all filenames not in the list.""" @@ -197,11 +217,11 @@ class IndexBuilder(object): visitor = WordCollector(doctree) doctree.walk(visitor) - def add_term(word, prefix='', stem=self._stemmer.stem): + def add_term(word, stem=self._stemmer.stem): word = stem(word) if len(word) < 3 or word in stopwords or word.isdigit(): return - self._mapping.setdefault(prefix + word, set()).add(filename) + self._mapping.setdefault(word, set()).add(filename) for word in word_re.findall(title): add_term(word) diff --git a/sphinx/setup_command.py b/sphinx/setup_command.py index d569b031..e2d83bc6 100644 --- a/sphinx/setup_command.py +++ b/sphinx/setup_command.py @@ -22,7 +22,41 @@ from sphinx.util.console import darkred, nocolor, color_terminal class BuildDoc(Command): - """Distutils command to build Sphinx documentation.""" + """Distutils command to build Sphinx documentation. + + The Sphinx build can then be triggered from distutils, and some Sphinx + options can be set in ``setup.py`` or ``setup.cfg`` instead of Sphinx own + configuration file. + + For instance, from `setup.py`:: + + # this is only necessary when not using setuptools/distribute + from sphinx.setup_command import BuildDoc + cmdclass = {'build_sphinx': BuildDoc} + + name = 'My project' + version = 1.2 + release = 1.2.0 + setup( + name=name, + author='Bernard Montgomery', + version=release, + cmdclass={'build_sphinx': BuildDoc}, + # these are optional and override conf.py settings + command_options={ + 'build_sphinx': { + 'project': ('setup.py', name), + 'version': ('setup.py', version), + 'release': ('setup.py', release)}}, + ) + + Or add this section in ``setup.cfg``:: + + [build_sphinx] + project = 'My project' + version = 1.2 + release = 1.2.0 + """ description = 'Build Sphinx documentation' user_options = [ @@ -30,16 +64,27 @@ class BuildDoc(Command): ('all-files', 'a', 'build all files'), ('source-dir=', 's', 'Source directory'), ('build-dir=', None, 'Build directory'), + ('config-dir=', 'c', 'Location of the configuration directory'), ('builder=', 'b', 'The builder to use. Defaults to "html"'), - ] - boolean_options = ['fresh-env', 'all-files'] + ('project=', None, 'The documented project\'s name'), + ('version=', None, 'The short X.Y version'), + ('release=', None, 'The full version, including alpha/beta/rc tags'), + ('today=', None, 'How to format the current date, used as the ' + 'replacement for |today|'), + ('link-index', 'i', 'Link index.html to the master doc'), + ] + boolean_options = ['fresh-env', 'all-files', 'link-index'] def initialize_options(self): self.fresh_env = self.all_files = False self.source_dir = self.build_dir = None - self.conf_file_name = 'conf.py' self.builder = 'html' + self.version = '' + self.release = '' + self.today = '' + self.config_dir = None + self.link_index = False def _guess_source_dir(self): for guess in ('doc', 'docs'): @@ -48,13 +93,18 @@ class BuildDoc(Command): for root, dirnames, filenames in os.walk(guess): if 'conf.py' in filenames: return root + return None def finalize_options(self): if self.source_dir is None: self.source_dir = self._guess_source_dir() self.announce('Using source directory %s' % self.source_dir) self.ensure_dirname('source_dir') + if self.source_dir is None: + self.source_dir = os.curdir self.source_dir = os.path.abspath(self.source_dir) + if self.config_dir is None: + self.config_dir = self.source_dir if self.build_dir is None: build = self.get_finalized_command('build') @@ -74,9 +124,16 @@ class BuildDoc(Command): status_stream = StringIO() else: status_stream = sys.stdout - app = Sphinx(self.source_dir, self.source_dir, + confoverrides = {} + if self.version: + confoverrides['version'] = self.version + if self.release: + confoverrides['release'] = self.release + if self.today: + confoverrides['today'] = self.today + app = Sphinx(self.source_dir, self.config_dir, self.builder_target_dir, self.doctree_dir, - self.builder, {}, status_stream, + self.builder, confoverrides, status_stream, freshenv=self.fresh_env) try: @@ -92,3 +149,8 @@ class BuildDoc(Command): 'backslashreplace') else: raise + + if self.link_index: + src = app.config.master_doc + app.builder.out_suffix + dst = app.builder.get_outfilename('index') + os.symlink(src, dst) diff --git a/sphinx/texinputs/Makefile b/sphinx/texinputs/Makefile index 5c0d5018..d5a73f5b 100644 --- a/sphinx/texinputs/Makefile +++ b/sphinx/texinputs/Makefile @@ -37,7 +37,6 @@ bz2: tar latex $(LATEXOPTS) '$<' latex $(LATEXOPTS) '$<' -makeindex -s python.ist '$(basename $<).idx' - -makeindex -s python.ist '$(basename mod$<).idx' latex $(LATEXOPTS) '$<' latex $(LATEXOPTS) '$<' @@ -46,7 +45,6 @@ bz2: tar pdflatex $(LATEXOPTS) '$<' pdflatex $(LATEXOPTS) '$<' -makeindex -s python.ist '$(basename $<).idx' - -makeindex -s python.ist '$(basename mod$<).idx' pdflatex $(LATEXOPTS) '$<' pdflatex $(LATEXOPTS) '$<' diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 6b98d289..be8a6c15 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -6,7 +6,7 @@ % \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{sphinx}[2008/05/01 LaTeX package (Sphinx markup)] +\ProvidesPackage{sphinx}[2010/01/15 LaTeX package (Sphinx markup)] \RequirePackage{textcomp} \RequirePackage{fancyhdr} @@ -130,8 +130,6 @@ \newcommand{\samp}[1]{`\code{#1}'} \newcommand{\email}[1]{\textsf{#1}} -\newcommand{\py@modulebadkey}{{--just-some-junk--}} - % Redefine the Verbatim environment to allow border and background colors. % The original environment is still used for verbatims within tables. \let\OriginalVerbatim=\Verbatim @@ -142,12 +140,11 @@ \newlength\leftsidespace \def\mycolorbox#1{% \setlength\leftsidespace{\@totalleftmargin}% - \setlength\distancetoright{\textwidth}% + \setlength\distancetoright{\linewidth}% \advance\distancetoright -\@totalleftmargin % \noindent\hspace*{\@totalleftmargin}% \fcolorbox{VerbatimBorderColor}{VerbatimColor}{% \begin{minipage}{\distancetoright}% - \smallskip% \noindent\hspace*{-\leftsidespace}% #1 \end{minipage}% @@ -156,6 +153,9 @@ \def\FrameCommand{\mycolorbox} \renewcommand{\Verbatim}[1][1]{% + % list starts new par, but we don't want it to be set apart vertically + \bgroup\parskip=0pt% + \smallskip% % The list environement is needed to control perfectly the vertical % space. \list{}{% @@ -173,6 +173,8 @@ \endOriginalVerbatim% \endMakeFramed% \endlist% + % close group to restore \parskip + \egroup% } @@ -193,89 +195,12 @@ \index{#4!#1 #2 #3} } -% support for the module index -\newif\ifpy@UseModuleIndex -\py@UseModuleIndexfalse - -\newcommand{\makemodindex}{ - \newwrite\modindexfile - \openout\modindexfile=mod\jobname.idx - \py@UseModuleIndextrue -} - -\newcommand{\printmodindex}{ - \@input@{mod\jobname.ind} -} - -% Add the defining entry for a module -\newcommand{\py@modindex}[2]{% - \renewcommand{\py@thismodule}{#1} - \ifpy@UseModuleIndex% - \@ifundefined{py@modplat@\py@thismodulekey}{ - \write\modindexfile{\protect\indexentry{#1@{\texttt{#1}}|hyperpage}{\thepage}}% - }{\write\modindexfile{\protect\indexentry{#1@{\texttt{#1 }% - \emph{(\platformof{\py@thismodulekey})}}|hyperpage}{\thepage}}% - } - \fi% -} - -% "Current" keys -\newcommand{\py@thisclass}{} -\newcommand{\py@thismodule}{} -\newcommand{\py@thismodulekey}{} -\newcommand{\py@thismoduletype}{} -\newcommand{\py@emptymodule}{} - -% \declaremodule[key]{type}{name} -\newcommand{\declaremodule}[3][\py@modulebadkey]{ - \renewcommand{\py@thismoduletype}{#2} - \ifx\py@modulebadkey#1 - \renewcommand{\py@thismodulekey}{#3} - \else - \renewcommand{\py@thismodulekey}{#1} - \fi - \py@modindex{#3}{} - %\label{module-\py@thismodulekey} -} - -% Record module platforms for the Module Index -\newif\ifpy@ModPlatformFileIsOpen \py@ModPlatformFileIsOpenfalse -\long\def\py@writeModPlatformFile#1{% - \protected@write\py@ModPlatformFile% - {\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}% - {\string#1}% -} -\newcommand{\py@ModPlatformFilename}{\jobname.pla} -\newcommand{\platform}[1]{ - \ifpy@ModPlatformFileIsOpen\else - \newwrite\py@ModPlatformFile - \openout\py@ModPlatformFile=\py@ModPlatformFilename - \py@ModPlatformFileIsOpentrue - \fi - \py@writeModPlatformFile{\py@defplatform{\py@thismodulekey}{#1}} -} -\newcommand{\py@defplatform}[2]{\expandafter\def\csname py@modplat@#1\endcsname{#2}} -\newcommand{\platformof}[1]{\csname py@modplat@#1\endcsname} - -\InputIfFileExists{\jobname.pla}{}{} - % \moduleauthor{name}{email} \newcommand{\moduleauthor}[2]{} % \sectionauthor{name}{email} \newcommand{\sectionauthor}[2]{} -% Ignore module synopsis. -\newcommand{\modulesynopsis}[1]{} - -% Reset "current" objects. -\newcommand{\resetcurrentobjects}{ - \renewcommand{\py@thisclass}{} - \renewcommand{\py@thismodule}{} - \renewcommand{\py@thismodulekey}{} - \renewcommand{\py@thismoduletype}{} -} - % Augment the sectioning commands used to get our own font family in place, % and reset some internal data items: \titleformat{\section}{\Large\py@HeaderFamily}% @@ -287,14 +212,7 @@ \titleformat{\paragraph}{\large\py@HeaderFamily}% {\py@TitleColor}{0em}{\py@TitleColor}{\py@NormalColor} - -% Now for a lot of semantically-loaded environments that do a ton of magical -% things to get the right formatting and index entries for the stuff in -% Python modules and C API. - - -% {fulllineitems} is used in one place in libregex.tex, but is really for -% internal use in this file. +% {fulllineitems} is the main environment for object descriptions. % \newcommand{\py@itemnewline}[1]{% \@tempdima\linewidth% @@ -308,222 +226,19 @@ \let\makelabel=\py@itemnewline} }{\end{list}} -% \optional is mostly for use in the arguments parameters to the various -% {*desc} environments defined below, but may be used elsewhere. Known to -% be used in the debugger chapter. -% -% Typical usage: -% -% \begin{funcdesc}{myfunc}{reqparm\optional{, optparm}} -% ^^^ ^^^ -% No space here No space here -% -% When a function has multiple optional parameters, \optional should be -% nested, not chained. This is right: -% -% \begin{funcdesc}{myfunc}{\optional{parm1\optional{, parm2}}} -% -\let\py@badkey=\@undefined - +% \optional is used for ``[, arg]``, i.e. desc_optional nodes. \newcommand{\optional}[1]{% {\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}} -% This can be used when a function or method accepts an varying number -% of arguments, such as by using the *args syntax in the parameter list. -\newcommand{\py@moreargs}{...} - -% This can be used when you don't want to document the parameters to a -% function or method, but simply state that it's an alias for -% something else. -\newcommand{\py@unspecified}{...} - -\newcommand{\py@varvars}[1]{{% - {\let\unspecified=\py@unspecified% - \let\moreargs=\py@moreargs% - \emph{#1}}}} - \newlength{\py@argswidth} -\newcommand{\py@sigparams}[1]{% - \parbox[t]{\py@argswidth}{\py@varvars{#1}\code{)}}} -\newcommand{\py@sigline}[2]{% +\newcommand{\py@sigparams}[2]{% + \parbox[t]{\py@argswidth}{#1\code{)}#2}} +\newcommand{\pysigline}[1]{\item[#1]\nopagebreak} +\newcommand{\pysiglinewithargsret}[3]{% \settowidth{\py@argswidth}{#1\code{(}}% \addtolength{\py@argswidth}{-2\py@argswidth}% - \addtolength{\py@argswidth}{\textwidth}% - \item[#1\code{(}\py@sigparams{#2}]} - -% C functions ------------------------------------------------------------ -% \begin{cfuncdesc}[refcount]{type}{name}{arglist} -% Note that the [refcount] slot should only be filled in by -% tools/anno-api.py; it pulls the value from the refcounts database. -\newcommand{\cfuncline}[3]{ - \py@sigline{\code{#1 \bfcode{#2}}}{#3}% -} -\newenvironment{cfuncdesc}[3]{ - \begin{fulllineitems} - \cfuncline{#1}{#2}{#3} -}{\end{fulllineitems}} - -% C variables ------------------------------------------------------------ -% \begin{cvardesc}{type}{name} -\newenvironment{cvardesc}[2]{ - \begin{fulllineitems} - \item[\code{#1 \bfcode{#2}}] -}{\end{fulllineitems}} - -% C data types ----------------------------------------------------------- -% \begin{ctypedesc}[index name]{typedef name} -\newenvironment{ctypedesc}[2][\py@badkey]{ - \begin{fulllineitems} - \item[\bfcode{#2}] -}{\end{fulllineitems}} - -% C type fields ---------------------------------------------------------- -% \begin{cmemberdesc}{container type}{ctype}{membername} -\newcommand{\cmemberline}[3]{ - \item[\code{#2 \bfcode{#3}}] -} -\newenvironment{cmemberdesc}[3]{ - \begin{fulllineitems} - \cmemberline{#1}{#2}{#3} -}{\end{fulllineitems}} - -% Funky macros ----------------------------------------------------------- -% \begin{csimplemacrodesc}{name} -% -- "simple" because it has no args; NOT for constant definitions! -\newenvironment{csimplemacrodesc}[1]{ - \begin{fulllineitems} - \item[\bfcode{#1}] -}{\end{fulllineitems}} - -% simple functions (not methods) ----------------------------------------- -% \begin{funcdesc}{name}{args} -\newcommand{\funcline}[2]{% - \py@sigline{\bfcode{#1}}{#2}} -\newenvironment{funcdesc}[2]{ - \begin{fulllineitems} - \funcline{#1}{#2} -}{\end{fulllineitems}} - -% classes ---------------------------------------------------------------- -% \begin{classdesc}{name}{constructor args} -\newcommand{\classline}[2]{ - \py@sigline{\strong{class }\bfcode{#1}}{#2}} -\newenvironment{classdesc}[2]{ - % Using \renewcommand doesn't work for this, for unknown reasons: - \global\def\py@thisclass{#1} - \begin{fulllineitems} - \classline{#1}{#2} -}{\end{fulllineitems}} - -% \begin{excclassdesc}{name}{constructor args} -% but indexes as an exception -\newenvironment{excclassdesc}[2]{ - % Using \renewcommand doesn't work for this, for unknown reasons: - \global\def\py@thisclass{#1} - \begin{fulllineitems} - \py@sigline{\strong{exception }\bfcode{#1}}{#2}% -}{\end{fulllineitems}} - -% There is no corresponding {excclassdesc*} environment. To describe -% a class exception without parameters, use the {excdesc} environment. - - -\let\py@classbadkey=\@undefined - -% object method ---------------------------------------------------------- -% \begin{methoddesc}[classname]{methodname}{args} -\newcommand{\methodline}[3][\@undefined]{ - \py@sigline{\bfcode{#2}}{#3}} -\newenvironment{methoddesc}[3][\@undefined]{ - \begin{fulllineitems} - \ifx\@undefined#1\relax - \methodline{#2}{#3} - \else - \def\py@thisclass{#1} - \methodline{#2}{#3} - \fi -}{\end{fulllineitems}} - -% static method ---------------------------------------------------------- -% \begin{staticmethoddesc}[classname]{methodname}{args} -\newcommand{\staticmethodline}[3][\@undefined]{ - \py@sigline{static \bfcode{#2}}{#3}} -\newenvironment{staticmethoddesc}[3][\@undefined]{ - \begin{fulllineitems} - \ifx\@undefined#1\relax - \staticmethodline{#2}{#3} - \else - \def\py@thisclass{#1} - \staticmethodline{#2}{#3} - \fi -}{\end{fulllineitems}} - -% class method ---------------------------------------------------------- -% \begin{classmethoddesc}[classname]{methodname}{args} -\newcommand{\classmethodline}[3][\@undefined]{ - \py@sigline{class \bfcode{#2}}{#3}} -\newenvironment{classmethoddesc}[3][\@undefined]{ - \begin{fulllineitems} - \ifx\@undefined#1\relax - \classmethodline{#2}{#3} - \else - \def\py@thisclass{#1} - \classmethodline{#2}{#3} - \fi -}{\end{fulllineitems}} - -% object data attribute -------------------------------------------------- -% \begin{memberdesc}[classname]{membername} -\newcommand{\memberline}[2][\py@classbadkey]{% - \ifx\@undefined#1\relax - \item[\bfcode{#2}] - \else - \item[\bfcode{#2}] - \fi -} -\newenvironment{memberdesc}[2][\py@classbadkey]{ - \begin{fulllineitems} - \ifx\@undefined#1\relax - \memberline{#2} - \else - \def\py@thisclass{#1} - \memberline{#2} - \fi -}{\end{fulllineitems}} - -% For exceptions: -------------------------------------------------------- -% \begin{excdesc}{name} -% -- for constructor information, use excclassdesc instead -\newenvironment{excdesc}[1]{ - \begin{fulllineitems} - \item[\strong{exception }\bfcode{#1}] -}{\end{fulllineitems}} - -% Module data or constants: ---------------------------------------------- -% \begin{datadesc}{name} -\newcommand{\dataline}[1]{% - \item[\bfcode{#1}]\nopagebreak} -\newenvironment{datadesc}[1]{ - \begin{fulllineitems} - \dataline{#1} -}{\end{fulllineitems}} - -% bytecode instruction --------------------------------------------------- -% \begin{opcodedesc}{name}{var} -% -- {var} may be {} -\newenvironment{opcodedesc}[2]{ - \begin{fulllineitems} - \item[\bfcode{#1}\quad\emph{#2}] -}{\end{fulllineitems}} - -% generic description ---------------------------------------------------- -\newcommand{\descline}[1]{% - \item[\bfcode{#1}]\nopagebreak% -} -\newenvironment{describe}[1]{ - \begin{fulllineitems} - \descline{#1} -}{\end{fulllineitems}} + \addtolength{\py@argswidth}{\linewidth}% + \item[#1\code{(}\py@sigparams{#2}{#3}]} % This version is being checked in for the historical record; it shows % how I've managed to get some aspects of this to work. It will not @@ -533,9 +248,10 @@ % the example completely. % \newcommand{\grammartoken}[1]{\texttt{#1}} -\newenvironment{productionlist}[1][\py@badkey]{ +\newenvironment{productionlist}[1][\@undefined]{ \def\optional##1{{\Large[}##1{\Large]}} - \def\production##1##2{\code{##1}&::=&\code{##2}\\} + \def\production##1##2{\hypertarget{grammar-token-##1}{}% + \code{##1}&::=&\code{##2}\\} \def\productioncont##1{& &\code{##1}\\} \def\token##1{##1} \let\grammartoken=\token @@ -728,8 +444,8 @@ % Include hyperref last. \RequirePackage[colorlinks,breaklinks, linkcolor=InnerLinkColor,filecolor=OuterLinkColor, - menucolor=OuterLinkColor,pagecolor=OuterLinkColor, - urlcolor=OuterLinkColor,citecolor=InnerLinkColor]{hyperref} + menucolor=OuterLinkColor,urlcolor=OuterLinkColor, + citecolor=InnerLinkColor]{hyperref} % From docutils.writers.latex2e \providecommand{\DUspan}[2]{% diff --git a/sphinx/texinputs/howto.cls b/sphinx/texinputs/sphinxhowto.cls index 6844533a..1ebdd434 100644 --- a/sphinx/texinputs/howto.cls +++ b/sphinx/texinputs/sphinxhowto.cls @@ -1,14 +1,25 @@ % -% howto.cls for Sphinx +% sphinxhowto.cls for Sphinx (http://sphinx.pocoo.org/) % \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesClass{howto}[2008/10/18 Document class (Sphinx HOWTO)] +\ProvidesClass{sphinxhowto}[2009/06/02 Document class (Sphinx HOWTO)] -% Pass all given class options to the parent class. -\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} +% 'oneside' option overriding the 'twoside' default +\newif\if@oneside +\DeclareOption{oneside}{\@onesidetrue} +% Pass remaining document options to the parent class. +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\sphinxdocclass}} \ProcessOptions\relax -\LoadClass[twoside]{article} + +% Default to two-side document +\if@oneside +% nothing to do (oneside is the default) +\else +\PassOptionsToClass{twoside}{\sphinxdocclass} +\fi + +\LoadClass{\sphinxdocclass} % Set some sane defaults for section numbering depth and TOC depth. You can % reset these counters in your preamble. diff --git a/sphinx/texinputs/manual.cls b/sphinx/texinputs/sphinxmanual.cls index 2fb77c62..57517798 100644 --- a/sphinx/texinputs/manual.cls +++ b/sphinx/texinputs/sphinxmanual.cls @@ -1,14 +1,28 @@ % -% manual.cls for Sphinx +% sphinxmanual.cls for Sphinx (http://sphinx.pocoo.org/) % \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesClass{manual}[2008/10/18 Document class (Sphinx manual)] +\ProvidesClass{sphinxmanual}[2009/06/02 Document class (Sphinx manual)] -% Pass all given class options to the parent class. -\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}} +% chapters starting at odd pages (overridden by 'openany' document option) +\PassOptionsToClass{openright}{\sphinxdocclass} + +% 'oneside' option overriding the 'twoside' default +\newif\if@oneside +\DeclareOption{oneside}{\@onesidetrue} +% Pass remaining document options to the parent class. +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\sphinxdocclass}} \ProcessOptions\relax -\LoadClass[twoside,openright]{report} + +% Defaults two-side document +\if@oneside +% nothing to do (oneside is the default) +\else +\PassOptionsToClass{twoside}{\sphinxdocclass} +\fi + +\LoadClass{\sphinxdocclass} % Set some sane defaults for section numbering depth and TOC depth. You can % reset these counters in your preamble. diff --git a/sphinx/themes/agogo/layout.html b/sphinx/themes/agogo/layout.html new file mode 100644 index 00000000..f1429770 --- /dev/null +++ b/sphinx/themes/agogo/layout.html @@ -0,0 +1,91 @@ +{# + agogo/layout.html + ~~~~~~~~~~~~~~~~~ + + Sphinx layout template for the agogo theme, originally written + by Andi Albrecht. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} +{% extends "basic/layout.html" %} + +{% block header %} + <div class="header-wrapper"> + <div class="header"> + {%- if logo %} + <p class="logo"><a href="{{ pathto(master_doc) }}"> + <img class="logo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/> + </a></p> + {%- endif %} + {%- block headertitle %} + <h1><a href="{{ pathto(master_doc) }}">{{ shorttitle|e }}</a></h1> + {%- endblock %} + <div class="rel"> + {%- for rellink in rellinks %} + <a href="{{ pathto(rellink[0]) }}" title="{{ rellink[1]|striptags }}" + {{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a> + {%- if not loop.last %}{{ reldelim2 }}{% endif %} + {%- endfor %} + </div> + </div> + </div> +{% endblock %} + +{% block content %} + <div class="content-wrapper"> + <div class="content"> + <div class="document"> + {%- block document %} + {{ super() }} + {%- endblock %} + </div> + <div class="sidebar"> + {%- block sidebartoc %} + <h3>{{ _('Table Of Contents') }}</h3> + {{ toctree() }} + {%- endblock %} + {%- block sidebarsearch %} + <h3 style="margin-top: 1.5em;">{{ _('Search') }}</h3> + <form class="search" action="{{ pathto('search') }}" method="get"> + <input type="text" name="q" size="18" /> + <input type="submit" value="{{ _('Go') }}" /> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> + </form> + <p class="searchtip" style="font-size: 90%"> + {{ _('Enter search terms or a module, class or function name.') }} + </p> + {%- endblock %} + </div> + <div class="clearer"></div> + </div> + </div> +{% endblock %} + +{% block footer %} + <div class="footer-wrapper"> + <div class="footer"> + <div class="left"> + {%- for rellink in rellinks %} + <a href="{{ pathto(rellink[0]) }}" title="{{ rellink[1]|striptags }}" + {{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a> + {%- if not loop.last %}{{ reldelim2 }}{% endif %} + {%- endfor %} + {%- if show_source and has_source and sourcename %} + <br/> + <a href="{{ pathto('_sources/' + sourcename, true)|e }}" + rel="nofollow">{{ _('Show Source') }}</a> + {%- endif %} + </div> + + <div class="right"> + {{ super() }} + </div> + <div class="clearer"></div> + </div> + </div> +{% endblock %} + +{% block relbar1 %}{% endblock %} +{% block relbar2 %}{% endblock %} diff --git a/sphinx/themes/agogo/static/agogo.css_t b/sphinx/themes/agogo/static/agogo.css_t new file mode 100644 index 00000000..d2233dfb --- /dev/null +++ b/sphinx/themes/agogo/static/agogo.css_t @@ -0,0 +1,422 @@ +/* + * agogo.css_t + * ~~~~~~~~~~~ + * + * Sphinx stylesheet -- agogo theme. + * + * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +* { + margin: 0px; + padding: 0px; +} + +body { + font-family: {{ theme_bodyfont }}; + line-height: 1.4em; + font-size: 14px; + color: black; + background-color: {{ theme_bgcolor }}; +} + + +/* Page layout */ + +div.header, div.content, div.footer { + width: {{ theme_pagewidth }}; + margin-left: auto; + margin-right: auto; +} + +div.header-wrapper { + background: {{ theme_headerbg }}; + border-bottom: 3px solid #2e3436; +} + + +/* Default body styles */ +a { + color: {{ theme_linkcolor }}; +} + +div.bodywrapper a, div.footer a { + text-decoration: underline; +} + +.clearer { + clear: both; +} + +.left { + float: left; +} + +.right { + float: right; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +h1, h2, h3, h4 { + font-family: {{ theme_headerfont }}; + font-weight: normal; + color: {{ theme_headercolor2 }}; + margin-bottom: .8em; +} + +h1 { + color: {{ theme_headercolor1 }}; +} + +h2 { + padding-bottom: .5em; + border-bottom: 1px solid {{ theme_headercolor2 }}; +} + +a.headerlink { + visibility: hidden; + color: #dddddd; + padding-left: .3em; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink { + visibility: visible; +} + +img { + border: 0; +} + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 2px 7px 1px 7px; + border-left: 0.2em solid black; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +dt:target, .highlighted { + background-color: #fbe54e; +} + +/* Header */ + +div.header { + padding-top: 10px; + padding-bottom: 10px; +} + +div.header h1 { + font-family: {{ theme_headerfont }}; + font-weight: normal; + font-size: 160%; + letter-spacing: .08em; +} + +div.header h1 a { + color: white; +} + +div.header div.rel { + margin-top: 1em; +} + +div.header div.rel a { + color: {{ theme_headerlinkcolor }}; + letter-spacing: .1em; + text-transform: uppercase; +} + +p.logo { + float: right; +} + +img.logo { + border: 0; +} + + +/* Content */ +div.content-wrapper { + background-color: white; + padding-top: 20px; + padding-bottom: 20px; +} + +div.document { + width: {{ theme_documentwidth }}; + float: left; +} + +div.body { + padding-right: 2em; + text-align: {{ theme_textalign }}; +} + +div.document ul { + margin: 1.5em; + list-style-type: square; +} + +div.document dd { + margin-left: 1.2em; + margin-top: .4em; + margin-bottom: 1em; +} + +div.document .section { + margin-top: 1.7em; +} +div.document .section:first-child { + margin-top: 0px; +} + +div.document div.highlight { + padding: 3px; + background-color: #eeeeec; + border-top: 2px solid #dddddd; + border-bottom: 2px solid #dddddd; + margin-top: .8em; + margin-bottom: .8em; +} + +div.document h2 { + margin-top: .7em; +} + +div.document p { + margin-bottom: .5em; +} + +div.document li.toctree-l1 { + margin-bottom: 1em; +} + +div.document .descname { + font-weight: bold; +} + +div.document .docutils.literal { + background-color: #eeeeec; + padding: 1px; +} + +div.document .docutils.xref.literal { + background-color: transparent; + padding: 0px; +} + +div.document blockquote { + margin: 1em; +} + +div.document ol { + margin: 1.5em; +} + + +/* Sidebar */ + +div.sidebar { + width: {{ theme_sidebarwidth }}; + float: right; + font-size: .9em; +} + +div.sidebar a, div.header a { + text-decoration: none; +} + +div.sidebar a:hover, div.header a:hover { + text-decoration: underline; +} + +div.sidebar h3 { + color: #2e3436; + text-transform: uppercase; + font-size: 130%; + letter-spacing: .1em; +} + +div.sidebar ul { + list-style-type: none; +} + +div.sidebar li.toctree-l1 a { + display: block; + padding: 1px; + border: 1px solid #dddddd; + background-color: #eeeeec; + margin-bottom: .4em; + padding-left: 3px; + color: #2e3436; +} + +div.sidebar li.toctree-l2 a { + background-color: transparent; + border: none; + margin-left: 1em; + border-bottom: 1px solid #dddddd; +} + +div.sidebar li.toctree-l3 a { + background-color: transparent; + border: none; + margin-left: 2em; + border-bottom: 1px solid #dddddd; +} + +div.sidebar li.toctree-l2:last-child a { + border-bottom: none; +} + +div.sidebar li.toctree-l1.current a { + border-right: 5px solid {{ theme_headerlinkcolor }}; +} + +div.sidebar li.toctree-l1.current li.toctree-l2 a { + border-right: none; +} + + +/* Footer */ + +div.footer-wrapper { + background: {{ theme_footerbg }}; + border-top: 4px solid #babdb6; + padding-top: 10px; + padding-bottom: 10px; + min-height: 80px; +} + +div.footer, div.footer a { + color: #888a85; +} + +div.footer .right { + text-align: right; +} + +div.footer .left { + text-transform: uppercase; +} + + +/* Styles copied from basic theme */ + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li div.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable dl, table.indextable dd { + margin-top: 0; + margin-bottom: 0; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +/* -- viewcode extension ---------------------------------------------------- */ + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family:: {{ theme_bodyfont }}; +} + +div.viewcode-block:target { + margin: -1px -3px; + padding: 0 3px; + background-color: #f4debf; + border-top: 1px solid #ac9; + border-bottom: 1px solid #ac9; +} diff --git a/sphinx/themes/agogo/static/bgfooter.png b/sphinx/themes/agogo/static/bgfooter.png Binary files differnew file mode 100644 index 00000000..9ce5bdd9 --- /dev/null +++ b/sphinx/themes/agogo/static/bgfooter.png diff --git a/sphinx/themes/agogo/static/bgtop.png b/sphinx/themes/agogo/static/bgtop.png Binary files differnew file mode 100644 index 00000000..a0d4709b --- /dev/null +++ b/sphinx/themes/agogo/static/bgtop.png diff --git a/sphinx/themes/agogo/theme.conf b/sphinx/themes/agogo/theme.conf new file mode 100644 index 00000000..3fc88580 --- /dev/null +++ b/sphinx/themes/agogo/theme.conf @@ -0,0 +1,19 @@ +[theme] +inherit = basic +stylesheet = agogo.css +pygments_style = tango + +[options] +bodyfont = "Verdana", Arial, sans-serif +headerfont = "Georgia", "Times New Roman", serif +pagewidth = 70em +documentwidth = 50em +sidebarwidth = 20em +bgcolor = #eeeeec +headerbg = url(bgtop.png) top left repeat-x +footerbg = url(bgfooter.png) top left repeat-x +linkcolor = #ce5c00 +headercolor1 = #204a87 +headercolor2 = #3465a4 +headerlinkcolor = #fcaf3e +textalign = justify
\ No newline at end of file diff --git a/sphinx/themes/basic/defindex.html b/sphinx/themes/basic/defindex.html index 40f4f4c9..f337faec 100644 --- a/sphinx/themes/basic/defindex.html +++ b/sphinx/themes/basic/defindex.html @@ -1,3 +1,12 @@ +{# + basic/defindex.html + ~~~~~~~~~~~~~~~~~~~ + + Default template for the "index" page. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} {% extends "layout.html" %} {% set title = _('Overview') %} {% block body %} diff --git a/sphinx/themes/basic/domainindex.html b/sphinx/themes/basic/domainindex.html new file mode 100644 index 00000000..0aca7e69 --- /dev/null +++ b/sphinx/themes/basic/domainindex.html @@ -0,0 +1,57 @@ +{# + basic/domainindex.html + ~~~~~~~~~~~~~~~~~~~~~~ + + Template for domain indices (module index, ...). + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} +{% extends "layout.html" %} +{% set title = indextitle %} +{% block extrahead %} +{{ super() }} +{% if not embedded and collapse_index %} + <script type="text/javascript"> + DOCUMENTATION_OPTIONS.COLLAPSE_INDEX = true; + </script> +{% endif %} +{% endblock %} +{% block body %} + + {%- set curr_group = 0 %} + + <h1>{{ indextitle }}</h1> + + <div class="modindex-jumpbox"> + {%- for (letter, entries) in content %} + <a href="#cap-{{ letter }}"><strong>{{ letter }}</strong></a> + {%- if not loop.last %} | {% endif %} + {%- endfor %} + </div> + + <table class="indextable modindextable" cellspacing="0" cellpadding="2"> + {%- for letter, entries in content %} + <tr class="pcap"><td></td><td> </td><td></td></tr> + <tr class="cap"><td></td><td><a name="cap-{{ letter }}"> + <strong>{{ letter }}</strong></a></td><td></td></tr> + {%- for (name, grouptype, page, anchor, extra, qualifier, description) + in entries %} + {%- if grouptype == 1 %}{% set curr_group = curr_group + 1 %}{% endif %} + <tr{% if grouptype == 2 %} class="cg-{{ curr_group }}"{% endif %}> + <td>{% if grouptype == 1 -%} + <img src="{{ pathto('_static/minus.png', 1) }}" id="toggle-{{ curr_group }}" + class="toggler" style="display: none" alt="-" /> + {%- endif %}</td> + <td>{% if grouptype == 2 %} {% endif %} + {% if page %}<a href="{{ pathto(page) }}#{{ anchor }}">{% endif -%} + <tt class="xref">{{ name|e }}</tt> + {%- if page %}</a>{% endif %} + {%- if extra %} <em>({{ extra|e }})</em>{% endif -%} + </td><td>{% if qualifier %}<strong>{{ qualifier|e }}:</strong>{% endif %} + <em>{{ description|e }}</em></td></tr> + {%- endfor %} + {%- endfor %} + </table> + +{% endblock %} diff --git a/sphinx/themes/basic/genindex-single.html b/sphinx/themes/basic/genindex-single.html index 9aaaeb0c..1e98ba9c 100644 --- a/sphinx/themes/basic/genindex-single.html +++ b/sphinx/themes/basic/genindex-single.html @@ -1,36 +1,38 @@ +{# + basic/genindex-single.html + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Template for a "single" page of a split index. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} {% extends "layout.html" %} {% set title = _('Index') %} {% block body %} <h1 id="index">{% trans key=key %}Index – {{ key }}{% endtrans %}</h1> -<table width="100%" class="indextable"><tr><td width="33%" valign="top"> -<dl> -{%- set breakat = count // 2 %} -{%- set numcols = 1 %} -{%- set numitems = 0 %} -{% for entryname, (links, subitems) in entries %} -<dt>{%- if links -%}<a href="{{ links[0] }}">{{ entryname|e }}</a> - {%- for link in links[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor -%} - {%- else -%} -{{ entryname|e }} - {%- endif -%}</dt> - {%- if subitems %} - <dd><dl> +<table width="100%" class="indextable"><tr> + {%- for column in entries|slice(2) if column %} + <td width="33%" valign="top"><dl> + {%- for entryname, (links, subitems) in column %} + <dt>{% if links %}<a href="{{ links[0] }}">{{ entryname|e }}</a> + {%- for link in links[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor %} + {%- else %}{{ entryname|e }}{% endif %}</dt> + {%- if subitems %} + <dd><dl> {%- for subentryname, subentrylinks in subitems %} - <dt><a href="{{ subentrylinks[0] }}">{{ subentryname|e }}</a> - {%- for link in subentrylinks[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor -%} - </dt> + <dt><a href="{{ subentrylinks[0] }}">{{ subentryname|e }}</a> + {%- for link in subentrylinks[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor -%} + </dt> {%- endfor %} </dl></dd> {%- endif -%} -{%- set numitems = numitems + 1 + (subitems|length) -%} -{%- if numcols < 2 and numitems > breakat -%} -{%- set numcols = numcols+1 -%} -</dl></td><td width="33%" valign="top"><dl> -{%- endif -%} {%- endfor %} -</dl></td></tr></table> +</dl></td> +{%- endfor %} +</tr></table> {% endblock %} diff --git a/sphinx/themes/basic/genindex-split.html b/sphinx/themes/basic/genindex-split.html index ab099e5b..d068a96a 100644 --- a/sphinx/themes/basic/genindex-split.html +++ b/sphinx/themes/basic/genindex-split.html @@ -1,3 +1,12 @@ +{# + basic/genindex-split.html + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + Template for a "split" index overview page. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} {% extends "layout.html" %} {% set title = _('Index') %} {% block body %} @@ -6,6 +15,7 @@ <p>{{ _('Index pages by letter') }}:</p> + <div class="genindex-jumpbox"> <p>{% for key, dummy in genindexentries -%} <a href="{{ pathto('genindex-' + key) }}"><strong>{{ key }}</strong></a> {% if not loop.last %}| {% endif %} @@ -13,6 +23,7 @@ <p><a href="{{ pathto('genindex-all') }}"><strong>{{ _('Full index on one page') }}</strong> ({{ _('can be huge') }})</a></p> + </div> {% endblock %} diff --git a/sphinx/themes/basic/genindex.html b/sphinx/themes/basic/genindex.html index a19aa80f..4d46380f 100644 --- a/sphinx/themes/basic/genindex.html +++ b/sphinx/themes/basic/genindex.html @@ -1,44 +1,46 @@ +{# + basic/genindex.html + ~~~~~~~~~~~~~~~~~~~ + + Template for an "all-in-one" index. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} {% extends "layout.html" %} {% set title = _('Index') %} {% block body %} <h1 id="index">{{ _('Index') }}</h1> + <div class="genindex-jumpbox"> {% for key, dummy in genindexentries -%} <a href="#{{ key }}"><strong>{{ key }}</strong></a> {% if not loop.last %}| {% endif %} {%- endfor %} + </div> - <hr /> - - {% for key, entries in genindexentries %} + {%- for key, entries in genindexentries %} <h2 id="{{ key }}">{{ key }}</h2> -<table width="100%" class="indextable"><tr><td width="33%" valign="top"> -<dl> -{%- set breakat = genindexcounts[loop.index0] // 2 %} -{%- set numcols = 1 %} -{%- set numitems = 0 %} -{% for entryname, (links, subitems) in entries %} -<dt>{%- if links -%}<a href="{{ links[0] }}">{{ entryname|e }}</a> - {%- for link in links[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor -%} - {%- else -%} -{{ entryname|e }} - {%- endif -%}</dt> - {%- if subitems %} - <dd><dl> +<table width="100%" class="indextable genindextable"><tr> + {%- for column in entries|slice(2) if column %} + <td width="33%" valign="top"><dl> + {%- for entryname, (links, subitems) in column %} + <dt>{% if links %}<a href="{{ links[0] }}">{{ entryname|e }}</a> + {%- for link in links[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor %} + {%- else %}{{ entryname|e }}{% endif %}</dt> + {%- if subitems %} + <dd><dl> {%- for subentryname, subentrylinks in subitems %} - <dt><a href="{{ subentrylinks[0] }}">{{ subentryname|e }}</a> - {%- for link in subentrylinks[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor -%} - </dt> + <dt><a href="{{ subentrylinks[0] }}">{{ subentryname|e }}</a> + {%- for link in subentrylinks[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor -%} + </dt> {%- endfor %} </dl></dd> {%- endif -%} -{%- set numitems = numitems + 1 + (subitems|length) -%} -{%- if numcols < 2 and numitems > breakat -%} -{%- set numcols = numcols+1 -%} -</dl></td><td width="33%" valign="top"><dl> -{%- endif -%} {%- endfor %} -</dl></td></tr></table> +</dl></td> +{%- endfor %} +</tr></table> {% endfor %} {% endblock %} diff --git a/sphinx/themes/basic/globaltoc.html b/sphinx/themes/basic/globaltoc.html new file mode 100644 index 00000000..7422888c --- /dev/null +++ b/sphinx/themes/basic/globaltoc.html @@ -0,0 +1,11 @@ +{# + basic/globaltoc.html + ~~~~~~~~~~~~~~~~~~~~ + + Sphinx sidebar template: global table of contents. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} +<h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3> +{{ toctree() }} diff --git a/sphinx/themes/basic/layout.html b/sphinx/themes/basic/layout.html index 3380dbe1..ee51804f 100644 --- a/sphinx/themes/basic/layout.html +++ b/sphinx/themes/basic/layout.html @@ -1,9 +1,20 @@ +{# + basic/layout.html + ~~~~~~~~~~~~~~~~~ + + Master layout template for Sphinx themes. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} {%- block doctype -%} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> {%- endblock %} {%- set reldelim1 = reldelim1 is not defined and ' »' or reldelim1 %} {%- set reldelim2 = reldelim2 is not defined and ' |' or reldelim2 %} +{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and + (not sidebars == []) %} {%- set url_root = pathto('', 1) %} {%- if url_root == '#' %}{% set url_root = '' %}{% endif %} @@ -29,7 +40,7 @@ {%- endmacro %} {%- macro sidebar() %} - {%- if not embedded %}{% if not theme_nosidebar|tobool %} + {%- if render_sidebar %} <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> {%- block sidebarlogo %} @@ -39,76 +50,57 @@ </a></p> {%- endif %} {%- endblock %} - {%- block sidebartoc %} - {%- if display_toc %} - <h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3> - {{ toc }} - {%- endif %} - {%- endblock %} - {%- block sidebarrel %} - {%- if prev %} - <h4>{{ _('Previous topic') }}</h4> - <p class="topless"><a href="{{ prev.link|e }}" - title="{{ _('previous chapter') }}">{{ prev.title }}</a></p> - {%- endif %} - {%- if next %} - <h4>{{ _('Next topic') }}</h4> - <p class="topless"><a href="{{ next.link|e }}" - title="{{ _('next chapter') }}">{{ next.title }}</a></p> - {%- endif %} - {%- endblock %} - {%- block sidebarsourcelink %} - {%- if show_source and has_source and sourcename %} - <h3>{{ _('This Page') }}</h3> - <ul class="this-page-menu"> - <li><a href="{{ pathto('_sources/' + sourcename, true)|e }}" - rel="nofollow">{{ _('Show Source') }}</a></li> - </ul> - {%- endif %} - {%- endblock %} - {%- if customsidebar %} - {% include customsidebar %} + {%- if sidebars != None %} + {#- new style sidebar: explicitly include/exclude templates #} + {%- for sidebartemplate in sidebars %} + {%- include sidebartemplate %} + {%- endfor %} + {%- else %} + {#- old style sidebars: using blocks -- should be deprecated #} + {%- block sidebartoc %} + {%- include "localtoc.html" %} + {%- endblock %} + {%- block sidebarrel %} + {%- include "relations.html" %} + {%- endblock %} + {%- block sidebarsourcelink %} + {%- include "sourcelink.html" %} + {%- endblock %} + {%- if customsidebar %} + {%- include customsidebar %} + {%- endif %} + {%- block sidebarsearch %} + {%- include "searchbox.html" %} + {%- endblock %} {%- endif %} - {%- block sidebarsearch %} - {%- if pagename != "search" %} - <div id="searchbox" style="display: none"> - <h3>{{ _('Quick search') }}</h3> - <form class="search" action="{{ pathto('search') }}" method="get"> - <input type="text" name="q" size="18" /> - <input type="submit" value="{{ _('Go') }}" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> - <p class="searchtip" style="font-size: 90%"> - {{ _('Enter search terms or a module, class or function name.') }} - </p> - </div> - <script type="text/javascript">$('#searchbox').show(0);</script> - {%- endif %} - {%- endblock %} </div> </div> - {%- endif %}{% endif %} + {%- endif %} {%- endmacro %} <html xmlns="http://www.w3.org/1999/xhtml"> <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta http-equiv="Content-Type" content="text/html; charset={{ encoding }}" /> {{ metatags }} {%- if not embedded and docstitle %} {%- set titlesuffix = " — "|safe + docstitle|e %} {%- else %} {%- set titlesuffix = "" %} {%- endif %} + {%- block htmltitle %} <title>{{ title|striptags }}{{ titlesuffix }}</title> + {%- endblock %} <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" /> <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" /> + {%- for cssfile in css_files %} + <link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" /> + {%- endfor %} {%- if not embedded %} <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '{{ url_root }}', VERSION: '{{ release|e }}', - COLLAPSE_MODINDEX: false, + COLLAPSE_INDEX: false, FILE_SUFFIX: '{{ file_suffix }}', HAS_SOURCE: {{ has_source|lower }} }; @@ -156,35 +148,39 @@ {%- block relbar1 %}{{ relbar() }}{% endblock %} -{%- block sidebar1 %} {# possible location for sidebar #} {% endblock %} +{%- block content %} + {%- block sidebar1 %} {# possible location for sidebar #} {% endblock %} <div class="document"> -{%- block document %} + {%- block document %} <div class="documentwrapper"> - {%- if not embedded %}{% if not theme_nosidebar|tobool %} + {%- if render_sidebar %} <div class="bodywrapper"> - {%- endif %}{% endif %} + {%- endif %} <div class="body"> {% block body %} {% endblock %} </div> - {%- if not embedded %}{% if not theme_nosidebar|tobool %} + {%- if render_sidebar %} </div> - {%- endif %}{% endif %} + {%- endif %} </div> -{%- endblock %} + {%- endblock %} -{%- block sidebar2 %}{{ sidebar() }}{% endblock %} + {%- block sidebar2 %}{{ sidebar() }}{% endblock %} <div class="clearer"></div> </div> +{%- endblock %} {%- block relbar2 %}{{ relbar() }}{% endblock %} {%- block footer %} <div class="footer"> - {%- if hasdoc('copyright') %} - {% trans path=pathto('copyright'), copyright=copyright|e %}© <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %} - {%- else %} - {% trans copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %} + {%- if show_copyright %} + {%- if hasdoc('copyright') %} + {% trans path=pathto('copyright'), copyright=copyright|e %}© <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %} + {%- else %} + {% trans copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %} + {%- endif %} {%- endif %} {%- if last_updated %} {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %} diff --git a/sphinx/themes/basic/localtoc.html b/sphinx/themes/basic/localtoc.html new file mode 100644 index 00000000..896eda9c --- /dev/null +++ b/sphinx/themes/basic/localtoc.html @@ -0,0 +1,13 @@ +{# + basic/localtoc.html + ~~~~~~~~~~~~~~~~~~~ + + Sphinx sidebar template: local table of contents. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} +{%- if display_toc %} + <h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3> + {{ toc }} +{%- endif %} diff --git a/sphinx/themes/basic/modindex.html b/sphinx/themes/basic/modindex.html deleted file mode 100644 index 0392edc8..00000000 --- a/sphinx/themes/basic/modindex.html +++ /dev/null @@ -1,42 +0,0 @@ -{% extends "layout.html" %} -{% set title = _('Global Module Index') %} -{% block extrahead %} -{{ super() }} -{% if not embedded and collapse_modindex %} - <script type="text/javascript"> - DOCUMENTATION_OPTIONS.COLLAPSE_MODINDEX = true; - </script> -{% endif %} -{% endblock %} -{% block body %} - - <h1 id="global-module-index">{{ _('Global Module Index') }}</h1> - - {%- for letter in letters %} - <a href="#cap-{{ letter }}"><strong>{{ letter }}</strong></a> {% if not loop.last %}| {% endif %} - {%- endfor %} - <hr/> - - <table width="100%" class="indextable" cellspacing="0" cellpadding="2"> - {%- for modname, collapse, cgroup, indent, fname, synops, pform, dep, stripped in modindexentries %} - {%- if not modname -%} - <tr class="pcap"><td></td><td> </td><td></td></tr> - <tr class="cap"><td></td><td><a name="cap-{{ fname }}"><strong>{{ fname }}</strong></a></td><td></td></tr> - {%- else -%} - <tr{% if indent %} class="cg-{{ cgroup }}"{% endif %}> - <td>{% if collapse -%} - <img src="{{ pathto('_static/minus.png', 1) }}" id="toggle-{{ cgroup }}" - class="toggler" style="display: none" alt="-" /> - {%- endif %}</td> - <td>{% if indent %} {% endif %} - {% if fname %}<a href="{{ fname }}">{% endif -%} - <tt class="xref">{{ stripped|e }}{{ modname|e }}</tt> - {%- if fname %}</a>{% endif %} - {%- if pform and pform[0] %} <em>({{ pform|join(', ') }})</em>{% endif -%} - </td><td>{% if dep %}<strong>{{ _('Deprecated')}}:</strong>{% endif %} - <em>{{ synops|e }}</em></td></tr> - {%- endif -%} - {% endfor %} - </table> - -{% endblock %} diff --git a/sphinx/themes/basic/page.html b/sphinx/themes/basic/page.html index 17a93016..c7188fa5 100644 --- a/sphinx/themes/basic/page.html +++ b/sphinx/themes/basic/page.html @@ -1,3 +1,12 @@ +{# + basic/page.html + ~~~~~~~~~~~~~~~ + + Master template for simple pages. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} {% extends "layout.html" %} {% block body %} {{ body }} diff --git a/sphinx/themes/basic/relations.html b/sphinx/themes/basic/relations.html new file mode 100644 index 00000000..b693daf8 --- /dev/null +++ b/sphinx/themes/basic/relations.html @@ -0,0 +1,19 @@ +{# + basic/relations.html + ~~~~~~~~~~~~~~~~~~~~ + + Sphinx sidebar template: relation links. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} +{%- if prev %} + <h4>{{ _('Previous topic') }}</h4> + <p class="topless"><a href="{{ prev.link|e }}" + title="{{ _('previous chapter') }}">{{ prev.title }}</a></p> +{%- endif %} +{%- if next %} + <h4>{{ _('Next topic') }}</h4> + <p class="topless"><a href="{{ next.link|e }}" + title="{{ _('next chapter') }}">{{ next.title }}</a></p> +{%- endif %} diff --git a/sphinx/themes/basic/search.html b/sphinx/themes/basic/search.html index 96c40652..eac32605 100644 --- a/sphinx/themes/basic/search.html +++ b/sphinx/themes/basic/search.html @@ -1,3 +1,12 @@ +{# + basic/search.html + ~~~~~~~~~~~~~~~~~ + + Template for the search page. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} {% extends "layout.html" %} {% set title = _('Search') %} {% set script_files = script_files + ['_static/searchtools.js'] %} diff --git a/sphinx/themes/basic/searchbox.html b/sphinx/themes/basic/searchbox.html new file mode 100644 index 00000000..56d6617c --- /dev/null +++ b/sphinx/themes/basic/searchbox.html @@ -0,0 +1,24 @@ +{# + basic/searchbox.html + ~~~~~~~~~~~~~~~~~~~~ + + Sphinx sidebar template: quick search box. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} +{%- if pagename != "search" %} +<div id="searchbox" style="display: none"> + <h3>{{ _('Quick search') }}</h3> + <form class="search" action="{{ pathto('search') }}" method="get"> + <input type="text" name="q" size="18" /> + <input type="submit" value="{{ _('Go') }}" /> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> + </form> + <p class="searchtip" style="font-size: 90%"> + {{ _('Enter search terms or a module, class or function name.') }} + </p> +</div> +<script type="text/javascript">$('#searchbox').show(0);</script> +{%- endif %} diff --git a/sphinx/themes/basic/sourcelink.html b/sphinx/themes/basic/sourcelink.html new file mode 100644 index 00000000..8fa7563b --- /dev/null +++ b/sphinx/themes/basic/sourcelink.html @@ -0,0 +1,16 @@ +{# + basic/sourcelink.html + ~~~~~~~~~~~~~~~~~~~~~ + + Sphinx sidebar template: "show source" link. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} +{%- if show_source and has_source and sourcename %} + <h3>{{ _('This Page') }}</h3> + <ul class="this-page-menu"> + <li><a href="{{ pathto('_sources/' + sourcename, true)|e }}" + rel="nofollow">{{ _('Show Source') }}</a></li> + </ul> +{%- endif %} diff --git a/sphinx/themes/basic/static/basic.css b/sphinx/themes/basic/static/basic.css index a04d6545..7cfacd5b 100644 --- a/sphinx/themes/basic/static/basic.css +++ b/sphinx/themes/basic/static/basic.css @@ -1,6 +1,12 @@ -/** - * Sphinx stylesheet -- basic theme - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * */ /* -- main layout ----------------------------------------------------------- */ @@ -127,6 +133,10 @@ span.linkdescr { /* -- general index --------------------------------------------------------- */ +table.indextable { + width: 100%; +} + table.indextable td { text-align: left; vertical-align: top; @@ -152,6 +162,20 @@ img.toggler { cursor: pointer; } +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + /* -- general body styles --------------------------------------------------- */ a.headerlink { @@ -252,7 +276,7 @@ table.docutils { } table.docutils td, table.docutils th { - padding: 1px 8px 1px 0; + padding: 1px 8px 1px 5px; border-top: 0; border-left: 0; border-right: 0; @@ -292,7 +316,7 @@ dd { margin-left: 30px; } -dt:target, .highlight { +dt:target, .highlighted { background-color: #fbe54e; } @@ -384,6 +408,20 @@ h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { background-color: transparent; } +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + /* -- math display ---------------------------------------------------------- */ img.math { diff --git a/sphinx/themes/basic/static/doctools.js b/sphinx/themes/basic/static/doctools.js index 9447678c..23e217c3 100644 --- a/sphinx/themes/basic/static/doctools.js +++ b/sphinx/themes/basic/static/doctools.js @@ -1,16 +1,31 @@ -/// XXX: make it cross browser +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Sphinx JavaScript utilties for all documentation. + * + * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/** + * select a different prefix for underscore + */ +$u = _.noConflict(); /** * make the code below compatible with browsers without * an installed firebug like debugger - */ if (!window.console || !console.firebug) { - var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", - "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", + "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", + "profile", "profileEnd"]; window.console = {}; for (var i = 0; i < names.length; ++i) - window.console[names[i]] = function() {} + window.console[names[i]] = function() {}; } + */ /** * small helper function to urldecode strings @@ -44,7 +59,7 @@ jQuery.getQueryParameters = function(s) { result[key] = [value]; } return result; -} +}; /** * small function to check if an array contains @@ -56,7 +71,7 @@ jQuery.contains = function(arr, item) { return true; } return false; -} +}; /** * highlight a given string on a jquery object by wrapping it in @@ -67,7 +82,7 @@ jQuery.fn.highlightText = function(text, className) { if (node.nodeType == 3) { var val = node.nodeValue; var pos = val.toLowerCase().indexOf(text); - if (pos >= 0 && !jQuery.className.has(node.parentNode, className)) { + if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { var span = document.createElement("span"); span.className = className; span.appendChild(document.createTextNode(val.substr(pos, text.length))); @@ -79,14 +94,14 @@ jQuery.fn.highlightText = function(text, className) { } else if (!jQuery(node).is("button, select, textarea")) { jQuery.each(node.childNodes, function() { - highlight(this) + highlight(this); }); } } return this.each(function() { highlight(this); }); -} +}; /** * Small JavaScript module for the documentation. @@ -96,7 +111,7 @@ var Documentation = { init : function() { this.fixFirefoxAnchorBug(); this.highlightSearchWords(); - this.initModIndex(); + this.initIndexTable(); }, /** @@ -167,7 +182,7 @@ var Documentation = { var body = $('div.body'); window.setTimeout(function() { $.each(terms, function() { - body.highlightText(this.toLowerCase(), 'highlight'); + body.highlightText(this.toLowerCase(), 'highlighted'); }); }, 10); $('<li class="highlight-link"><a href="javascript:Documentation.' + @@ -177,19 +192,19 @@ var Documentation = { }, /** - * init the modindex toggle buttons + * init the domain index toggle buttons */ - initModIndex : function() { + initIndexTable : function() { var togglers = $('img.toggler').click(function() { var src = $(this).attr('src'); var idnum = $(this).attr('id').substr(7); - console.log($('tr.cg-' + idnum).toggle()); + $('tr.cg-' + idnum).toggle(); if (src.substr(-9) == 'minus.png') $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); else $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); }).css('display', ''); - if (DOCUMENTATION_OPTIONS.COLLAPSE_MODINDEX) { + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { togglers.click(); } }, @@ -199,7 +214,7 @@ var Documentation = { */ hideSearchWords : function() { $('.sidebar .this-page-menu li.highlight-link').fadeOut(300); - $('span.highlight').removeClass('highlight'); + $('span.highlighted').removeClass('highlighted'); }, /** diff --git a/sphinx/themes/basic/static/jquery.js b/sphinx/themes/basic/static/jquery.js index 82b98e1d..5c70e4c5 100644 --- a/sphinx/themes/basic/static/jquery.js +++ b/sphinx/themes/basic/static/jquery.js @@ -1,32 +1,151 @@ -/* - * jQuery 1.2.6 - New Wave Javascript +/*! + * jQuery JavaScript Library v1.4 + * http://jquery.com/ * - * Copyright (c) 2008 John Resig (jquery.com) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://docs.jquery.com/License * - * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ - * $Rev: 5685 $ + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Wed Jan 13 15:23:05 2010 -0500 */ -(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else -return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else -return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else -selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else -return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else -this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else -return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else -jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&©&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else -script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else -for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else -for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else -jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else -ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else -while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else -while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else -for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else -jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else -xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else -jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else -for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else -s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else -e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();
\ No newline at end of file +(function(A,w){function oa(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(oa,1);return}c.ready()}}function La(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function $(a,b,d,f,e,i){var j=a.length;if(typeof b==="object"){for(var o in b)$(a,o,b[o],f,e,d);return a}if(d!==w){f=!i&&f&&c.isFunction(d);for(o=0;o<j;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,i);return a}return j? +e(a[0],b):null}function K(){return(new Date).getTime()}function aa(){return false}function ba(){return true}function pa(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function qa(a){var b=true,d=[],f=[],e=arguments,i,j,o,p,n,t=c.extend({},c.data(this,"events").live);for(p in t){j=t[p];if(j.live===a.type||j.altLive&&c.inArray(a.type,j.altLive)>-1){i=j.data;i.beforeFilter&&i.beforeFilter[a.type]&&!i.beforeFilter[a.type](a)||f.push(j.selector)}else delete t[p]}i=c(a.target).closest(f,a.currentTarget); +n=0;for(l=i.length;n<l;n++)for(p in t){j=t[p];o=i[n].elem;f=null;if(i[n].selector===j.selector){if(j.live==="mouseenter"||j.live==="mouseleave")f=c(a.relatedTarget).closest(j.selector)[0];if(!f||f!==o)d.push({elem:o,fn:j})}}n=0;for(l=d.length;n<l;n++){i=d[n];a.currentTarget=i.elem;a.data=i.fn.data;if(i.fn.apply(i.elem,e)===false){b=false;break}}return b}function ra(a,b){return["live",a,b.replace(/\./g,"`").replace(/ /g,"&")].join(".")}function sa(a){return!a||!a.parentNode||a.parentNode.nodeType=== +11}function ta(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var i in f)for(var j in f[i])c.event.add(this,i,f[i][j],f[i][j].data)}}})}function ua(a,b,d){var f,e,i;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0){e=true;if(i=c.fragments[a[0]])if(i!==1)f=i}if(!f){b=b&&b[0]?b[0].ownerDocument||b[0]:s;f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]= +i?f:1;return{fragment:f,cacheable:e}}function T(a){for(var b=0,d,f;(d=a[b])!=null;b++)if(!c.noData[d.nodeName.toLowerCase()]&&(f=d[H]))delete c.cache[f]}function L(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ma=A.jQuery,Na=A.$,s=A.document,U,Oa=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Pa=/^.[^:#\[\.,]*$/,Qa=/\S/, +Ra=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Sa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],M,ca=Object.prototype.toString,da=Object.prototype.hasOwnProperty,ea=Array.prototype.push,R=Array.prototype.slice,V=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(typeof a==="string")if((d=Oa.exec(a))&&(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Sa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])]; +c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=ua([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return U.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a)}else return!b||b.jquery?(b||U).find(a):c(b).find(a);else if(c.isFunction(a))return U.ready(a);if(a.selector!==w){this.selector=a.selector; +this.context=a.context}return c.isArray(a)?this.setArray(a):c.makeArray(a,this)},selector:"",jquery:"1.4",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){a=c(a||null);a.prevObject=this;a.context=this.context;if(b==="find")a.selector=this.selector+(this.selector?" ":"")+d;else if(b)a.selector=this.selector+"."+b+"("+d+")";return a},setArray:function(a){this.length= +0;ea.apply(this,a);return this},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject|| +c(null)},push:ea,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,i,j,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(i in e){j=a[i];o=e[i];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){j=j&&(c.isPlainObject(j)||c.isArray(j))?j:c.isArray(o)?[]:{};a[i]=c.extend(f,j,o)}else if(o!==w)a[i]= +o}return a};c.extend({noConflict:function(a){A.$=Na;if(a)A.jQuery=Ma;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",M,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange", +M);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&oa()}}},isFunction:function(a){return ca.call(a)==="[object Function]"},isArray:function(a){return ca.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||ca.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!da.call(a,"constructor")&&!da.call(a.constructor.prototype,"isPrototypeOf"))return false;var b;for(b in a);return b===w||da.call(a,b)}, +isEmptyObject:function(a){for(var b in a)return false;return true},noop:function(){},globalEval:function(a){if(a&&Qa.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,i=a.length,j=i===w||c.isFunction(a); +if(d)if(j)for(f in a){if(b.apply(a[f],d)===false)break}else for(;e<i;){if(b.apply(a[e++],d)===false)break}else if(j)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<i&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Ra,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ea.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d= +0,f=b.length;d<f;d++)if(b[d]===a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,i=a.length;e<i;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,i=0,j=a.length;i<j;i++){e=b(a[i],i,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b=== +"string"){d=a;a=d[b];b=w}else if(b&&!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){var b={browser:""};a=a.toLowerCase();if(/webkit/.test(a))b={browser:"webkit",version:/webkit[\/ ]([\w.]+)/};else if(/opera/.test(a))b={browser:"opera",version:/version/.test(a)?/version[\/ ]([\w.]+)/:/opera[\/ ]([\w.]+)/};else if(/msie/.test(a))b={browser:"msie",version:/msie ([\w.]+)/};else if(/mozilla/.test(a)&& +!/compatible/.test(a))b={browser:"mozilla",version:/rv:([\w.]+)/};b.version=(b.version&&b.version.exec(a)||[0,"0"])[1];return b},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=true;if(V)c.inArray=function(a,b){return V.call(b,a)};U=c(s);if(s.addEventListener)M=function(){s.removeEventListener("DOMContentLoaded",M,false);c.ready()};else if(s.attachEvent)M=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange", +M);c.ready()}};if(V)c.inArray=function(a,b){return V.call(b,a)};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+K();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=d.getElementsByTagName("*"),i=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!i)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length, +htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55$/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(j){}a.insertBefore(b, +a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function o(){c.support.noCloneEvent=false;d.detachEvent("onclick",o)});d.cloneNode(true).fireEvent("onclick")}c(function(){var o=s.createElement("div");o.style.width=o.style.paddingLeft="1px";s.body.appendChild(o);c.boxModel=c.support.boxModel=o.offsetWidth===2;s.body.removeChild(o).style.display="none"});a=function(o){var p=s.createElement("div");o="on"+o;var n=o in +p;if(!n){p.setAttribute(o,"return;");n=typeof p[o]==="function"}return n};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=i=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var H="jQuery"+K(),Ta=0,ya={},Ua={};c.extend({cache:{},expando:H,noData:{embed:true,object:true,applet:true},data:function(a, +b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?ya:a;var f=a[H],e=c.cache;if(!b&&!f)return null;f||(f=++Ta);if(typeof b==="object"){a[H]=f;e=e[f]=c.extend(true,{},b)}else e=e[f]?e[f]:typeof d==="undefined"?Ua:(e[f]={});if(d!==w){a[H]=f;e[b]=d}return typeof b==="string"?e[b]:e}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?ya:a;var d=a[H],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{try{delete a[H]}catch(i){a.removeAttribute&& +a.removeAttribute(H)}delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,a,b)})},removeData:function(a){return this.each(function(){c.removeData(this, +a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this, +a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var za=/[\n\t]/g,fa=/\s+/,Va=/\r/g,Wa=/href|src|style/,Xa=/(button|input)/i,Ya=/(button|input|object|select|textarea)/i,Za=/^(a|area)$/i,Aa=/radio|checkbox/;c.fn.extend({attr:function(a, +b){return $(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(p){var n=c(this);n.addClass(a.call(this,p,n.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(fa),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className)for(var i=" "+e.className+" ",j=0,o=b.length;j<o;j++){if(i.indexOf(" "+b[j]+" ")<0)e.className+= +" "+b[j]}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(p){var n=c(this);n.removeClass(a.call(this,p,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(fa),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var i=(" "+e.className+" ").replace(za," "),j=0,o=b.length;j<o;j++)i=i.replace(" "+b[j]+" "," ");e.className=i.substring(1,i.length-1)}else e.className=""}return this},toggleClass:function(a, +b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var i=c(this);i.toggleClass(a.call(this,e,i.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,i=0,j=c(this),o=b,p=a.split(fa);e=p[i++];){o=f?o:!j.hasClass(e);j[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a= +" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(za," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var i=b?d:0;for(d=b?d+1:e.length;i<d;i++){var j=e[i];if(j.selected){a=c(j).val();if(b)return a;f.push(a)}}return f}if(Aa.test(b.type)&& +!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Va,"")}return w}var o=c.isFunction(a);return this.each(function(p){var n=c(this),t=a;if(this.nodeType===1){if(o)t=a.call(this,p,n.val());if(typeof t==="number")t+="";if(c.isArray(t)&&Aa.test(this.type))this.checked=c.inArray(n.val(),t)>=0;else if(c.nodeName(this,"select")){var z=c.makeArray(t);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),z)>=0});if(!z.length)this.selectedIndex= +-1}else this.value=t}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var i=Wa.test(b);if(b in a&&f&&!i){if(e){if(b==="type"&&Xa.test(a.nodeName)&&a.parentNode)throw"type property can't be changed";a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue; +if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Ya.test(a.nodeName)||Za.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&i?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var $a=function(a){return a.replace(/[^\w\s\.\|`]/g,function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType=== +3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;if(!d.guid)d.guid=c.guid++;if(f!==w){d=c.proxy(d);d.data=f}var e=c.data(a,"events")||c.data(a,"events",{}),i=c.data(a,"handle"),j;if(!i){j=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(j.elem,arguments):w};i=c.data(a,"handle",j)}if(i){i.elem=a;b=b.split(/\s+/);for(var o,p=0;o=b[p++];){var n=o.split(".");o=n.shift();d.type=n.slice(0).sort().join(".");var t=e[o],z=this.special[o]||{};if(!t){t=e[o]={}; +if(!z.setup||z.setup.call(a,f,n,d)===false)if(a.addEventListener)a.addEventListener(o,i,false);else a.attachEvent&&a.attachEvent("on"+o,i)}if(z.add)if((n=z.add.call(a,d,f,n,t))&&c.isFunction(n)){n.guid=n.guid||d.guid;d=n}t[d.guid]=d;this.global[o]=true}a=null}}},global:{},remove:function(a,b,d){if(!(a.nodeType===3||a.nodeType===8)){var f=c.data(a,"events"),e,i,j;if(f){if(b===w||typeof b==="string"&&b.charAt(0)===".")for(i in f)this.remove(a,i+(b||""));else{if(b.type){d=b.handler;b=b.type}b=b.split(/\s+/); +for(var o=0;i=b[o++];){var p=i.split(".");i=p.shift();var n=!p.length,t=c.map(p.slice(0).sort(),$a);t=new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.)?")+"(\\.|$)");var z=this.special[i]||{};if(f[i]){if(d){j=f[i][d.guid];delete f[i][d.guid]}else for(var B in f[i])if(n||t.test(f[i][B].type))delete f[i][B];z.remove&&z.remove.call(a,p,j);for(e in f[i])break;if(!e){if(!z.teardown||z.teardown.call(a,p)===false)if(a.removeEventListener)a.removeEventListener(i,c.data(a,"handle"),false);else a.detachEvent&&a.detachEvent("on"+ +i,c.data(a,"handle"));e=null;delete f[i]}}}}for(e in f)break;if(!e){if(B=c.data(a,"handle"))B.elem=null;c.removeData(a,"events");c.removeData(a,"handle")}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[H]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();this.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType=== +8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;var i=c.data(d,"handle");i&&i.apply(d,b);var j,o;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()])){j=d[e];o=d["on"+e]}}catch(p){}i=c.nodeName(d,"a")&&e==="click";if(!f&&j&&!a.isDefaultPrevented()&&!i){this.triggered=true;try{d[e]()}catch(n){}}else if(o&&d["on"+e].apply(d,b)===false)a.result=false;this.triggered=false;if(!a.isPropagationStopped())(d=d.parentNode||d.ownerDocument)&&c.event.trigger(a,b,d,true)}, +handle:function(a){var b,d;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;d=a.type.split(".");a.type=d.shift();b=!d.length&&!a.exclusive;var f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");d=(c.data(this,"events")||{})[a.type];for(var e in d){var i=d[e];if(b||f.test(i.type)){a.handler=i;a.data=i.data;i=i.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}return a.result}, +props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[H])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement|| +s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&& +a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a,b){c.extend(a,b||{});a.guid+=b.selector+b.live;c.event.add(this,b.live,qa,b)},remove:function(a){if(a.length){var b=0,d=new RegExp("(^|\\.)"+a[0]+"(\\.|$)");c.each(c.data(this,"events").live||{},function(){d.test(this.type)&&b++});b<1&&c.event.remove(this,a[0],qa)}},special:{}},beforeunload:{setup:function(a, +b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=K();this[H]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=ba;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped= +ba;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ba;this.stopPropagation()},isDefaultPrevented:aa,isPropagationStopped:aa,isImmediatePropagationStopped:aa};var Ba=function(a){for(var b=a.relatedTarget;b&&b!==this;)try{b=b.parentNode}catch(d){break}if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}},Ca=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover", +mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ca:Ba,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ca:Ba)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(a,b,d){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="submit"||i==="image")&&c(e).closest("form").length)return pa("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit."+ +d.guid,function(f){var e=f.target,i=e.type;if((i==="text"||i==="password")&&c(e).closest("form").length&&f.keyCode===13)return pa("submit",this,arguments)})}else return false},remove:function(a,b){c.event.remove(this,"click.specialSubmit"+(b?"."+b.guid:""));c.event.remove(this,"keypress.specialSubmit"+(b?"."+b.guid:""))}};if(!c.support.changeBubbles){var ga=/textarea|input|select/i;function Da(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex> +-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d}function ha(a,b){var d=a.target,f,e;if(!(!ga.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Da(d);if(e!==f){if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",e);if(d.type!=="select"&&(f!=null||e)){a.type="change";return c.event.trigger(a,b,this)}}}}c.event.special.change={filters:{focusout:ha,click:function(a){var b=a.target,d=b.type;if(d=== +"radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return ha.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return ha.call(this,a)},beforeactivate:function(a){a=a.target;a.nodeName.toLowerCase()==="input"&&a.type==="radio"&&c.data(a,"_change_data",Da(a))}},setup:function(a,b,d){for(var f in W)c.event.add(this,f+".specialChange."+d.guid,W[f]);return ga.test(this.nodeName)}, +remove:function(a,b){for(var d in W)c.event.remove(this,d+".specialChange"+(b?"."+b.guid:""),W[d]);return ga.test(this.nodeName)}};var W=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d, +f,e){if(typeof d==="object"){for(var i in d)this[b](i,f,d[i],e);return this}if(c.isFunction(f)){thisObject=e;e=f;f=w}var j=b==="one"?c.proxy(e,function(o){c(this).unbind(o,j);return e.apply(this,arguments)}):e;return d==="unload"&&b!=="one"?this.one(d,f,e,thisObject):this.each(function(){c.event.add(this,d,j,f)})}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault){for(var d in a)this.unbind(d,a[d]);return this}return this.each(function(){c.event.remove(this,a,b)})},trigger:function(a, +b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b|| +a)},live:function(a,b,d){if(c.isFunction(b)){d=b;b=w}c(this.context).bind(ra(a,this.selector),{data:b,selector:this.selector,live:a},d);return this},die:function(a,b){c(this.context).unbind(ra(a,this.selector),b?{guid:b.guid+this.selector+a}:null);return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d){return d? +this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",k,m=0;g[m];m++){k=g[m];if(k.nodeType===3||k.nodeType===4)h+=k.nodeValue;else if(k.nodeType!==8)h+=a(k.childNodes)}return h}function b(g,h,k,m,r,q){r=0;for(var v=m.length;r<v;r++){var u=m[r];if(u){u=u[g];for(var y=false;u;){if(u.sizcache=== +k){y=m[u.sizset];break}if(u.nodeType===1&&!q){u.sizcache=k;u.sizset=r}if(u.nodeName.toLowerCase()===h){y=u;break}u=u[g]}m[r]=y}}}function d(g,h,k,m,r,q){r=0;for(var v=m.length;r<v;r++){var u=m[r];if(u){u=u[g];for(var y=false;u;){if(u.sizcache===k){y=m[u.sizset];break}if(u.nodeType===1){if(!q){u.sizcache=k;u.sizset=r}if(typeof h!=="string"){if(u===h){y=true;break}}else if(p.filter(h,[u]).length>0){y=u;break}}u=u[g]}m[r]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,i=Object.prototype.toString,j=false,o=true;[0,0].sort(function(){o=false;return 0});var p=function(g,h,k,m){k=k||[];var r=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return k;for(var q=[],v,u,y,S,I=true,N=x(h),J=g;(f.exec(""),v=f.exec(J))!==null;){J=v[3];q.push(v[1]);if(v[2]){S=v[3];break}}if(q.length>1&&t.exec(g))if(q.length===2&&n.relative[q[0]])u=ia(q[0]+q[1],h);else for(u=n.relative[q[0]]?[h]:p(q.shift(),h);q.length;){g=q.shift();if(n.relative[g])g+=q.shift(); +u=ia(g,u)}else{if(!m&&q.length>1&&h.nodeType===9&&!N&&n.match.ID.test(q[0])&&!n.match.ID.test(q[q.length-1])){v=p.find(q.shift(),h,N);h=v.expr?p.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:q.pop(),set:B(m)}:p.find(q.pop(),q.length===1&&(q[0]==="~"||q[0]==="+")&&h.parentNode?h.parentNode:h,N);u=v.expr?p.filter(v.expr,v.set):v.set;if(q.length>0)y=B(u);else I=false;for(;q.length;){var E=q.pop();v=E;if(n.relative[E])v=q.pop();else E="";if(v==null)v=h;n.relative[E](y,v,N)}}else y=[]}y||(y=u);if(!y)throw"Syntax error, unrecognized expression: "+ +(E||g);if(i.call(y)==="[object Array]")if(I)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&F(h,y[g])))k.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&k.push(u[g]);else k.push.apply(k,y);else B(y,k);if(S){p(S,r,k,m);p.uniqueSort(k)}return k};p.uniqueSort=function(g){if(D){j=o;g.sort(D);if(j)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};p.matches=function(g,h){return p(g,null,null,h)};p.find=function(g,h,k){var m,r;if(!g)return[]; +for(var q=0,v=n.order.length;q<v;q++){var u=n.order[q];if(r=n.leftMatch[u].exec(g)){var y=r[1];r.splice(1,1);if(y.substr(y.length-1)!=="\\"){r[1]=(r[1]||"").replace(/\\/g,"");m=n.find[u](r,h,k);if(m!=null){g=g.replace(n.match[u],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};p.filter=function(g,h,k,m){for(var r=g,q=[],v=h,u,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var I in n.filter)if((u=n.leftMatch[I].exec(g))!=null&&u[2]){var N=n.filter[I],J,E;E=u[1];y=false;u.splice(1,1);if(E.substr(E.length- +1)!=="\\"){if(v===q)q=[];if(n.preFilter[I])if(u=n.preFilter[I](u,v,k,q,m,S)){if(u===true)continue}else y=J=true;if(u)for(var X=0;(E=v[X])!=null;X++)if(E){J=N(E,u,X,v);var Ea=m^!!J;if(k&&J!=null)if(Ea)y=true;else v[X]=false;else if(Ea){q.push(E);y=true}}if(J!==w){k||(v=q);g=g.replace(n.match[I],"");if(!y)return[];break}}}if(g===r)if(y==null)throw"Syntax error, unrecognized expression: "+g;else break;r=g}return v};var n=p.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, +CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}}, +relative:{"+":function(g,h){var k=typeof h==="string",m=k&&!/\W/.test(h);k=k&&!m;if(m)h=h.toLowerCase();m=0;for(var r=g.length,q;m<r;m++)if(q=g[m]){for(;(q=q.previousSibling)&&q.nodeType!==1;);g[m]=k||q&&q.nodeName.toLowerCase()===h?q||false:q===h}k&&p.filter(h,g,true)},">":function(g,h){var k=typeof h==="string";if(k&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,r=g.length;m<r;m++){var q=g[m];if(q){k=q.parentNode;g[m]=k.nodeName.toLowerCase()===h?k:false}}}else{m=0;for(r=g.length;m<r;m++)if(q=g[m])g[m]= +k?q.parentNode:q.parentNode===h;k&&p.filter(h,g,true)}},"":function(g,h,k){var m=e++,r=d;if(typeof h==="string"&&!/\W/.test(h)){var q=h=h.toLowerCase();r=b}r("parentNode",h,m,g,q,k)},"~":function(g,h,k){var m=e++,r=d;if(typeof h==="string"&&!/\W/.test(h)){var q=h=h.toLowerCase();r=b}r("previousSibling",h,m,g,q,k)}},find:{ID:function(g,h,k){if(typeof h.getElementById!=="undefined"&&!k)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var k=[]; +h=h.getElementsByName(g[1]);for(var m=0,r=h.length;m<r;m++)h[m].getAttribute("name")===g[1]&&k.push(h[m]);return k.length===0?null:k}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,k,m,r,q){g=" "+g[1].replace(/\\/g,"")+" ";if(q)return g;q=0;for(var v;(v=h[q])!=null;q++)if(v)if(r^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))k||m.push(v);else if(k)h[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,k,m,r,q){h=g[1].replace(/\\/g,"");if(!q&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,k,m,r){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=p(g[3],null,null,h);else{g=p.filter(g[3],h,k,true^r);k||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,k){return!!p(k[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,k,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,k){return h<k[3]-0},gt:function(g,h,k){return h>k[3]-0},nth:function(g,h,k){return k[3]-0===h},eq:function(g,h,k){return k[3]-0===h}},filter:{PSEUDO:function(g,h,k,m){var r=h[1],q=n.filters[r];if(q)return q(g,k,h,m);else if(r==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(r==="not"){h= +h[3];k=0;for(m=h.length;k<m;k++)if(h[k]===g)return false;return true}else throw"Syntax error, unrecognized expression: "+r;},CHILD:function(g,h){var k=h[1],m=g;switch(k){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(k==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":k=h[2];var r=h[3];if(k===1&&r===0)return true;h=h[0];var q=g.parentNode;if(q&&(q.sizcache!==h||!g.nodeIndex)){var v=0;for(m=q.firstChild;m;m= +m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;q.sizcache=h}g=g.nodeIndex-r;return k===0?g===0:g%k===0&&g/k>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var k=h[1];g=n.attrHandle[k]?n.attrHandle[k](g):g[k]!=null?g[k]:g.getAttribute(k);k=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?k===h:m==="*="?k.indexOf(h)>=0:m==="~="?(" "+k+" ").indexOf(h)>=0:!h?k&&g!==false:m==="!="?k!==h:m==="^="?k.indexOf(h)===0:m==="$="?k.substr(k.length-h.length)===h:m==="|="?k===h||k.substr(0,h.length+1)===h+"-":false},POS:function(g,h,k,m){var r=n.setFilters[h[2]];if(r)return r(g,k,h,m)}}},t=n.match.POS;for(var z in n.match){n.match[z]=new RegExp(n.match[z].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[z]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[z].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var B=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){B=function(g,h){h=h||[];if(i.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var k=0,m=g.length;k<m;k++)h.push(g[k]);else for(k=0;g[k];k++)h.push(g[k]);return h}}var D;if(s.documentElement.compareDocumentPosition)D=function(g,h){if(!g.compareDocumentPosition|| +!h.compareDocumentPosition){if(g==h)j=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)j=true;return g};else if("sourceIndex"in s.documentElement)D=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)j=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)j=true;return g};else if(s.createRange)D=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)j=true;return g.ownerDocument?-1:1}var k=g.ownerDocument.createRange(),m= +h.ownerDocument.createRange();k.setStart(g,0);k.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=k.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)j=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var k=s.documentElement;k.insertBefore(g,k.firstChild);if(s.getElementById(h)){n.find.ID=function(m,r,q){if(typeof r.getElementById!=="undefined"&&!q)return(r=r.getElementById(m[1]))?r.id===m[1]||typeof r.getAttributeNode!=="undefined"&& +r.getAttributeNode("id").nodeValue===m[1]?[r]:w:[]};n.filter.ID=function(m,r){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===r}}k.removeChild(g);k=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,k){k=k.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;k[m];m++)k[m].nodeType===1&&h.push(k[m]);k=h}return k};g.innerHTML="<a href='#'></a>"; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=p,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){p=function(m,r,q,v){r=r||s;if(!v&&r.nodeType===9&&!x(r))try{return B(r.querySelectorAll(m),q)}catch(u){}return g(m,r,q,v)};for(var k in g)p[k]=g[k];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,k,m){if(typeof k.getElementsByClassName!=="undefined"&&!m)return k.getElementsByClassName(h[1])};g=null}}})();var F=s.compareDocumentPosition?function(g,h){return g.compareDocumentPosition(h)&16}:function(g, +h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ia=function(g,h){var k=[],m="",r;for(h=h.nodeType?[h]:h;r=n.match.PSEUDO.exec(g);){m+=r[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;r=0;for(var q=h.length;r<q;r++)p(g,h[r],k);return p.filter(m,k)};c.find=p;c.expr=p.selectors;c.expr[":"]=c.expr.filters;c.unique=p.uniqueSort;c.getText=a;c.isXMLDoc=x;c.contains=F})();var ab=/Until$/,bb=/^(?:parents|prevUntil|prevAll)/, +cb=/,/;R=Array.prototype.slice;var Fa=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,i){return!!b.call(e,i,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Pa.test(b))return c.filter(b,f,!d);else b=c.filter(b,a)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length; +c.find(a,this[f],b);if(f>0)for(var i=d;i<b.length;i++)for(var j=0;j<d;j++)if(b[j]===b[i]){b.splice(i--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Fa(this,a,false),"not",a)},filter:function(a){return this.pushStack(Fa(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,i= +{},j;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){j=a[e];i[j]||(i[j]=c.expr.match.POS.test(j)?c(j,b||this.context):j)}for(;f&&f.ownerDocument&&f!==b;){for(j in i){e=i[j];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:j,elem:f});delete i[j]}}f=f.parentNode}}return d}var p=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,t){for(;t&&t.ownerDocument&&t!==b;){if(p?p.index(t)>-1:c(t).is(a))return t;t=t.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(sa(a[0])||sa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);ab.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||cb.test(f))&&bb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ga=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,db=/(<([\w:]+)[^>]*?)\/>/g,eb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,Ha=/<([\w:]+)/,fb=/<tbody/i,gb=/<|&\w+;/,hb=function(a,b,d){return eb.test(d)?a:b+"></"+d+">"},G={option:[1,"<select multiple='multiple'>","</select>"], +legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};G.optgroup=G.option;G.tbody=G.tfoot=G.colgroup=G.caption=G.thead;G.th=G.td;if(!c.support.htmlSerialize)G._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this); +return d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.getText(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&& +this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this, +"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ga,"").replace(Y,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ta(this,b);ta(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType=== +1?this[0].innerHTML.replace(Ga,""):null;else if(typeof a==="string"&&!/<script/i.test(a)&&(c.support.leadingWhitespace||!Y.test(a))&&!G[(Ha.exec(a)||["",""])[1].toLowerCase()])try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){T(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}else c.isFunction(a)?this.each(function(e){var i=c(this),j=i.html();i.empty().append(function(){return a.call(this,e,j)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&& +this[0].parentNode){c.isFunction(a)||(a=c(a).detach());return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(t){return c.nodeName(t,"table")?t.getElementsByTagName("tbody")[0]||t.appendChild(t.ownerDocument.createElement("tbody")):t}var e,i,j=a[0],o=[];if(c.isFunction(j))return this.each(function(t){var z= +c(this);a[0]=j.call(this,t,b?z.html():w);return z.domManip(a,b,d)});if(this[0]){e=a[0]&&a[0].parentNode&&a[0].parentNode.nodeType===11?{fragment:a[0].parentNode}:ua(a,this,o);if(i=e.fragment.firstChild){b=b&&c.nodeName(i,"tr");for(var p=0,n=this.length;p<n;p++)d.call(b?f(this[p],i):this[p],e.cacheable||this.length>1||p>0?e.fragment.cloneNode(true):e.fragment)}o&&c.each(o,La)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"}, +function(a,b){c.fn[a]=function(d){var f=[];d=c(d);for(var e=0,i=d.length;e<i;e++){var j=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),j);f=f.concat(j)}return this.pushStack(f,a,d.selector)}});c.each({remove:function(a,b){if(!a||c.filter(a,[this]).length){if(!b&&this.nodeType===1){T(this.getElementsByTagName("*"));T([this])}this.parentNode&&this.parentNode.removeChild(this)}},empty:function(){for(this.nodeType===1&&T(this.getElementsByTagName("*"));this.firstChild;)this.removeChild(this.firstChild)}}, +function(a,b){c.fn[a]=function(){return this.each(b,arguments)}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;var e=[];c.each(a,function(i,j){if(typeof j==="number")j+="";if(j){if(typeof j==="string"&&!gb.test(j))j=b.createTextNode(j);else if(typeof j==="string"){j=j.replace(db,hb);var o=(Ha.exec(j)||["",""])[1].toLowerCase(),p=G[o]||G._default,n=p[0];i=b.createElement("div");for(i.innerHTML=p[1]+j+p[2];n--;)i=i.lastChild; +if(!c.support.tbody){n=fb.test(j);o=o==="table"&&!n?i.firstChild&&i.firstChild.childNodes:p[1]==="<table>"&&!n?i.childNodes:[];for(p=o.length-1;p>=0;--p)c.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!c.support.leadingWhitespace&&Y.test(j)&&i.insertBefore(b.createTextNode(Y.exec(j)[0]),i.firstChild);j=c.makeArray(i.childNodes)}if(j.nodeType)e.push(j);else e=c.merge(e,j)}});if(d)for(a=0;e[a];a++)if(f&&c.nodeName(e[a],"script")&&(!e[a].type||e[a].type.toLowerCase()=== +"text/javascript"))f.push(e[a].parentNode?e[a].parentNode.removeChild(e[a]):e[a]);else{e[a].nodeType===1&&e.splice.apply(e,[a+1,0].concat(c.makeArray(e[a].getElementsByTagName("script"))));d.appendChild(e[a])}return e}});var ib=/z-?index|font-?weight|opacity|zoom|line-?height/i,Ia=/alpha\([^)]*\)/,Ja=/opacity=([^)]*)/,ja=/float/i,ka=/-([a-z])/ig,jb=/([A-Z])/g,kb=/^-?\d+(?:px)?$/i,lb=/^-?\d/,mb={position:"absolute",visibility:"hidden",display:"block"},nb=["Left","Right"],ob=["Top","Bottom"],pb=s.defaultView&& +s.defaultView.getComputedStyle,Ka=c.support.cssFloat?"cssFloat":"styleFloat",la=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return $(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!ib.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""=== +"NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=Ia.test(a)?a.replace(Ia,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Ja.exec(f.filter)[1])/100+"":""}if(ja.test(b))b=Ka;b=b.replace(ka,la);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,i=b==="width"?nb:ob;function j(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(i,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+= +parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,"border"+this+"Width",true))||0})}a.offsetWidth!==0?j():c.swap(a,mb,j);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Ja.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ja.test(b))b=Ka;if(!d&&e&&e[b])f=e[b];else if(pb){if(ja.test(b))b="float";b=b.replace(jb,"-$1").toLowerCase();e= +a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ka,la);f=a.currentStyle[b]||a.currentStyle[d];if(!kb.test(f)&&lb.test(f)){b=e.left;var i=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=i}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]= +f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var qb=K(),rb=/<script(.|\s)*?\/script>/gi,sb=/select|textarea/i,tb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,O=/=\?(&|$)/,ma=/\?/,ub=/(\?|&)_=.*?(&|$)/,vb=/^(\w+:)?\/\/([^\/?#]+)/, +wb=/%20/g;c.fn.extend({_load:c.fn.load,load:function(a,b,d){if(typeof a!=="string")return this._load(a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}c.ajax({url:a,type:f,dataType:"html",data:b,context:this,complete:function(i,j){if(j==="success"||j==="notmodified")this.html(e?c("<div />").append(i.responseText.replace(rb, +"")).find(e):i.responseText);d&&this.each(d,[i.responseText,j,i])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||sb.test(this.nodeName)||tb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}}); +c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})}, +ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript", +text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&e.success.call(p,o,j,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(p,x,j);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(r,q){(e.context?c(e.context):c.event).trigger(r,q)}var e=c.extend(true,{},c.ajaxSettings,a),i,j,o,p=e.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data, +e.traditional);if(e.dataType==="jsonp"){if(n==="GET")O.test(e.url)||(e.url+=(ma.test(e.url)?"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!O.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&O.test(e.data)||O.test(e.url))){i=e.jsonpCallback||"jsonp"+qb++;if(e.data)e.data=(e.data+"").replace(O,"="+i+"$1");e.url=e.url.replace(O,"="+i+"$1");e.dataType="script";A[i]=A[i]||function(r){o=r;b();d();A[i]=w;try{delete A[i]}catch(q){}B&& +B.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===false&&n==="GET"){var t=K(),z=e.url.replace(ub,"$1_="+t+"$2");e.url=z+(z===e.url?(ma.test(e.url)?"&":"?")+"_="+t:"")}if(e.data&&n==="GET")e.url+=(ma.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");t=(t=vb.exec(e.url))&&(t[1]&&t[1]!==location.protocol||t[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&t){var B=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script"); +C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!i){var D=false;C.onload=C.onreadystatechange=function(){if(!D&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){D=true;b();d();C.onload=C.onreadystatechange=null;B&&C.parentNode&&B.removeChild(C)}}}B.insertBefore(C,B.firstChild);return w}var F=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type", +e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}t||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ia){}if(e.beforeSend&&e.beforeSend.call(p,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend", +[x,e]);var g=x.onreadystatechange=function(r){if(!x||x.readyState===0){F||d();F=true;if(x)x.onreadystatechange=c.noop}else if(!F&&x&&(x.readyState===4||r==="timeout")){F=true;x.onreadystatechange=c.noop;j=r==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";if(j==="success")try{o=c.httpData(x,e.dataType,e)}catch(q){j="parsererror"}if(j==="success"||j==="notmodified")i||b();else c.handleError(e,x,j);d();r==="timeout"&&x.abort();if(e.async)x= +null}};try{var h=x.abort;x.abort=function(){if(x){h.call(x);if(x)x.readyState=0}g()}}catch(k){}e.async&&e.timeout>0&&setTimeout(function(){x&&!F&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||A,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol=== +"file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;if(e&&a.documentElement.nodeName==="parsererror")throw"parsererror";if(d&& +d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&f.indexOf("json")>=0)if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))a=A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+a))();else throw"Invalid JSON: "+a;else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(e,i){i= +c.isFunction(i)?i():i;f[f.length]=encodeURIComponent(e)+"="+encodeURIComponent(i)}var f=[];if(b===w)b=c.ajaxSettings.traditional;c.isArray(a)||a.jquery?c.each(a,function(){d(this.name,this.value)}):c.each(a,function e(i,j){if(c.isArray(j))c.each(j,function(o,p){b?d(i,p):e(i+"["+(typeof p==="object"||c.isArray(p)?o:"")+"]",p)});else!b&&j!=null&&typeof j==="object"?c.each(j,function(o,p){e(i+"["+o+"]",p)}):d(i,j)});return f.join("&").replace(wb,"+")}});var na={},xb=/toggle|show|hide/,yb=/^([+-]=)?([\d+-.]+)(.*)$/, +Z,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a!=null)return this.animate(L("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(na[d])f=na[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove(); +na[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a!=null)return this.animate(L("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&& +c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(L("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var i=c.extend({},e),j,o=this.nodeType===1&&c(this).is(":hidden"), +p=this;for(j in a){var n=j.replace(ka,la);if(j!==n){a[n]=a[j];delete a[j];j=n}if(a[j]==="hide"&&o||a[j]==="show"&&!o)return i.complete.call(this);if((j==="height"||j==="width")&&this.style){i.display=c.css(this,"display");i.overflow=this.style.overflow}if(c.isArray(a[j])){(i.specialEasing=i.specialEasing||{})[j]=a[j][1];a[j]=a[j][0]}}if(i.overflow!=null)this.style.overflow="hidden";i.curAnim=c.extend({},a);c.each(a,function(t,z){var B=new c.fx(p,i,t);if(xb.test(z))B[z==="toggle"?o?"show":"hide":z](a); +else{var C=yb.exec(z),D=B.cur(true)||0;if(C){z=parseFloat(C[2]);var F=C[3]||"px";if(F!=="px"){p.style[t]=(z||1)+F;D=(z||1)/B.cur(true)*D;p.style[t]=D+F}if(C[1])z=(C[1]==="-="?-1:1)*z+D;B.custom(D,z,F)}else B.custom(D,z,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:L("show",1),slideUp:L("hide",1),slideToggle:L("toggle", +1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration==="number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a, +b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]== +null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(i){return e.step(i)}this.startTime=K();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!Z)Z=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop=== +"width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=K(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow= +this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos= +c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},stop:function(){clearInterval(Z);Z=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!= +null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?function(a){var b=this[0];if(!b||!b.ownerDocument)return null;if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(), +f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(!b||!b.ownerDocument)return null;if(a)return this.each(function(t){c.offset.setOffset(this,a,t)});if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f= +b,e=b.ownerDocument,i,j=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var p=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==j;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;i=e?e.getComputedStyle(b,null):b.currentStyle;p-=b.scrollTop;n-=b.scrollLeft;if(b===d){p+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){p+=parseFloat(i.borderTopWidth)|| +0;n+=parseFloat(i.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&i.overflow!=="visible"){p+=parseFloat(i.borderTopWidth)||0;n+=parseFloat(i.borderLeftWidth)||0}f=i}if(f.position==="relative"||f.position==="static"){p+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&f.position==="fixed"){p+=Math.max(j.scrollTop,o.scrollTop);n+=Math.max(j.scrollLeft,o.scrollLeft)}return{top:p,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"), +d,f,e,i=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild); +d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i;a.removeChild(b);c.offset.initialize=c.noop}, +bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),i=parseInt(c.curCSS(a,"top",true),10)||0,j=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,d,e);d={top:b.top-e.top+i,left:b.left- +e.left+j};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a= +this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],i;if(!e)return null;if(f!==w)return this.each(function(){if(i=wa(this))i.scrollTo(!a?f:c(i).scrollLeft(),a?f:c(i).scrollTop());else this[d]=f});else return(i=wa(e))?"pageXOffset"in i?i[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&i.document.documentElement[d]||i.document.body[d]:e[d]}}); +c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;return"scrollTo"in e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+ +b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/sphinx/themes/basic/static/searchtools.js b/sphinx/themes/basic/static/searchtools.js index f679a754..ec1f3e0f 100644 --- a/sphinx/themes/basic/static/searchtools.js +++ b/sphinx/themes/basic/static/searchtools.js @@ -1,3 +1,14 @@ +/* + * searchtools.js + * ~~~~~~~~~~~~~~ + * + * Sphinx JavaScript utilties for the full-text search. + * + * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + /** * helper function to return a node containing the * search summary for a given text. keywords is a list @@ -20,7 +31,7 @@ jQuery.makeSearchSummary = function(text, keywords, hlwords) { ((start + 240 - text.length) ? '...' : ''); var rv = $('<div class="context"></div>').text(excerpt); $.each(hlwords, function() { - rv = rv.highlightText(this, 'highlight'); + rv = rv.highlightText(this, 'highlighted'); }); return rv; } @@ -287,8 +298,13 @@ var Search = { }, query : function(query) { - // stem the searchterms and add them to the - // correct list + var stopwords = ['and', 'then', 'into', 'it', 'as', 'are', 'in', + 'if', 'for', 'no', 'there', 'their', 'was', 'is', + 'be', 'to', 'that', 'but', 'they', 'not', 'such', + 'with', 'by', 'a', 'on', 'these', 'of', 'will', + 'this', 'near', 'the', 'or', 'at']; + + // stem the searchterms and add them to the correct list var stemmer = new PorterStemmer(); var searchterms = []; var excluded = []; @@ -296,9 +312,11 @@ var Search = { var tmp = query.split(/\s+/); var object = (tmp.length == 1) ? tmp[0].toLowerCase() : null; for (var i = 0; i < tmp.length; i++) { - // ignore leading/trailing whitespace - if (tmp[i] == "") + if ($u.indexOf(stopwords, tmp[i]) != -1 || tmp[i].match(/^\d+$/) || + tmp[i] == "") { + // skip this "word" continue; + } // stem the word var word = stemmer.stemWord(tmp[i]).toLowerCase(); // select the correct list @@ -316,39 +334,42 @@ var Search = { }; var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" ")); - console.debug('SEARCH: searching for:'); - console.info('required: ', searchterms); - console.info('excluded: ', excluded); + // console.debug('SEARCH: searching for:'); + // console.info('required: ', searchterms); + // console.info('excluded: ', excluded); // prepare search var filenames = this._index.filenames; var titles = this._index.titles; var terms = this._index.terms; - var descrefs = this._index.descrefs; - var modules = this._index.modules; - var desctypes = this._index.desctypes; + var objects = this._index.objects; + var objtypes = this._index.objtypes; + var objnames = this._index.objnames; var fileMap = {}; var files = null; + // different result priorities + var importantResults = []; var objectResults = []; var regularResults = []; + var unimportantResults = []; $('#search-progress').empty(); // lookup as object if (object != null) { - for (var module in modules) { - if (module.indexOf(object) > -1) { - fn = modules[module]; - descr = _('module, in ') + titles[fn]; - objectResults.push([filenames[fn], module, '#module-'+module, descr]); - } - } - for (var prefix in descrefs) { - for (var name in descrefs[prefix]) { + for (var prefix in objects) { + for (var name in objects[prefix]) { var fullname = (prefix ? prefix + '.' : '') + name; if (fullname.toLowerCase().indexOf(object) > -1) { - match = descrefs[prefix][name]; - descr = desctypes[match[1]] + _(', in ') + titles[match[0]]; - objectResults.push([filenames[match[0]], fullname, '#'+fullname, descr]); + match = objects[prefix][name]; + descr = objnames[match[1]] + _(', in ') + titles[match[0]]; + // XXX the generated anchors are not generally correct + // XXX there may be custom prefixes + result = [filenames[match[0]], fullname, '#'+fullname, descr]; + switch (match[2]) { + case 1: objectResults.push(result); break; + case 0: importantResults.push(result); break; + case 2: unimportantResults.push(result); break; + } } } } @@ -359,6 +380,14 @@ var Search = { return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0); }); + importantResults.sort(function(a, b) { + return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0); + }); + + unimportantResults.sort(function(a, b) { + return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0); + }); + // perform the search on the required terms for (var i = 0; i < searchterms.length; i++) { @@ -414,8 +443,9 @@ var Search = { return (left > right) ? -1 : ((left < right) ? 1 : 0); }); - // combine both - var results = regularResults.concat(objectResults); + // combine all results + var results = unimportantResults.concat(regularResults) + .concat(objectResults).concat(importantResults); // print the results var resultCount = results.length; diff --git a/sphinx/themes/basic/static/underscore.js b/sphinx/themes/basic/static/underscore.js new file mode 100644 index 00000000..9146e086 --- /dev/null +++ b/sphinx/themes/basic/static/underscore.js @@ -0,0 +1,16 @@ +(function(){var j=this,n=j._,i=function(a){this._wrapped=a},m=typeof StopIteration!=="undefined"?StopIteration:"__break__",b=j._=function(a){return new i(a)};if(typeof exports!=="undefined")exports._=b;var k=Array.prototype.slice,o=Array.prototype.unshift,p=Object.prototype.toString,q=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;b.VERSION="0.5.5";b.each=function(a,c,d){try{if(a.forEach)a.forEach(c,d);else if(b.isArray(a)||b.isArguments(a))for(var e=0,f=a.length;e<f;e++)c.call(d, +a[e],e,a);else{var g=b.keys(a);f=g.length;for(e=0;e<f;e++)c.call(d,a[g[e]],g[e],a)}}catch(h){if(h!=m)throw h;}return a};b.map=function(a,c,d){if(a&&b.isFunction(a.map))return a.map(c,d);var e=[];b.each(a,function(f,g,h){e.push(c.call(d,f,g,h))});return e};b.reduce=function(a,c,d,e){if(a&&b.isFunction(a.reduce))return a.reduce(b.bind(d,e),c);b.each(a,function(f,g,h){c=d.call(e,c,f,g,h)});return c};b.reduceRight=function(a,c,d,e){if(a&&b.isFunction(a.reduceRight))return a.reduceRight(b.bind(d,e),c); +var f=b.clone(b.toArray(a)).reverse();b.each(f,function(g,h){c=d.call(e,c,g,h,a)});return c};b.detect=function(a,c,d){var e;b.each(a,function(f,g,h){if(c.call(d,f,g,h)){e=f;b.breakLoop()}});return e};b.select=function(a,c,d){if(a&&b.isFunction(a.filter))return a.filter(c,d);var e=[];b.each(a,function(f,g,h){c.call(d,f,g,h)&&e.push(f)});return e};b.reject=function(a,c,d){var e=[];b.each(a,function(f,g,h){!c.call(d,f,g,h)&&e.push(f)});return e};b.all=function(a,c,d){c=c||b.identity;if(a&&b.isFunction(a.every))return a.every(c, +d);var e=true;b.each(a,function(f,g,h){(e=e&&c.call(d,f,g,h))||b.breakLoop()});return e};b.any=function(a,c,d){c=c||b.identity;if(a&&b.isFunction(a.some))return a.some(c,d);var e=false;b.each(a,function(f,g,h){if(e=c.call(d,f,g,h))b.breakLoop()});return e};b.include=function(a,c){if(b.isArray(a))return b.indexOf(a,c)!=-1;var d=false;b.each(a,function(e){if(d=e===c)b.breakLoop()});return d};b.invoke=function(a,c){var d=b.rest(arguments,2);return b.map(a,function(e){return(c?e[c]:e).apply(e,d)})};b.pluck= +function(a,c){return b.map(a,function(d){return d[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);var e={computed:-Infinity};b.each(a,function(f,g,h){g=c?c.call(d,f,g,h):f;g>=e.computed&&(e={value:f,computed:g})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};b.each(a,function(f,g,h){g=c?c.call(d,f,g,h):f;g<e.computed&&(e={value:f,computed:g})});return e.value};b.sortBy=function(a,c,d){return b.pluck(b.map(a, +function(e,f,g){return{value:e,criteria:c.call(d,e,f,g)}}).sort(function(e,f){e=e.criteria;f=f.criteria;return e<f?-1:e>f?1:0}),"value")};b.sortedIndex=function(a,c,d){d=d||b.identity;for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?(e=g+1):(f=g)}return e};b.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(b.isArray(a))return a;if(b.isArguments(a))return k.call(a);return b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=function(a,c,d){return c&&!d?k.call(a, +0,c):a[0]};b.rest=function(a,c,d){return k.call(a,b.isUndefined(c)||d?1:c)};b.last=function(a){return a[a.length-1]};b.compact=function(a){return b.select(a,function(c){return!!c})};b.flatten=function(a){return b.reduce(a,[],function(c,d){if(b.isArray(d))return c.concat(b.flatten(d));c.push(d);return c})};b.without=function(a){var c=b.rest(arguments);return b.select(a,function(d){return!b.include(c,d)})};b.uniq=function(a,c){return b.reduce(a,[],function(d,e,f){if(0==f||(c===true?b.last(d)!=e:!b.include(d, +e)))d.push(e);return d})};b.intersect=function(a){var c=b.rest(arguments);return b.select(b.uniq(a),function(d){return b.all(c,function(e){return b.indexOf(e,d)>=0})})};b.zip=function(){for(var a=b.toArray(arguments),c=b.max(b.pluck(a,"length")),d=new Array(c),e=0;e<c;e++)d[e]=b.pluck(a,String(e));return d};b.indexOf=function(a,c){if(a.indexOf)return a.indexOf(c);for(var d=0,e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,c){if(a.lastIndexOf)return a.lastIndexOf(c);for(var d= +a.length;d--;)if(a[d]===c)return d;return-1};b.range=function(a,c,d){var e=b.toArray(arguments),f=e.length<=1;a=f?0:e[0];c=f?e[0]:e[1];d=e[2]||1;e=Math.ceil((c-a)/d);if(e<=0)return[];e=new Array(e);f=a;for(var g=0;1;f+=d){if((d>0?f-c:c-f)>=0)return e;e[g++]=f}};b.bind=function(a,c){var d=b.rest(arguments,2);return function(){return a.apply(c||j,d.concat(b.toArray(arguments)))}};b.bindAll=function(a){var c=b.rest(arguments);if(c.length==0)c=b.functions(a);b.each(c,function(d){a[d]=b.bind(a[d],a)}); +return a};b.delay=function(a,c){var d=b.rest(arguments,2);return setTimeout(function(){return a.apply(a,d)},c)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(b.rest(arguments)))};b.wrap=function(a,c){return function(){var d=[a].concat(b.toArray(arguments));return c.apply(c,d)}};b.compose=function(){var a=b.toArray(arguments);return function(){for(var c=b.toArray(arguments),d=a.length-1;d>=0;d--)c=[a[d].apply(this,c)];return c[0]}};b.keys=function(a){if(b.isArray(a))return b.range(0,a.length); +var c=[];for(var d in a)q.call(a,d)&&c.push(d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=function(a){return b.select(b.keys(a),function(c){return b.isFunction(a[c])}).sort()};b.extend=function(a,c){for(var d in c)a[d]=c[d];return a};b.clone=function(a){if(b.isArray(a))return a.slice(0);return b.extend({},a)};b.tap=function(a,c){c(a);return a};b.isEqual=function(a,c){if(a===c)return true;var d=typeof a;if(d!=typeof c)return false;if(a==c)return true;if(!a&&c||a&&!c)return false; +if(a.isEqual)return a.isEqual(c);if(b.isDate(a)&&b.isDate(c))return a.getTime()===c.getTime();if(b.isNaN(a)&&b.isNaN(c))return true;if(b.isRegExp(a)&&b.isRegExp(c))return a.source===c.source&&a.global===c.global&&a.ignoreCase===c.ignoreCase&&a.multiline===c.multiline;if(d!=="object")return false;if(a.length&&a.length!==c.length)return false;d=b.keys(a);var e=b.keys(c);if(d.length!=e.length)return false;for(var f in a)if(!b.isEqual(a[f],c[f]))return false;return true};b.isEmpty=function(a){return b.keys(a).length== +0};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=function(a){return!!(a&&a.concat&&a.unshift)};b.isArguments=function(a){return a&&b.isNumber(a.length)&&!b.isArray(a)&&!r.call(a,"length")};b.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)};b.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};b.isNumber=function(a){return p.call(a)==="[object Number]"};b.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)};b.isRegExp=function(a){return!!(a&& +a.test&&a.exec&&(a.ignoreCase||a.ignoreCase===false))};b.isNaN=function(a){return b.isNumber(a)&&isNaN(a)};b.isNull=function(a){return a===null};b.isUndefined=function(a){return typeof a=="undefined"};b.noConflict=function(){j._=n;return this};b.identity=function(a){return a};b.breakLoop=function(){throw m;};var s=0;b.uniqueId=function(a){var c=s++;return a?a+c:c};b.template=function(a,c){a=new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+a.replace(/[\r\t\n]/g, +" ").replace(/'(?=[^%]*%>)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<%=(.+?)%>/g,"',$1,'").split("<%").join("');").split("%>").join("p.push('")+"');}return p.join('');");return c?a(c):a};b.forEach=b.each;b.foldl=b.inject=b.reduce;b.foldr=b.reduceRight;b.filter=b.select;b.every=b.all;b.some=b.any;b.head=b.first;b.tail=b.rest;b.methods=b.functions;var l=function(a,c){return c?b(a).chain():a};b.each(b.functions(b),function(a){var c=b[a];i.prototype[a]=function(){var d=b.toArray(arguments); +o.call(d,this._wrapped);return l(c.apply(b,d),this._chain)}});b.each(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var c=Array.prototype[a];i.prototype[a]=function(){c.apply(this._wrapped,arguments);return l(this._wrapped,this._chain)}});b.each(["concat","join","slice"],function(a){var c=Array.prototype[a];i.prototype[a]=function(){return l(c.apply(this._wrapped,arguments),this._chain)}});i.prototype.chain=function(){this._chain=true;return this};i.prototype.value=function(){return this._wrapped}})(); diff --git a/sphinx/themes/default/static/default.css_t b/sphinx/themes/default/static/default.css_t index 5f4a4c6f..579f57a4 100644 --- a/sphinx/themes/default/static/default.css_t +++ b/sphinx/themes/default/static/default.css_t @@ -1,6 +1,12 @@ -/** - * Sphinx stylesheet -- default theme - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/* + * default.css_t + * ~~~~~~~~~~~~~ + * + * Sphinx stylesheet -- default theme. + * + * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * */ @import url("basic.css"); @@ -148,13 +154,13 @@ a { text-decoration: none; } -a:hover { - text-decoration: underline; +a:visited { + color: {{ theme_visitedlinkcolor }}; + text-decoration: none; } -div.body p, div.body dd, div.body li { - text-align: justify; - line-height: 130%; +a:hover { + text-decoration: underline; } div.body h1, @@ -255,6 +261,10 @@ tt { font-size: 0.95em; } +th { + background-color: #ede; +} + .warning tt { background: #efc2c2; } @@ -262,3 +272,13 @@ tt { .note tt { background: #d6d6d6; } + +.viewcode-back { + font-family: {{ theme_bodyfont }}; +} + +div.viewcode-block:target { + background-color: #f4debf; + border-top: 1px solid #ac9; + border-bottom: 1px solid #ac9; +} diff --git a/sphinx/themes/default/theme.conf b/sphinx/themes/default/theme.conf index 812330f8..5035fae5 100644 --- a/sphinx/themes/default/theme.conf +++ b/sphinx/themes/default/theme.conf @@ -21,6 +21,7 @@ headbgcolor = #f2f2f2 headtextcolor = #20435c headlinkcolor = #c60f0f linkcolor = #355f7c +visitedlinkcolor = #355f7c codebgcolor = #eeffcc codetextcolor = #333333 diff --git a/sphinx/themes/epub/layout.html b/sphinx/themes/epub/layout.html new file mode 100644 index 00000000..8a348bed --- /dev/null +++ b/sphinx/themes/epub/layout.html @@ -0,0 +1,16 @@ +{# + epub/layout.html + ~~~~~~~~~~~~~~~~ + + Sphinx layout template for the epub theme. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} +{% extends "basic/layout.html" %} + +{# add only basic navigation links #} +{% block sidebar1 %}{% endblock %} +{% block sidebar2 %}{% endblock %} +{% block relbar2 %}{% endblock %} +{% block linktags %}{% endblock %} diff --git a/sphinx/themes/epub/static/epub.css b/sphinx/themes/epub/static/epub.css new file mode 100644 index 00000000..de21c462 --- /dev/null +++ b/sphinx/themes/epub/static/epub.css @@ -0,0 +1,464 @@ +/* + * epub.css_t + * ~~~~~~~~~~ + * + * Sphinx stylesheet -- epub theme. + * + * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +a:link, a:visited { + color: #3333ff; + text-decoration: underline; +} + +img { + border: 0; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-family: sans-serif; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 100%; +} + +img { + border: 0; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li div.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 130%; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable dl, table.indextable dd { + margin-top: 0; + margin-bottom: 0; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +/* -- general body styles --------------------------------------------------- */ + +a.headerlink { + visibility: hidden; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.field-list ul { + padding-left: 100%; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px 7px 0 7px; + background-color: #ffe; + width: 40%; + float: right; +} + +p.sidebar-title { + font-weight: bold; +} + +/* -- topics ---------------------------------------------------------------- */ + +div.topic { + border: 1px solid #ccc; + padding: 7px 7px 0 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 110%; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +div.admonition dl { + margin-bottom: 0; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + border: 0; + border-collapse: collapse; +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +table.field-list td, table.field-list th { + border: 0 !important; +} + +table.footnote td, table.footnote th { + border: 0 !important; +} + +th { + text-align: left; + padding-right: 5px; +} + +/* -- other body styles ----------------------------------------------------- */ + +dl { + margin-bottom: 15px; +} + +dd p { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dt:target, .highlighted { + background-color: #ddd; +} + +dl.glossary dt { + font-weight: bold; + font-size: 110%; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.refcount { + color: #060; +} + +.optional { + font-size: 130%; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #dddddd; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + font-family: "LiberationNarrow", monospace; + overflow: auto; +} + +td.linenos pre { + padding: 5px 0px; + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + margin-left: 0.5em; +} + +table.highlighttable td { + padding: 0 0.5em 0 0.5em; +} + +tt { + font-family: "LiberationNarrow", monospace; +} + +tt.descname { + background-color: transparent; + font-weight: bold; + font-size: 1.2em; +} + +tt.descclassname { + background-color: transparent; +} + +tt.xref, a tt { + background-color: transparent; + font-weight: bold; +} + +h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { + background-color: transparent; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +/* -- special divs --------------------------------------------------------- */ + +div.quotebar { + background-color: #e3eff1; + max-width: 250px; + float: right; + font-family: sans-serif; + padding: 7px 7px; + border: 1px solid #ccc; +} +div.footer { + background-color: #e3eff1; + padding: 3px 8px 3px 0; + clear: both; + font-family: sans-serif; + font-size: 80%; + text-align: right; +} + +div.footer a { + text-decoration: underline; +} + +/* -- link-target ----------------------------------------------------------- */ + +.link-target { + font-size: 80%; +} + +table .link-target { + /* Do not show links in tables, there is not enough space */ + display: none; +} + +/* -- font-face ------------------------------------------------------------- */ + +@font-face { + font-family: "LiberationNarrow"; + font-style: normal; + font-weight: normal; + src: url("res:///Data/fonts/LiberationNarrow-Regular.otf") + format("opentype"); +} +@font-face { + font-family: "LiberationNarrow"; + font-style: oblique, italic; + font-weight: normal; + src: url("res:///Data/fonts/LiberationNarrow-Italic.otf") + format("opentype"); +} +@font-face { + font-family: "LiberationNarrow"; + font-style: normal; + font-weight: bold; + src: url("res:///Data/fonts/LiberationNarrow-Bold.otf") + format("opentype"); +} +@font-face { + font-family: "LiberationNarrow"; + font-style: oblique, italic; + font-weight: bold; + src: url("res:///Data/fonts/LiberationNarrow-BoldItalic.otf") + format("opentype"); +} + diff --git a/sphinx/themes/epub/theme.conf b/sphinx/themes/epub/theme.conf new file mode 100644 index 00000000..d5806ec5 --- /dev/null +++ b/sphinx/themes/epub/theme.conf @@ -0,0 +1,4 @@ +[theme] +inherit = basic +stylesheet = epub.css +pygments_style = none diff --git a/sphinx/themes/haiku/layout.html b/sphinx/themes/haiku/layout.html new file mode 100644 index 00000000..91c76852 --- /dev/null +++ b/sphinx/themes/haiku/layout.html @@ -0,0 +1,68 @@ +{# + haiku/layout.html + ~~~~~~~~~~~~~~~~~ + + Sphinx layout template for the haiku theme. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} +{% extends "basic/layout.html" %} +{% set script_files = script_files + ['_static/theme_extras.js'] %} +{% set css_files = css_files + ['_static/print.css'] %} + +{# do not display relbars #} +{% block relbar1 %}{% endblock %} +{% block relbar2 %}{% endblock %} + +{% macro nav() %} + <p> + {%- block haikurel1 %} + {%- endblock %} + {%- if prev %} + «  <a href="{{ prev.link|e }}">{{ prev.title }}</a> +   ::   + {%- endif %} + <a class="uplink" href="{{ pathto(master_doc) }}">{{ _('Contents') }}</a> + {%- if next %} +   ::   + <a href="{{ next.link|e }}">{{ next.title }}</a>  » + {%- endif %} + {%- block haikurel2 %} + {%- endblock %} + </p> +{% endmacro %} + +{% block content %} + <div class="header"> + {%- block haikuheader %} + {%- if theme_full_logo != "false" %} + <a href="{{ pathto('index') }}"> + <img class="logo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/> + </a> + {%- else %} + {%- if logo -%} + <img class="rightlogo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/> + {%- endif -%} + <h1 class="heading"><a href="{{ pathto('index') }}"> + <span>{{ shorttitle|e }}</span></a></h1> + <h2 class="heading"><span>{{ title|striptags }}</span></h2> + {%- endif %} + {%- endblock %} + </div> + <div class="topnav"> + {{ nav() }} + </div> + <div class="content"> + {#{%- if display_toc %} + <div id="toc"> + <h3>Table Of Contents</h3> + {{ toc }} + </div> + {%- endif %}#} + {% block body %}{% endblock %} + </div> + <div class="bottomnav"> + {{ nav() }} + </div> +{% endblock %}
\ No newline at end of file diff --git a/sphinx/themes/haiku/static/alert_info_32.png b/sphinx/themes/haiku/static/alert_info_32.png Binary files differnew file mode 100644 index 00000000..05b4fe89 --- /dev/null +++ b/sphinx/themes/haiku/static/alert_info_32.png diff --git a/sphinx/themes/haiku/static/alert_warning_32.png b/sphinx/themes/haiku/static/alert_warning_32.png Binary files differnew file mode 100644 index 00000000..f13611cd --- /dev/null +++ b/sphinx/themes/haiku/static/alert_warning_32.png diff --git a/sphinx/themes/haiku/static/bg-page.png b/sphinx/themes/haiku/static/bg-page.png Binary files differnew file mode 100644 index 00000000..c6f3bc47 --- /dev/null +++ b/sphinx/themes/haiku/static/bg-page.png diff --git a/sphinx/themes/haiku/static/bullet_orange.png b/sphinx/themes/haiku/static/bullet_orange.png Binary files differnew file mode 100644 index 00000000..ad5d02f3 --- /dev/null +++ b/sphinx/themes/haiku/static/bullet_orange.png diff --git a/sphinx/themes/haiku/static/haiku.css_t b/sphinx/themes/haiku/static/haiku.css_t new file mode 100644 index 00000000..93007dfb --- /dev/null +++ b/sphinx/themes/haiku/static/haiku.css_t @@ -0,0 +1,371 @@ +/* + * haiku.css_t + * ~~~~~~~~~~~ + * + * Sphinx stylesheet -- haiku theme. + * + * Adapted from http://haiku-os.org/docs/Haiku-doc.css. + * Original copyright message: + * + * Copyright 2008-2009, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Francois Revol <revol@free.fr> + * Stephan Assmus <superstippi@gmx.de> + * Braden Ewing <brewin@gmail.com> + * Humdinger <humdingerb@gmail.com> + * + * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +@import url("basic.css"); + +html { + margin: 0px; + padding: 0px; + background: #FFF url(bg-page.png) top left repeat-x; +} + +body { + line-height: 1.5; + margin: auto; + padding: 0px; + font-family: "DejaVu Sans", Arial, Helvetica, sans-serif; + min-width: 59em; + max-width: 70em; + color: {{ theme_textcolor }}; +} + +div.footer { + padding: 8px; + font-size: 11px; + text-align: center; + letter-spacing: 0.5px; +} + +/* link colors and text decoration */ + +a:link { + font-weight: bold; + text-decoration: none; + color: {{ theme_linkcolor }}; +} + +a:visited { + font-weight: bold; + text-decoration: none; + color: {{ theme_visitedlinkcolor }}; +} + +a:hover, a:active { + text-decoration: underline; + color: {{ theme_hoverlinkcolor }}; +} + +/* Some headers act as anchors, don't give them a hover effect */ + +h1 a:hover, a:active { + text-decoration: none; + color: {{ theme_headingcolor }}; +} + +h2 a:hover, a:active { + text-decoration: none; + color: {{ theme_headingcolor }}; +} + +h3 a:hover, a:active { + text-decoration: none; + color: {{ theme_headingcolor }}; +} + +h4 a:hover, a:active { + text-decoration: none; + color: {{ theme_headingcolor }}; +} + +a.headerlink { + color: #a7ce38; + padding-left: 5px; +} + +a.headerlink:hover { + color: #a7ce38; +} + +/* basic text elements */ + +div.content { + margin-top: 20px; + margin-left: 40px; + margin-right: 40px; + margin-bottom: 50px; + font-size: 0.9em; +} + +/* heading and navigation */ + +div.header { + position: relative; + left: 0px; + top: 0px; + height: 85px; + /* background: #eeeeee; */ + padding: 0 40px; +} +div.header h1 { + font-size: 1.6em; + font-weight: normal; + letter-spacing: 1px; + color: {{ theme_headingcolor }}; + border: 0; + margin: 0; + padding-top: 15px; +} +div.header h1 a { + font-weight: normal; + color: {{ theme_headingcolor }}; +} +div.header h2 { + font-size: 1.3em; + font-weight: normal; + letter-spacing: 1px; + text-transform: uppercase; + color: #aaa; + border: 0; + margin-top: -3px; + padding: 0; +} + +div.header img.rightlogo { + float: right; +} + + +div.title { + font-size: 1.3em; + font-weight: bold; + color: {{ theme_headingcolor }}; + border-bottom: dotted thin #e0e0e0; + margin-bottom: 25px; +} +div.topnav { + /* background: #e0e0e0; */ +} +div.topnav p { + margin-top: 0; + margin-left: 40px; + margin-right: 40px; + margin-bottom: 0px; + text-align: right; + font-size: 0.8em; +} +div.bottomnav { + background: #eeeeee; +} +div.bottomnav p { + margin-right: 40px; + text-align: right; + font-size: 0.8em; +} + +a.uplink { + font-weight: normal; +} + + +/* contents box */ + +table.index { + margin: 0px 0px 30px 30px; + padding: 1px; + border-width: 1px; + border-style: dotted; + border-color: #e0e0e0; +} +table.index tr.heading { + background-color: #e0e0e0; + text-align: center; + font-weight: bold; + font-size: 1.1em; +} +table.index tr.index { + background-color: #eeeeee; +} +table.index td { + padding: 5px 20px; +} + +table.index a:link, table.index a:visited { + font-weight: normal; + text-decoration: none; + color: {{ theme_linkcolor }}; +} +table.index a:hover, table.index a:active { + text-decoration: underline; + color: {{ theme_hoverlinkcolor }}; +} + + +/* Haiku User Guide styles and layout */ + +/* Rounded corner boxes */ +/* Common declarations */ +div.admonition { + -webkit-border-radius: 10px; + -khtml-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + border-style: dotted; + border-width: thin; + border-color: #dcdcdc; + padding: 10px 15px 10px 15px; + margin-bottom: 15px; + margin-top: 15px; +} +div.note { + padding: 10px 15px 10px 80px; + background: #e4ffde url(alert_info_32.png) 15px 15px no-repeat; + min-height: 42px; +} +div.warning { + padding: 10px 15px 10px 80px; + background: #fffbc6 url(alert_warning_32.png) 15px 15px no-repeat; + min-height: 42px; +} +div.seealso { + background: #e4ffde; +} + +/* More layout and styles */ +h1 { + font-size: 1.3em; + font-weight: bold; + color: {{ theme_headingcolor }}; + border-bottom: dotted thin #e0e0e0; + margin-top: 30px; +} + +h2 { + font-size: 1.2em; + font-weight: normal; + color: {{ theme_headingcolor }}; + border-bottom: dotted thin #e0e0e0; + margin-top: 30px; +} + +h3 { + font-size: 1.1em; + font-weight: normal; + color: {{ theme_headingcolor }}; + margin-top: 30px; +} + +h4 { + font-size: 1.0em; + font-weight: normal; + color: {{ theme_headingcolor }}; + margin-top: 30px; +} + +p { + text-align: justify; +} + +p.last { + margin-bottom: 0; +} + +ol { + padding-left: 20px; +} + +ul { + padding-left: 5px; + margin-top: 3px; +} + +li { + line-height: 1.3; +} + +div.content li { + -moz-background-clip:border; + -moz-background-inline-policy:continuous; + -moz-background-origin:padding; + background: transparent url(bullet_orange.png) no-repeat scroll left 0.45em; + list-style-image: none; + list-style-type: none; + padding: 0 0 0 1.666em; + margin-bottom: 3px; +} + +td { + vertical-align: top; +} + +tt { + background-color: #e2e2e2; + font-size: 1.0em; + font-family: monospace; +} + +pre { + border-color: #0c3762; + border-style: dotted; + border-width: thin; + margin: 0 0 12px 0; + padding: 0.8em; + background-color: #f0f0f0; +} + +hr { + border-top: 1px solid #ccc; + border-bottom: 0; + border-right: 0; + border-left: 0; + margin-bottom: 10px; + margin-top: 20px; +} + +/* printer only pretty stuff */ +@media print { + .noprint { + display: none; + } + /* for acronyms we want their definitions inlined at print time */ + acronym[title]:after { + font-size: small; + content: " (" attr(title) ")"; + font-style: italic; + } + /* and not have mozilla dotted underline */ + acronym { + border: none; + } + div.topnav, div.bottomnav, div.header, table.index { + display: none; + } + div.content { + margin: 0px; + padding: 0px; + } + html { + background: #FFF; + } +} + +.viewcode-back { + font-family: "DejaVu Sans", Arial, Helvetica, sans-serif; +} + +div.viewcode-block:target { + background-color: #f4debf; + border-top: 1px solid #ac9; + border-bottom: 1px solid #ac9; + margin: -1px -12px; + padding: 0 12px; +} diff --git a/sphinx/themes/haiku/theme.conf b/sphinx/themes/haiku/theme.conf new file mode 100644 index 00000000..3537da1d --- /dev/null +++ b/sphinx/themes/haiku/theme.conf @@ -0,0 +1,12 @@ +[theme] +inherit = basic +stylesheet = haiku.css +pygments_style = autumn + +[options] +full_logo = false +textcolor = #333333 +headingcolor = #0c3762 +linkcolor = #dc3c01 +visitedlinkcolor = #892601 +hoverlinkcolor = #ff4500 diff --git a/sphinx/themes/nature/static/nature.css_t b/sphinx/themes/nature/static/nature.css_t new file mode 100644 index 00000000..d0aa912b --- /dev/null +++ b/sphinx/themes/nature/static/nature.css_t @@ -0,0 +1,245 @@ +/* + * nature.css_t + * ~~~~~~~~~~~~ + * + * Sphinx stylesheet -- nature theme. + * + * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +@import url("basic.css"); + +/* -- page layout ----------------------------------------------------------- */ + +body { + font-family: Arial, sans-serif; + font-size: 100%; + background-color: #111; + color: #555; + margin: 0; + padding: 0; +} + +div.documentwrapper { + float: left; + width: 100%; +} + +div.bodywrapper { + margin: 0 0 0 230px; +} + +hr { + border: 1px solid #B1B4B6; +} + +div.document { + background-color: #eee; +} + +div.body { + background-color: #ffffff; + color: #3E4349; + padding: 0 30px 30px 30px; + font-size: 0.9em; +} + +div.footer { + color: #555; + width: 100%; + padding: 13px 0; + text-align: center; + font-size: 75%; +} + +div.footer a { + color: #444; + text-decoration: underline; +} + +div.related { + background-color: #6BA81E; + line-height: 32px; + color: #fff; + text-shadow: 0px 1px 0 #444; + font-size: 0.9em; +} + +div.related a { + color: #E2F3CC; +} + +div.sphinxsidebar { + font-size: 0.75em; + line-height: 1.5em; +} + +div.sphinxsidebarwrapper{ + padding: 20px 0; +} + +div.sphinxsidebar h3, +div.sphinxsidebar h4 { + font-family: Arial, sans-serif; + color: #222; + font-size: 1.2em; + font-weight: normal; + margin: 0; + padding: 5px 10px; + background-color: #ddd; + text-shadow: 1px 1px 0 white +} + +div.sphinxsidebar h4{ + font-size: 1.1em; +} + +div.sphinxsidebar h3 a { + color: #444; +} + + +div.sphinxsidebar p { + color: #888; + padding: 5px 20px; +} + +div.sphinxsidebar p.topless { +} + +div.sphinxsidebar ul { + margin: 10px 20px; + padding: 0; + color: #000; +} + +div.sphinxsidebar a { + color: #444; +} + +div.sphinxsidebar input { + border: 1px solid #ccc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar input[type=text]{ + margin-left: 20px; +} + +/* -- body styles ----------------------------------------------------------- */ + +a { + color: #005B81; + text-decoration: none; +} + +a:hover { + color: #E32E00; + text-decoration: underline; +} + +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + font-family: Arial, sans-serif; + background-color: #BED4EB; + font-weight: normal; + color: #212224; + margin: 30px 0px 10px 0px; + padding: 5px 0 5px 10px; + text-shadow: 0px 1px 0 white +} + +div.body h1 { border-top: 20px solid white; margin-top: 0; font-size: 200%; } +div.body h2 { font-size: 150%; background-color: #C8D5E3; } +div.body h3 { font-size: 120%; background-color: #D8DEE3; } +div.body h4 { font-size: 110%; background-color: #D8DEE3; } +div.body h5 { font-size: 100%; background-color: #D8DEE3; } +div.body h6 { font-size: 100%; background-color: #D8DEE3; } + +a.headerlink { + color: #c60f0f; + font-size: 0.8em; + padding: 0 4px 0 4px; + text-decoration: none; +} + +a.headerlink:hover { + background-color: #c60f0f; + color: white; +} + +div.body p, div.body dd, div.body li { + line-height: 1.5em; +} + +div.admonition p.admonition-title + p { + display: inline; +} + +div.highlight{ + background-color: white; +} + +div.note { + background-color: #eee; + border: 1px solid #ccc; +} + +div.seealso { + background-color: #ffc; + border: 1px solid #ff6; +} + +div.topic { + background-color: #eee; +} + +div.warning { + background-color: #ffe4e4; + border: 1px solid #f66; +} + +p.admonition-title { + display: inline; +} + +p.admonition-title:after { + content: ":"; +} + +pre { + padding: 10px; + background-color: White; + color: #222; + line-height: 1.2em; + border: 1px solid #C6C9CB; + font-size: 1.1em; + margin: 1.5em 0 1.5em 0; + -webkit-box-shadow: 1px 1px 1px #d8d8d8; + -moz-box-shadow: 1px 1px 1px #d8d8d8; +} + +tt { + background-color: #ecf0f3; + color: #222; + /* padding: 1px 2px; */ + font-size: 1.1em; + font-family: monospace; +} + +.viewcode-back { + font-family: Arial, sans-serif; +} + +div.viewcode-block:target { + background-color: #f4debf; + border-top: 1px solid #ac9; + border-bottom: 1px solid #ac9; +} diff --git a/sphinx/themes/nature/theme.conf b/sphinx/themes/nature/theme.conf new file mode 100644 index 00000000..1cc40044 --- /dev/null +++ b/sphinx/themes/nature/theme.conf @@ -0,0 +1,4 @@ +[theme] +inherit = basic +stylesheet = nature.css +pygments_style = tango diff --git a/sphinx/themes/scrolls/artwork/logo.svg b/sphinx/themes/scrolls/artwork/logo.svg new file mode 100644 index 00000000..0907a4ea --- /dev/null +++ b/sphinx/themes/scrolls/artwork/logo.svg @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="200" + height="80" + id="svg2766" + sodipodi:version="0.32" + inkscape:version="0.46" + version="1.0" + sodipodi:docname="logo.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs2768"> + <linearGradient + id="linearGradient6558"> + <stop + style="stop-color:#575757;stop-opacity:1;" + offset="0" + id="stop6560" /> + <stop + style="stop-color:#2f2f2f;stop-opacity:1;" + offset="1" + id="stop6562" /> + </linearGradient> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + id="perspective2774" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient6558" + id="radialGradient2797" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.7160081,0,0,0.6767021,-34.98413,-3.3035294e-2)" + cx="61.297766" + cy="60.910986" + fx="61.297766" + fy="60.910986" + r="44.688254" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="6.1848684" + inkscape:cx="95.923838" + inkscape:cy="34.518668" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1440" + inkscape:window-height="852" + inkscape:window-x="0" + inkscape:window-y="0" /> + <metadata + id="metadata2771"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <path + style="opacity:1;fill:url(#radialGradient2797);fill-opacity:1;fill-rule:evenodd;stroke:#323232;stroke-width:0.71600807000000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + d="M 72.4375 8.6875 L 3.0625 18.71875 L 20.84375 29.0625 L 20.6875 44.09375 L 7.75 36.1875 L 8.40625 71.75 L 17.125 65.625 L 29.09375 67.5625 L 33.15625 39.90625 L 25.875 43.78125 L 26.1875 33.59375 L 46.875 31.34375 L 47.21875 42.96875 L 39.28125 40.5625 L 42.6875 67.71875 L 52.375 66.75 L 60.3125 71.75 L 62.90625 33.4375 L 53.03125 43.625 L 53.03125 28.25 L 72.4375 8.6875 z M 48.03125 22.125 L 47.0625 26.46875 L 28.46875 28.09375 L 28.46875 25.1875 L 48.03125 22.125 z M 58.375 45.0625 L 57.40625 62.875 L 51.40625 60.59375 L 45.90625 61.71875 L 43 46.21875 L 53.84375 49.9375 L 58.375 45.0625 z M 12.125 46.53125 L 22 49.75 L 26.53125 47.03125 L 25.21875 62.0625 L 16.96875 60.4375 L 12.125 63.65625 L 12.125 46.53125 z " + id="path2783" /> + <path + style="opacity:1;fill:#e7eef6;fill-opacity:1;fill-rule:nonzero;stroke:#e1e8f3;stroke-width:0.52748101999999997;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + d="M 75.632462,22.265877 L 64.489624,64.880679 L 92.7889,40.941187 L 91.373937,61.872575 L 128.87048,23.519253 L 116.84328,58.36312 L 144.25821,44.450641 L 145.49631,65.632704 L 169.02007,38.183758 L 170.78877,60.493861 L 193.07447,18.631085 L 176.09491,36.554369 L 176.44864,19.633786 L 152.0405,44.701316 L 156.81601,27.655396 L 128.87048,44.325304 L 137.00652,14.494942 L 99.863721,44.325304 L 100.74807,27.028707 L 76.163076,45.829355 L 75.632462,22.265877 z" + id="path2804" /> + <text + xml:space="preserve" + style="font-size:12px;font-style:normal;font-weight:normal;opacity:1;fill:#1752b4;fill-opacity:1;fill-rule:nonzero;stroke:#28437f;stroke-width:0.71600807000000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans" + x="68.40242" + y="54.03759" + id="text2800"><tspan + sodipodi:role="line" + id="tspan2802" + x="68.40242" + y="54.03759" + style="font-size:36px;fill:#1752b4;fill-opacity:1;fill-rule:nonzero;stroke:#28437f;stroke-width:0.71600807000000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate">Project</tspan></text> + </g> +</svg> diff --git a/sphinx/themes/scrolls/layout.html b/sphinx/themes/scrolls/layout.html new file mode 100644 index 00000000..9c139b88 --- /dev/null +++ b/sphinx/themes/scrolls/layout.html @@ -0,0 +1,42 @@ +{# + scrolls/layout.html + ~~~~~~~~~~~~~~~~~~~ + + Sphinx layout template for the scrolls theme, originally written + by Armin Ronacher. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} +{% extends "basic/layout.html" %} +{% set script_files = script_files + ['_static/theme_extras.js'] %} +{% set css_files = css_files + ['_static/print.css'] %} +{# do not display relbars #} +{% block relbar1 %}{% endblock %} +{% block relbar2 %}{% endblock %} +{% block content %} + <div id="content"> + <div class="header"> + <h1 class="heading"><a href="{{ pathto('index') }}" + title="back to the documentation overview"><span>{{ title|striptags }}</span></a></h1> + </div> + <div class="relnav"> + {%- if prev %} + <a href="{{ prev.link|e }}">« {{ prev.title }}</a> | + {%- endif %} + <a href="{{ pathto(current_page_name) if current_page_name else '#' }}">{{ title }}</a> + {%- if next %} + | <a href="{{ next.link|e }}">{{ next.title }} »</a> + {%- endif %} + </div> + <div id="contentwrapper"> + {%- if display_toc %} + <div id="toc"> + <h3>Table Of Contents</h3> + {{ toc }} + </div> + {%- endif %} + {% block body %}{% endblock %} + </div> + </div> +{% endblock %}
\ No newline at end of file diff --git a/sphinx/themes/scrolls/static/darkmetal.png b/sphinx/themes/scrolls/static/darkmetal.png Binary files differnew file mode 100644 index 00000000..e8c9ff62 --- /dev/null +++ b/sphinx/themes/scrolls/static/darkmetal.png diff --git a/sphinx/themes/scrolls/static/headerbg.png b/sphinx/themes/scrolls/static/headerbg.png Binary files differnew file mode 100644 index 00000000..0c5b3657 --- /dev/null +++ b/sphinx/themes/scrolls/static/headerbg.png diff --git a/sphinx/themes/scrolls/static/logo.png b/sphinx/themes/scrolls/static/logo.png Binary files differnew file mode 100644 index 00000000..d1961cf0 --- /dev/null +++ b/sphinx/themes/scrolls/static/logo.png diff --git a/sphinx/themes/scrolls/static/metal.png b/sphinx/themes/scrolls/static/metal.png Binary files differnew file mode 100644 index 00000000..97166f13 --- /dev/null +++ b/sphinx/themes/scrolls/static/metal.png diff --git a/sphinx/themes/scrolls/static/navigation.png b/sphinx/themes/scrolls/static/navigation.png Binary files differnew file mode 100644 index 00000000..1e248d4d --- /dev/null +++ b/sphinx/themes/scrolls/static/navigation.png diff --git a/sphinx/themes/scrolls/static/print.css b/sphinx/themes/scrolls/static/print.css new file mode 100644 index 00000000..fb633d87 --- /dev/null +++ b/sphinx/themes/scrolls/static/print.css @@ -0,0 +1,5 @@ +div.header, div.relnav, #toc { display: none; } +#contentwrapper { padding: 0; margin: 0; border: none; } +body { color: black; background-color: white; } +div.footer { border-top: 1px solid #888; color: #888; margin-top: 1cm; } +div.footer a { text-decoration: none; } diff --git a/sphinx/themes/scrolls/static/scrolls.css_t b/sphinx/themes/scrolls/static/scrolls.css_t new file mode 100644 index 00000000..589f91ab --- /dev/null +++ b/sphinx/themes/scrolls/static/scrolls.css_t @@ -0,0 +1,431 @@ +/* + * scrolls.css_t + * ~~~~~~~~~~~~~ + * + * Sphinx stylesheet -- scrolls theme. + * + * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +body { + background-color: #222; + margin: 0; + padding: 0; + font-family: 'Georgia', serif; + font-size: 15px; + color: #eee; +} + +div.footer { + border-top: 1px solid #111; + padding: 8px; + font-size: 11px; + text-align: center; + letter-spacing: 0.5px; +} + +div.footer a { + color: #eee; +} + +div.header { + margin: 0 -15px 0 -15px; + background: url(headerbg.png) repeat-x; + border-top: 6px solid {{ theme_headerbordercolor }}; +} + +div.relnav { + border-bottom: 1px solid #111; + background: url(navigation.png); + margin: 0 -15px 0 -15px; + padding: 2px 20px 0 28px; + line-height: 25px; + color: #aaa; + font-size: 12px; + text-align: center; +} + +div.relnav a { + color: #eee; + font-weight: bold; + text-decoration: none; +} + +div.relnav a:hover { + text-decoration: underline; +} + +#content { + background-color: white; + color: #111; + border-bottom: 1px solid black; + background: url(watermark.png) center 0; + padding: 0 15px 0 15px; + margin: 0; +} + +h1 { + margin: 0; + padding: 15px 0 0 0; +} + +h1.heading { + margin: 0; + padding: 0; + height: 80px; +} + +h1.heading:hover { + background: #222; +} + +h1.heading a { + background: url({{ logo if logo else 'logo.png' }}) no-repeat center 0; + display: block; + width: 100%; + height: 80px; +} + +h1.heading a:focus { + -moz-outline: none; + outline: none; +} + +h1.heading span { + display: none; +} + +#contentwrapper { + max-width: 680px; + padding: 0 18px 20px 18px; + margin: 0 auto 0 auto; + border-right: 1px solid #eee; + border-left: 1px solid #eee; + background: url(watermark_blur.png) center -114px; +} + +#contentwrapper h2, +#contentwrapper h2 a { + color: #222; + font-size: 24px; + margin: 20px 0 0 0; +} + +#contentwrapper h3, +#contentwrapper h3 a { + color: {{ theme_subheadlinecolor }}; + font-size: 20px; + margin: 20px 0 0 0; +} + +table.docutils { + border-collapse: collapse; + border: 2px solid #aaa; + margin: 0.5em 1.5em 0.5em 1.5em; +} + +table.docutils td { + padding: 2px; + border: 1px solid #ddd; +} + +p, li, dd, dt, blockquote { + color: #333; +} + +blockquote { + margin: 10px 0 10px 20px; +} + +p { + line-height: 20px; + margin-bottom: 0; + margin-top: 10px; +} + +hr { + border-top: 1px solid #ccc; + border-bottom: 0; + border-right: 0; + border-left: 0; + margin-bottom: 10px; + margin-top: 20px; +} + +dl { + margin-left: 10px; +} + +li, dt { + margin-top: 5px; +} + +dt { + font-weight: bold; + color: #000; +} + +dd { + margin-top: 10px; + line-height: 20px; +} + +th { + text-align: left; + padding: 3px; + background-color: #f2f2f2; +} + +a { + color: {{ theme_linkcolor }}; +} + +a:hover { + color: {{ theme_visitedlinkcolor }}; +} + +pre { + background: #ededed url(metal.png); + border-top: 1px solid #ccc; + border-bottom: 1px solid #ccc; + padding: 5px; + font-size: 13px; + font-family: 'Bitstream Vera Sans Mono', 'Monaco', monospace; +} + +tt { + font-size: 13px; + font-family: 'Bitstream Vera Sans Mono', 'Monaco', monospace; + color: black; + padding: 1px 2px 1px 2px; + background-color: #fafafa; + border-bottom: 1px solid #eee; +} + +a.reference:hover tt { + border-bottom-color: #aaa; +} + +cite { + /* abusing <cite>, it's generated by ReST for `x` */ + font-size: 13px; + font-family: 'Bitstream Vera Sans Mono', 'Monaco', monospace; + font-weight: bold; + font-style: normal; +} + +div.admonition { + margin: 10px 0 10px 0; + padding: 10px; + border: 1px solid #ccc; +} + +div.admonition p.admonition-title { + background-color: {{ theme_admonitioncolor }}; + color: white; + margin: -10px -10px 10px -10px; + padding: 4px 10px 4px 10px; + font-weight: bold; + font-size: 15px; +} + +div.admonition p.admonition-title a { + color: white!important; +} + +a.headerlink { + color: #B4B4B4!important; + font-size: 0.8em; + padding: 0 4px 0 4px; + text-decoration: none!important; + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +dt:hover > a.headerlink { + visibility: visible; +} + +a.headerlink:hover { + background-color: #B4B4B4; + color: #F0F0F0!important; +} + +table.indextable { + width: 100%; +} + +table.genindextable td { + vertical-align: top; + width: 50%; +} + +table.indextable dl dd { + font-size: 11px; +} + +table.indextable dl dd a { + color: #000; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +table.modindextable { + width: 100%; + border: none; +} + +table.modindextable img.toggler { + margin-right: 10px; +} + +dl.function dt, +dl.class dt, +dl.exception dt, +dl.method dt, +dl.attribute dt { + font-weight: normal; +} + +dt .descname { + font-weight: bold; + margin-right: 4px; +} + +dt .descname, dt .descclassname { + padding: 0; + background: transparent; + border-bottom: 1px solid #111; +} + +dt .descclassname { + margin-left: 2px; +} + +dl dt big { + font-size: 100%; +} + +ul.search { + margin: 10px 0 0 30px; + padding: 0; +} + +ul.search li { + margin: 10px 0 0 0; + padding: 0; +} + +ul.search div.context { + font-size: 12px; + padding: 4px 0 0 20px; + color: #888; +} + +span.highlight { + background-color: #eee; + border: 1px solid #ccc; +} + +#toc { + margin: 0 -17px 0 -17px; + display: none; +} + +#toc h3 { + float: right; + margin: 5px 5px 0 0; + padding: 0; + font-size: 12px; + color: #777; +} + +#toc h3:hover { + color: #333; + cursor: pointer; +} + +.expandedtoc { + background: #222 url(darkmetal.png); + border-bottom: 1px solid #111; + outline-bottom: 1px solid #000; + padding: 5px; +} + +.expandedtoc h3 { + color: #aaa; + margin: 0!important; +} + +.expandedtoc h3:hover { + color: white!important; +} + +#tod h3:hover { + color: white; +} + +#toc a { + color: #ddd; + text-decoration: none; +} + +#toc a:hover { + color: white; + text-decoration: underline; +} + +#toc ul { + margin: 5px 0 12px 17px; + padding: 0 7px 0 7px; +} + +#toc ul ul { + margin-bottom: 0; +} + +#toc ul li { + margin: 2px 0 0 0; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: 'Georgia', serif; +} + +div.viewcode-block:target { + background-color: #f4debf; + border-top: 1px solid #ac9; + border-bottom: 1px solid #ac9; + margin: -1px -5px; + padding: 0 5px; +} diff --git a/sphinx/themes/scrolls/static/theme_extras.js b/sphinx/themes/scrolls/static/theme_extras.js new file mode 100644 index 00000000..1c042187 --- /dev/null +++ b/sphinx/themes/scrolls/static/theme_extras.js @@ -0,0 +1,26 @@ +$(function() { + + var + toc = $('#toc').show(), + items = $('#toc > ul').hide(); + + $('#toc h3') + .click(function() { + if (items.is(':visible')) { + items.animate({ + height: 'hide', + opacity: 'hide' + }, 300, function() { + toc.removeClass('expandedtoc'); + }); + } + else { + items.animate({ + height: 'show', + opacity: 'show' + }, 400); + toc.addClass('expandedtoc'); + } + }); + +}); diff --git a/sphinx/themes/scrolls/static/watermark.png b/sphinx/themes/scrolls/static/watermark.png Binary files differnew file mode 100644 index 00000000..eb1b6be9 --- /dev/null +++ b/sphinx/themes/scrolls/static/watermark.png diff --git a/sphinx/themes/scrolls/static/watermark_blur.png b/sphinx/themes/scrolls/static/watermark_blur.png Binary files differnew file mode 100644 index 00000000..563f6cde --- /dev/null +++ b/sphinx/themes/scrolls/static/watermark_blur.png diff --git a/sphinx/themes/scrolls/theme.conf b/sphinx/themes/scrolls/theme.conf new file mode 100644 index 00000000..4e7800f9 --- /dev/null +++ b/sphinx/themes/scrolls/theme.conf @@ -0,0 +1,11 @@ +[theme] +inherit = basic +stylesheet = scrolls.css +pygments_style = tango + +[options] +headerbordercolor = #1752b4 +subheadlinecolor = #0d306b +linkcolor = #1752b4 +visitedlinkcolor = #444 +admonitioncolor = #28437f diff --git a/sphinx/themes/sphinxdoc/layout.html b/sphinx/themes/sphinxdoc/layout.html index 48d2118e..2d653f9f 100644 --- a/sphinx/themes/sphinxdoc/layout.html +++ b/sphinx/themes/sphinxdoc/layout.html @@ -1,3 +1,12 @@ +{# + sphinxdoc/layout.html + ~~~~~~~~~~~~~~~~~~~~~ + + Sphinx layout template for the sphinxdoc theme. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} {% extends "basic/layout.html" %} {# put the sidebar before the body #} diff --git a/sphinx/themes/sphinxdoc/static/sphinxdoc.css b/sphinx/themes/sphinxdoc/static/sphinxdoc.css index 75b2ae0f..c7e6e335 100644 --- a/sphinx/themes/sphinxdoc/static/sphinxdoc.css +++ b/sphinx/themes/sphinxdoc/static/sphinxdoc.css @@ -1,8 +1,13 @@ -/** - * Sphinx stylesheet -- sphinxdoc theme - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/* + * sphinxdoc.css_t + * ~~~~~~~~~~~~~~~ + * + * Sphinx stylesheet -- sphinxdoc theme. Originally created by + * Armin Ronacher for Werkzeug. + * + * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. * - * Originally created by Armin Ronacher for Werkzeug, adapted by Georg Brandl. */ @import url("basic.css"); @@ -321,3 +326,14 @@ div.versioninfo { line-height: 1.3em; font-size: 0.9em; } + +.viewcode-back { + font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', + 'Verdana', sans-serif; +} + +div.viewcode-block:target { + background-color: #f4debf; + border-top: 1px solid #ac9; + border-bottom: 1px solid #ac9; +} diff --git a/sphinx/themes/traditional/static/traditional.css b/sphinx/themes/traditional/static/traditional.css index 8c224c07..c9980fa5 100644 --- a/sphinx/themes/traditional/static/traditional.css +++ b/sphinx/themes/traditional/static/traditional.css @@ -1,5 +1,12 @@ -/** - * Sphinx Doc Design -- traditional python.org style +/* + * traditional.css + * ~~~~~~~~~~~~~~~ + * + * Sphinx stylesheet -- traditional docs.python.org theme. + * + * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * */ body { @@ -636,6 +643,18 @@ tt.xref, a tt { .footnote:target { background-color: #ffa } +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { background-color: transparent; } @@ -698,3 +717,20 @@ form.comment textarea { display: none; } } + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: serif; +} + +div.viewcode-block:target { + background-color: #f4debf; + border-top: 1px solid #ac9; + border-bottom: 1px solid #ac9; + margin: -1px -10px; + padding: 0 10px; +} diff --git a/sphinx/theming.py b/sphinx/theming.py index 27a1c26a..0d0f2863 100644 --- a/sphinx/theming.py +++ b/sphinx/theming.py @@ -78,7 +78,7 @@ class Theme(object): dirname = path.dirname(name) if not path.isdir(path.join(self.themedir, dirname)): os.makedirs(path.join(self.themedir, dirname)) - fp = open(path.join(self.themedir, name), 'w') + fp = open(path.join(self.themedir, name), 'wb') fp.write(tinfo.read(name)) fp.close() diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index 5745907f..8d1298cd 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -12,10 +12,6 @@ import os import re import sys -import stat -import time -import errno -import types import shutil import fnmatch import tempfile @@ -24,301 +20,72 @@ import traceback from os import path import docutils +from docutils.utils import relative_path + +import jinja2 + import sphinx +from sphinx.errors import PycodeError -# Errnos that we need. -EEXIST = getattr(errno, 'EEXIST', 0) -ENOENT = getattr(errno, 'ENOENT', 0) -EPIPE = getattr(errno, 'EPIPE', 0) +# import other utilities; partly for backwards compatibility, so don't +# prune unused ones indiscriminately +from sphinx.util.osutil import SEP, os_path, relative_uri, ensuredir, walk, \ + mtimes_of_files, movefile, copyfile, copytimes, make_filename, ustrftime +from sphinx.util.nodes import nested_parse_with_titles, split_explicit_title, \ + explicit_title_re, caption_ref_re +from sphinx.util.matching import patfilter # 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 -# -# Define SEP as a manifest constant, not so much because we expect it to change -# in the future as to avoid the suspicion that a stray "/" in the code is a -# hangover from more *nix-oriented origins. -SEP = "/" - -def os_path(canonicalpath): - return canonicalpath.replace(SEP, os.path.sep) - - -def relative_uri(base, to): - """Return a relative URL from ``base`` to ``to``.""" - if to.startswith(SEP): - return to - b2 = base.split(SEP) - t2 = to.split(SEP) - # remove common segments - for x, y in zip(b2, t2): - if x != y: - break - b2.pop(0) - t2.pop(0) - return ('..' + SEP) * (len(b2)-1) + SEP.join(t2) +# High-level utility functions. def docname_join(basedocname, docname): return posixpath.normpath( posixpath.join('/' + basedocname, '..', docname))[1:] -def ensuredir(path): - """Ensure that a path exists.""" - try: - os.makedirs(path) - except OSError, err: - # 0 for Jython/Win32 - if err.errno not in [0, EEXIST]: - raise - - -def walk(top, topdown=True, followlinks=False): - """ - Backport of os.walk from 2.6, where the followlinks argument was added. +def get_matching_files(dirname, exclude_matchers=()): """ - names = os.listdir(top) - - dirs, nondirs = [], [] - for name in names: - if path.isdir(path.join(top, name)): - dirs.append(name) - else: - nondirs.append(name) - - if topdown: - yield top, dirs, nondirs - for name in dirs: - fullpath = path.join(top, name) - if followlinks or not path.islink(fullpath): - for x in walk(fullpath, topdown, followlinks): - yield x - if not topdown: - yield top, dirs, nondirs - + Get all file names in a directory, recursively. -def get_matching_docs(dirname, suffix, exclude_docs=(), exclude_dirs=(), - exclude_trees=(), exclude_dirnames=()): + Exclude files and dirs matching some matcher in *exclude_matchers*. """ - Get all file names (without suffix) matching a suffix in a - directory, recursively. - - Exclude docs in *exclude_docs*, exclude dirs in *exclude_dirs*, - prune dirs in *exclude_trees*, prune dirnames in *exclude_dirnames*. - """ - pattern = '*' + suffix # dirname is a normalized absolute path. dirname = path.normpath(path.abspath(dirname)) - dirlen = len(dirname) + 1 # exclude slash - for root, dirs, files in walk(dirname, followlinks=True): - if root[dirlen:] in exclude_dirs: - continue - if root[dirlen:] in exclude_trees: - del dirs[:] - continue - dirs.sort() - files.sort() - for prunedir in exclude_dirnames: - if prunedir in dirs: - dirs.remove(prunedir) - for sfile in files: - if not fnmatch.fnmatch(sfile, pattern): - continue - qualified_name = path.join(root[dirlen:], sfile[:-len(suffix)]) - qualified_name = qualified_name.replace(os.path.sep, SEP) - if qualified_name in exclude_docs: - continue - yield qualified_name - - -def mtimes_of_files(dirnames, suffix): - for dirname in dirnames: - for root, dirs, files in os.walk(dirname): - for sfile in files: - if sfile.endswith(suffix): - try: - yield path.getmtime(path.join(root, sfile)) - except EnvironmentError: - pass - - -def shorten_result(text='', keywords=[], maxlen=240, fuzz=60): - if not text: - text = '' - text_low = text.lower() - beg = -1 - for k in keywords: - i = text_low.find(k.lower()) - if (i > -1 and i < beg) or beg == -1: - beg = i - excerpt_beg = 0 - if beg > fuzz: - for sep in ('.', ':', ';', '='): - eb = text.find(sep, beg - fuzz, beg - 1) - if eb > -1: - eb += 1 - break - else: - eb = beg - fuzz - excerpt_beg = eb - if excerpt_beg < 0: - excerpt_beg = 0 - msg = text[excerpt_beg:beg+maxlen] - if beg > fuzz: - msg = '... ' + msg - if beg < len(text)-maxlen: - msg = msg + ' ...' - return msg - - -class attrdict(dict): - def __getattr__(self, key): - return self[key] - def __setattr__(self, key, val): - self[key] = val - def __delattr__(self, key): - del self[key] + dirlen = len(dirname) + 1 # exclude final os.path.sep + for root, dirs, files in walk(dirname, followlinks=True): + relativeroot = root[dirlen:] -def fmt_ex(ex): - """Format a single line with an exception description.""" - return traceback.format_exception_only(ex.__class__, ex)[-1].strip() - - -def rpartition(s, t): - """Similar to str.rpartition from 2.5, but doesn't return the separator.""" - i = s.rfind(t) - if i != -1: - return s[:i], s[i+len(t):] - return '', s - - -def format_exception_cut_frames(x=1): - """ - Format an exception with traceback, but only the last x frames. - """ - typ, val, tb = sys.exc_info() - #res = ['Traceback (most recent call last):\n'] - res = [] - tbres = traceback.format_tb(tb) - res += tbres[-x:] - res += traceback.format_exception_only(typ, val) - return ''.join(res) - + qdirs = enumerate(path.join(relativeroot, dn).replace(os.path.sep, SEP) + for dn in dirs) + qfiles = enumerate(path.join(relativeroot, fn).replace(os.path.sep, SEP) + for fn in files) + for matcher in exclude_matchers: + qdirs = [entry for entry in qdirs if not matcher(entry[1])] + qfiles = [entry for entry in qfiles if not matcher(entry[1])] -def save_traceback(): - """ - Save the current exception's traceback in a temporary file. - """ - exc = traceback.format_exc() - fd, path = tempfile.mkstemp('.log', 'sphinx-err-') - os.write(fd, '# Sphinx version: %s\n' % sphinx.__version__) - os.write(fd, '# Docutils version: %s %s\n' % (docutils.__version__, - docutils.__version_details__)) - os.write(fd, exc) - os.close(fd) - return path + dirs[:] = sorted(dirs[i] for (i, _) in qdirs) + for i, filename in sorted(qfiles): + yield filename -def _translate_pattern(pat): - """ - Translate a shell-style glob pattern to a regular expression. - Adapted from the fnmatch module, but enhanced so that single stars don't - match slashes. +def get_matching_docs(dirname, suffix, exclude_matchers=()): """ - i, n = 0, len(pat) - res = '' - while i < n: - c = pat[i] - i += 1 - if c == '*': - if i < n and pat[i] == '*': - # double star matches slashes too - i += 1 - res = res + '.*' - else: - # single star doesn't match slashes - res = res + '[^/]*' - elif c == '?': - # question mark doesn't match slashes too - res = res + '[^/]' - elif c == '[': - j = i - if j < n and pat[j] == '!': - j += 1 - if j < n and pat[j] == ']': - j += 1 - while j < n and pat[j] != ']': - j += 1 - if j >= n: - res = res + '\\[' - else: - stuff = pat[i:j].replace('\\', '\\\\') - i = j + 1 - if stuff[0] == '!': - # negative pattern mustn't match slashes too - stuff = '^/' + stuff[1:] - elif stuff[0] == '^': - stuff = '\\' + stuff - res = '%s[%s]' % (res, stuff) - else: - res += re.escape(c) - return res + '$' - - -_pat_cache = {} - -def patfilter(names, pat): - """ - Return the subset of the list NAMES that match PAT. - Adapted from fnmatch module. - """ - if pat not in _pat_cache: - _pat_cache[pat] = re.compile(_translate_pattern(pat)) - match = _pat_cache[pat].match - return filter(match, names) - - -no_fn_re = re.compile(r'[^a-zA-Z0-9_-]') - -def make_filename(string): - return no_fn_re.sub('', string) - - -def nested_parse_with_titles(state, content, node): - # hack around title style bookkeeping - surrounding_title_styles = state.memo.title_styles - surrounding_section_level = state.memo.section_level - state.memo.title_styles = [] - state.memo.section_level = 0 - 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): - # strftime for unicode strings - return time.strftime(unicode(format).encode('utf-8'), *args).decode('utf-8') - + Get all file names (without suffix) matching a suffix in a + directory, recursively. -class Tee(object): - """ - File-like object writing to two streams. + Exclude files and dirs matching a pattern in *exclude_patterns*. """ - def __init__(self, stream1, stream2): - self.stream1 = stream1 - self.stream2 = stream2 - - def write(self, text): - self.stream1.write(text) - self.stream2.write(text) + suffixpattern = '*' + suffix + for filename in get_matching_files(dirname, exclude_matchers): + if not fnmatch.fnmatch(filename, suffixpattern): + continue + yield filename[:-len(suffix)] class FilenameUniqDict(dict): @@ -358,6 +125,105 @@ class FilenameUniqDict(dict): self._existing = state +def copy_static_entry(source, targetdir, builder, context={}, + exclude_matchers=(), level=0): + """Copy a HTML builder static_path entry from source to targetdir. + + Handles all possible cases of files, directories and subdirectories. + """ + if exclude_matchers: + relpath = relative_path(builder.srcdir, source) + for matcher in exclude_matchers: + if matcher(relpath): + return + if path.isfile(source): + target = path.join(targetdir, path.basename(source)) + if source.lower().endswith('_t') and builder.templates: + # templated! + fsrc = open(source, 'rb') + fdst = open(target[:-2], 'wb') + fdst.write(builder.templates.render_string(fsrc.read(), context)) + fsrc.close() + fdst.close() + else: + copyfile(source, target) + elif path.isdir(source): + if level == 0: + for entry in os.listdir(source): + if entry.startswith('.'): + continue + copy_static_entry(path.join(source, entry), targetdir, + builder, context, level=1, + exclude_matchers=exclude_matchers) + else: + target = path.join(targetdir, path.basename(source)) + if path.exists(target): + shutil.rmtree(target) + shutil.copytree(source, target) + + +def save_traceback(): + """ + Save the current exception's traceback in a temporary file. + """ + exc = traceback.format_exc() + fd, path = tempfile.mkstemp('.log', 'sphinx-err-') + os.write(fd, '# Sphinx version: %s\n' % sphinx.__version__) + os.write(fd, '# Docutils version: %s %s\n' % (docutils.__version__, + docutils.__version_details__)) + os.write(fd, '# Jinja2 version: %s\n' % jinja2.__version__) + os.write(fd, exc) + os.close(fd) + return path + + +def get_module_source(modname): + """Try to find the source code for a module. + + Can return ('file', 'filename') in which case the source is in the given + file, or ('string', 'source') which which case the source is the string. + """ + if modname not in sys.modules: + try: + __import__(modname) + except Exception, err: + raise PycodeError('error importing %r' % modname, err) + mod = sys.modules[modname] + if hasattr(mod, '__loader__'): + try: + source = mod.__loader__.get_source(modname) + except Exception, err: + raise PycodeError('error getting source for %r' % modname, err) + return 'string', source + filename = getattr(mod, '__file__', None) + if filename is None: + raise PycodeError('no source found for module %r' % modname) + filename = path.normpath(path.abspath(filename)) + lfilename = filename.lower() + if lfilename.endswith('.pyo') or lfilename.endswith('.pyc'): + filename = filename[:-1] + elif not lfilename.endswith('.py'): + raise PycodeError('source is not a .py file: %r' % filename) + if not path.isfile(filename): + raise PycodeError('source file is not present: %r' % filename) + return 'file', filename + + +# Low-level utility functions and classes. + +class Tee(object): + """ + File-like object writing to two streams. + """ + def __init__(self, stream1, stream2): + self.stream1 = stream1 + self.stream2 = stream2 + + def write(self, text): + self.stream1.write(text) + self.stream2.write(text) + + def parselinenos(spec, total): """ Parse a line number spec (such as "1,2,4-6") and return a list of @@ -376,12 +242,13 @@ def parselinenos(spec, total): start = (begend[0] == '') and 0 or int(begend[0])-1 end = (begend[1] == '') and total or int(begend[1]) items.extend(xrange(start, end)) - except Exception, err: + except Exception: raise ValueError('invalid line number spec: %r' % spec) return items def force_decode(string, encoding): + """Forcibly get a unicode string out of a bytestring.""" if isinstance(string, str): if encoding: string = string.decode(encoding) @@ -395,93 +262,31 @@ def force_decode(string, encoding): return string -def movefile(source, dest): - """Move a file, removing the destination if it exists.""" - if os.path.exists(dest): - try: - os.unlink(dest) - except OSError: - pass - os.rename(source, dest) - - -def copytimes(source, dest): - """Copy a file's modification times.""" - st = os.stat(source) - if hasattr(os, 'utime'): - os.utime(dest, (st.st_atime, st.st_mtime)) +class attrdict(dict): + def __getattr__(self, key): + return self[key] + def __setattr__(self, key, val): + self[key] = val + def __delattr__(self, key): + del self[key] -def copyfile(source, dest): - """Copy a file and its modification times, if possible.""" - shutil.copyfile(source, dest) - try: - # don't do full copystat because the source may be read-only - copytimes(source, dest) - except OSError: - pass +def rpartition(s, t): + """Similar to str.rpartition from 2.5, but doesn't return the separator.""" + i = s.rfind(t) + if i != -1: + return s[:i], s[i+len(t):] + return '', s -def copy_static_entry(source, target, builder, context={}): - if path.isfile(source): - if source.lower().endswith('_t'): - # templated! - fsrc = open(source, 'rb') - fdst = open(target[:-2], 'wb') - fdst.write(builder.templates.render_string(fsrc.read(), context)) - fsrc.close() - fdst.close() - else: - copyfile(source, target) - elif path.isdir(source): - if source in builder.config.exclude_dirnames: - return - if path.exists(target): - shutil.rmtree(target) - shutil.copytree(source, target) - - -def clean_astext(node): - """Like node.astext(), but ignore images.""" - node = node.deepcopy() - for img in node.traverse(docutils.nodes.image): - img['alt'] = '' - return node.astext() - - -# 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 +def format_exception_cut_frames(x=1): + """ + Format an exception with traceback, but only the last x frames. + """ + typ, val, tb = sys.exc_info() + #res = ['Traceback (most recent call last):\n'] + res = [] + tbres = traceback.format_tb(tb) + res += tbres[-x:] + res += traceback.format_exception_only(typ, val) + return ''.join(res) diff --git a/sphinx/util/compat.py b/sphinx/util/compat.py index 885a458e..3fbfe4b2 100644 --- a/sphinx/util/compat.py +++ b/sphinx/util/compat.py @@ -11,7 +11,7 @@ from docutils import nodes -# function missing in 0.5 SVN +# function missing in docutils 0.5 def make_admonition(node_class, name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): #if not content: @@ -35,64 +35,13 @@ def make_admonition(node_class, name, arguments, options, content, lineno, return [admonition_node] -# support the class-style Directive interface even when using docutils 0.4 +# backwards-compatibility aliases for helpers in older Sphinx versions that +# supported the docutils 0.4 directive function interface -try: - from docutils.parsers.rst import Directive +from docutils.parsers.rst import Directive -except ImportError: - class Directive(object): - """ - Fake Directive class to allow Sphinx directives to be written in - class style. - """ - required_arguments = 0 - optional_arguments = 0 - final_argument_whitespace = False - option_spec = None - has_content = False - - def __init__(self, name, arguments, options, content, lineno, - content_offset, block_text, state, state_machine): - self.name = name - self.arguments = arguments - self.options = options - self.content = content - self.lineno = lineno - self.content_offset = content_offset - self.block_text = block_text - self.state = state - self.state_machine = state_machine - - def run(self): - raise NotImplementedError('Must override run() is subclass.') - - def directive_dwim(obj): - """ - Return something usable with register_directive(), regardless if - class or function. For that, we need to convert classes to a - function for docutils 0.4. - """ - if isinstance(obj, type) and issubclass(obj, Directive): - def _class_directive(name, arguments, options, content, - lineno, content_offset, block_text, - state, state_machine): - return obj(name, arguments, options, content, - lineno, content_offset, block_text, - state, state_machine).run() - _class_directive.options = obj.option_spec - _class_directive.content = obj.has_content - _class_directive.arguments = (obj.required_arguments, - obj.optional_arguments, - obj.final_argument_whitespace) - return _class_directive - return obj - -else: - def directive_dwim(obj): - """ - Return something usable with register_directive(), regardless if - class or function. Nothing to do here, because docutils 0.5 takes - care of converting functions itself. - """ - return obj +def directive_dwim(obj): + import warnings + warnings.warn('directive_dwim is deprecated and no longer needed', + DeprecationWarning, stacklevel=2) + return obj diff --git a/sphinx/util/docfields.py b/sphinx/util/docfields.py new file mode 100644 index 00000000..da93c6fe --- /dev/null +++ b/sphinx/util/docfields.py @@ -0,0 +1,267 @@ +# -*- coding: utf-8 -*- +""" + sphinx.util.docfields + ~~~~~~~~~~~~~~~~~~~~~ + + "Doc fields" are reST field lists in object descriptions that will + be domain-specifically transformed to a more appealing presentation. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from docutils import nodes + +from sphinx import addnodes + + +def _is_single_paragraph(node): + """True if the node only contains one paragraph (and system messages).""" + if len(node) == 0: + return False + elif len(node) > 1: + for subnode in node[1:]: + if not isinstance(subnode, nodes.system_message): + return False + if isinstance(node[0], nodes.paragraph): + return True + return False + + +class Field(object): + """ + A doc field that is never grouped. It can have an argument or not, the + argument can be linked using a specified *rolename*. Field should be used + for doc fields that usually don't occur more than once. + + Example:: + + :returns: description of the return value + :rtype: description of the return type + """ + is_grouped = False + is_typed = False + + def __init__(self, name, names=(), label=None, has_arg=True, rolename=None): + self.name = name + self.names = names + self.label = label + self.has_arg = has_arg + self.rolename = rolename + + def make_xref(self, rolename, domain, target, innernode=nodes.emphasis): + if not rolename: + return innernode(target, target) + refnode = addnodes.pending_xref('', refdomain=domain, refexplicit=False, + reftype=rolename, reftarget=target) + refnode += innernode(target, target) + return refnode + + def make_entry(self, fieldarg, content): + return (fieldarg, content) + + def make_field(self, types, domain, item): + fieldarg, content = item + fieldname = nodes.field_name('', self.label) + if fieldarg: + fieldname += nodes.Text(' ') + fieldname += self.make_xref(self.rolename, domain, + fieldarg, nodes.Text) + fieldbody = nodes.field_body('', nodes.paragraph('', *content)) + return nodes.field('', fieldname, fieldbody) + + +class GroupedField(Field): + """ + A doc field that is grouped; i.e., all fields of that type will be + transformed into one field with its body being a bulleted list. It always + has an argument. The argument can be linked using the given *rolename*. + GroupedField should be used for doc fields that can occur more than once. + If *can_collapse* is true, this field will revert to a Field if only used + once. + + Example:: + + :raises ErrorClass: description when it is raised + """ + is_grouped = True + list_type = nodes.bullet_list + + def __init__(self, name, names=(), label=None, rolename=None, + can_collapse=False): + Field.__init__(self, name, names, label, True, rolename) + self.can_collapse = can_collapse + + def make_field(self, types, domain, items): + fieldname = nodes.field_name('', self.label) + listnode = self.list_type() + if len(items) == 1 and self.can_collapse: + return Field.make_field(self, types, domain, items[0]) + for fieldarg, content in items: + par = nodes.paragraph() + par += self.make_xref(self.rolename, domain, fieldarg, nodes.strong) + par += nodes.Text(' -- ') + par += content + listnode += nodes.list_item('', par) + fieldbody = nodes.field_body('', listnode) + return nodes.field('', fieldname, fieldbody) + + +class TypedField(GroupedField): + """ + A doc field that is grouped and has type information for the arguments. It + always has an argument. The argument can be linked using the given + *rolename*, the type using the given *typerolename*. + + Two uses are possible: either parameter and type description are given + separately, using a field from *names* and one from *typenames*, + respectively, or both are given using a field from *names*, see the example. + + Example:: + + :param foo: description of parameter foo + :type foo: SomeClass + + -- or -- + + :param SomeClass foo: description of parameter foo + """ + is_typed = True + + def __init__(self, name, names=(), typenames=(), label=None, + rolename=None, typerolename=None): + GroupedField.__init__(self, name, names, label, rolename, False) + self.typenames = typenames + self.typerolename = typerolename + + def make_field(self, types, domain, items): + fieldname = nodes.field_name('', self.label) + listnode = self.list_type() + for fieldarg, content in items: + par = nodes.paragraph() + par += self.make_xref(self.rolename, domain, fieldarg, nodes.strong) + if fieldarg in types: + typename = u''.join(n.astext() for n in types[fieldarg]) + par += nodes.Text(' (') + par += self.make_xref(self.typerolename, domain, typename) + par += nodes.Text(')') + par += nodes.Text(' -- ') + par += content + listnode += nodes.list_item('', par) + fieldbody = nodes.field_body('', listnode) + return nodes.field('', fieldname, fieldbody) + + +class DocFieldTransformer(object): + """ + Transforms field lists in "doc field" syntax into better-looking + equivalents, using the field type definitions given on a domain. + """ + + def __init__(self, directive): + self.domain = directive.domain + if not hasattr(directive, '_doc_field_type_map'): + directive.__class__._doc_field_type_map = \ + self.preprocess_fieldtypes(directive.__class__.doc_field_types) + self.typemap = directive._doc_field_type_map + + def preprocess_fieldtypes(self, types): + typemap = {} + for fieldtype in types: + for name in fieldtype.names: + typemap[name] = fieldtype, False + if fieldtype.is_typed: + for name in fieldtype.typenames: + typemap[name] = fieldtype, True + return typemap + + def transform_all(self, node): + """Transform all field list children of a node.""" + # don't traverse, only handle field lists that are immediate children + for child in node: + if isinstance(child, nodes.field_list): + self.transform(child) + + def transform(self, node): + """Transform a single field list *node*.""" + typemap = self.typemap + + entries = [] + groupindices = {} + types = {} + + # step 1: traverse all fields and collect field types and content + for field in node: + fieldname, fieldbody = field + try: + # split into field type and argument + fieldtype, fieldarg = fieldname.astext().split(None, 1) + except ValueError: + # maybe an argument-less field type? + fieldtype, fieldarg = fieldname.astext(), '' + typedesc, is_typefield = typemap.get(fieldtype, (None, None)) + + # sort out unknown fields + if typedesc is None or typedesc.has_arg != bool(fieldarg): + # either the field name is unknown, or the argument doesn't + # match the spec; capitalize field name and be done with it + new_fieldname = fieldtype.capitalize() + ' ' + fieldarg + fieldname[0] = nodes.Text(new_fieldname) + entries.append(field) + continue + + typename = typedesc.name + + # collect the content, trying not to keep unnecessary paragraphs + if _is_single_paragraph(fieldbody): + content = fieldbody.children[0].children + else: + content = fieldbody.children + + # if the field specifies a type, put it in the types collection + if is_typefield: + # filter out only inline nodes; others will result in invalid + # markup being written out + content = filter(lambda n: isinstance(n, nodes.Inline), content) + if content: + types.setdefault(typename, {})[fieldarg] = content + continue + + # also support syntax like ``:param type name:`` + if typedesc.is_typed: + try: + argtype, argname = fieldarg.split(None, 1) + except ValueError: + pass + else: + types.setdefault(typename, {})[argname] = \ + [nodes.Text(argtype)] + fieldarg = argname + + # grouped entries need to be collected in one entry, while others + # get one entry per field + if typedesc.is_grouped: + if typename in groupindices: + group = entries[groupindices[typename]] + else: + groupindices[typename] = len(entries) + group = [typedesc, []] + entries.append(group) + group[1].append(typedesc.make_entry(fieldarg, content)) + else: + entries.append([typedesc, + typedesc.make_entry(fieldarg, content)]) + + # step 2: all entries are collected, construct the new field list + new_list = nodes.field_list() + for entry in entries: + if isinstance(entry, nodes.field): + # pass-through old field + new_list += entry + else: + fieldtype, content = entry + fieldtypes = types.get(fieldtype.name, {}) + new_list += fieldtype.make_field(fieldtypes, self.domain, + content) + + node.replace_self(new_list) diff --git a/sphinx/util/matching.py b/sphinx/util/matching.py new file mode 100644 index 00000000..c459aca2 --- /dev/null +++ b/sphinx/util/matching.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +""" + sphinx.util.matching + ~~~~~~~~~~~~~~~~~~~~ + + Pattern-matching utility functions for Sphinx. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + + +def _translate_pattern(pat): + """ + Translate a shell-style glob pattern to a regular expression. + + Adapted from the fnmatch module, but enhanced so that single stars don't + match slashes. + """ + i, n = 0, len(pat) + res = '' + while i < n: + c = pat[i] + i += 1 + if c == '*': + if i < n and pat[i] == '*': + # double star matches slashes too + i += 1 + res = res + '.*' + else: + # single star doesn't match slashes + res = res + '[^/]*' + elif c == '?': + # question mark doesn't match slashes too + res = res + '[^/]' + elif c == '[': + j = i + if j < n and pat[j] == '!': + j += 1 + if j < n and pat[j] == ']': + j += 1 + while j < n and pat[j] != ']': + j += 1 + if j >= n: + res = res + '\\[' + else: + stuff = pat[i:j].replace('\\', '\\\\') + i = j + 1 + if stuff[0] == '!': + # negative pattern mustn't match slashes too + stuff = '^/' + stuff[1:] + elif stuff[0] == '^': + stuff = '\\' + stuff + res = '%s[%s]' % (res, stuff) + else: + res += re.escape(c) + return res + '$' + +def compile_matchers(patterns): + return [re.compile(_translate_pattern(pat)).match for pat in patterns] + + +_pat_cache = {} + +def patmatch(name, pat): + """ + Return if name matches pat. Adapted from fnmatch module. + """ + if pat not in _pat_cache: + _pat_cache[pat] = re.compile(_translate_pattern(pat)) + return _pat_cache[pat].match(name) + +def patfilter(names, pat): + """ + Return the subset of the list NAMES that match PAT. + Adapted from fnmatch module. + """ + if pat not in _pat_cache: + _pat_cache[pat] = re.compile(_translate_pattern(pat)) + match = _pat_cache[pat].match + return filter(match, names) diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py new file mode 100644 index 00000000..04185436 --- /dev/null +++ b/sphinx/util/nodes.py @@ -0,0 +1,126 @@ +# -*- coding: utf-8 -*- +""" + sphinx.util.nodes + ~~~~~~~~~~~~~~~~~ + + Docutils node-related utility functions for Sphinx. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re +import types + +from docutils import nodes + +from sphinx import addnodes + + +# \x00 means the "<" was backslash-escaped +explicit_title_re = re.compile(r'^(.+?)\s*(?<!\x00)<(.*?)>$', re.DOTALL) +caption_ref_re = explicit_title_re # b/w compat alias + + +def nested_parse_with_titles(state, content, node): + # hack around title style bookkeeping + surrounding_title_styles = state.memo.title_styles + surrounding_section_level = state.memo.section_level + state.memo.title_styles = [] + state.memo.section_level = 0 + 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 clean_astext(node): + """Like node.astext(), but ignore images.""" + node = node.deepcopy() + for img in node.traverse(nodes.image): + img['alt'] = '' + return node.astext() + + +def split_explicit_title(text): + """Split role content into title and target, if given.""" + match = explicit_title_re.match(text) + if match: + return True, match.group(1), match.group(2) + return False, text, text + + +def inline_all_toctrees(builder, docnameset, docname, tree, colorfunc): + """Inline all toctrees in the *tree*. + + Record all docnames in *docnameset*, and output docnames with *colorfunc*. + """ + tree = tree.deepcopy() + for toctreenode in tree.traverse(addnodes.toctree): + newnodes = [] + includefiles = map(str, toctreenode['includefiles']) + for includefile in includefiles: + try: + builder.info(colorfunc(includefile) + " ", nonl=1) + subtree = inline_all_toctrees(builder, docnameset, includefile, + builder.env.get_doctree(includefile), colorfunc) + docnameset.add(includefile) + except Exception: + builder.warn('toctree contains ref to nonexisting ' + 'file %r' % includefile, + builder.env.doc2path(docname)) + else: + sof = addnodes.start_of_file(docname=includefile) + sof.children = subtree.children + newnodes.append(sof) + toctreenode.parent.replace(toctreenode, newnodes) + return tree + + +def make_refnode(builder, fromdocname, todocname, targetid, child, title=None): + """Shortcut to create a reference node.""" + node = nodes.reference('', '') + if fromdocname == todocname: + node['refid'] = targetid + else: + node['refuri'] = (builder.get_relative_uri(fromdocname, todocname) + + '#' + targetid) + if title: + node['reftitle'] = title + node.append(child) + return node + +# 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, result): + """Version of Node.traverse() that doesn't need a condition.""" + result.append(self) + for child in self.children: + child._all_traverse(result) + return result + +def _fast_traverse(self, cls, result): + """Version of Node.traverse() that only supports instance checks.""" + if isinstance(self, cls): + result.append(self) + for child in self.children: + child._fast_traverse(cls, result) + 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) + +nodes.Node._old_traverse = nodes.Node.traverse +nodes.Node._all_traverse = _all_traverse +nodes.Node._fast_traverse = _fast_traverse +nodes.Node.traverse = _new_traverse diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py new file mode 100644 index 00000000..beab38cb --- /dev/null +++ b/sphinx/util/osutil.py @@ -0,0 +1,130 @@ +# -*- coding: utf-8 -*- +""" + sphinx.util.osutil + ~~~~~~~~~~~~~~~~~~ + + Operating system-related utility functions for Sphinx. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import os +import re +import time +import errno +import shutil +from os import path + +# Errnos that we need. +EEXIST = getattr(errno, 'EEXIST', 0) +ENOENT = getattr(errno, 'ENOENT', 0) +EPIPE = getattr(errno, 'EPIPE', 0) + +# SEP separates path elements in the canonical file names +# +# Define SEP as a manifest constant, not so much because we expect it to change +# in the future as to avoid the suspicion that a stray "/" in the code is a +# hangover from more *nix-oriented origins. +SEP = "/" + +def os_path(canonicalpath): + return canonicalpath.replace(SEP, path.sep) + + +def relative_uri(base, to): + """Return a relative URL from ``base`` to ``to``.""" + if to.startswith(SEP): + return to + b2 = base.split(SEP) + t2 = to.split(SEP) + # remove common segments + for x, y in zip(b2, t2): + if x != y: + break + b2.pop(0) + t2.pop(0) + return ('..' + SEP) * (len(b2)-1) + SEP.join(t2) + + +def ensuredir(path): + """Ensure that a path exists.""" + try: + os.makedirs(path) + except OSError, err: + # 0 for Jython/Win32 + if err.errno not in [0, EEXIST]: + raise + + +def walk(top, topdown=True, followlinks=False): + """ + Backport of os.walk from 2.6, where the followlinks argument was added. + """ + names = os.listdir(top) + + dirs, nondirs = [], [] + for name in names: + if path.isdir(path.join(top, name)): + dirs.append(name) + else: + nondirs.append(name) + + if topdown: + yield top, dirs, nondirs + for name in dirs: + fullpath = path.join(top, name) + if followlinks or not path.islink(fullpath): + for x in walk(fullpath, topdown, followlinks): + yield x + if not topdown: + yield top, dirs, nondirs + + +def mtimes_of_files(dirnames, suffix): + for dirname in dirnames: + for root, dirs, files in os.walk(dirname): + for sfile in files: + if sfile.endswith(suffix): + try: + yield path.getmtime(path.join(root, sfile)) + except EnvironmentError: + pass + + +def movefile(source, dest): + """Move a file, removing the destination if it exists.""" + if os.path.exists(dest): + try: + os.unlink(dest) + except OSError: + pass + os.rename(source, dest) + + +def copytimes(source, dest): + """Copy a file's modification times.""" + st = os.stat(source) + if hasattr(os, 'utime'): + os.utime(dest, (st.st_atime, st.st_mtime)) + + +def copyfile(source, dest): + """Copy a file and its modification times, if possible.""" + shutil.copyfile(source, dest) + try: + # don't do full copystat because the source may be read-only + copytimes(source, dest) + except OSError: + pass + + +no_fn_re = re.compile(r'[^a-zA-Z0-9_-]') + +def make_filename(string): + return no_fn_re.sub('', string) + + +def ustrftime(format, *args): + # strftime for unicode strings + return time.strftime(unicode(format).encode('utf-8'), *args).decode('utf-8') diff --git a/sphinx/util/pycompat.py b/sphinx/util/pycompat.py index 02194307..24040608 100644 --- a/sphinx/util/pycompat.py +++ b/sphinx/util/pycompat.py @@ -13,6 +13,17 @@ import sys import codecs import encodings + +try: + any = any +except NameError: + def any(gen): + for i in gen: + if i: + return True + return False + + if sys.version_info < (2, 5): # Python 2.4 doesn't know the utf-8-sig encoding, so deliver it here diff --git a/sphinx/util/texescape.py b/sphinx/util/texescape.py index 73790829..4cabd9b2 100644 --- a/sphinx/util/texescape.py +++ b/sphinx/util/texescape.py @@ -99,6 +99,7 @@ tex_replacements = [ ] tex_escape_map = {} +tex_replace_map = {} tex_hl_escape_map_old = {} # replacement map for Pygments <= 1.1 tex_hl_escape_map_new = {} # replacement map for Pygments >= 1.2 _old_cmd_chars = {ord(u'\\'): u'@', ord(u'{'): u'[', ord(u'}'): u']'} @@ -106,6 +107,7 @@ _old_cmd_chars = {ord(u'\\'): u'@', ord(u'{'): u'[', ord(u'}'): u']'} def init(): for a, b in tex_replacements: tex_escape_map[ord(a)] = b + tex_replace_map[ord(a)] = u'_' for a, b in tex_replacements: if a in u'[]{}\\': continue diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py index ea79fb9d..00496fa2 100644 --- a/sphinx/writers/html.py +++ b/sphinx/writers/html.py @@ -16,7 +16,7 @@ import os from docutils import nodes from docutils.writers.html4css1 import Writer, HTMLTranslator as BaseTranslator -from sphinx.locale import admonitionlabels, versionlabels +from sphinx.locale import admonitionlabels, versionlabels, _ from sphinx.util.smartypants import sphinx_smarty_pants try: @@ -59,9 +59,16 @@ class HTMLTranslator(BaseTranslator): self.highlightlinenothreshold = sys.maxint self.protect_literal_text = 0 self.add_permalinks = builder.config.html_add_permalinks + self.secnumber_suffix = builder.config.html_secnumber_suffix + + def visit_start_of_file(self, node): + # only occurs in the single-file builder + self.body.append('<span id="document-%s"></span>' % node['docname']) + def depart_start_of_file(self, node): + pass def visit_desc(self, node): - self.body.append(self.starttag(node, 'dl', CLASS=node['desctype'])) + self.body.append(self.starttag(node, 'dl', CLASS=node['objtype'])) def depart_desc(self, node): self.body.append('</dl>\n\n') @@ -69,7 +76,7 @@ class HTMLTranslator(BaseTranslator): # the id is set automatically self.body.append(self.starttag(node, 'dt')) # anchor for per-desc interactive data - if node.parent['desctype'] != 'describe' \ + if node.parent['objtype'] != 'describe' \ and node['ids'] and node['first']: self.body.append('<!--[%s]-->' % node['ids'][0]) def depart_desc_signature(self, node): @@ -138,7 +145,7 @@ class HTMLTranslator(BaseTranslator): self.body.append('</em>') def visit_versionmodified(self, node): - self.body.append(self.starttag(node, 'p')) + self.body.append(self.starttag(node, 'p', CLASS=node['type'])) text = versionlabels[node['type']] % node['version'] if len(node): text += ': ' @@ -159,7 +166,8 @@ class HTMLTranslator(BaseTranslator): self.body[-1] = '<a title="%s"' % self.attval(node['reftitle']) + \ starttag[2:] if node.hasattr('secnumber'): - self.body.append('%s. ' % '.'.join(map(str, node['secnumber']))) + self.body.append(('%s' + self.secnumber_suffix) % + '.'.join(map(str, node['secnumber']))) # overwritten -- we don't want source comments to show up in the HTML def visit_comment(self, node): @@ -180,30 +188,21 @@ class HTMLTranslator(BaseTranslator): def add_secnumber(self, node): if node.hasattr('secnumber'): - self.body.append('.'.join(map(str, node['secnumber'])) + '. ') + self.body.append('.'.join(map(str, node['secnumber'])) + + self.secnumber_suffix) elif isinstance(node.parent, nodes.section): anchorname = '#' + node.parent['ids'][0] if anchorname not in self.builder.secnumbers: anchorname = '' # try first heading which has no anchor if anchorname in self.builder.secnumbers: numbers = self.builder.secnumbers[anchorname] - self.body.append('.'.join(map(str, numbers)) + '. ') - - # overwritten for docutils 0.4 - if hasattr(BaseTranslator, 'start_tag_with_title'): - def visit_section(self, node): - # the 0.5 version, to get the id attribute in the <div> tag - self.section_level += 1 - self.body.append(self.starttag(node, 'div', CLASS='section')) - - def visit_title(self, node): - # don't move the id attribute inside the <h> tag - BaseTranslator.visit_title(self, node, move_ids=0) - self.add_secnumber(node) - else: - def visit_title(self, node): - BaseTranslator.visit_title(self, node) - self.add_secnumber(node) + self.body.append('.'.join(map(str, numbers)) + + self.secnumber_suffix) + + # overwritten + def visit_title(self, node): + BaseTranslator.visit_title(self, node) + self.add_secnumber(node) # overwritten def visit_literal_block(self, node): @@ -357,11 +356,6 @@ class HTMLTranslator(BaseTranslator): def depart_acks(self, node): pass - def visit_module(self, node): - pass - def depart_module(self, node): - pass - def visit_hlist(self, node): self.body.append('<table class="hlist"><tr>') def depart_hlist(self, node): diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 43882057..d018c3f6 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -22,14 +22,16 @@ from docutils.writers.latex2e import Babel from sphinx import addnodes from sphinx import highlighting from sphinx.errors import SphinxError -from sphinx.locale import admonitionlabels, versionlabels -from sphinx.util import ustrftime -from sphinx.util.texescape import tex_escape_map +from sphinx.locale import admonitionlabels, versionlabels, _ +from sphinx.util.osutil import ustrftime +from sphinx.util.texescape import tex_escape_map, tex_replace_map from sphinx.util.smartypants import educateQuotesLatex HEADER = r'''%% Generated by Sphinx. -\documentclass[%(papersize)s,%(pointsize)s%(classoptions)s]{%(docclass)s} +\def\sphinxdocclass{%(docclass)s} +\documentclass[%(papersize)s,%(pointsize)s%(classoptions)s]{%(wrapperclass)s} %(inputenc)s +%(utf8extra)s %(fontenc)s %(babel)s %(fontpkg)s @@ -45,7 +47,6 @@ HEADER = r'''%% Generated by Sphinx. \newcommand{\sphinxlogo}{%(logo)s} \renewcommand{\releasename}{%(releasename)s} %(makeindex)s -%(makemodindex)s ''' BEGIN_DOC = r''' @@ -56,9 +57,6 @@ BEGIN_DOC = r''' ''' FOOTER = r''' -%(footer)s -\renewcommand{\indexname}{%(modindexname)s} -%(printmodindex)s \renewcommand{\indexname}{%(indexname)s} %(printindex)s \end{document} @@ -119,14 +117,6 @@ class Table(object): self.longtable = False -class Desc(object): - def __init__(self, node): - self.env = LaTeXTranslator.desc_map.get(node['desctype'], 'describe') - self.type = self.cls = self.name = self.params = \ - self.annotation = self.returns = '' - self.count = 0 - - class LaTeXTranslator(nodes.NodeVisitor): sectionnames = ["part", "chapter", "section", "subsection", "subsubsection", "paragraph", "subparagraph"] @@ -134,11 +124,11 @@ class LaTeXTranslator(nodes.NodeVisitor): ignore_missing_images = False default_elements = { - 'docclass': 'manual', 'papersize': 'letterpaper', 'pointsize': '10pt', 'classoptions': '', 'inputenc': '\\usepackage[utf8]{inputenc}', + 'utf8extra': '\\DeclareUnicodeCharacter{00A0}{\\nobreakspace}', 'fontenc': '\\usepackage[T1]{fontenc}', 'babel': '\\usepackage{babel}', 'fontpkg': '\\usepackage{times}', @@ -152,12 +142,10 @@ class LaTeXTranslator(nodes.NodeVisitor): 'logo': '', 'releasename': 'Release', 'makeindex': '\\makeindex', - 'makemodindex': '\\makemodindex', 'shorthandoff': '', 'maketitle': '\\maketitle', 'tableofcontents': '\\tableofcontents', 'footer': '', - 'printmodindex': '\\printmodindex', 'printindex': '\\printindex', } @@ -173,7 +161,7 @@ class LaTeXTranslator(nodes.NodeVisitor): self.elements = self.default_elements.copy() self.elements.update({ - 'docclass': document.settings.docclass, + 'wrapperclass': 'sphinx' + document.settings.docclass, 'papersize': papersize, 'pointsize': builder.config.latex_font_size, # if empty, the title is set to the first section title @@ -182,9 +170,13 @@ class LaTeXTranslator(nodes.NodeVisitor): 'author': document.settings.author, 'releasename': _('Release'), 'preamble': builder.config.latex_preamble, - 'modindexname': _('Module Index'), 'indexname': _('Index'), }) + if document.settings.docclass == 'howto': + docclass = builder.config.latex_docclass.get('howto', 'article') + else: + docclass = builder.config.latex_docclass.get('manual', 'report') + self.elements['docclass'] = docclass if builder.config.today: self.elements['date'] = builder.config.today else: @@ -205,14 +197,11 @@ class LaTeXTranslator(nodes.NodeVisitor): self.elements['fncychap'] = '\\usepackage[Sonny]{fncychap}' else: self.elements['classoptions'] += ',english' - if not builder.config.latex_use_modindex: - self.elements['makemodindex'] = '' - self.elements['printmodindex'] = '' # allow the user to override them all self.elements.update(builder.config.latex_elements) - self.highlighter = highlighting.PygmentsBridge( - 'latex', builder.config.pygments_style) + self.highlighter = highlighting.PygmentsBridge('latex', + builder.config.pygments_style, builder.config.trim_doctest_flags) self.context = [] self.descstack = [] self.bibitems = [] @@ -224,18 +213,17 @@ class LaTeXTranslator(nodes.NodeVisitor): # by .. highlight:: directive in the master file self.hlsettingstack = 2 * [[builder.config.highlight_language, sys.maxint]] - self.written_ids = set() self.footnotestack = [] self.curfilestack = [] self.handled_abbrs = set() - if self.elements['docclass'] == 'manual': + if document.settings.docclass == 'howto': + self.top_sectionlevel = 2 + else: if builder.config.latex_use_parts: self.top_sectionlevel = 0 else: self.top_sectionlevel = 1 - else: - self.top_sectionlevel = 2 - self.next_section_target = None + self.next_section_ids = set() # flags self.verbatim = None self.in_title = 0 @@ -245,13 +233,71 @@ class LaTeXTranslator(nodes.NodeVisitor): self.literal_whitespace = 0 self.no_contractions = 0 self.compact_list = 0 + self.first_param = 0 def astext(self): - return (HEADER % self.elements + self.highlighter.get_stylesheet() + - u''.join(self.body) + FOOTER % self.elements) + return (HEADER % self.elements + + self.highlighter.get_stylesheet() + + u''.join(self.body) + + '\n' + self.elements['footer'] + '\n' + + self.generate_indices() + + FOOTER % self.elements) + + def hypertarget(self, id, withdoc=True, anchor=True): + if withdoc: + id = self.curfilestack[-1] + ':' + id + return (anchor and '\\phantomsection' or '') + \ + '\\label{%s}' % self.idescape(id) + + def hyperlink(self, id): + return '\\hyperref[%s]{' % (self.idescape(id)) def idescape(self, id): - return str(unicode(id).translate(tex_escape_map)) + return str(unicode(id).translate(tex_replace_map)) + + def generate_indices(self): + def generate(content, collapsed): + ret.append('\\begin{theindex}\n') + ret.append('\\def\\bigletter#1{{\\Large\\sffamily#1}' + '\\nopagebreak\\vspace{1mm}}\n') + for i, (letter, entries) in enumerate(content): + if i > 0: + ret.append('\\indexspace\n') + ret.append('\\bigletter{%s}\n' % letter) + for entry in entries: + if not entry[3]: + continue + ret.append('\\item {\\texttt{%s}}' % self.encode(entry[0])) + if entry[4]: + # add "extra" info + ret.append(' \\emph{(%s)}' % self.encode(entry[4])) + ret.append(', \\pageref{%s:%s}\n' % + (entry[2], self.idescape(entry[3]))) + ret.append('\\end{theindex}\n') + + ret = [] + # latex_domain_indices can be False/True or a list of index names + indices_config = self.builder.config.latex_domain_indices + if indices_config: + for domain in self.builder.env.domains.itervalues(): + for indexcls in domain.indices: + indexname = '%s-%s' % (domain.name, indexcls.name) + if isinstance(indices_config, list): + if indexname not in indices_config: + continue + # deprecated config value + if indexname == 'py-modindex' and \ + not self.builder.config.latex_use_modindex: + continue + content, collapsed = indexcls(domain).generate( + self.builder.docnames) + if not content: + continue + ret.append('\\renewcommand{\\indexname}{%s}\n' % + indexcls.localname) + generate(content, collapsed) + + return ''.join(ret) def visit_document(self, node): self.footnotestack.append(self.collect_footnotes(node)) @@ -265,8 +311,7 @@ class LaTeXTranslator(nodes.NodeVisitor): self.body.append('\n\\appendix\n') self.first_document = -1 if node.has_key('docname'): - self.body.append('\\hypertarget{--doc-%s}{}' % - self.idescape(node['docname'])) + self.body.append(self.hypertarget(':doc')) # "- 1" because the level is increased before the title is visited self.sectionlevel = self.top_sectionlevel - 1 def depart_document(self, node): @@ -277,23 +322,18 @@ class LaTeXTranslator(nodes.NodeVisitor): widest_label = bi[0] self.body.append('\n\\begin{thebibliography}{%s}\n' % widest_label) for bi in self.bibitems: - # cite_key: underscores must not be escaped - cite_key = bi[0].replace(r"\_", "_") - self.body.append('\\bibitem[%s]{%s}{\hypertarget{%s}{} %s}\n' % - (bi[0], cite_key, - self.idescape(cite_key.lower()), bi[1])) + target = self.hypertarget(bi[2] + ':' + bi[0].lower(), + withdoc=False) + self.body.append('\\bibitem[%s]{%s}{%s %s}\n' % + (bi[0], self.idescape(bi[0]), target, bi[1])) self.body.append('\\end{thebibliography}\n') self.bibitems = [] def visit_start_of_file(self, node): - # This marks the begin of a new file; therefore the current module and - # class must be reset - self.body.append('\n\\resetcurrentobjects\n') - # and also, new footnotes + # collect new footnotes self.footnotestack.append(self.collect_footnotes(node)) # also add a document target - self.body.append('\\hypertarget{--doc-%s}{}' % - self.idescape(node['docname'])) + self.next_section_ids.add(':doc') self.curfilestack.append(node['docname']) # use default highlight settings for new file self.hlsettingstack.append(self.hlsettingstack[0]) @@ -327,15 +367,8 @@ class LaTeXTranslator(nodes.NodeVisitor): if not self.this_is_the_title: self.sectionlevel += 1 self.body.append('\n\n') - if self.next_section_target: - self.body.append(r'\hypertarget{%s}{}' % - self.idescape(self.next_section_target)) - self.next_section_target = None - #if node.get('ids'): - # for id in node['ids']: - # if id not in self.written_ids: - # self.body.append(r'\hypertarget{%s}{}' % id) - # self.written_ids.add(id) + if node.get('ids'): + self.next_section_ids.update(node['ids']) def depart_section(self, node): self.sectionlevel = max(self.sectionlevel - 1, self.top_sectionlevel - 1) @@ -347,7 +380,7 @@ class LaTeXTranslator(nodes.NodeVisitor): def visit_topic(self, node): self.body.append('\\setbox0\\vbox{\n' - '\\begin{minipage}{0.95\\textwidth}\n') + '\\begin{minipage}{0.95\\linewidth}\n') def depart_topic(self, node): self.body.append('\\end{minipage}}\n' '\\begin{center}\\setlength{\\fboxsep}{5pt}' @@ -406,6 +439,12 @@ class LaTeXTranslator(nodes.NodeVisitor): # just use "subparagraph", it's not numbered anyway self.body.append(r'\%s{' % self.sectionnames[-1]) self.context.append('}\n') + + if self.next_section_ids: + for id in self.next_section_ids: + self.context[-1] += self.hypertarget(id, anchor=False) + self.next_section_ids.clear() + elif isinstance(parent, (nodes.topic, nodes.sidebar)): self.body.append(r'\textbf{') self.context.append('}\n\n\medskip\n\n') @@ -437,138 +476,76 @@ class LaTeXTranslator(nodes.NodeVisitor): def depart_subtitle(self, node): self.body.append(self.context.pop()) - desc_map = { - 'function' : 'funcdesc', - 'class': 'classdesc', - 'method': 'methoddesc', - 'classmethod': 'classmethoddesc', - 'staticmethod': 'staticmethoddesc', - 'exception': 'excdesc', - 'data': 'datadesc', - 'attribute': 'memberdesc', - 'opcode': 'opcodedesc', - - 'cfunction': 'cfuncdesc', - 'cmember': 'cmemberdesc', - 'cmacro': 'csimplemacrodesc', - 'ctype': 'ctypedesc', - 'cvar': 'cvardesc', - - 'describe': 'describe', - # and all others are 'describe' too - } - def visit_desc(self, node): - self.descstack.append(Desc(node)) + self.body.append('\n\n\\begin{fulllineitems}\n') def depart_desc(self, node): - d = self.descstack.pop() - self.body.append("\\end{%s}\n" % d.env) + self.body.append('\n\\end{fulllineitems}\n\n') def visit_desc_signature(self, node): - d = self.descstack[-1] - # reset these for every signature - d.type = d.cls = d.name = d.params = '' - def depart_desc_signature(self, node): - d = self.descstack[-1] - d.cls = d.cls.rstrip('.') - if node.parent['desctype'] != 'describe' and node['ids']: - hyper = '\\hypertarget{%s}{}' % self.idescape(node['ids'][0]) + if node.parent['objtype'] != 'describe' and node['ids']: + hyper = self.hypertarget(node['ids'][0]) else: hyper = '' - if d.count == 0: - t1 = "\n\n%s\\begin{%s}" % (hyper, d.env) + self.body.append(hyper) + for child in node: + if isinstance(child, addnodes.desc_parameterlist): + self.body.append(r'\pysiglinewithargsret{') + break else: - t1 = "\n%s\\%sline" % (hyper, d.env[:-4]) - d.count += 1 - if d.env in ('funcdesc', 'classdesc', 'excclassdesc'): - t2 = "{%s}{%s}" % (d.name, d.params) - elif d.env in ('datadesc', 'excdesc', 'csimplemacrodesc'): - t2 = "{%s}" % (d.name) - elif d.env in ('methoddesc', 'classmethoddesc', 'staticmethoddesc'): - if d.cls: - t2 = "[%s]{%s}{%s}" % (d.cls, d.name, d.params) - else: - t2 = "{%s}{%s}" % (d.name, d.params) - elif d.env == 'memberdesc': - if d.cls: - t2 = "[%s]{%s}" % (d.cls, d.name) - else: - t2 = "{%s}" % d.name - elif d.env == 'cfuncdesc': - if d.cls: - # C++ class names - d.name = '%s::%s' % (d.cls, d.name) - t2 = "{%s}{%s}{%s}" % (d.type, d.name, d.params) - elif d.env == 'cmemberdesc': - try: - type, container = d.type.rsplit(' ', 1) - container = container.rstrip('.') - except ValueError: - container = '' - type = d.type - t2 = "{%s}{%s}{%s}" % (container, type, d.name) - elif d.env == 'cvardesc': - t2 = "{%s}{%s}" % (d.type, d.name) - elif d.env == 'ctypedesc': - t2 = "{%s}" % (d.name) - elif d.env == 'opcodedesc': - t2 = "{%s}{%s}" % (d.name, d.params) - elif d.env == 'describe': - t2 = "{%s}" % d.name - self.body.append(t1 + t2) + self.body.append(r'\pysigline{') + def depart_desc_signature(self, node): + self.body.append('}{}') + + def visit_desc_addname(self, node): + self.body.append(r'\code{') + self.literal_whitespace += 1 + def depart_desc_addname(self, node): + self.body.append('}') + self.literal_whitespace -= 1 def visit_desc_type(self, node): - d = self.descstack[-1] - if d.env == 'describe': - d.name += self.encode(node.astext()) - else: - self.descstack[-1].type = self.encode(node.astext().strip()) - raise nodes.SkipNode + pass + def depart_desc_type(self, node): + pass def visit_desc_returns(self, node): - d = self.descstack[-1] - if d.env == 'describe': - d.name += ' $\\rightarrow$ ' + self.encode(node.astext()) - else: - self.descstack[-1].returns = self.encode(node.astext().strip()) - raise nodes.SkipNode + self.body.append(r'}{ $\rightarrow$ ') + def depart_desc_returns(self, node): + pass def visit_desc_name(self, node): - d = self.descstack[-1] - if d.env == 'describe': - d.name += self.encode(node.astext()) - else: - self.descstack[-1].name = self.encode(node.astext().strip()) - raise nodes.SkipNode - - def visit_desc_addname(self, node): - d = self.descstack[-1] - if d.env == 'describe': - d.name += self.encode(node.astext()) - else: - self.descstack[-1].cls = self.encode(node.astext().strip()) - raise nodes.SkipNode + self.body.append(r'\bfcode{') + self.literal_whitespace += 1 + def depart_desc_name(self, node): + self.body.append('}') + self.literal_whitespace -= 1 def visit_desc_parameterlist(self, node): - d = self.descstack[-1] - if d.env == 'describe': - d.name += self.encode(node.astext()) - else: - self.descstack[-1].params = self.encode(node.astext().strip()) - raise nodes.SkipNode + self.body.append('}{') + self.first_param = 1 + def depart_desc_parameterlist(self, node): + pass - def visit_desc_annotation(self, node): - d = self.descstack[-1] - if d.env == 'describe': - d.name += self.encode(node.astext()) + def visit_desc_parameter(self, node): + if not self.first_param: + self.body.append(', ') else: - self.descstack[-1].annotation = self.encode(node.astext().strip()) - raise nodes.SkipNode + self.first_param = 0 + if not node.hasattr('noemph'): + self.body.append(r'\emph{') + def depart_desc_parameter(self, node): + if not node.hasattr('noemph'): + self.body.append('}') + + def visit_desc_optional(self, node): + self.body.append(r'\optional{') + def depart_desc_optional(self, node): + self.body.append('}') - def visit_refcount(self, node): - self.body.append("\\emph{") - def depart_refcount(self, node): - self.body.append("}\\\\") + def visit_desc_annotation(self, node): + self.body.append(r'\strong{') + def depart_desc_annotation(self, node): + self.body.append('}') def visit_desc_content(self, node): if node.children and not isinstance(node.children[0], nodes.paragraph): @@ -577,6 +554,11 @@ class LaTeXTranslator(nodes.NodeVisitor): def depart_desc_content(self, node): pass + def visit_refcount(self, node): + self.body.append("\\emph{") + def depart_refcount(self, node): + self.body.append("}\\\\") + def visit_seealso(self, node): self.body.append("\n\n\\strong{%s:}\n\n" % admonitionlabels['seealso']) def depart_seealso(self, node): @@ -602,6 +584,7 @@ class LaTeXTranslator(nodes.NodeVisitor): def visit_label(self, node): if isinstance(node.parent, nodes.citation): self.bibitems[-1][0] = node.astext() + self.bibitems[-1][2] = self.curfilestack[-1] raise nodes.SkipNode def visit_tabular_col_spec(self, node): @@ -631,13 +614,13 @@ class LaTeXTranslator(nodes.NodeVisitor): elif self.table.has_verbatim: self.body.append('\n\\begin{tabular}') else: - self.body.append('\n\\begin{tabulary}{\\textwidth}') + self.body.append('\n\\begin{tabulary}{\\linewidth}') if self.table.colspec: self.body.append(self.table.colspec) else: if self.table.has_verbatim: colwidth = 0.95 / self.table.colcount - colspec = ('p{%.3f\\textwidth}|' % colwidth) * \ + colspec = ('p{%.3f\\linewidth}|' % colwidth) * \ self.table.colcount self.body.append('{|' + colspec + '}\n') elif self.table.longtable: @@ -765,7 +748,7 @@ class LaTeXTranslator(nodes.NodeVisitor): def visit_term(self, node): ctx = '}] \\leavevmode' if node.has_key('ids') and node['ids']: - ctx += '\\hypertarget{%s}{}' % self.idescape(node['ids'][0]) + ctx += self.hypertarget(node['ids'][0]) self.body.append('\\item[{') self.context.append(ctx) def depart_term(self, node): @@ -822,19 +805,6 @@ class LaTeXTranslator(nodes.NodeVisitor): def depart_hlistcol(self, node): pass - def visit_module(self, node): - modname = node['modname'] - self.body.append('\n\\hypertarget{module-%s}{}' % - self.idescape(modname.replace(' ',''))) - self.body.append('\n\\declaremodule[%s]{}{%s}' % ( - modname.replace('_', ''), self.encode(modname))) - self.body.append('\n\\modulesynopsis{%s}' % - self.encode(node['synopsis'])) - if node.has_key('platform'): - self.body.append('\\platform{%s}' % self.encode(node['platform'])) - def depart_module(self, node): - pass - def latex_image_length(self, width_str): match = re.match('(\d*\.?\d*)\s*(\S*)', width_str) if not match: @@ -888,7 +858,7 @@ class LaTeXTranslator(nodes.NodeVisitor): pre.append(align_prepost[is_inline, attrs['align']][0]) post.append(align_prepost[is_inline, attrs['align']][1]) except KeyError: - pass # XXX complain here? + pass if not is_inline: pre.append('\n') post.append('\n') @@ -990,19 +960,30 @@ class LaTeXTranslator(nodes.NodeVisitor): # indexing uses standard LaTeX index markup, so the targets # will be generated differently if not id.startswith('index-'): - self.body.append(r'\hypertarget{%s}{}' % self.idescape(id)) + self.body.append(self.hypertarget(id)) - if node.has_key('refid') and node['refid'] not in self.written_ids: - parindex = node.parent.index(node) + # postpone the labels until after the sectioning command + parindex = node.parent.index(node) + try: try: next = node.parent[parindex+1] - if isinstance(next, nodes.section): - self.next_section_target = node['refid'] - return except IndexError: - pass + # last node in parent, look at next after parent + # (for section of equal level) + next = node.parent.parent[node.parent.parent.index(node.parent)] + if isinstance(next, nodes.section): + if node.get('refid'): + self.next_section_ids.add(node['refid']) + self.next_section_ids.update(node['ids']) + return + except IndexError: + pass + if 'refuri' in node: + return + if node.get('refid'): add_target(node['refid']) - self.written_ids.add(node['refid']) + for id in node['ids']: + add_target(id) def depart_target(self, node): pass @@ -1050,15 +1031,20 @@ class LaTeXTranslator(nodes.NodeVisitor): self.body.append('\\href{%s}{' % self.encode_uri(uri)) self.context.append('}') elif uri.startswith('#'): - # references to labels - self.body.append('\\hyperlink{%s}{' % self.idescape(uri[1:])) + # references to labels in the same document + self.body.append(self.hyperlink(self.curfilestack[-1] + + ':' + uri[1:])) self.context.append('}') elif uri.startswith('%'): # references to documents or labels inside documents hashindex = uri.find('#') - targetname = (hashindex == -1) and '--doc-' + uri[1:] \ - or uri[hashindex+1:] - self.body.append('\\hyperlink{%s}{' % self.idescape(targetname)) + if hashindex == -1: + # reference to the document + id = uri[1:] + '::doc' + else: + # reference to a label + id = uri[1:].replace('#', ':') + self.body.append(self.hyperlink(id)) self.context.append('}') elif uri.startswith('@token'): if self.in_production_list: @@ -1121,7 +1107,7 @@ class LaTeXTranslator(nodes.NodeVisitor): def visit_citation(self, node): # TODO maybe use cite bibitems - self.bibitems.append(['', '']) + self.bibitems.append(['', '', '']) # [citeid, citetext, docname] self.context.append(len(self.body)) def depart_citation(self, node): size = self.context.pop() @@ -1130,8 +1116,9 @@ class LaTeXTranslator(nodes.NodeVisitor): self.bibitems[-1][1] = text def visit_citation_reference(self, node): - citeid = node.astext() - self.body.append('\\cite{%s}' % citeid) + # This is currently never encountered, since citation_reference nodes + # are already replaced by pending_xref nodes in the environment. + self.body.append('\\cite{%s}' % self.idescape(node.astext())) raise nodes.SkipNode def visit_literal(self, node): @@ -1198,9 +1185,9 @@ class LaTeXTranslator(nodes.NodeVisitor): * serif typeface """ self.body.append('{\\raggedright{}') - self.literal_whitespace = 1 + self.literal_whitespace += 1 def depart_line_block(self, node): - self.literal_whitespace = 0 + self.literal_whitespace -= 1 # remove the last \\ del self.body[-1] self.body.append('}\n') @@ -1281,7 +1268,7 @@ class LaTeXTranslator(nodes.NodeVisitor): raise nodes.SkipNode def visit_description(self, node): - self.body.append( ' ' ) + self.body.append(' ') def depart_description(self, node): pass diff --git a/sphinx/writers/manpage.py b/sphinx/writers/manpage.py new file mode 100644 index 00000000..eb35c5a5 --- /dev/null +++ b/sphinx/writers/manpage.py @@ -0,0 +1,323 @@ +# -*- coding: utf-8 -*- +""" + sphinx.writers.manpage + ~~~~~~~~~~~~~~~~~~~~~~ + + Manual page writer, extended for Sphinx custom nodes. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from docutils import nodes +try: + from docutils.writers.manpage import MACRO_DEF, Writer, \ + Translator as BaseTranslator + has_manpage_writer = True +except ImportError: + # define the classes in any case, sphinx.application needs it + Writer = BaseTranslator = object + has_manpage_writer = False + +from sphinx import addnodes +from sphinx.locale import admonitionlabels, versionlabels, _ +from sphinx.util.osutil import ustrftime + + +class ManualPageWriter(Writer): + def __init__(self, builder): + Writer.__init__(self) + self.builder = builder + + def translate(self): + visitor = ManualPageTranslator(self.builder, self.document) + self.visitor = visitor + self.document.walkabout(visitor) + self.output = visitor.astext() + + +class ManualPageTranslator(BaseTranslator): + """ + Custom translator. + """ + + def __init__(self, builder, *args, **kwds): + BaseTranslator.__init__(self, *args, **kwds) + self.builder = builder + + self.in_productionlist = 0 + + # first title is the manpage title + self.section_level = -1 + + # docinfo set by man_pages config value + self._docinfo['title'] = self.document.settings.title + self._docinfo['subtitle'] = self.document.settings.subtitle + if self.document.settings.authors: + # don't set it if no author given + self._docinfo['author'] = self.document.settings.authors + self._docinfo['manual_section'] = self.document.settings.section + + # docinfo set by other config values + self._docinfo['title_upper'] = self._docinfo['title'].upper() + if builder.config.today: + self._docinfo['date'] = builder.config.today + else: + self._docinfo['date'] = ustrftime(builder.config.today_fmt + or _('%B %d, %Y')) + self._docinfo['copyright'] = builder.config.copyright + self._docinfo['version'] = builder.config.version + self._docinfo['manual_group'] = builder.config.project + + # since self.append_header() is never called, need to do this here + self.body.append(MACRO_DEF) + + # overwritten -- added quotes around all .TH arguments + def header(self): + tmpl = (".TH \"%(title_upper)s\" \"%(manual_section)s\"" + " \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n" + ".SH NAME\n" + "%(title)s \- %(subtitle)s\n") + return tmpl % self._docinfo + + def visit_start_of_file(self, node): + pass + def depart_start_of_file(self, node): + pass + + def visit_desc(self, node): + self.visit_definition_list(node) + def depart_desc(self, node): + self.depart_definition_list(node) + + def visit_desc_signature(self, node): + self.visit_definition_list_item(node) + self.visit_term(node) + def depart_desc_signature(self, node): + self.depart_term(node) + + def visit_desc_addname(self, node): + pass + def depart_desc_addname(self, node): + pass + + def visit_desc_type(self, node): + pass + def depart_desc_type(self, node): + pass + + def visit_desc_returns(self, node): + self.body.append(' -> ') + def depart_desc_returns(self, node): + pass + + def visit_desc_name(self, node): + pass + def depart_desc_name(self, node): + pass + + def visit_desc_parameterlist(self, node): + self.body.append('(') + self.first_param = 1 + def depart_desc_parameterlist(self, node): + self.body.append(')') + + def visit_desc_parameter(self, node): + if not self.first_param: + self.body.append(', ') + else: + self.first_param = 0 + def depart_desc_parameter(self, node): + pass + + def visit_desc_optional(self, node): + self.body.append('[') + def depart_desc_optional(self, node): + self.body.append(']') + + def visit_desc_annotation(self, node): + pass + def depart_desc_annotation(self, node): + pass + + def visit_desc_content(self, node): + self.visit_definition(node) + def depart_desc_content(self, node): + self.depart_definition(node) + + def visit_refcount(self, node): + self.body.append(self.defs['emphasis'][0]) + def depart_refcount(self, node): + self.body.append(self.defs['emphasis'][1]) + + def visit_versionmodified(self, node): + self.visit_paragraph(node) + text = versionlabels[node['type']] % node['version'] + if len(node): + text += ': ' + else: + text += '.' + self.body.append(text) + def depart_versionmodified(self, node): + self.depart_paragraph(node) + + # overwritten -- we don't want source comments to show up + def visit_comment(self, node): + raise nodes.SkipNode + + # overwritten -- added ensure_eol() + def visit_footnote(self, node): + self.ensure_eol() + BaseTranslator.visit_footnote(self, node) + + # overwritten -- handle footnotes rubric + def visit_rubric(self, node): + self.ensure_eol() + if len(node.children) == 1: + rubtitle = node.children[0].astext() + if rubtitle in ('Footnotes', _('Footnotes')): + self.body.append('.SH ' + self.deunicode(rubtitle).upper() + + '\n') + raise nodes.SkipNode + else: + self.body.append('.sp\n') + def depart_rubric(self, node): + pass + + def visit_seealso(self, node): + self.visit_admonition(node) + def depart_seealso(self, node): + self.depart_admonition(node) + + # overwritten -- use our own label translations + def visit_admonition(self, node, name=None): + if name: + self.body.append('.IP %s\n' % + admonitionlabels.get(name, name)) + + def visit_productionlist(self, node): + self.ensure_eol() + names = [] + self.in_productionlist += 1 + self.body.append('.sp\n.nf\n') + for production in node: + names.append(production['tokenname']) + maxlen = max(len(name) for name in names) + for production in node: + if production['tokenname']: + lastname = production['tokenname'].ljust(maxlen) + self.body.append(self.defs['strong'][0]) + self.body.append(self.deunicode(lastname)) + self.body.append(self.defs['strong'][1]) + self.body.append(' ::= ') + else: + self.body.append('%s ' % (' '*len(lastname))) + production.walkabout(self) + self.body.append('\n') + self.body.append('\n.fi\n') + self.in_productionlist -= 1 + raise nodes.SkipNode + + def visit_production(self, node): + pass + def depart_production(self, node): + pass + + # overwritten -- don't emit a warning for images + def visit_image(self, node): + if 'alt' in node.attributes: + self.body.append('[image: %s]\n' % node['alt']) + self.body.append('[image]\n') + raise nodes.SkipNode + + # overwritten -- don't visit inner marked up nodes + def visit_reference(self, node): + self.body.append(self.defs['reference'][0]) + self.body.append(node.astext()) + self.body.append(self.defs['reference'][1]) + raise nodes.SkipNode + + def visit_centered(self, node): + self.ensure_eol() + self.body.append('.sp\n.ce\n') + def depart_centered(self, node): + self.body.append('\n.ce 0\n') + + def visit_compact_paragraph(self, node): + pass + def depart_compact_paragraph(self, node): + pass + + def visit_highlightlang(self, node): + pass + def depart_highlightlang(self, node): + pass + + def visit_download_reference(self, node): + pass + def depart_download_reference(self, node): + pass + + def visit_toctree(self, node): + raise nodes.SkipNode + + def visit_index(self, node): + raise nodes.SkipNode + + def visit_tabular_col_spec(self, node): + raise nodes.SkipNode + + def visit_glossary(self, node): + pass + def depart_glossary(self, node): + pass + + def visit_acks(self, node): + self.ensure_eol() + self.body.append(', '.join(n.astext() + for n in node.children[0].children) + '.') + self.body.append('\n') + raise nodes.SkipNode + + def visit_hlist(self, node): + self.visit_bullet_list(node) + def depart_hlist(self, node): + self.depart_bullet_list(node) + + def visit_hlistcol(self, node): + pass + def depart_hlistcol(self, node): + pass + + def visit_literal_emphasis(self, node): + return self.visit_emphasis(node) + def depart_literal_emphasis(self, node): + return self.depart_emphasis(node) + + def visit_abbreviation(self, node): + pass + def depart_abbreviation(self, node): + pass + + # overwritten: handle section titles better than in 0.6 release + def visit_title(self, node): + if isinstance(node.parent, addnodes.seealso): + self.body.append('.IP "') + return + elif isinstance(node.parent, nodes.section): + if self.section_level == 0: + # skip the document title + raise nodes.SkipNode + elif self.section_level == 1: + self.body.append('.SH %s\n' % + self.deunicode(node.astext().upper())) + raise nodes.SkipNode + return BaseTranslator.visit_title(self, node) + def depart_title(self, node): + if isinstance(node.parent, addnodes.seealso): + self.body.append('"\n') + return + return BaseTranslator.depart_title(self, node) + + def unknown_visit(self, node): + raise NotImplementedError('Unknown node: ' + node.__class__.__name__) diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index df881c86..c08471f8 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -15,7 +15,7 @@ import textwrap from docutils import nodes, writers from sphinx import addnodes -from sphinx.locale import admonitionlabels, versionlabels +from sphinx.locale import admonitionlabels, versionlabels, _ class TextWriter(writers.Writer): @@ -47,7 +47,7 @@ STDINDENT = 3 class TextTranslator(nodes.NodeVisitor): - sectionchars = '*=-~"+' + sectionchars = '*=-~"+`' def __init__(self, document, builder): nodes.NodeVisitor.__init__(self, document) @@ -161,13 +161,6 @@ class TextTranslator(nodes.NodeVisitor): def depart_attribution(self, node): pass - def visit_module(self, node): - if node.has_key('platform'): - self.new_state(0) - self.add_text(_('Platform: %s') % node['platform']) - self.end_state() - raise nodes.SkipNode - def visit_desc(self, node): pass def depart_desc(self, node): @@ -175,8 +168,8 @@ class TextTranslator(nodes.NodeVisitor): def visit_desc_signature(self, node): self.new_state(0) - if node.parent['desctype'] in ('class', 'exception'): - self.add_text('%s ' % node.parent['desctype']) + if node.parent['objtype'] in ('class', 'exception'): + self.add_text('%s ' % node.parent['objtype']) def depart_desc_signature(self, node): # XXX: wrap signatures in a way that makes sense self.end_state(wrap=False, end=None) |
