mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
merge with 'stable'
This commit is contained in:
commit
e800fef3d1
4
CHANGES
4
CHANGES
@ -91,6 +91,10 @@ Bugs fixed
|
||||
* #2140: Fix footnotes in table has broken in LaTeX
|
||||
* #2127: MecabBinder for html searching feature doesn't work with Python 3.
|
||||
Thanks to Tomoko Uchida.
|
||||
* #2012: Fix exception occurred if ``numfig_format`` is invalid
|
||||
* #2142: Provide non-minified JS code in ``sphinx/search/non-minified-js/*.js`` for
|
||||
source distribution on PyPI.
|
||||
* #2148: Error while building devhelp target with non-ASCII document.
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
@ -91,7 +91,7 @@ class DevhelpBuilder(StandaloneHTMLBuilder):
|
||||
write_toc(subnode, item)
|
||||
elif isinstance(node, nodes.reference):
|
||||
parent.attrib['link'] = node['refuri']
|
||||
parent.attrib['name'] = node.astext().encode('utf-8')
|
||||
parent.attrib['name'] = node.astext()
|
||||
|
||||
def istoctree(node):
|
||||
return isinstance(node, addnodes.compact_paragraph) and \
|
||||
@ -129,6 +129,6 @@ class DevhelpBuilder(StandaloneHTMLBuilder):
|
||||
# Dump the XML file
|
||||
f = comp_open(path.join(outdir, outname + '.devhelp'), 'w')
|
||||
try:
|
||||
tree.write(f)
|
||||
tree.write(f, 'utf-8')
|
||||
finally:
|
||||
f.close()
|
||||
|
@ -648,7 +648,12 @@ class StandardDomain(Domain):
|
||||
if target == fully_normalize_name(title):
|
||||
title = env.config.numfig_format.get(figtype, '')
|
||||
|
||||
newtitle = title % '.'.join(map(str, fignumber))
|
||||
try:
|
||||
newtitle = title % '.'.join(map(str, fignumber))
|
||||
except TypeError:
|
||||
env.warn(fromdocname, 'invalid numfig_format: %s' % title)
|
||||
return None
|
||||
|
||||
return self.build_reference_node(fromdocname, builder,
|
||||
docname, labelid, newtitle, 'numref',
|
||||
nodeclass=addnodes.number_reference,
|
||||
|
@ -48,3 +48,5 @@ test-tocdepth
|
||||
* Table.2.2 is :numref:`Table:%s <table22>`
|
||||
* List.1 is :numref:`CODE_1`
|
||||
* List.2.2 is :numref:`Code-%s <CODE22>`
|
||||
* Invalid numfig_format 01: :numref:`invalid <fig1>`
|
||||
* Invalid numfig_format 02: :numref:`Fig %s %s <fig1>`
|
||||
|
@ -488,6 +488,9 @@ def test_tocdepth_singlehtml(app, status, warning):
|
||||
def test_numfig_disabled(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
assert 'WARNING: invalid numfig_format: invalid' not in warning.getvalue()
|
||||
assert 'WARNING: invalid numfig_format: Fig %s %s' not in warning.getvalue()
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
@ -547,6 +550,9 @@ def test_numfig_without_numbered_toctree(app, status, warning):
|
||||
(app.srcdir / 'index.rst').write_text(index, encoding='utf-8')
|
||||
app.builder.build_all()
|
||||
|
||||
assert 'WARNING: invalid numfig_format: invalid' in warning.getvalue()
|
||||
assert 'WARNING: invalid numfig_format: Fig %s %s' in warning.getvalue()
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
@ -642,6 +648,9 @@ def test_numfig_without_numbered_toctree(app, status, warning):
|
||||
def test_numfig_with_numbered_toctree(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
assert 'WARNING: invalid numfig_format: invalid' in warning.getvalue()
|
||||
assert 'WARNING: invalid numfig_format: Fig %s %s' in warning.getvalue()
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
@ -740,6 +749,9 @@ def test_numfig_with_numbered_toctree(app, status, warning):
|
||||
def test_numfig_with_prefix(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
assert 'WARNING: invalid numfig_format: invalid' in warning.getvalue()
|
||||
assert 'WARNING: invalid numfig_format: Fig %s %s' in warning.getvalue()
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
@ -835,6 +847,9 @@ def test_numfig_with_prefix(app, status, warning):
|
||||
def test_numfig_with_secnum_depth(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
assert 'WARNING: invalid numfig_format: invalid' in warning.getvalue()
|
||||
assert 'WARNING: invalid numfig_format: Fig %s %s' in warning.getvalue()
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
|
Loading…
Reference in New Issue
Block a user