Fix #4051: warn() function for HTML theme outputs 'None' string

This commit is contained in:
Takeshi KOMIYA 2017-09-26 00:55:42 +09:00
parent 9eec5fa8d7
commit ec2e60674f
2 changed files with 8 additions and 2 deletions

View File

@ -38,7 +38,7 @@ Bugs fixed
* #4067: Return non-zero exit status when make subprocess fails
* #4055: graphviz: the :align: option does not work for SVG output
* #4055: graphviz: the :align: center option does not work for latex output
* #4051: ``warn()`` function for HTML theme outputs 'None' string
Testing

View File

@ -898,7 +898,6 @@ class StandaloneHTMLBuilder(Builder):
outfilename=None, event_arg=None):
# type: (unicode, Dict, unicode, unicode, Any) -> None
ctx = self.globalcontext.copy()
ctx['warn'] = self.warn
# current_page_name is backwards compatibility
ctx['pagename'] = ctx['current_page_name'] = pagename
ctx['encoding'] = self.config.html_output_encoding
@ -931,6 +930,13 @@ class StandaloneHTMLBuilder(Builder):
return False
ctx['hasdoc'] = hasdoc
def warn(*args, **kwargs):
# type: (Any, Any) -> unicode
"""Simple warn() wrapper for themes."""
self.warn(*args, **kwargs)
return '' # return empty string
ctx['warn'] = warn
ctx['toctree'] = lambda **kw: self._get_local_toctree(pagename, **kw)
self.add_sidebars(pagename, ctx)
ctx.update(addctx)