mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch 'stable' into 1.7-release
This commit is contained in:
commit
8b8c3d1736
3
CHANGES
3
CHANGES
@ -193,7 +193,8 @@ Bugs fixed
|
||||
----------
|
||||
|
||||
* #1922: html search: Upper characters problem in French
|
||||
|
||||
* #4412: Updated jQuery version from 3.1.0 to 3.2.1
|
||||
* #4438: math: math with labels with whitespace cause html error
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -10,6 +10,7 @@
|
||||
"""
|
||||
|
||||
from docutils import nodes, utils
|
||||
from docutils.nodes import make_id
|
||||
from docutils.parsers.rst import Directive, directives
|
||||
|
||||
from sphinx.config import string_classes
|
||||
@ -55,7 +56,8 @@ class MathDomain(Domain):
|
||||
label = 'mathematics'
|
||||
|
||||
initial_data = {
|
||||
'objects': {}, # labelid -> (docname, eqno)
|
||||
'nameids': {}, # label -> equation ID
|
||||
'objects': {}, # equation ID -> (docname, eqno)
|
||||
} # type: Dict[unicode, Dict[unicode, Tuple[unicode, int]]]
|
||||
dangling_warnings = {
|
||||
'eq': 'equation not found: %(target)s',
|
||||
@ -63,9 +65,9 @@ class MathDomain(Domain):
|
||||
|
||||
def clear_doc(self, docname):
|
||||
# type: (unicode) -> None
|
||||
for labelid, (doc, eqno) in list(self.data['objects'].items()):
|
||||
for equation_id, (doc, eqno) in list(self.data['objects'].items()):
|
||||
if doc == docname:
|
||||
del self.data['objects'][labelid]
|
||||
del self.data['objects'][equation_id]
|
||||
|
||||
def merge_domaindata(self, docnames, otherdata):
|
||||
# type: (Iterable[unicode], Dict) -> None
|
||||
@ -84,10 +86,10 @@ class MathDomain(Domain):
|
||||
newnode['target'] = target
|
||||
return newnode
|
||||
else:
|
||||
node_id = make_id('equation-%s' % target)
|
||||
if env.config.math_numfig and env.config.numfig:
|
||||
if docname in env.toc_fignumbers:
|
||||
id = 'equation-' + target
|
||||
number = env.toc_fignumbers[docname]['displaymath'].get(id, ())
|
||||
number = env.toc_fignumbers[docname]['displaymath'].get(node_id, ())
|
||||
number = '.'.join(map(str, number))
|
||||
else:
|
||||
number = ''
|
||||
@ -98,8 +100,8 @@ class MathDomain(Domain):
|
||||
logger.warning('Invalid math_eqref_format: %r', exc,
|
||||
location=node)
|
||||
title = nodes.Text("(%d)" % number)
|
||||
return make_refnode(builder, fromdocname, docname,
|
||||
"equation-" + target, title)
|
||||
title = nodes.Text("(%d)" % number)
|
||||
return make_refnode(builder, fromdocname, docname, node_id, title)
|
||||
else:
|
||||
return None
|
||||
|
||||
@ -260,7 +262,8 @@ class MathDirective(Directive):
|
||||
node['number'] = eqno
|
||||
|
||||
# add target node
|
||||
target = nodes.target('', '', ids=['equation-' + node['label']])
|
||||
node_id = make_id('equation-%s' % node['label'])
|
||||
target = nodes.target('', '', ids=[node_id])
|
||||
self.state.document.note_explicit_target(target)
|
||||
ret.insert(0, target)
|
||||
except UserWarning as exc:
|
||||
|
File diff suppressed because it is too large
Load Diff
8
sphinx/themes/basic/static/jquery.js
vendored
8
sphinx/themes/basic/static/jquery.js
vendored
File diff suppressed because one or more lines are too long
@ -40,9 +40,9 @@ def test_jsmath(app, status, warning):
|
||||
assert (u'<span class="eqno">(1)<a class="headerlink" href="#equation-foo" '
|
||||
u'title="Permalink to this equation">\xb6</a></span>'
|
||||
u'<div class="math notranslate" id="equation-foo">\ne^{i\\pi} = 1</div>' in content)
|
||||
assert (u'<span class="eqno">(2)<a class="headerlink" href="#equation-math:0" '
|
||||
assert (u'<span class="eqno">(2)<a class="headerlink" href="#equation-math-0" '
|
||||
u'title="Permalink to this equation">\xb6</a></span>'
|
||||
u'<div class="math notranslate" id="equation-math:0">\n'
|
||||
u'<div class="math notranslate" id="equation-math-0">\n'
|
||||
u'e^{ix} = \\cos x + i\\sin x</div>' in content)
|
||||
assert '<div class="math notranslate">\nn \\in \\mathbb N</div>' in content
|
||||
assert '<div class="math notranslate">\na + 1 < b</div>' in content
|
||||
@ -102,7 +102,7 @@ def test_math_number_all_mathjax(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
content = (app.outdir / 'index.html').text()
|
||||
html = (r'<div class="math notranslate" id="equation-index:0">\s*'
|
||||
html = (r'<div class="math notranslate" id="equation-index-0">\s*'
|
||||
r'<span class="eqno">\(1\)<a .*>\xb6</a></span>\\\[a\^2\+b\^2=c\^2\\\]</div>')
|
||||
assert re.search(html, content, re.S)
|
||||
|
||||
|
@ -71,7 +71,7 @@ def test_js_source(app, status, warning):
|
||||
|
||||
app.builder.build(['contents'])
|
||||
|
||||
v = '3.1.0'
|
||||
v = '3.2.1'
|
||||
msg = 'jquery.js version does not match to {v}'.format(v=v)
|
||||
jquery_min = (app.outdir / '_static' / 'jquery.js').text()
|
||||
assert 'jQuery v{v}'.format(v=v) in jquery_min, msg
|
||||
|
Loading…
Reference in New Issue
Block a user