mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #2899 from shibukawa/fix/hasdoc
Fix hasdoc() function in Jinja2 template.
This commit is contained in:
commit
8606de3963
1
CHANGES
1
CHANGES
@ -10,6 +10,7 @@ Bugs fixed
|
||||
* #2902: jsdump.loads fails to load search index if keywords starts with
|
||||
underscore
|
||||
* #2900: Fix epub content.opf: add auto generated orphan files to spine.
|
||||
* #2899: Fix ``hasdoc()`` function in Jinja2 template. It can detect ``genindex``, ``search`` collectly.
|
||||
|
||||
Release 1.4.6 (released Aug 20, 2016)
|
||||
=====================================
|
||||
|
@ -785,7 +785,17 @@ class StandaloneHTMLBuilder(Builder):
|
||||
uri = relative_uri(baseuri, otheruri) or '#'
|
||||
return uri
|
||||
ctx['pathto'] = pathto
|
||||
ctx['hasdoc'] = lambda name: name in self.env.all_docs
|
||||
|
||||
def hasdoc(name):
|
||||
if name in self.env.all_docs:
|
||||
return True
|
||||
elif name == 'search' and self.search:
|
||||
return True
|
||||
elif name == 'genindex' and self.get_builder_config('use_index', 'html'):
|
||||
return True
|
||||
return False
|
||||
ctx['hasdoc'] = hasdoc
|
||||
|
||||
if self.name != 'htmlhelp':
|
||||
ctx['encoding'] = encoding = self.config.html_output_encoding
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user