Fix #2247: #2205 breaks make html for definition list with classifiers that contains regular-expression like string

This commit is contained in:
Takeshi KOMIYA 2016-01-18 11:31:48 +09:00
parent 8167a9b7ad
commit 34cbf3bad7
5 changed files with 12 additions and 1 deletions

View File

@ -10,6 +10,8 @@ Bugs fixed
* Fix line numbers was not shown on warnings of indecies
* #2026: Fix LaTeX builder rais error if parsed-literal includes links
* #2243: Ignore strange docstring types for classes, do not crash
* #2247: Fix #2205 breaks make html for definition list with classifiers
that contains regular-expression like string
Release 1.3.4 (released Jan 12, 2016)
=====================================

View File

@ -50,7 +50,7 @@ def apply_source_workaround(node):
# strip classifier from rawsource of term
for classifier in reversed(node.parent.traverse(nodes.classifier)):
node.rawsource = re.sub(
'\s*:\s*%s' % classifier.astext(), '', node.rawsource)
'\s*:\s*%s' % re.escape(classifier.astext()), '', node.rawsource)
# workaround: recommonmark-0.2.0 doesn't set rawsource attribute
if not node.rawsource:

View File

@ -40,3 +40,8 @@ msgstr "CLASSIFIER1"
msgid "classifier2"
msgstr "CLASSIFIER2"
msgid "Some term with"
msgstr "SOME TERM WITH"
msgid "classifier[]"
msgstr "CLASSIFIER[]"

View File

@ -12,3 +12,5 @@ Some *term* `with link <http://sphinx-doc.org/>`__
Some **term** with : classifier1 : classifier2
The corresponding definition
Some term with : classifier[]
The corresponding definition

View File

@ -192,6 +192,8 @@ def test_text_builder(app, status, warning):
u"\n THE CORRESPONDING DEFINITION #2\n"
u"\nSOME **TERM** WITH : CLASSIFIER1 : CLASSIFIER2"
u"\n THE CORRESPONDING DEFINITION\n"
u"\nSOME TERM WITH : CLASSIFIER[]"
u"\n THE CORRESPONDING DEFINITION\n"
)
yield assert_equal, result, expect