diff options
| author | shimizukawa <shimizukawa@gmail.com> | 2013-01-30 23:41:37 +0900 |
|---|---|---|
| committer | shimizukawa <shimizukawa@gmail.com> | 2013-01-30 23:41:37 +0900 |
| commit | 90adca43d84a85217456ee9dc6b685d7d3195965 (patch) | |
| tree | aed0ca9fe32c7918260f4235dba2dd2f137b28d8 /sphinx/environment.py | |
| parent | e555c40ae830cf488ea0a841208d709cdfaddc82 (diff) | |
| download | sphinx-90adca43d84a85217456ee9dc6b685d7d3195965.tar.gz | |
Fix :term: doesn't link to glossary if term text translated. refs #1090
Diffstat (limited to 'sphinx/environment.py')
| -rw-r--r-- | sphinx/environment.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sphinx/environment.py b/sphinx/environment.py index 0ddb4bfb..2995cbbc 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -297,6 +297,16 @@ class Locale(Transform): if refname in refname_ids_map: new["ids"] = refname_ids_map[refname] + # Original pending_xref['reftarget'] contain not-translated + # target name, new pending_xref must use original one. + old_refs = node.traverse(addnodes.pending_xref) + new_refs = patch.traverse(addnodes.pending_xref) + if len(old_refs) != len(new_refs): + env.warn_node('inconsistent term references in ' + 'translated message', node) + for old, new in zip(old_refs, new_refs): + new['reftarget'] = old['reftarget'] + # update leaves for child in patch.children: child.parent = node |
