fix #955: consider the numbered-footnote. update test and code

This commit is contained in:
Takayuki Shimizukawa 2012-11-22 12:12:41 +09:00
parent 30c3fff6d7
commit f50091b643
4 changed files with 12 additions and 6 deletions

View File

@ -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)

View File

@ -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."

View File

@ -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.

View File

@ -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