From 8aaea906a1971fb5d4254250fa8a801b278dacc5 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Sun, 14 Feb 2021 20:41:19 +0300 Subject: [PATCH 1/3] Fix #8884: Include sphinx/search/minified-js in the tarball --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index 54da42895..1114ca19f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -22,6 +22,7 @@ recursive-include sphinx/texinputs_win * recursive-include sphinx/themes * recursive-include sphinx/locale *.js *.pot *.po *.mo recursive-include sphinx/search/non-minified-js *.js +recursive-include sphinx/search/minified-js *.js recursive-include sphinx/ext/autosummary/templates * recursive-include tests * recursive-include utils * From 19ea727f1baf0f2d2f4224847f7cb6e53231a864 Mon Sep 17 00:00:00 2001 From: jfbu Date: Sun, 14 Feb 2021 21:13:09 +0100 Subject: [PATCH 2/3] Adapt our tests to Pygments 2.8.0 --- tests/test_build_html.py | 9 +- tests/test_directive_code.py | 204 ++++++++++++++++++++++++----------- 2 files changed, 150 insertions(+), 63 deletions(-) diff --git a/tests/test_build_html.py b/tests/test_build_html.py index 8d02f5bed..ffd32d6f5 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -1621,7 +1621,14 @@ def test_html_codeblock_linenos_style_table(app): app.build() content = (app.outdir / 'index.html').read_text() - assert '
1\n2\n3\n4
' in content + pygments_version = tuple(LooseVersion(pygments.__version__).version) + if pygments_version >= (2, 8): + assert ('
1\n'
+                '2\n'
+                '3\n'
+                '4
') in content + else: + assert '
1\n2\n3\n4
' in content @pytest.mark.sphinx('html', testroot='reST-code-block', diff --git a/tests/test_directive_code.py b/tests/test_directive_code.py index 0ae11baf3..ee67b738a 100644 --- a/tests/test_directive_code.py +++ b/tests/test_directive_code.py @@ -9,7 +9,9 @@ """ import os +from distutils.version import LooseVersion +import pygments import pytest 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): app.builder.build(['linenos']) html = (app.outdir / 'linenos.html').read_text() + pygments_version = tuple(LooseVersion(pygments.__version__).version) # :linenos: - assert ('
'
-            ' 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
' in html) + if pygments_version >= (2, 8): + assert ('
'
+                ' 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
' in html) + else: + assert ('
'
+                ' 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
' in html) # :lineno-start: - assert ('
'
-            '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
' in html) + if pygments_version >= (2, 8): + assert ('
'
+                '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
' in html) + else: + assert ('
'
+                '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
' in html) # :lineno-match: - assert ('
'
-            '5\n'
-            '6\n'
-            '7\n'
-            '8\n'
-            '9
' in html) + if pygments_version >= (2, 8): + assert ('
'
+                '5\n'
+                '6\n'
+                '7\n'
+                '8\n'
+                '9
' in html) + else: + assert ('
'
+                '5\n'
+                '6\n'
+                '7\n'
+                '8\n'
+                '9
' in html) @pytest.mark.sphinx('latex', testroot='directive-code') @@ -594,45 +637,82 @@ def test_linenothreshold(app, status, warning): app.builder.build(['linenothreshold']) html = (app.outdir / 'linenothreshold.html').read_text() + pygments_version = tuple(LooseVersion(pygments.__version__).version) lineos_head = '
'
     lineos_tail = '
' # code-block using linenothreshold - _, matched, html = html.partition(lineos_head + - '1\n' - '2\n' - '3\n' - '4\n' - '5\n' - '6' + lineos_tail) + if pygments_version >= (2, 8): + _, matched, html = html.partition(lineos_head + + '1\n' + '2\n' + '3\n' + '4\n' + '5\n' + '6' + lineos_tail) + else: + _, matched, html = html.partition(lineos_head + + '1\n' + '2\n' + '3\n' + '4\n' + '5\n' + '6' + lineos_tail) assert matched # code-block not using linenothreshold - html, matched, _ = html.partition(lineos_head + - '1\n' - '2' + lineos_tail) + if pygments_version >= (2, 8): + html, matched, _ = html.partition(lineos_head + + '1\n' + '2' + lineos_tail) + else: + html, matched, _ = html.partition(lineos_head + + '1\n' + '2' + lineos_tail) assert not matched # literal include using linenothreshold - _, 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) + if pygments_version >= (2, 8): + _, 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) + 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 # literal include not using linenothreshold - html, matched, _ = html.partition(lineos_head + - '1\n' - '2\n' - '3' + lineos_tail) + if pygments_version >= (2, 8): + html, matched, _ = html.partition(lineos_head + + '1\n' + '2\n' + '3' + lineos_tail) + else: + html, matched, _ = html.partition(lineos_head + + '1\n' + '2\n' + '3' + lineos_tail) assert not matched From f993f769984223c2d73846f5d32c8d5de613488d Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 15 Feb 2021 22:58:17 +0900 Subject: [PATCH 3/3] Update CHANGES for PR #8886 --- CHANGES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index be9c0c5c0..18354fa92 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,8 @@ Features added Bugs fixed ---------- +* #8884: html: minified js stemmers not included in the distributed package + Testing --------