mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
Fix #4767: html: search highlighting breaks mathjax equations
This commit is contained in:
+11
-11
@@ -35,19 +35,19 @@ def test_jsmath(app, status, warning):
|
||||
app.builder.build_all()
|
||||
content = (app.outdir / 'math.html').text()
|
||||
|
||||
assert '<div class="math notranslate">\na^2 + b^2 = c^2</div>' in content
|
||||
assert ('<div class="math notranslate">\n\\begin{split}a + 1 < b\\end{split}</div>'
|
||||
in content)
|
||||
assert '<div class="math notranslate nohighlight">\na^2 + b^2 = c^2</div>' in content
|
||||
assert ('<div class="math notranslate nohighlight">\n\\begin{split}a + 1 < '
|
||||
'b\\end{split}</div>' in content)
|
||||
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)
|
||||
u'<div class="math notranslate nohighlight" id="equation-foo">'
|
||||
'\ne^{i\\pi} = 1</div>' in content)
|
||||
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 nohighlight" 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
|
||||
assert '<div class="math notranslate nohighlight">\nn \\in \\mathbb N</div>' in content
|
||||
assert '<div class="math notranslate nohighlight">\na + 1 < b</div>' in content
|
||||
|
||||
|
||||
@pytest.mark.skipif(not has_binary('dvipng'),
|
||||
@@ -91,7 +91,7 @@ def test_mathjax_align(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
content = (app.outdir / 'index.html').text()
|
||||
html = (r'<div class="math notranslate">\s*'
|
||||
html = (r'<div class="math notranslate nohighlight">\s*'
|
||||
r'\\\[ \\begin\{align\}\\begin\{aligned\}S \&= \\pi r\^2\\\\'
|
||||
r'V \&= \\frac\{4\}\{3\} \\pi r\^3\\end\{aligned\}\\end\{align\} \\\]</div>')
|
||||
assert re.search(html, content, re.S)
|
||||
@@ -104,7 +104,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 nohighlight" 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)
|
||||
|
||||
@@ -169,7 +169,7 @@ def test_mathjax_numfig_html(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
content = (app.outdir / 'math.html').text()
|
||||
html = ('<div class="math notranslate" id="equation-math-0">\n'
|
||||
html = ('<div class="math notranslate nohighlight" id="equation-math-0">\n'
|
||||
'<span class="eqno">(1.2)')
|
||||
assert html in content
|
||||
html = ('<p>Referencing equation <a class="reference internal" '
|
||||
|
||||
Reference in New Issue
Block a user