You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Normally, building a document with invalid footnote references will not cause a crash.
However, if the translation catalog contains invalid footnote references, it will crash during the write phase.
To Reproduce
Normal case will emit warnings, but will not crash.
index.rst
Hello
========
* a invalid auto-numbered [#]_ ref.
* a invalid named [1]_ ref.
this emits...
...(snip)...
reading sources... [100%] index
test/index.rst:4: WARNING: Too many autonumbered footnote references: only 0 corresponding footnotes available.
test/index.rst:5: WARNING: Unknown target name: "1".
...(snip)...
build succeeded, 2 warnings.
However, invalid footnote references in translation catalog files, sphinx will crash on writing phase.
index2.rst
Hello
========
* this is literal ``[#]_`` ref.
* this is literal ``[1]_`` ref.
index2.po
msgid "this is literal ``[#]_`` ref."
msgstr "this is literal ''[#]_'' ref."
msgid "this is literal ``[#]_`` ref."
msgstr "this is literal ''[1]_'' ref."
In this example, the backticks were mistakenly changed to single quotes in the translation catalog file, resulting in a footnote reference that is not in the source.
If you build with this translation catalog, you will get the following error:
test> sphinx-build -M html . _build -Dlanguage=ja
Running Sphinx v4.0.0+/37fc43a4d
loading translations [ja]... done
building [mo]: targets for 1 po files that are out of date
writing output... [100%] locale/ja/LC_MESSAGES/index2.mo
building [html]: targets for 2 source files that are out of date
updating environment: [new config] 2 added, 0 changed, 0 removed
reading sources... [100%] index2
test/index.rst:4: WARNING: Too many autonumbered footnote references: only 0 corresponding footnotes available.
test/index.rst:5: WARNING: Unknown target name: "1".
test/index2.rst:4: WARNING: inconsistent footnote references in translated message. original: [], translated: ['[#]_']
test/index2.rst:5: WARNING: inconsistent footnote references in translated message. original: [], translated: ['[1]_']
test/index2.rst:5: WARNING: Unknown target name: "1".
looking for now-outdated files... none found
pickling environment... done
checking consistency... C:\Project\sphinx-dev\sphinx-doc-translations\test\index2.rst: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%] index2
Exception occurred:
File ".venv\lib\site-packages\docutils\nodes.py", line 625, in __getitem__
return self.attributes[key]
KeyError: 'refid'
Describe the bug
Normally, building a document with invalid footnote references will not cause a crash.
However, if the translation catalog contains invalid footnote references, it will crash during the write phase.
To Reproduce
Normal case will emit warnings, but will not crash.
index.rst
this emits...
However, invalid footnote references in translation catalog files, sphinx will crash on writing phase.
index2.rst
index2.po
In this example, the backticks were mistakenly changed to single quotes in the translation catalog file, resulting in a footnote reference that is not in the source.
If you build with this translation catalog, you will get the following error:
Expected behavior
No crash
Your project
test.zip
Environment info
Additional context
Actual case
The text was updated successfully, but these errors were encountered: