Code style nits.

This commit is contained in:
Georg Brandl 2010-08-21 19:19:12 +02:00
parent 7a40e07eda
commit c170c5f5da
4 changed files with 8 additions and 9 deletions

View File

@ -13,8 +13,6 @@ import collections
from datetime import datetime from datetime import datetime
from os import path from os import path
from docutils import nodes
from sphinx.builders import Builder from sphinx.builders import Builder
from sphinx.util.nodes import extract_messages from sphinx.util.nodes import extract_messages
from sphinx.util.osutil import SEP from sphinx.util.osutil import SEP

View File

@ -184,6 +184,7 @@ class CitationReferences(Transform):
refnode += nodes.Text('[' + cittext + ']') refnode += nodes.Text('[' + cittext + ']')
citnode.parent.replace(citnode, refnode) citnode.parent.replace(citnode, refnode)
class Locale(Transform): class Locale(Transform):
""" """
Replace translatable nodes with their translated doctree. Replace translatable nodes with their translated doctree.
@ -207,7 +208,8 @@ class Locale(Transform):
parser = RSTParser() parser = RSTParser()
for node, msg in extract_messages(self.document): for node, msg in extract_messages(self.document):
ctx = node.parent # XXX ctx not used
#ctx = node.parent
patch = new_document(source, settings) patch = new_document(source, settings)
msgstr = catalog.ugettext(msg) msgstr = catalog.ugettext(msg)
# XXX add marker to untranslated parts # XXX add marker to untranslated parts
@ -221,7 +223,6 @@ class Locale(Transform):
node.children = patch.children node.children = patch.children
class SphinxStandaloneReader(standalone.Reader): class SphinxStandaloneReader(standalone.Reader):
""" """
Add our own transforms. Add our own transforms.
@ -792,7 +793,6 @@ class BuildEnvironment:
if node['level'] < filterlevel: if node['level'] < filterlevel:
node.parent.remove(node) node.parent.remove(node)
def process_dependencies(self, docname, doctree): def process_dependencies(self, docname, doctree):
""" """
Process docutils-generated dependency info. Process docutils-generated dependency info.

View File

@ -192,8 +192,8 @@ def init(locale_dirs, language, catalog='sphinx'):
""" """
Look for message catalogs in `locale_dirs` and *ensure* that there is at Look for message catalogs in `locale_dirs` and *ensure* that there is at
least a NullTranslations catalog set in `translators`. If called multiple least a NullTranslations catalog set in `translators`. If called multiple
times or several ``.mo`` files are found their contents are merged times or if several ``.mo`` files are found, their contents are merged
together (thus making `init` reentrable). together (thus making ``init`` reentrable).
""" """
global translators global translators
translator = translators.get(catalog) translator = translators.get(catalog)

View File

@ -28,6 +28,7 @@ def extract_messages(doctree):
if isinstance(node, (nodes.Invisible, nodes.Inline)): if isinstance(node, (nodes.Invisible, nodes.Inline)):
continue continue
# <field_name>orphan</field_name> # <field_name>orphan</field_name>
# XXX ignore all metadata (== docinfo)
if isinstance(node, nodes.field_name) and node.children[0] == 'orphan': if isinstance(node, nodes.field_name) and node.children[0] == 'orphan':
continue continue
msg = node.rawsource.replace('\n', ' ').strip() msg = node.rawsource.replace('\n', ' ').strip()