mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #4913: i18n: literal blocks in bullet list are not translated
This commit is contained in:
parent
2d42753acd
commit
5c56c99dfd
1
CHANGES
1
CHANGES
@ -19,6 +19,7 @@ Bugs fixed
|
||||
* #4924: html search: Upper characters problem in any other languages
|
||||
* #4932: apidoc: some subpackage is ignored if sibling subpackage contains a
|
||||
module starting with underscore
|
||||
* #4913: i18n: literal blocks in bullet list are not translated
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -53,6 +53,10 @@ def apply_source_workaround(node):
|
||||
node.rawsource = re.sub(r'\s*:\s*%s' % re.escape(classifier.astext()),
|
||||
'', node.rawsource)
|
||||
|
||||
# workaround: literal_block under bullet list (#4913)
|
||||
if isinstance(node, nodes.literal_block) and node.source is None:
|
||||
node.source = find_source_node(node)
|
||||
|
||||
# workaround: recommonmark-0.2.0 doesn't set rawsource attribute
|
||||
if not node.rawsource:
|
||||
node.rawsource = node.astext()
|
||||
|
@ -72,6 +72,11 @@ msgstr ""
|
||||
" return 0;\n"
|
||||
"}"
|
||||
|
||||
msgid "literal-block\n"
|
||||
"in list"
|
||||
msgstr "LITERAL-BLOCK\n"
|
||||
"IN LIST"
|
||||
|
||||
msgid "doctest blocks"
|
||||
msgstr "DOCTEST-BLOCKS"
|
||||
|
||||
|
@ -44,6 +44,11 @@ code blocks
|
||||
}
|
||||
|
||||
|
||||
* ::
|
||||
|
||||
literal-block
|
||||
in list
|
||||
|
||||
doctest blocks
|
||||
==============
|
||||
|
||||
|
@ -1000,6 +1000,14 @@ def test_additional_targets_should_not_be_translated(app):
|
||||
"""<span class="cpf"><stdio.h></span>""")
|
||||
assert_count(expected_expr, result, 1)
|
||||
|
||||
# literal block in list item should not be translated
|
||||
expected_expr = ("""<span class="n">literal</span>"""
|
||||
"""<span class="o">-</span>"""
|
||||
"""<span class="n">block</span>\n"""
|
||||
"""<span class="k">in</span> """
|
||||
"""<span class="n">list</span>""")
|
||||
assert_count(expected_expr, result, 1)
|
||||
|
||||
# doctest block should not be translated but be highlighted
|
||||
expected_expr = (
|
||||
"""<span class="gp">>>> </span>"""
|
||||
@ -1066,6 +1074,14 @@ def test_additional_targets_should_be_translated(app):
|
||||
"""<span class="cpf"><STDIO.H></span>""")
|
||||
assert_count(expected_expr, result, 1)
|
||||
|
||||
# literal block in list item should be translated
|
||||
expected_expr = ("""<span class="no">LITERAL</span>"""
|
||||
"""<span class="o">-</span>"""
|
||||
"""<span class="no">BLOCK</span>\n"""
|
||||
"""<span class="no">IN</span> """
|
||||
"""<span class="no">LIST</span>""")
|
||||
assert_count(expected_expr, result, 1)
|
||||
|
||||
# doctest block should not be translated but be highlighted
|
||||
expected_expr = (
|
||||
"""<span class="gp">>>> </span>"""
|
||||
|
Loading…
Reference in New Issue
Block a user