Merge with 'stable'

Conflicts:
	CHANGES
	sphinx/__init__.py
	sphinx/io.py
This commit is contained in:
shimizukawa 2016-02-29 23:19:13 +09:00
commit 283bf42ea7
5 changed files with 27 additions and 5 deletions

11
CHANGES
View File

@ -148,9 +148,16 @@ Documentation
* #1757: Fix for usage of :confval:`html_last_updated_fmt`. Thanks to Ralf Hemmecke. * #1757: Fix for usage of :confval:`html_last_updated_fmt`. Thanks to Ralf Hemmecke.
Release 1.3.6 (in development) Release 1.3.7 (in development)
============================== ==============================
Bugs fixed
----------
Release 1.3.6 (released Feb 29, 2016)
=====================================
Features added Features added
-------------- --------------
@ -172,7 +179,7 @@ Bugs fixed
* #2324: Print a hint how to increase the recursion limit when it is hit. * #2324: Print a hint how to increase the recursion limit when it is hit.
* #1565, #2229: Revert new warning; the new warning will be triggered from version 1.4 on. * #1565, #2229: Revert new warning; the new warning will be triggered from version 1.4 on.
* #2329: Refresh environment forcely if source directory has changed. * #2329: Refresh environment forcely if source directory has changed.
* #2019: Fix the domain objects in search result are not escaped
Release 1.3.5 (released Jan 24, 2016) Release 1.3.5 (released Jan 24, 2016)
===================================== =====================================

View File

@ -203,8 +203,8 @@ html_theme = 'alabaster'
# of the sidebar. # of the sidebar.
#html_logo = None #html_logo = None
# The name of an image file (within the static path) to use as favicon of the # The name of an image file (relative to this directory) to use as a favicon of
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large. # pixels large.
#html_favicon = None #html_favicon = None

View File

@ -16,6 +16,7 @@ from docutils.nodes import raw, comment, title, Text, NodeVisitor, SkipNode
from os import path from os import path
from sphinx.util import jsdump, rpartition from sphinx.util import jsdump, rpartition
from sphinx.util.pycompat import htmlescape
class SearchLanguage(object): class SearchLanguage(object):
@ -284,6 +285,7 @@ class IndexBuilder(object):
continue continue
if prio < 0: if prio < 0:
continue continue
fullname = htmlescape(fullname)
prefix, name = rpartition(fullname, '.') prefix, name = rpartition(fullname, '.')
pdict = rv.setdefault(prefix, {}) pdict = rv.setdefault(prefix, {})
try: try:

View File

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

View File

@ -13,6 +13,9 @@ from docutils import frontend, utils
from docutils.parsers import rst from docutils.parsers import rst
from sphinx.search import IndexBuilder from sphinx.search import IndexBuilder
from sphinx.util import jsdump
from util import with_app
settings = parser = None settings = parser = None
@ -39,3 +42,13 @@ def test_wordcollector():
ix.feed('filename', 'title', doc) ix.feed('filename', 'title', doc)
assert 'boson' not in ix._mapping assert 'boson' not in ix._mapping
assert 'fermion' in ix._mapping assert 'fermion' in ix._mapping
@with_app()
def test_objects_are_escaped(app, status, warning):
app.builder.build_all()
searchindex = (app.outdir / 'searchindex.js').text()
assert searchindex.startswith('Search.setIndex(')
index = jsdump.loads(searchindex[16:-2])
assert 'n::Array&lt;T, d&gt;' in index.get('objects').get('') # n::Array<T,d> is escaped