summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES5
-rw-r--r--doc/conf.py2
-rw-r--r--doc/ext/example_google.rst4
-rw-r--r--doc/ext/example_numpy.rst4
-rw-r--r--doc/markup/inline.rst6
-rw-r--r--sphinx/builders/epub.py18
-rw-r--r--sphinx/builders/epub3.py4
-rw-r--r--sphinx/make_mode.py5
-rw-r--r--sphinx/themes/epub/layout.html3
-rw-r--r--sphinx/util/osutil.py7
10 files changed, 46 insertions, 12 deletions
diff --git a/CHANGES b/CHANGES
index 64ba439db..67889a1b1 100644
--- a/CHANGES
+++ b/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)
=====================================
diff --git a/doc/conf.py b/doc/conf.py
index 753ffab4c..f3bf569f8 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -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)]
diff --git a/doc/ext/example_google.rst b/doc/ext/example_google.rst
index 06508082c..a06f161b9 100644
--- a/doc/ext/example_google.rst
+++ b/doc/ext/example_google.rst
@@ -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
diff --git a/doc/ext/example_numpy.rst b/doc/ext/example_numpy.rst
index a3b41613e..38d3439c8 100644
--- a/doc/ext/example_numpy.rst
+++ b/doc/ext/example_numpy.rst
@@ -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
diff --git a/doc/markup/inline.rst b/doc/markup/inline.rst
index 0e825b66a..ae47f820d 100644
--- a/doc/markup/inline.rst
+++ b/doc/markup/inline.rst
@@ -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
------------------------------------------
diff --git a/sphinx/builders/epub.py b/sphinx/builders/epub.py
index e46d2cba0..9426b6bf5 100644
--- a/sphinx/builders/epub.py
+++ b/sphinx/builders/epub.py
@@ -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)
diff --git a/sphinx/builders/epub3.py b/sphinx/builders/epub3.py
index 57ed1abbe..4bb593546 100644
--- a/sphinx/builders/epub3.py
+++ b/sphinx/builders/epub3.py
@@ -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):
diff --git a/sphinx/make_mode.py b/sphinx/make_mode.py
index 9a17895bd..36f0a4298 100644
--- a/sphinx/make_mode.py
+++ b/sphinx/make_mode.py
@@ -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__))
diff --git a/sphinx/themes/epub/layout.html b/sphinx/themes/epub/layout.html
index bdbcec21d..541fcdba5 100644
--- a/sphinx/themes/epub/layout.html
+++ b/sphinx/themes/epub/layout.html
@@ -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 %}
diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py
index 0de6d8472..9586306fd 100644
--- a/sphinx/util/osutil.py
+++ b/sphinx/util/osutil.py
@@ -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)