disable download role on epub/qthelp builder

This commit is contained in:
Yoshiki Shibukawa 2016-07-21 05:41:06 +09:00
parent 1257c038ef
commit d935fd82fc
5 changed files with 11 additions and 1 deletions

View File

@ -107,6 +107,8 @@ Bugs fixed
* Change extension from .html to .xhtml.
* Disable search page on epub results
* Fix :download: role on epub/qthelp builder. They ignore the role because they don't support it.
Release 1.4.5 (released Jul 13, 2016)
=====================================

View File

@ -188,6 +188,8 @@ class EpubBuilder(StandaloneHTMLBuilder):
add_permalinks = False
# don't add sidebar etc.
embedded = True
# disable download role
download_support = False
# don't generate search index or include search page
search = False
@ -481,6 +483,9 @@ class EpubBuilder(StandaloneHTMLBuilder):
else:
super(EpubBuilder, self).copy_image_files()
def copy_download_files(self):
pass
def handle_page(self, pagename, addctx, templatename='page.html',
outfilename=None, event_arg=None):
"""Create a rendered page.

View File

@ -82,6 +82,7 @@ class StandaloneHTMLBuilder(Builder):
add_permalinks = True
embedded = False # for things like HTML help or Qt help: suppresses sidebar
search = True # for things like HTML help and Apple help: suppress search
download_support = True # enable download role
# This is a class attribute because it is mutated by Sphinx.add_javascript.
script_files = ['_static/jquery.js', '_static/underscore.js',

View File

@ -108,6 +108,8 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
# don't add sidebar etc.
embedded = True
# disable download role
download_support = False
# don't generate the search index or include the search page
search = False

View File

@ -439,7 +439,7 @@ class HTMLTranslator(BaseTranslator):
pass
def visit_download_reference(self, node):
if node.hasattr('filename'):
if self.builder.download_support and node.hasattr('filename'):
self.body.append(
'<a class="reference download internal" href="%s" download="">' %
posixpath.join(self.builder.dlpath, node['filename']))