diff options
author | shimizukawa <shimizukawa@gmail.com> | 2015-08-16 19:20:45 +0900 |
---|---|---|
committer | shimizukawa <shimizukawa@gmail.com> | 2015-09-13 00:20:21 +0900 |
commit | f886c54263150b03b6df1dc64eb38ede72c42a89 (patch) | |
tree | e726fb5a2f731708a44d837060eeee2fcbca2637 /sphinx/transforms.py | |
parent | 2c5c54aa67869ca5d3ae36f8392b6ab170c20c9a (diff) | |
download | sphinx-git-f886c54263150b03b6df1dc64eb38ede72c42a89.tar.gz |
Fix #1994: More supporting non-standard parser (like recommonmark parser) for Translation and WebSupport feature. Now node.rawsource is fall backed to node.astext() during docutils transforming.
Diffstat (limited to 'sphinx/transforms.py')
-rw-r--r-- | sphinx/transforms.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sphinx/transforms.py b/sphinx/transforms.py index afb91d935..d4ad4316e 100644 --- a/sphinx/transforms.py +++ b/sphinx/transforms.py @@ -22,6 +22,7 @@ from sphinx.locale import _, init as init_locale from sphinx.util import split_index_msg from sphinx.util.nodes import ( traverse_translatable_index, extract_messages, LITERAL_TYPE_NODES, IMAGE_TYPE_NODES, + apply_source_workaround, ) from sphinx.util.osutil import ustrftime from sphinx.util.i18n import find_catalog @@ -169,6 +170,18 @@ TRANSLATABLE_NODES = { } +class ApplySourceWorkaround(Transform): + """ + update source and rawsource attributes + """ + default_priority = 10 + + def apply(self): + for n in self.document.traverse(): + if isinstance(n, nodes.TextElement): + apply_source_workaround(n) + + class ExtraTranslatableNodes(Transform): """ make nodes translatable |