Takayuki Shimizukawa avatar Takayuki Shimizukawa committed b5482e5

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

Comments (0)

Files changed (4)

sphinx/environment.py

                              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)

tests/root/i18n_footnote.po

 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."
 msgid "This is a named footnote."
 msgstr "THIS IS A NAMED FOOTNOTE."
 
+msgid "This is a numbered footnote."
+msgstr "THIS IS A NUMBERED FOOTNOTE."
+

tests/root/i18n_footnote.txt

 ==================
 .. #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.

tests/test_intl.py

     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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.