mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #3185: Add new warning type `misc.highlighting_failure
`
This commit is contained in:
parent
b799249c77
commit
12660e44b5
1
CHANGES
1
CHANGES
@ -13,6 +13,7 @@ Features added
|
|||||||
self-signed HTTPS servers in linkcheck and intersphinx
|
self-signed HTTPS servers in linkcheck and intersphinx
|
||||||
* #2215: make.bat generated by sphinx-quickstart can be called from another dir.
|
* #2215: make.bat generated by sphinx-quickstart can be called from another dir.
|
||||||
Thanks to Timotheus Kampik.
|
Thanks to Timotheus Kampik.
|
||||||
|
* #3185: Add new warning type ``misc.highlighting_failure``
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
@ -232,6 +232,7 @@ General configuration
|
|||||||
* ref.option
|
* ref.option
|
||||||
* ref.citation
|
* ref.citation
|
||||||
* ref.doc
|
* ref.doc
|
||||||
|
* misc.highlighting_failure
|
||||||
|
|
||||||
You can choose from these types.
|
You can choose from these types.
|
||||||
|
|
||||||
@ -239,6 +240,10 @@ General configuration
|
|||||||
|
|
||||||
.. versionadded:: 1.4
|
.. versionadded:: 1.4
|
||||||
|
|
||||||
|
.. versionchanged:: 1.5
|
||||||
|
|
||||||
|
Added ``misc.highlighting_failure``
|
||||||
|
|
||||||
.. confval:: needs_sphinx
|
.. confval:: needs_sphinx
|
||||||
|
|
||||||
If set to a ``major.minor`` version string like ``'1.1'``, Sphinx will
|
If set to a ``major.minor`` version string like ``'1.1'``, Sphinx will
|
||||||
|
@ -143,7 +143,8 @@ class PygmentsBridge(object):
|
|||||||
pass # automatic highlighting failed.
|
pass # automatic highlighting failed.
|
||||||
elif warn:
|
elif warn:
|
||||||
warn('Could not lex literal_block as "%s". '
|
warn('Could not lex literal_block as "%s". '
|
||||||
'Highlighting skipped.' % lang)
|
'Highlighting skipped.' % lang,
|
||||||
|
type='misc', subtype='higlighting_failure')
|
||||||
else:
|
else:
|
||||||
raise exc
|
raise exc
|
||||||
hlsource = highlight(source, lexers['none'], formatter)
|
hlsource = highlight(source, lexers['none'], formatter)
|
||||||
|
@ -363,8 +363,8 @@ class HTMLTranslator(BaseTranslator):
|
|||||||
else:
|
else:
|
||||||
opts = {}
|
opts = {}
|
||||||
|
|
||||||
def warner(msg):
|
def warner(msg, **kwargs):
|
||||||
self.builder.warn(msg, (self.builder.current_docname, node.line))
|
self.builder.warn(msg, (self.builder.current_docname, node.line), **kwargs)
|
||||||
highlighted = self.highlighter.highlight_block(
|
highlighted = self.highlighter.highlight_block(
|
||||||
node.rawsource, lang, opts=opts, warn=warner, linenos=linenos,
|
node.rawsource, lang, opts=opts, warn=warner, linenos=linenos,
|
||||||
**highlight_args)
|
**highlight_args)
|
||||||
|
@ -1954,8 +1954,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
else:
|
else:
|
||||||
opts = {}
|
opts = {}
|
||||||
|
|
||||||
def warner(msg):
|
def warner(msg, **kwargs):
|
||||||
self.builder.warn(msg, (self.curfilestack[-1], node.line))
|
self.builder.warn(msg, (self.curfilestack[-1], node.line), **kwargs)
|
||||||
hlcode = self.highlighter.highlight_block(code, lang, opts=opts,
|
hlcode = self.highlighter.highlight_block(code, lang, opts=opts,
|
||||||
warn=warner, linenos=linenos,
|
warn=warner, linenos=linenos,
|
||||||
**highlight_args)
|
**highlight_args)
|
||||||
|
Loading…
Reference in New Issue
Block a user