mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch 'stable'
This commit is contained in:
commit
80bfc55795
5
CHANGES
5
CHANGES
@ -95,7 +95,12 @@ Bugs fixed
|
||||
----------
|
||||
|
||||
* applehelp: Sphinx crashes if ``hiutil`` or ``codesign`` commands not found
|
||||
* Fix ``make clean`` abort issue when build dir contains regular files like ``DS_Store``.
|
||||
* Reduce epubcheck warnings/errors:
|
||||
|
||||
* Fix DOCTYPE to html5
|
||||
* Change extension from .html to .xhtml.
|
||||
* Disable search page on epub results
|
||||
|
||||
Release 1.4.5 (released Jul 13, 2016)
|
||||
=====================================
|
||||
|
@ -47,7 +47,7 @@ epub_fix_images = False
|
||||
epub_max_image_width = 0
|
||||
epub_show_urls = 'inline'
|
||||
epub_use_index = False
|
||||
epub_guide = (('toc', 'contents.html', u'Table of Contents'),)
|
||||
epub_guide = (('toc', 'contents.xhtml', u'Table of Contents'),)
|
||||
|
||||
latex_documents = [('contents', 'sphinx.tex', 'Sphinx Documentation',
|
||||
'Georg Brandl', 'manual', 1)]
|
||||
|
@ -9,7 +9,9 @@ Example Google Style Python Docstrings
|
||||
|
||||
:ref:`example_numpy`
|
||||
|
||||
Download: :download:`example_google.py <example_google.py>`
|
||||
.. only:: builder_html
|
||||
|
||||
Download: :download:`example_google.py <example_google.py>`
|
||||
|
||||
.. literalinclude:: example_google.py
|
||||
:language: python
|
||||
|
@ -9,7 +9,9 @@ Example NumPy Style Python Docstrings
|
||||
|
||||
:ref:`example_google`
|
||||
|
||||
Download: :download:`example_numpy.py <example_numpy.py>`
|
||||
.. only:: builder_html
|
||||
|
||||
Download: :download:`example_numpy.py <example_numpy.py>`
|
||||
|
||||
.. literalinclude:: example_numpy.py
|
||||
:language: python
|
||||
|
@ -200,6 +200,12 @@ Referencing downloadable files
|
||||
The ``example.py`` file will be copied to the output directory, and a
|
||||
suitable link generated to it.
|
||||
|
||||
Not to show unavailable download links, you should wrap whole paragraphs that
|
||||
have this role::
|
||||
|
||||
.. only:: builder_html
|
||||
|
||||
See :download:`this example script <../example.py>`.
|
||||
|
||||
Cross-referencing figures by figure number
|
||||
------------------------------------------
|
||||
|
@ -113,7 +113,7 @@ COVER_TEMPLATE = u'''\
|
||||
<meta name="cover" content="%(cover)s"/>
|
||||
'''
|
||||
|
||||
COVERPAGE_NAME = u'epub-cover.html'
|
||||
COVERPAGE_NAME = u'epub-cover.xhtml'
|
||||
|
||||
FILE_TEMPLATE = u'''\
|
||||
<item id="%(id)s"
|
||||
@ -128,6 +128,10 @@ GUIDE_TEMPLATE = u'''\
|
||||
|
||||
TOCTREE_TEMPLATE = u'toctree-l%d'
|
||||
|
||||
DOCTYPE = u'''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
'''
|
||||
|
||||
LINK_TARGET_TEMPLATE = u' [%(uri)s]'
|
||||
|
||||
FOOTNOTE_LABEL_TEMPLATE = u'#%d'
|
||||
@ -143,7 +147,7 @@ GUIDE_TITLES = {
|
||||
}
|
||||
|
||||
MEDIA_TYPES = {
|
||||
'.html': 'application/xhtml+xml',
|
||||
'.xhtml': 'application/xhtml+xml',
|
||||
'.css': 'text/css',
|
||||
'.png': 'image/png',
|
||||
'.gif': 'image/gif',
|
||||
@ -185,6 +189,9 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
# don't add sidebar etc.
|
||||
embedded = True
|
||||
|
||||
# don't generate search index or include search page
|
||||
search = False
|
||||
|
||||
mimetype_template = MIMETYPE_TEMPLATE
|
||||
container_template = CONTAINER_TEMPLATE
|
||||
toc_template = TOC_TEMPLATE
|
||||
@ -198,6 +205,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
spine_template = SPINE_TEMPLATE
|
||||
guide_template = GUIDE_TEMPLATE
|
||||
toctree_template = TOCTREE_TEMPLATE
|
||||
doctype = DOCTYPE
|
||||
link_target_template = LINK_TARGET_TEMPLATE
|
||||
css_link_target_class = CSS_LINK_TARGET_CLASS
|
||||
guide_titles = GUIDE_TITLES
|
||||
@ -207,7 +215,8 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
def init(self):
|
||||
StandaloneHTMLBuilder.init(self)
|
||||
# the output files for epub must be .html only
|
||||
self.out_suffix = '.html'
|
||||
self.out_suffix = '.xhtml'
|
||||
self.link_suffix = '.xhtml'
|
||||
self.playorder = 0
|
||||
self.tocid = 0
|
||||
|
||||
@ -277,7 +286,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
"""
|
||||
refnodes.insert(0, {
|
||||
'level': 1,
|
||||
'refuri': self.esc(self.config.master_doc + '.html'),
|
||||
'refuri': self.esc(self.config.master_doc + self.out_suffix),
|
||||
'text': ssp(self.esc(
|
||||
self.env.titles[self.config.master_doc].astext()))
|
||||
})
|
||||
@ -481,6 +490,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
"""
|
||||
if pagename.startswith('genindex'):
|
||||
self.fix_genindex(addctx['genindexentries'])
|
||||
addctx['doctype'] = self.doctype
|
||||
StandaloneHTMLBuilder.handle_page(self, pagename, addctx, templatename,
|
||||
outfilename, event_arg)
|
||||
|
||||
|
@ -83,6 +83,9 @@ PACKAGE_DOC_TEMPLATE = u'''\
|
||||
</package>
|
||||
'''
|
||||
|
||||
DOCTYPE = u'''<!DOCTYPE html>
|
||||
'''
|
||||
|
||||
# The epub3 publisher
|
||||
|
||||
|
||||
@ -100,6 +103,7 @@ class Epub3Builder(EpubBuilder):
|
||||
navlist_template = NAVLIST_TEMPLATE
|
||||
navlist_indent = NAVLIST_INDENT
|
||||
content_template = PACKAGE_DOC_TEMPLATE
|
||||
doctype = DOCTYPE
|
||||
|
||||
# Finish by building the epub file
|
||||
def handle_finish(self):
|
||||
|
@ -18,13 +18,12 @@ from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
from os import path
|
||||
from subprocess import call
|
||||
|
||||
import sphinx
|
||||
from sphinx.util.console import bold, blue
|
||||
from sphinx.util.osutil import cd
|
||||
from sphinx.util.osutil import cd, rmtree
|
||||
|
||||
proj_name = os.getenv('SPHINXPROJ', '<project>')
|
||||
|
||||
@ -77,7 +76,7 @@ class Make(object):
|
||||
return 1
|
||||
print("Removing everything under %r..." % self.builddir)
|
||||
for item in os.listdir(self.builddir):
|
||||
shutil.rmtree(self.builddir_join(item))
|
||||
rmtree(self.builddir_join(item))
|
||||
|
||||
def build_help(self):
|
||||
print(bold("Sphinx v%s" % sphinx.__display_version__))
|
||||
|
@ -10,8 +10,7 @@
|
||||
{%- extends "basic/layout.html" %}
|
||||
|
||||
{%- block doctype -%}
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
{{ doctype }}
|
||||
{%- endblock -%}
|
||||
{# add only basic navigation links #}
|
||||
{% block sidebar1 %}{% endblock %}
|
||||
|
@ -217,3 +217,10 @@ def cd(target_dir):
|
||||
yield
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
||||
|
||||
def rmtree(path):
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
else:
|
||||
os.remove(path)
|
||||
|
Loading…
Reference in New Issue
Block a user