mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merged in kou/sphinx/i18n-term-translatable (pull request #72)
This commit is contained in:
commit
c47881fd64
@ -43,6 +43,14 @@ IGNORED_NODES = (
|
|||||||
def extract_messages(doctree):
|
def extract_messages(doctree):
|
||||||
"""Extract translatable messages from a document tree."""
|
"""Extract translatable messages from a document tree."""
|
||||||
for node in doctree.traverse(nodes.TextElement):
|
for node in doctree.traverse(nodes.TextElement):
|
||||||
|
# workaround: nodes.term doesn't have source, line and rawsource
|
||||||
|
# It should be fixed in Docutils. There is a patch for it in Docutils
|
||||||
|
# tracker: https://sourceforge.net/tracker/?func=detail&aid=3548418&group_id=38414&atid=422032
|
||||||
|
if isinstance(node, nodes.term) and not node.source:
|
||||||
|
definition_list_item = node.parent;
|
||||||
|
node.source = definition_list_item.source
|
||||||
|
node.line = definition_list_item.line - 1
|
||||||
|
node.rawsource = definition_list_item.rawsource.split("\n", 2)[0]
|
||||||
if not node.source:
|
if not node.source:
|
||||||
continue # built-in message
|
continue # built-in message
|
||||||
if isinstance(node, IGNORED_NODES):
|
if isinstance(node, IGNORED_NODES):
|
||||||
|
Loading…
Reference in New Issue
Block a user