mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #1565: Show warning if Pygments throws an ErrorToken
This commit is contained in:
parent
5574aba60e
commit
0329edc510
1
CHANGES
1
CHANGES
@ -12,6 +12,7 @@ Bugs fixed
|
|||||||
* #2243: Ignore strange docstring types for classes, do not crash
|
* #2243: Ignore strange docstring types for classes, do not crash
|
||||||
* #2247: Fix #2205 breaks make html for definition list with classifiers
|
* #2247: Fix #2205 breaks make html for definition list with classifiers
|
||||||
that contains regular-expression like string
|
that contains regular-expression like string
|
||||||
|
* #1565: Show warning if Pygments throws an ErrorToken
|
||||||
|
|
||||||
Release 1.3.4 (released Jan 12, 2016)
|
Release 1.3.4 (released Jan 12, 2016)
|
||||||
=====================================
|
=====================================
|
||||||
|
@ -183,9 +183,13 @@ class PygmentsBridge(object):
|
|||||||
formatter = self.get_formatter(**kwargs)
|
formatter = self.get_formatter(**kwargs)
|
||||||
try:
|
try:
|
||||||
hlsource = highlight(source, lexer, formatter)
|
hlsource = highlight(source, lexer, formatter)
|
||||||
except ErrorToken:
|
except ErrorToken as exc:
|
||||||
# this is most probably not the selected language,
|
# this is most probably not the selected language,
|
||||||
# so let it pass unhighlighted
|
# 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)
|
hlsource = highlight(source, lexers['none'], formatter)
|
||||||
if self.dest == 'html':
|
if self.dest == 'html':
|
||||||
return hlsource
|
return hlsource
|
||||||
|
@ -266,6 +266,12 @@ Code blocks
|
|||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.stdout.write('hello world!\n')
|
||||||
|
|
||||||
|
|
||||||
Misc stuff
|
Misc stuff
|
||||||
----------
|
----------
|
||||||
|
@ -31,13 +31,14 @@ http://www.python.org/logo.png
|
|||||||
reading included file u'.*?wrongenc.inc' seems to be wrong, try giving an \
|
reading included file u'.*?wrongenc.inc' seems to be wrong, try giving an \
|
||||||
:encoding: option\\n?
|
:encoding: option\\n?
|
||||||
%(root)s/includes.txt:4: WARNING: download file not readable: .*?nonexisting.png
|
%(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 \
|
(%(root)s/undecodable.txt:3: WARNING: undecodable source characters, replacing \
|
||||||
with "\\?": b?'here: >>>(\\\\|/)xbb<<<'
|
with "\\?": b?'here: >>>(\\\\|/)xbb<<<'
|
||||||
)?"""
|
)?"""
|
||||||
|
|
||||||
HTML_WARNINGS = ENV_WARNINGS + """\
|
HTML_WARNINGS = ENV_WARNINGS + """\
|
||||||
%(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*'
|
%(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/footnote.txt:60: WARNING: citation not found: missing
|
||||||
%(root)s/markup.txt:158: WARNING: unknown option: &option
|
%(root)s/markup.txt:158: WARNING: unknown option: &option
|
||||||
"""
|
"""
|
||||||
|
@ -27,6 +27,7 @@ LATEX_WARNINGS = ENV_WARNINGS + """\
|
|||||||
%(root)s/markup.txt:158: WARNING: unknown option: &option
|
%(root)s/markup.txt:158: WARNING: unknown option: &option
|
||||||
%(root)s/footnote.txt:60: WARNING: citation not found: missing
|
%(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/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:
|
if PY3:
|
||||||
|
Loading…
Reference in New Issue
Block a user