diff options
| author | shimizukawa <shimizukawa@gmail.com> | 2012-11-22 12:12:41 +0900 |
|---|---|---|
| committer | shimizukawa <shimizukawa@gmail.com> | 2012-11-22 12:12:41 +0900 |
| commit | 56b656b3b37cb82df16f7a78c3965ff3fd4ea61b (patch) | |
| tree | 698406079b98d93f007faeff41e2d81a97494326 | |
| parent | aaef5e456593dbf9386557c47fbaad2052d00864 (diff) | |
| download | sphinx-56b656b3b37cb82df16f7a78c3965ff3fd4ea61b.tar.gz | |
fix #955: consider the numbered-footnote. update test and code
| -rw-r--r-- | sphinx/environment.py | 3 | ||||
| -rw-r--r-- | tests/root/i18n_footnote.po | 7 | ||||
| -rw-r--r-- | tests/root/i18n_footnote.txt | 3 | ||||
| -rw-r--r-- | tests/test_intl.py | 5 |
4 files changed, 12 insertions, 6 deletions
diff --git a/sphinx/environment.py b/sphinx/environment.py index 9e971ed3..8fe52bb9 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -230,7 +230,8 @@ class Locale(Transform): if isinstance(r, nodes.footnote_reference) and r.get('auto') == 1] for i, child in enumerate(patch.children): # update leaves - if isinstance(child, nodes.footnote_reference): + if isinstance(child, nodes.footnote_reference) \ + and child.get('auto') == 1: # use original 'footnote_reference' object. # this object already registered in self.document.autofootnote_refs patch.children[i] = footnote_refs.pop(0) diff --git a/tests/root/i18n_footnote.po b/tests/root/i18n_footnote.po index b7f2b584..47f8d3db 100644 --- a/tests/root/i18n_footnote.po +++ b/tests/root/i18n_footnote.po @@ -19,8 +19,8 @@ msgstr "" msgid "i18n with Footnote" msgstr "I18N WITH FOOTNOTE" -msgid "Contents [#]_ for `i18n with Footnote`_ [ref]_" -msgstr "`I18N WITH FOOTNOTE`_ INCLUDE THIS CONTENTS [ref]_ [#]_" +msgid "[100]_ Contents [#]_ for `i18n with Footnote`_ [ref]_" +msgstr "`I18N WITH FOOTNOTE`_ INCLUDE THIS CONTENTS [ref]_ [#]_ [100]_" msgid "This is a auto numbered footnote." msgstr "THIS IS A AUTO NUMBERED FOOTNOTE." @@ -28,3 +28,6 @@ msgstr "THIS IS A AUTO NUMBERED FOOTNOTE." msgid "This is a named footnote." msgstr "THIS IS A NAMED FOOTNOTE." +msgid "This is a numbered footnote." +msgstr "THIS IS A NUMBERED FOOTNOTE." + diff --git a/tests/root/i18n_footnote.txt b/tests/root/i18n_footnote.txt index 3a1097af..3ef76bba 100644 --- a/tests/root/i18n_footnote.txt +++ b/tests/root/i18n_footnote.txt @@ -4,7 +4,8 @@ i18n with Footnote ================== .. #955 cant-build-html-with-footnotes-when-using -Contents [#]_ for `i18n with Footnote`_ [ref]_ +[100]_ Contents [#]_ for `i18n with Footnote`_ [ref]_ .. [#] This is a auto numbered footnote. .. [ref] This is a named footnote. +.. [100] This is a numbered footnote. diff --git a/tests/test_intl.py b/tests/test_intl.py index 01005166..19d5ab4a 100644 --- a/tests/test_intl.py +++ b/tests/test_intl.py @@ -82,7 +82,8 @@ def test_i18n_footnote_regression(app): result = (app.outdir / 'i18n_footnote.txt').text(encoding='utf-8') expect = (u"\nI18N WITH FOOTNOTE" u"\n******************\n" # underline matches new translation - u"\nI18N WITH FOOTNOTE INCLUDE THIS CONTENTS [ref] [1]\n" + u"\nI18N WITH FOOTNOTE INCLUDE THIS CONTENTS [ref] [1] [100]\n" u"\n[1] THIS IS A AUTO NUMBERED FOOTNOTE.\n" - u"\n[ref] THIS IS A NAMED FOOTNOTE.\n") + u"\n[ref] THIS IS A NAMED FOOTNOTE.\n" + u"\n[100] THIS IS A NUMBERED FOOTNOTE.\n") assert result == expect |
