versioning_conditions for uuid/i18n uses is_translatable instead of nodes.TextElement directly.

This commit is contained in:
shimizukawa 2015-02-22 18:34:59 +09:00
parent 67dd1c0d03
commit 28dc3ab053
3 changed files with 5 additions and 4 deletions

View File

@ -39,7 +39,7 @@ from docutils.frontend import OptionParser
from sphinx import addnodes
from sphinx.util import url_re, get_matching_docs, docname_join, split_into, \
FilenameUniqDict, get_figtype
from sphinx.util.nodes import clean_astext, make_refnode, WarningStream
from sphinx.util.nodes import clean_astext, make_refnode, WarningStream, is_translatable
from sphinx.util.osutil import SEP, find_catalog_files, getcwd, fs_encoding
from sphinx.util.console import bold, purple
from sphinx.util.matching import compile_matchers
@ -84,7 +84,7 @@ dummy_reporter = Reporter('', 4, 4)
versioning_conditions = {
'none': False,
'text': nodes.TextElement,
'text': is_translatable,
'commentable': is_commentable,
}

View File

@ -163,6 +163,7 @@ TRANSLATABLE_NODES = {
'literal-block': nodes.literal_block,
'doctest-block': nodes.doctest_block,
'raw': nodes.raw,
'index': addnodes.index,
}
class ExtraTranslatableNodes(Transform):
"""

View File

@ -75,7 +75,7 @@ IGNORED_NODES = (
nodes.doctest_block,
#XXX there are probably more
)
def translatable_node(node):
def is_translatable(node):
if isinstance(node, nodes.TextElement):
apply_source_workaround(node)
@ -99,7 +99,7 @@ LITERAL_TYPE_NODES = (
)
def extract_messages(doctree):
"""Extract translatable messages from a document tree."""
for node in doctree.traverse(translatable_node):
for node in doctree.traverse(is_translatable):
if isinstance(node, LITERAL_TYPE_NODES):
msg = node.rawsource
else: