mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '3.5.x' into 8888
This commit is contained in:
commit
ba0fa064f9
2
CHANGES
2
CHANGES
@ -16,6 +16,8 @@ Features added
|
|||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
* #8884: html: minified js stemmers not included in the distributed package
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ recursive-include sphinx/texinputs_win *
|
|||||||
recursive-include sphinx/themes *
|
recursive-include sphinx/themes *
|
||||||
recursive-include sphinx/locale *.js *.pot *.po *.mo
|
recursive-include sphinx/locale *.js *.pot *.po *.mo
|
||||||
recursive-include sphinx/search/non-minified-js *.js
|
recursive-include sphinx/search/non-minified-js *.js
|
||||||
|
recursive-include sphinx/search/minified-js *.js
|
||||||
recursive-include sphinx/ext/autosummary/templates *
|
recursive-include sphinx/ext/autosummary/templates *
|
||||||
recursive-include tests *
|
recursive-include tests *
|
||||||
recursive-include utils *
|
recursive-include utils *
|
||||||
|
@ -1621,7 +1621,14 @@ def test_html_codeblock_linenos_style_table(app):
|
|||||||
app.build()
|
app.build()
|
||||||
content = (app.outdir / 'index.html').read_text()
|
content = (app.outdir / 'index.html').read_text()
|
||||||
|
|
||||||
assert '<div class="linenodiv"><pre>1\n2\n3\n4</pre></div>' in content
|
pygments_version = tuple(LooseVersion(pygments.__version__).version)
|
||||||
|
if pygments_version >= (2, 8):
|
||||||
|
assert ('<div class="linenodiv"><pre><span class="normal">1</span>\n'
|
||||||
|
'<span class="normal">2</span>\n'
|
||||||
|
'<span class="normal">3</span>\n'
|
||||||
|
'<span class="normal">4</span></pre></div>') in content
|
||||||
|
else:
|
||||||
|
assert '<div class="linenodiv"><pre>1\n2\n3\n4</pre></div>' in content
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('html', testroot='reST-code-block',
|
@pytest.mark.sphinx('html', testroot='reST-code-block',
|
||||||
|
@ -9,7 +9,9 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
|
import pygments
|
||||||
import pytest
|
import pytest
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
|
||||||
@ -421,46 +423,87 @@ def test_literal_include_block_start_with_comment_or_brank(app, status, warning)
|
|||||||
def test_literal_include_linenos(app, status, warning):
|
def test_literal_include_linenos(app, status, warning):
|
||||||
app.builder.build(['linenos'])
|
app.builder.build(['linenos'])
|
||||||
html = (app.outdir / 'linenos.html').read_text()
|
html = (app.outdir / 'linenos.html').read_text()
|
||||||
|
pygments_version = tuple(LooseVersion(pygments.__version__).version)
|
||||||
|
|
||||||
# :linenos:
|
# :linenos:
|
||||||
assert ('<td class="linenos"><div class="linenodiv"><pre>'
|
if pygments_version >= (2, 8):
|
||||||
' 1\n'
|
assert ('<td class="linenos"><div class="linenodiv"><pre>'
|
||||||
' 2\n'
|
'<span class="normal"> 1</span>\n'
|
||||||
' 3\n'
|
'<span class="normal"> 2</span>\n'
|
||||||
' 4\n'
|
'<span class="normal"> 3</span>\n'
|
||||||
' 5\n'
|
'<span class="normal"> 4</span>\n'
|
||||||
' 6\n'
|
'<span class="normal"> 5</span>\n'
|
||||||
' 7\n'
|
'<span class="normal"> 6</span>\n'
|
||||||
' 8\n'
|
'<span class="normal"> 7</span>\n'
|
||||||
' 9\n'
|
'<span class="normal"> 8</span>\n'
|
||||||
'10\n'
|
'<span class="normal"> 9</span>\n'
|
||||||
'11\n'
|
'<span class="normal">10</span>\n'
|
||||||
'12\n'
|
'<span class="normal">11</span>\n'
|
||||||
'13</pre></div></td>' in html)
|
'<span class="normal">12</span>\n'
|
||||||
|
'<span class="normal">13</span></pre></div></td>' in html)
|
||||||
|
else:
|
||||||
|
assert ('<td class="linenos"><div class="linenodiv"><pre>'
|
||||||
|
' 1\n'
|
||||||
|
' 2\n'
|
||||||
|
' 3\n'
|
||||||
|
' 4\n'
|
||||||
|
' 5\n'
|
||||||
|
' 6\n'
|
||||||
|
' 7\n'
|
||||||
|
' 8\n'
|
||||||
|
' 9\n'
|
||||||
|
'10\n'
|
||||||
|
'11\n'
|
||||||
|
'12\n'
|
||||||
|
'13</pre></div></td>' in html)
|
||||||
|
|
||||||
# :lineno-start:
|
# :lineno-start:
|
||||||
assert ('<td class="linenos"><div class="linenodiv"><pre>'
|
if pygments_version >= (2, 8):
|
||||||
'200\n'
|
assert ('<td class="linenos"><div class="linenodiv"><pre>'
|
||||||
'201\n'
|
'<span class="normal">200</span>\n'
|
||||||
'202\n'
|
'<span class="normal">201</span>\n'
|
||||||
'203\n'
|
'<span class="normal">202</span>\n'
|
||||||
'204\n'
|
'<span class="normal">203</span>\n'
|
||||||
'205\n'
|
'<span class="normal">204</span>\n'
|
||||||
'206\n'
|
'<span class="normal">205</span>\n'
|
||||||
'207\n'
|
'<span class="normal">206</span>\n'
|
||||||
'208\n'
|
'<span class="normal">207</span>\n'
|
||||||
'209\n'
|
'<span class="normal">208</span>\n'
|
||||||
'210\n'
|
'<span class="normal">209</span>\n'
|
||||||
'211\n'
|
'<span class="normal">210</span>\n'
|
||||||
'212</pre></div></td>' in html)
|
'<span class="normal">211</span>\n'
|
||||||
|
'<span class="normal">212</span></pre></div></td>' in html)
|
||||||
|
else:
|
||||||
|
assert ('<td class="linenos"><div class="linenodiv"><pre>'
|
||||||
|
'200\n'
|
||||||
|
'201\n'
|
||||||
|
'202\n'
|
||||||
|
'203\n'
|
||||||
|
'204\n'
|
||||||
|
'205\n'
|
||||||
|
'206\n'
|
||||||
|
'207\n'
|
||||||
|
'208\n'
|
||||||
|
'209\n'
|
||||||
|
'210\n'
|
||||||
|
'211\n'
|
||||||
|
'212</pre></div></td>' in html)
|
||||||
|
|
||||||
# :lineno-match:
|
# :lineno-match:
|
||||||
assert ('<td class="linenos"><div class="linenodiv"><pre>'
|
if pygments_version >= (2, 8):
|
||||||
'5\n'
|
assert ('<td class="linenos"><div class="linenodiv"><pre>'
|
||||||
'6\n'
|
'<span class="normal">5</span>\n'
|
||||||
'7\n'
|
'<span class="normal">6</span>\n'
|
||||||
'8\n'
|
'<span class="normal">7</span>\n'
|
||||||
'9</pre></div></td>' in html)
|
'<span class="normal">8</span>\n'
|
||||||
|
'<span class="normal">9</span></pre></div></td>' in html)
|
||||||
|
else:
|
||||||
|
assert ('<td class="linenos"><div class="linenodiv"><pre>'
|
||||||
|
'5\n'
|
||||||
|
'6\n'
|
||||||
|
'7\n'
|
||||||
|
'8\n'
|
||||||
|
'9</pre></div></td>' in html)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('latex', testroot='directive-code')
|
@pytest.mark.sphinx('latex', testroot='directive-code')
|
||||||
@ -594,45 +637,82 @@ def test_linenothreshold(app, status, warning):
|
|||||||
app.builder.build(['linenothreshold'])
|
app.builder.build(['linenothreshold'])
|
||||||
html = (app.outdir / 'linenothreshold.html').read_text()
|
html = (app.outdir / 'linenothreshold.html').read_text()
|
||||||
|
|
||||||
|
pygments_version = tuple(LooseVersion(pygments.__version__).version)
|
||||||
lineos_head = '<td class="linenos"><div class="linenodiv"><pre>'
|
lineos_head = '<td class="linenos"><div class="linenodiv"><pre>'
|
||||||
lineos_tail = '</pre></div></td>'
|
lineos_tail = '</pre></div></td>'
|
||||||
|
|
||||||
# code-block using linenothreshold
|
# code-block using linenothreshold
|
||||||
_, matched, html = html.partition(lineos_head +
|
if pygments_version >= (2, 8):
|
||||||
'1\n'
|
_, matched, html = html.partition(lineos_head +
|
||||||
'2\n'
|
'<span class="normal">1</span>\n'
|
||||||
'3\n'
|
'<span class="normal">2</span>\n'
|
||||||
'4\n'
|
'<span class="normal">3</span>\n'
|
||||||
'5\n'
|
'<span class="normal">4</span>\n'
|
||||||
'6' + lineos_tail)
|
'<span class="normal">5</span>\n'
|
||||||
|
'<span class="normal">6</span>' + lineos_tail)
|
||||||
|
else:
|
||||||
|
_, matched, html = html.partition(lineos_head +
|
||||||
|
'1\n'
|
||||||
|
'2\n'
|
||||||
|
'3\n'
|
||||||
|
'4\n'
|
||||||
|
'5\n'
|
||||||
|
'6' + lineos_tail)
|
||||||
assert matched
|
assert matched
|
||||||
|
|
||||||
# code-block not using linenothreshold
|
# code-block not using linenothreshold
|
||||||
html, matched, _ = html.partition(lineos_head +
|
if pygments_version >= (2, 8):
|
||||||
'1\n'
|
html, matched, _ = html.partition(lineos_head +
|
||||||
'2' + lineos_tail)
|
'<span class="normal">1</span>\n'
|
||||||
|
'<span class="normal">2</span>' + lineos_tail)
|
||||||
|
else:
|
||||||
|
html, matched, _ = html.partition(lineos_head +
|
||||||
|
'1\n'
|
||||||
|
'2' + lineos_tail)
|
||||||
assert not matched
|
assert not matched
|
||||||
|
|
||||||
# literal include using linenothreshold
|
# literal include using linenothreshold
|
||||||
_, matched, html = html.partition(lineos_head +
|
if pygments_version >= (2, 8):
|
||||||
' 1\n'
|
_, matched, html = html.partition(lineos_head +
|
||||||
' 2\n'
|
'<span class="normal"> 1</span>\n'
|
||||||
' 3\n'
|
'<span class="normal"> 2</span>\n'
|
||||||
' 4\n'
|
'<span class="normal"> 3</span>\n'
|
||||||
' 5\n'
|
'<span class="normal"> 4</span>\n'
|
||||||
' 6\n'
|
'<span class="normal"> 5</span>\n'
|
||||||
' 7\n'
|
'<span class="normal"> 6</span>\n'
|
||||||
' 8\n'
|
'<span class="normal"> 7</span>\n'
|
||||||
' 9\n'
|
'<span class="normal"> 8</span>\n'
|
||||||
'10\n'
|
'<span class="normal"> 9</span>\n'
|
||||||
'11\n'
|
'<span class="normal">10</span>\n'
|
||||||
'12\n'
|
'<span class="normal">11</span>\n'
|
||||||
'13' + lineos_tail)
|
'<span class="normal">12</span>\n'
|
||||||
|
'<span class="normal">13</span>' + lineos_tail)
|
||||||
|
else:
|
||||||
|
_, matched, html = html.partition(lineos_head +
|
||||||
|
' 1\n'
|
||||||
|
' 2\n'
|
||||||
|
' 3\n'
|
||||||
|
' 4\n'
|
||||||
|
' 5\n'
|
||||||
|
' 6\n'
|
||||||
|
' 7\n'
|
||||||
|
' 8\n'
|
||||||
|
' 9\n'
|
||||||
|
'10\n'
|
||||||
|
'11\n'
|
||||||
|
'12\n'
|
||||||
|
'13' + lineos_tail)
|
||||||
assert matched
|
assert matched
|
||||||
|
|
||||||
# literal include not using linenothreshold
|
# literal include not using linenothreshold
|
||||||
html, matched, _ = html.partition(lineos_head +
|
if pygments_version >= (2, 8):
|
||||||
'1\n'
|
html, matched, _ = html.partition(lineos_head +
|
||||||
'2\n'
|
'<span class="normal">1</span>\n'
|
||||||
'3' + lineos_tail)
|
'<span class="normal">2</span>\n'
|
||||||
|
'<span class="normal">3</span>' + lineos_tail)
|
||||||
|
else:
|
||||||
|
html, matched, _ = html.partition(lineos_head +
|
||||||
|
'1\n'
|
||||||
|
'2\n'
|
||||||
|
'3' + lineos_tail)
|
||||||
assert not matched
|
assert not matched
|
||||||
|
Loading…
Reference in New Issue
Block a user