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
|
||||
* #2215: make.bat generated by sphinx-quickstart can be called from another dir.
|
||||
Thanks to Timotheus Kampik.
|
||||
* #3185: Add new warning type ``misc.highlighting_failure``
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
@ -232,6 +232,7 @@ General configuration
|
||||
* ref.option
|
||||
* ref.citation
|
||||
* ref.doc
|
||||
* misc.highlighting_failure
|
||||
|
||||
You can choose from these types.
|
||||
|
||||
@ -239,6 +240,10 @@ General configuration
|
||||
|
||||
.. versionadded:: 1.4
|
||||
|
||||
.. versionchanged:: 1.5
|
||||
|
||||
Added ``misc.highlighting_failure``
|
||||
|
||||
.. confval:: needs_sphinx
|
||||
|
||||
If set to a ``major.minor`` version string like ``'1.1'``, Sphinx will
|
||||
|
@ -143,7 +143,8 @@ class PygmentsBridge(object):
|
||||
pass # automatic highlighting failed.
|
||||
elif warn:
|
||||
warn('Could not lex literal_block as "%s". '
|
||||
'Highlighting skipped.' % lang)
|
||||
'Highlighting skipped.' % lang,
|
||||
type='misc', subtype='higlighting_failure')
|
||||
else:
|
||||
raise exc
|
||||
hlsource = highlight(source, lexers['none'], formatter)
|
||||
|
@ -363,8 +363,8 @@ class HTMLTranslator(BaseTranslator):
|
||||
else:
|
||||
opts = {}
|
||||
|
||||
def warner(msg):
|
||||
self.builder.warn(msg, (self.builder.current_docname, node.line))
|
||||
def warner(msg, **kwargs):
|
||||
self.builder.warn(msg, (self.builder.current_docname, node.line), **kwargs)
|
||||
highlighted = self.highlighter.highlight_block(
|
||||
node.rawsource, lang, opts=opts, warn=warner, linenos=linenos,
|
||||
**highlight_args)
|
||||
|
@ -1954,8 +1954,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
else:
|
||||
opts = {}
|
||||
|
||||
def warner(msg):
|
||||
self.builder.warn(msg, (self.curfilestack[-1], node.line))
|
||||
def warner(msg, **kwargs):
|
||||
self.builder.warn(msg, (self.curfilestack[-1], node.line), **kwargs)
|
||||
hlcode = self.highlighter.highlight_block(code, lang, opts=opts,
|
||||
warn=warner, linenos=linenos,
|
||||
**highlight_args)
|
||||
|
Loading…
Reference in New Issue
Block a user