mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch 'stable'
This commit is contained in:
commit
92e4b0cac6
3
CHANGES
3
CHANGES
@ -80,6 +80,9 @@ 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
|
||||
* #1565: Show warning if Pygments throws an ErrorToken
|
||||
|
||||
Release 1.3.4 (released Jan 12, 2016)
|
||||
=====================================
|
||||
|
@ -183,9 +183,13 @@ class PygmentsBridge(object):
|
||||
formatter = self.get_formatter(**kwargs)
|
||||
try:
|
||||
hlsource = highlight(source, lexer, formatter)
|
||||
except ErrorToken:
|
||||
except ErrorToken as exc:
|
||||
# this is most probably not the selected language,
|
||||
# so let it pass unhighlighted
|
||||
if warn:
|
||||
warn('Could not parse literal_block as "%s". highlighting skipped.' % lang)
|
||||
else:
|
||||
raise exc
|
||||
hlsource = highlight(source, lexers['none'], formatter)
|
||||
if self.dest == 'html':
|
||||
return hlsource
|
||||
|
@ -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:
|
||||
|
@ -266,6 +266,12 @@ Code blocks
|
||||
false
|
||||
end
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
import sys
|
||||
|
||||
sys.stdout.write('hello world!\n')
|
||||
|
||||
|
||||
Misc stuff
|
||||
----------
|
||||
|
@ -40,3 +40,8 @@ msgstr "CLASSIFIER1"
|
||||
msgid "classifier2"
|
||||
msgstr "CLASSIFIER2"
|
||||
|
||||
msgid "Some term with"
|
||||
msgstr "SOME TERM WITH"
|
||||
|
||||
msgid "classifier[]"
|
||||
msgstr "CLASSIFIER[]"
|
||||
|
@ -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
|
||||
|
@ -31,13 +31,14 @@ http://www.python.org/logo.png
|
||||
reading included file u'.*?wrongenc.inc' seems to be wrong, try giving an \
|
||||
:encoding: option\\n?
|
||||
%(root)s/includes.txt:4: WARNING: download file not readable: .*?nonexisting.png
|
||||
(%(root)s/markup.txt:351: WARNING: invalid single index entry u'')?
|
||||
(%(root)s/markup.txt:357: WARNING: invalid single index entry u'')?
|
||||
(%(root)s/undecodable.txt:3: WARNING: undecodable source characters, replacing \
|
||||
with "\\?": b?'here: >>>(\\\\|/)xbb<<<'
|
||||
)?"""
|
||||
|
||||
HTML_WARNINGS = ENV_WARNINGS + """\
|
||||
%(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*'
|
||||
%(root)s/markup.txt:269: WARNING: Could not parse literal_block as "c". highlighting skipped.
|
||||
%(root)s/footnote.txt:60: WARNING: citation not found: missing
|
||||
%(root)s/markup.txt:158: WARNING: unknown option: &option
|
||||
"""
|
||||
@ -82,7 +83,7 @@ HTML_XPATH = {
|
||||
(".//a[@href='_downloads/img1.png']", ''),
|
||||
(".//pre", u'"quotes"'),
|
||||
(".//pre", u"'included'"),
|
||||
(".//pre/span[@class='s']", u'üöä'),
|
||||
(".//pre/span[@class='s2']", u'üöä'),
|
||||
(".//div[@class='inc-pyobj1 highlight-text']//pre",
|
||||
r'^class Foo:\n pass\n\s*$'),
|
||||
(".//div[@class='inc-pyobj2 highlight-text']//pre",
|
||||
|
@ -27,6 +27,7 @@ LATEX_WARNINGS = ENV_WARNINGS + """\
|
||||
%(root)s/markup.txt:158: WARNING: unknown option: &option
|
||||
%(root)s/footnote.txt:60: WARNING: citation not found: missing
|
||||
%(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*'
|
||||
%(root)s/markup.txt:269: WARNING: Could not parse literal_block as "c". highlighting skipped.
|
||||
"""
|
||||
|
||||
if PY3:
|
||||
|
@ -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
|
||||
|
||||
@ -692,14 +694,15 @@ def test_additional_targets_should_not_be_translated(app, status, warning):
|
||||
yield assert_count(expected_expr, result, 1)
|
||||
|
||||
# C code block with lang should not be translated but be *C* highlighted
|
||||
expected_expr = """<span class="cp">#include <stdio.h></span>"""
|
||||
expected_expr = ("""<span class="cp">#include</span> """
|
||||
"""<span class="cpf"><stdio.h></span>""")
|
||||
yield assert_count(expected_expr, result, 1)
|
||||
|
||||
# doctest block should not be translated but be highlighted
|
||||
expected_expr = (
|
||||
"""<span class="gp">>>> </span>"""
|
||||
"""<span class="kn">import</span> <span class="nn">sys</span> """
|
||||
"""<span class="c"># sys importing</span>""")
|
||||
"""<span class="c1"># sys importing</span>""")
|
||||
yield assert_count(expected_expr, result, 1)
|
||||
|
||||
## raw.txt
|
||||
@ -752,14 +755,15 @@ def test_additional_targets_should_be_translated(app, status, warning):
|
||||
yield assert_count(expected_expr, result, 1)
|
||||
|
||||
# C code block with lang should be translated and be *C* highlighted
|
||||
expected_expr = """<span class="cp">#include <STDIO.H></span>"""
|
||||
expected_expr = ("""<span class="cp">#include</span> """
|
||||
"""<span class="cpf"><STDIO.H></span>""")
|
||||
yield assert_count(expected_expr, result, 1)
|
||||
|
||||
# doctest block should not be translated but be highlighted
|
||||
expected_expr = (
|
||||
"""<span class="gp">>>> </span>"""
|
||||
"""<span class="kn">import</span> <span class="nn">sys</span> """
|
||||
"""<span class="c"># SYS IMPORTING</span>""")
|
||||
"""<span class="c1"># SYS IMPORTING</span>""")
|
||||
yield assert_count(expected_expr, result, 1)
|
||||
|
||||
## raw.txt
|
||||
|
Loading…
Reference in New Issue
Block a user