Skip to content

Commit

Permalink
Fix sphinx-doc#4051: warn() function for HTML theme outputs 'None' st…
Browse files Browse the repository at this point in the history
…ring
  • Loading branch information
tk0miya committed Sep 25, 2017
1 parent 9eec5fa commit ec2e606
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion sphinx/builders/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,6 @@ def handle_page(self, pagename, addctx, templatename='page.html',
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
Expand Down Expand Up @@ -931,6 +930,13 @@ def hasdoc(name):
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)
Expand Down

0 comments on commit ec2e606

Please sign in to comment.