mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-14 00:16:59 +02:00
dev-python/docutils: Sync with Gentoo
It's from Gentoo commit 3a83d73166a974ec73fb824b146c1710332bcb5a.
This commit is contained in:
parent
a3bd98076e
commit
c82350adc5
@ -1,3 +1,2 @@
|
|||||||
DIST docutils-0.16.tar.gz 1962041 BLAKE2B 64d045d43433e944686b5d9077de0b544d49d041adf398f9b66612db432860853df4a84f4c4b44461789b3039f83e3847547062b2f5bc5d2bde3a0f1ffc9ffba SHA512 4e0c6662924cac6b8f28bb77a4f50eafd637c1083990a23dbd905d8a05362a18dae96e63408ed43b595b693ca755c7961d1282129d3215ed3774af0dddcc0466
|
|
||||||
DIST docutils-0.17.1.tar.gz 2016138 BLAKE2B aa0b6525ba2e3eaebc17010806952ed5f40919876fcb813f50cc05b628dfd22e6073a9a4b2bfe989089ae68d9b7111ae3a97dda2bde5c0536f8fb76c0942fe29 SHA512 5ec2087116bd5356fdffc54f07f6b0355aac5fa9d6caeefa77e8d201fd4706c0d419193c4d9a3964ae493da3091fe2c7dc36b74f81a1e1b9282173658b06e71b
|
DIST docutils-0.17.1.tar.gz 2016138 BLAKE2B aa0b6525ba2e3eaebc17010806952ed5f40919876fcb813f50cc05b628dfd22e6073a9a4b2bfe989089ae68d9b7111ae3a97dda2bde5c0536f8fb76c0942fe29 SHA512 5ec2087116bd5356fdffc54f07f6b0355aac5fa9d6caeefa77e8d201fd4706c0d419193c4d9a3964ae493da3091fe2c7dc36b74f81a1e1b9282173658b06e71b
|
||||||
DIST docutils-0.18.1.tar.gz 2043249 BLAKE2B 3959199236baade9601d61c3f6d7b6f840fbefdd46d9ea05869fde2cd2c800356a01faba891f51e220c85e66f3029f49f616f2046b85041b674c64825a4242ec SHA512 44404a6cc9d4c1e79c73a6ffee2898e459c9925ab9661e5d41394e13b3d861334cf0c5efcd18e87eb03041374e326cfd00539a6b2ec5979678889e8a536c9542
|
DIST docutils-0.19.tar.gz 2056383 BLAKE2B 9983a905642de4e81ca118578671b503ddfda4bef1afcc0524de40543e1f9617fd8d768ef467da49d2f01076683400bad6a0fe15f6b5a3a1e202c42b2e34ab1b SHA512 fb904a899f2b6f3c07c5079577bd7c52a3182cb85f6a4149391e523498df15bfa317f0c04095b890beeb3f89c2b444875a2a609d880ac4d7fbc3125e46b37ea5
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
# Copyright 1999-2021 Gentoo Authors
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
|
|
||||||
EAPI=7
|
|
||||||
|
|
||||||
PYTHON_COMPAT=( python3_{8..10} pypy3 )
|
|
||||||
|
|
||||||
inherit distutils-r1
|
|
||||||
|
|
||||||
DESCRIPTION="Python Documentation Utilities"
|
|
||||||
HOMEPAGE="https://docutils.sourceforge.io/ https://pypi.org/project/docutils/"
|
|
||||||
#SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
|
|
||||||
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
|
|
||||||
|
|
||||||
LICENSE="BSD-2 GPL-3 public-domain"
|
|
||||||
SLOT="0"
|
|
||||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
|
|
||||||
IUSE=""
|
|
||||||
|
|
||||||
BDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
|
|
||||||
dev-python/pygments[${PYTHON_USEDEP}]"
|
|
||||||
RDEPEND="${DEPEND}"
|
|
||||||
|
|
||||||
PATCHES=(
|
|
||||||
"${FILESDIR}"/${P}-tests.patch
|
|
||||||
)
|
|
||||||
|
|
||||||
python_compile_all() {
|
|
||||||
# Generate html docs from reStructured text sources.
|
|
||||||
|
|
||||||
# Place html4css1.css in base directory to ensure that the generated reference to it is correct.
|
|
||||||
cp docutils/writers/html4css1/html4css1.css . || die
|
|
||||||
|
|
||||||
cd tools || die
|
|
||||||
"${EPYTHON}" buildhtml.py --input-encoding=utf-8 \
|
|
||||||
--stylesheet-path=../html4css1.css, --traceback ../docs || die
|
|
||||||
}
|
|
||||||
|
|
||||||
src_test() {
|
|
||||||
cd test || die
|
|
||||||
distutils-r1_src_test
|
|
||||||
}
|
|
||||||
|
|
||||||
python_test() {
|
|
||||||
"${EPYTHON}" alltests.py -v || die "Testing failed with ${EPYTHON}"
|
|
||||||
}
|
|
||||||
|
|
||||||
python_install() {
|
|
||||||
distutils-r1_python_install
|
|
||||||
|
|
||||||
# Install tools.
|
|
||||||
python_doscript tools/{buildhtml,quicktest}.py
|
|
||||||
}
|
|
||||||
|
|
||||||
install_txt_doc() {
|
|
||||||
local doc="${1}"
|
|
||||||
local dir="txt/$(dirname ${doc})"
|
|
||||||
docinto "${dir}"
|
|
||||||
dodoc "${doc}"
|
|
||||||
}
|
|
||||||
|
|
||||||
python_install_all() {
|
|
||||||
local DOCS=( *.txt )
|
|
||||||
local HTML_DOCS=( docs tools docutils/writers/html4css1/html4css1.css )
|
|
||||||
|
|
||||||
distutils-r1_python_install_all
|
|
||||||
|
|
||||||
local doc
|
|
||||||
while IFS= read -r -d '' doc; do
|
|
||||||
install_txt_doc "${doc}"
|
|
||||||
done < <(find docs tools -name '*.txt' -print0)
|
|
||||||
}
|
|
@ -1,24 +1,34 @@
|
|||||||
# Copyright 1999-2022 Gentoo Authors
|
# Copyright 1999-2023 Gentoo Authors
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
EAPI=8
|
EAPI=8
|
||||||
|
|
||||||
PYTHON_COMPAT=( python3_{8..10} pypy3 )
|
DISTUTILS_USE_PEP517=setuptools
|
||||||
|
PYTHON_COMPAT=( python3_{9..11} pypy3 )
|
||||||
|
|
||||||
inherit distutils-r1
|
inherit distutils-r1
|
||||||
|
|
||||||
DESCRIPTION="Python Documentation Utilities"
|
DESCRIPTION="Python Documentation Utilities (reference reStructuredText impl.)"
|
||||||
HOMEPAGE="https://docutils.sourceforge.io/ https://pypi.org/project/docutils/"
|
HOMEPAGE="
|
||||||
#SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
|
https://docutils.sourceforge.io/
|
||||||
|
https://pypi.org/project/docutils/
|
||||||
|
"
|
||||||
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
|
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
|
||||||
|
|
||||||
LICENSE="BSD-2 GPL-3 public-domain"
|
LICENSE="BSD-2 GPL-3 public-domain"
|
||||||
SLOT="0"
|
SLOT="0"
|
||||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
|
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
|
||||||
IUSE=""
|
|
||||||
|
|
||||||
RDEPEND="dev-python/pygments[${PYTHON_USEDEP}]"
|
RDEPEND="
|
||||||
BDEPEND="${RDEPEND}"
|
dev-python/pygments[${PYTHON_USEDEP}]
|
||||||
|
"
|
||||||
|
BDEPEND="
|
||||||
|
${RDEPEND}
|
||||||
|
"
|
||||||
|
|
||||||
|
PATCHES=(
|
||||||
|
"${FILESDIR}/docutils-0.18.1-py311.patch"
|
||||||
|
)
|
||||||
|
|
||||||
python_compile_all() {
|
python_compile_all() {
|
||||||
# Generate html docs from reStructured text sources.
|
# Generate html docs from reStructured text sources.
|
@ -1,24 +1,34 @@
|
|||||||
# Copyright 1999-2022 Gentoo Authors
|
# Copyright 1999-2023 Gentoo Authors
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
EAPI=7
|
EAPI=8
|
||||||
|
|
||||||
PYTHON_COMPAT=( python3_{7..10} pypy3 )
|
DISTUTILS_USE_PEP517=setuptools
|
||||||
|
PYTHON_COMPAT=( python3_{9..11} pypy3 )
|
||||||
|
|
||||||
inherit distutils-r1
|
inherit distutils-r1
|
||||||
|
|
||||||
DESCRIPTION="Python Documentation Utilities"
|
DESCRIPTION="Python Documentation Utilities (reference reStructuredText impl.)"
|
||||||
HOMEPAGE="https://docutils.sourceforge.io/ https://pypi.org/project/docutils/"
|
HOMEPAGE="
|
||||||
#SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
|
https://docutils.sourceforge.io/
|
||||||
|
https://pypi.org/project/docutils/
|
||||||
|
"
|
||||||
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
|
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
|
||||||
|
|
||||||
LICENSE="BSD-2 GPL-3 public-domain"
|
LICENSE="BSD-2 GPL-3 public-domain"
|
||||||
SLOT="0"
|
SLOT="0"
|
||||||
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
|
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
|
||||||
IUSE=""
|
|
||||||
|
|
||||||
RDEPEND="dev-python/pygments[${PYTHON_USEDEP}]"
|
RDEPEND="
|
||||||
BDEPEND="${RDEPEND}"
|
dev-python/pygments[${PYTHON_USEDEP}]
|
||||||
|
"
|
||||||
|
BDEPEND="
|
||||||
|
${RDEPEND}
|
||||||
|
"
|
||||||
|
|
||||||
|
PATCHES=(
|
||||||
|
"${FILESDIR}"/${PN}-0.19-pygments-2.14.patch
|
||||||
|
)
|
||||||
|
|
||||||
python_compile_all() {
|
python_compile_all() {
|
||||||
# Generate html docs from reStructured text sources.
|
# Generate html docs from reStructured text sources.
|
@ -1,66 +0,0 @@
|
|||||||
Index: docutils/test/test_parsers/test_rst/test_directives/test_code.py
|
|
||||||
===================================================================
|
|
||||||
--- docutils/test/test_parsers/test_rst/test_directives/test_code.py (revision 8494)
|
|
||||||
+++ docutils/test/test_parsers/test_rst/test_directives/test_code.py (working copy)
|
|
||||||
@@ -107,7 +107,7 @@
|
|
||||||
<document source="test data">
|
|
||||||
<literal_block classes="code python testclass" xml:space="preserve">
|
|
||||||
\n\
|
|
||||||
- <inline classes="keyword">
|
|
||||||
+ <inline classes="name builtin">
|
|
||||||
print
|
|
||||||
<inline classes="punctuation">
|
|
||||||
(
|
|
||||||
@@ -167,7 +167,7 @@
|
|
||||||
<inline classes="ln">
|
|
||||||
12 \n\
|
|
||||||
\n\
|
|
||||||
- <inline classes="keyword">
|
|
||||||
+ <inline classes="name builtin">
|
|
||||||
print
|
|
||||||
<inline classes="punctuation">
|
|
||||||
(
|
|
||||||
Index: docutils/test/test_parsers/test_rst/test_directives/test_code_long.py
|
|
||||||
===================================================================
|
|
||||||
--- docutils/test/test_parsers/test_rst/test_directives/test_code_long.py (revision 8494)
|
|
||||||
+++ docutils/test/test_parsers/test_rst/test_directives/test_code_long.py (working copy)
|
|
||||||
@@ -69,7 +69,7 @@
|
|
||||||
<inline classes="ln">
|
|
||||||
12 \n\
|
|
||||||
\n\
|
|
||||||
- <inline classes="keyword">
|
|
||||||
+ <inline classes="name builtin">
|
|
||||||
print
|
|
||||||
<inline classes="punctuation">
|
|
||||||
(
|
|
||||||
Index: docutils/test/test_parsers/test_rst/test_directives/test_tables.py
|
|
||||||
===================================================================
|
|
||||||
--- docutils/test/test_parsers/test_rst/test_directives/test_tables.py (revision 8494)
|
|
||||||
+++ docutils/test/test_parsers/test_rst/test_directives/test_tables.py (working copy)
|
|
||||||
@@ -45,10 +45,11 @@
|
|
||||||
# some error messages changed in Python 3.3, CPython has backported to 2.7.4,
|
|
||||||
# PyPy has not
|
|
||||||
csv_eod_error_str = 'unexpected end of data'
|
|
||||||
-if sys.version_info < (2,7,4) or platform.python_implementation() == 'PyPy':
|
|
||||||
+if sys.version_info < (2,7,4) or (platform.python_implementation() == 'PyPy'
|
|
||||||
+ and sys.version_info < (3,0)):
|
|
||||||
csv_eod_error_str = 'newline inside string'
|
|
||||||
# pypy adds a line number
|
|
||||||
-if sys.version_info >= (3, 0) and platform.python_implementation() == 'PyPy':
|
|
||||||
+if platform.python_implementation() == 'PyPy':
|
|
||||||
csv_eod_error_str = 'line 1: ' + csv_eod_error_str
|
|
||||||
csv_unknown_url = "'bogus.csv'"
|
|
||||||
if sys.version_info < (3, 0):
|
|
||||||
Index: docutils/test/test_parsers/test_rst/test_interpreted.py
|
|
||||||
===================================================================
|
|
||||||
--- docutils/test/test_parsers/test_rst/test_interpreted.py (revision 8494)
|
|
||||||
+++ docutils/test/test_parsers/test_rst/test_interpreted.py (working copy)
|
|
||||||
@@ -283,7 +283,7 @@
|
|
||||||
<paragraph>
|
|
||||||
Python code \n\
|
|
||||||
<literal classes="code testclass python">
|
|
||||||
- <inline classes="keyword">
|
|
||||||
+ <inline classes="name builtin">
|
|
||||||
print
|
|
||||||
<inline classes="punctuation">
|
|
||||||
(
|
|
135
sdk_container/src/third_party/portage-stable/dev-python/docutils/files/docutils-0.18.1-py311.patch
vendored
Normal file
135
sdk_container/src/third_party/portage-stable/dev-python/docutils/files/docutils-0.18.1-py311.patch
vendored
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
Combination of:
|
||||||
|
http://svn.code.sf.net/p/docutils/code/trunk@8910
|
||||||
|
http://svn.code.sf.net/p/docutils/code/trunk@8909
|
||||||
|
|
||||||
|
diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py
|
||||||
|
index 592d3f9df..e1f33aa7a 100644
|
||||||
|
--- a/test/DocutilsTestSupport.py
|
||||||
|
+++ b/test/DocutilsTestSupport.py
|
||||||
|
@@ -819,6 +819,7 @@ def exception_data(func, *args, **kwds):
|
||||||
|
except Exception as detail:
|
||||||
|
return (detail, detail.args,
|
||||||
|
'%s: %s' % (detail.__class__.__name__, detail))
|
||||||
|
+ return None, [], "No exception"
|
||||||
|
|
||||||
|
|
||||||
|
def _format_str(*args):
|
||||||
|
diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py
|
||||||
|
index 07be0122f..73724ed7e 100755
|
||||||
|
--- a/test/test_parsers/test_rst/test_directives/test_tables.py
|
||||||
|
+++ b/test/test_parsers/test_rst/test_directives/test_tables.py
|
||||||
|
@@ -65,6 +65,92 @@ def null_bytes():
|
||||||
|
next(reader)
|
||||||
|
|
||||||
|
null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes)[0]
|
||||||
|
+# Null bytes are valid in Python 3.11+:
|
||||||
|
+if null_bytes_exception is None:
|
||||||
|
+ bad_encoding_result = """\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <table>
|
||||||
|
+ <title>
|
||||||
|
+ bad encoding
|
||||||
|
+ <tgroup cols="4">
|
||||||
|
+ <colspec colwidth="25">
|
||||||
|
+ <colspec colwidth="25">
|
||||||
|
+ <colspec colwidth="25">
|
||||||
|
+ <colspec colwidth="25">
|
||||||
|
+ <tbody>
|
||||||
|
+ <row>
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ \xfe\xff"Treat"
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ "Quantity"
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ "Description"
|
||||||
|
+ <entry>
|
||||||
|
+ <row>
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ "Albatr\u00b0\u00df"
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ 2.99
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ "\u00a1Ona\x03\xc3\x03\xc4\x03\xb9\x03\xba!"
|
||||||
|
+ <entry>
|
||||||
|
+ <row>
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ "CrunchyFrog"
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ 1.49
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ "Ifwetooktheb\u00f6nesout
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ itwouldn\x20\x19tbe
|
||||||
|
+ <row>
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ crunchy
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ nowwouldit?"
|
||||||
|
+ <entry>
|
||||||
|
+ <entry>
|
||||||
|
+ <row>
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ "GannetRipple"
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ 1.99
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ "\xbfOna\x03\xc3\x03\xc4\x03\xb9\x03\xba?"
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
|
||||||
|
+"""
|
||||||
|
+else:
|
||||||
|
+ bad_encoding_result = """\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <system_message level="3" line="1" source="test data" type="ERROR">
|
||||||
|
+ <paragraph>
|
||||||
|
+ Error with CSV data in "csv-table" directive:
|
||||||
|
+ %s
|
||||||
|
+ <literal_block xml:space="preserve">
|
||||||
|
+ .. csv-table:: bad encoding
|
||||||
|
+ :file: %s
|
||||||
|
+ :encoding: latin-1
|
||||||
|
+ <paragraph>
|
||||||
|
+ (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
|
||||||
|
+""" % (null_bytes_exception, utf_16_csv)
|
||||||
|
+
|
||||||
|
|
||||||
|
totest = {}
|
||||||
|
|
||||||
|
@@ -1031,19 +1117,8 @@ u"""\
|
||||||
|
|
||||||
|
(7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
|
||||||
|
""" % utf_16_csv,
|
||||||
|
-"""\
|
||||||
|
-<document source="test data">
|
||||||
|
- <system_message level="3" line="1" source="test data" type="ERROR">
|
||||||
|
- <paragraph>
|
||||||
|
- Error with CSV data in "csv-table" directive:
|
||||||
|
- %s
|
||||||
|
- <literal_block xml:space="preserve">
|
||||||
|
- .. csv-table:: bad encoding
|
||||||
|
- :file: %s
|
||||||
|
- :encoding: latin-1
|
||||||
|
- <paragraph>
|
||||||
|
- (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
|
||||||
|
-""" % (null_bytes_exception, utf_16_csv)],
|
||||||
|
+bad_encoding_result
|
||||||
|
+],
|
||||||
|
["""\
|
||||||
|
.. csv-table:: good encoding
|
||||||
|
:file: %s
|
@ -0,0 +1,672 @@
|
|||||||
|
https://bugs.gentoo.org/892213
|
||||||
|
https://sourceforge.net/p/docutils/patches/201/
|
||||||
|
--- a/test/test_parsers/test_rst/test_directives/test_code.py
|
||||||
|
+++ b/test/test_parsers/test_rst/test_directives/test_code.py
|
||||||
|
@@ -10,14 +10,20 @@ Test the 'code' directive in parsers/rst
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import __init__ # noqa: F401
|
||||||
|
+from packaging.version import Version
|
||||||
|
from test_parsers import DocutilsTestSupport
|
||||||
|
-from docutils.utils.code_analyzer import with_pygments
|
||||||
|
+from docutils.utils.code_analyzer import with_pygments, pygments_version
|
||||||
|
|
||||||
|
|
||||||
|
def suite():
|
||||||
|
s = DocutilsTestSupport.ParserTestSuite()
|
||||||
|
if not with_pygments:
|
||||||
|
del(totest['code-parsing'])
|
||||||
|
+ del(totest['code-parsing-2-14'])
|
||||||
|
+ elif pygments_version >= Version('2.14.0'):
|
||||||
|
+ del(totest['code-parsing'])
|
||||||
|
+ else:
|
||||||
|
+ del(totest['code-parsing-2-14'])
|
||||||
|
s.generateTests(totest)
|
||||||
|
return s
|
||||||
|
|
||||||
|
@@ -170,6 +176,165 @@ totest['code-parsing'] = [
|
||||||
|
\n\
|
||||||
|
<inline classes="name builtin">
|
||||||
|
print
|
||||||
|
+ <inline classes="punctuation">
|
||||||
|
+ (
|
||||||
|
+ <inline classes="literal number integer">
|
||||||
|
+ 8
|
||||||
|
+ <inline classes="operator">
|
||||||
|
+ /
|
||||||
|
+ <inline classes="literal number integer">
|
||||||
|
+ 2
|
||||||
|
+ <inline classes="punctuation">
|
||||||
|
+ )
|
||||||
|
+"""],
|
||||||
|
+["""\
|
||||||
|
+.. code:: latex
|
||||||
|
+ :class: testclass
|
||||||
|
+
|
||||||
|
+ hello \\emph{world} % emphasize
|
||||||
|
+""",
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <literal_block classes="code latex testclass" xml:space="preserve">
|
||||||
|
+ hello \n\
|
||||||
|
+ <inline classes="keyword">
|
||||||
|
+ \\emph
|
||||||
|
+ <inline classes="name builtin">
|
||||||
|
+ {
|
||||||
|
+ world
|
||||||
|
+ <inline classes="name builtin">
|
||||||
|
+ }
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="comment">
|
||||||
|
+ % emphasize"""],
|
||||||
|
+["""\
|
||||||
|
+.. code:: rst
|
||||||
|
+ :number-lines:
|
||||||
|
+
|
||||||
|
+ This is a code block with text.
|
||||||
|
+""",
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <literal_block classes="code rst" xml:space="preserve">
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 1 \n\
|
||||||
|
+ This is a code block with text.
|
||||||
|
+"""],
|
||||||
|
+["""\
|
||||||
|
+Code not parsed but warning silenced in ParserTestCase.
|
||||||
|
+
|
||||||
|
+.. code:: s-lang
|
||||||
|
+
|
||||||
|
+ % abc.sl
|
||||||
|
+ autoload("abc_mode", "abc");
|
||||||
|
+""",
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <paragraph>
|
||||||
|
+ Code not parsed but warning silenced in ParserTestCase.
|
||||||
|
+ <literal_block classes="code s-lang" xml:space="preserve">
|
||||||
|
+ % abc.sl
|
||||||
|
+ autoload("abc_mode", "abc");
|
||||||
|
+"""],
|
||||||
|
+["""\
|
||||||
|
+Place the language name in a class argument to avoid the no-lexer warning:
|
||||||
|
+
|
||||||
|
+.. code::
|
||||||
|
+ :class: s-lang
|
||||||
|
+
|
||||||
|
+ % abc.sl
|
||||||
|
+ autoload("abc_mode", "abc");
|
||||||
|
+""",
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <paragraph>
|
||||||
|
+ Place the language name in a class argument to avoid the no-lexer warning:
|
||||||
|
+ <literal_block classes="code s-lang" xml:space="preserve">
|
||||||
|
+ % abc.sl
|
||||||
|
+ autoload("abc_mode", "abc");
|
||||||
|
+"""],
|
||||||
|
+]
|
||||||
|
+
|
||||||
|
+totest['code-parsing-2-14'] = [
|
||||||
|
+["""\
|
||||||
|
+.. code:: python3
|
||||||
|
+ :class: testclass
|
||||||
|
+
|
||||||
|
+ print('hello world') # to stdout
|
||||||
|
+""",
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <literal_block classes="code python3 testclass" xml:space="preserve">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="name builtin">
|
||||||
|
+ print
|
||||||
|
+ <inline classes="punctuation">
|
||||||
|
+ (
|
||||||
|
+ <inline classes="literal string single">
|
||||||
|
+ 'hello world'
|
||||||
|
+ <inline classes="punctuation">
|
||||||
|
+ )
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="comment single">
|
||||||
|
+ # to stdout
|
||||||
|
+"""],
|
||||||
|
+["""\
|
||||||
|
+.. code:: python3
|
||||||
|
+ :class: testclass
|
||||||
|
+ :name: my_function
|
||||||
|
+ :number-lines: 7
|
||||||
|
+
|
||||||
|
+ def my_function():
|
||||||
|
+ '''Test the lexer.
|
||||||
|
+ '''
|
||||||
|
+
|
||||||
|
+ # and now for something completely different
|
||||||
|
+ print(8/2)
|
||||||
|
+""",
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <literal_block classes="code python3 testclass" ids="my-function" names="my_function" xml:space="preserve">
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 7 \n\
|
||||||
|
+ <inline classes="keyword">
|
||||||
|
+ def
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="name function">
|
||||||
|
+ my_function
|
||||||
|
+ <inline classes="punctuation">
|
||||||
|
+ ():
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 8 \n\
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="literal string doc">
|
||||||
|
+ \'\'\'Test the lexer.
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 9 \n\
|
||||||
|
+ <inline classes="literal string doc">
|
||||||
|
+ \'\'\'
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 10 \n\
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 11 \n\
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="comment single">
|
||||||
|
+ # and now for something completely different
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 12 \n\
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="name builtin">
|
||||||
|
+ print
|
||||||
|
<inline classes="punctuation">
|
||||||
|
(
|
||||||
|
<inline classes="literal number integer">
|
||||||
|
--- a/test/test_parsers/test_rst/test_directives/test_code_long.py
|
||||||
|
+++ b/test/test_parsers/test_rst/test_directives/test_code_long.py
|
||||||
|
@@ -10,15 +10,22 @@ Test the 'code' directive in body.py wit
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import __init__ # noqa: F401
|
||||||
|
+from packaging.version import Version
|
||||||
|
from test_parsers import DocutilsTestSupport
|
||||||
|
-from docutils.utils.code_analyzer import with_pygments
|
||||||
|
+from docutils.utils.code_analyzer import with_pygments, pygments_version
|
||||||
|
|
||||||
|
|
||||||
|
def suite():
|
||||||
|
settings = {'syntax_highlight': 'long'}
|
||||||
|
s = DocutilsTestSupport.ParserTestSuite(suite_settings=settings)
|
||||||
|
if with_pygments:
|
||||||
|
+ if pygments_version >= Version('2.14.0'):
|
||||||
|
+ del(totest['code-parsing-long'])
|
||||||
|
+ else:
|
||||||
|
+ del(totest['code-parsing-long-2-14'])
|
||||||
|
+
|
||||||
|
s.generateTests(totest)
|
||||||
|
+
|
||||||
|
return s
|
||||||
|
|
||||||
|
|
||||||
|
@@ -73,6 +80,94 @@ totest['code-parsing-long'] = [
|
||||||
|
\n\
|
||||||
|
<inline classes="name builtin">
|
||||||
|
print
|
||||||
|
+ <inline classes="punctuation">
|
||||||
|
+ (
|
||||||
|
+ <inline classes="literal number integer">
|
||||||
|
+ 8
|
||||||
|
+ <inline classes="operator">
|
||||||
|
+ /
|
||||||
|
+ <inline classes="literal number integer">
|
||||||
|
+ 2
|
||||||
|
+ <inline classes="punctuation">
|
||||||
|
+ )
|
||||||
|
+"""],
|
||||||
|
+["""\
|
||||||
|
+.. code:: latex
|
||||||
|
+
|
||||||
|
+ hello \\emph{world} % emphasize
|
||||||
|
+""",
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <literal_block classes="code latex" xml:space="preserve">
|
||||||
|
+ hello \n\
|
||||||
|
+ <inline classes="keyword">
|
||||||
|
+ \\emph
|
||||||
|
+ <inline classes="name builtin">
|
||||||
|
+ {
|
||||||
|
+ world
|
||||||
|
+ <inline classes="name builtin">
|
||||||
|
+ }
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="comment">
|
||||||
|
+ % emphasize"""],
|
||||||
|
+]
|
||||||
|
+
|
||||||
|
+totest['code-parsing-long-2-14'] = [
|
||||||
|
+["""\
|
||||||
|
+.. code:: python3
|
||||||
|
+ :number-lines: 7
|
||||||
|
+
|
||||||
|
+ def my_function():
|
||||||
|
+ '''Test the lexer.
|
||||||
|
+ '''
|
||||||
|
+
|
||||||
|
+ # and now for something completely different
|
||||||
|
+ print(8/2)
|
||||||
|
+""",
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <literal_block classes="code python3" xml:space="preserve">
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 7 \n\
|
||||||
|
+ <inline classes="keyword">
|
||||||
|
+ def
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="name function">
|
||||||
|
+ my_function
|
||||||
|
+ <inline classes="punctuation">
|
||||||
|
+ ():
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 8 \n\
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="literal string doc">
|
||||||
|
+ \'\'\'Test the lexer.
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 9 \n\
|
||||||
|
+ <inline classes="literal string doc">
|
||||||
|
+ \'\'\'
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 10 \n\
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 11 \n\
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="comment single">
|
||||||
|
+ # and now for something completely different
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 12 \n\
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="name builtin">
|
||||||
|
+ print
|
||||||
|
<inline classes="punctuation">
|
||||||
|
(
|
||||||
|
<inline classes="literal number integer">
|
||||||
|
--- a/test/test_parsers/test_rst/test_directives/test_include.py
|
||||||
|
+++ b/test/test_parsers/test_rst/test_directives/test_include.py
|
||||||
|
@@ -10,9 +10,10 @@ Tests for misc.py "include" directive.
|
||||||
|
import os.path
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import __init__ # noqa: F401
|
||||||
|
+from packaging.version import Version
|
||||||
|
from test_parsers import DocutilsTestSupport
|
||||||
|
from docutils import parsers
|
||||||
|
-from docutils.utils.code_analyzer import with_pygments
|
||||||
|
+from docutils.utils.code_analyzer import with_pygments, pygments_version
|
||||||
|
|
||||||
|
# optional 3rd-party markdown parser
|
||||||
|
md_parser_name = 'recommonmark'
|
||||||
|
@@ -27,6 +28,11 @@ def suite():
|
||||||
|
# eventually skip optional parts:
|
||||||
|
if not with_pygments:
|
||||||
|
del(totest['include-code'])
|
||||||
|
+ del(totest['include-code-2-14'])
|
||||||
|
+ elif pygments_version >= Version('2.14.0'):
|
||||||
|
+ del(totest['include-code'])
|
||||||
|
+ else:
|
||||||
|
+ del(totest['include-code-2-14'])
|
||||||
|
if not md_parser_class:
|
||||||
|
del(totest['include-markdown'])
|
||||||
|
s.generateTests(totest)
|
||||||
|
@@ -1191,6 +1197,313 @@ Including includes/include14.txt
|
||||||
|
<inline classes="punctuation">
|
||||||
|
..
|
||||||
|
\n\
|
||||||
|
+ <inline classes="operator word">
|
||||||
|
+ include
|
||||||
|
+ <inline classes="punctuation">
|
||||||
|
+ ::
|
||||||
|
+ ../sibling/include7.txt
|
||||||
|
+""" % reldir(include6)],
|
||||||
|
+["""\
|
||||||
|
+Circular inclusion
|
||||||
|
+
|
||||||
|
+.. include:: %s
|
||||||
|
+""" % include15,
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <paragraph>
|
||||||
|
+ Circular inclusion
|
||||||
|
+ <paragraph>
|
||||||
|
+ File "include15.txt": example of rekursive inclusion.
|
||||||
|
+ <paragraph>
|
||||||
|
+ File "include16.txt": example of rekursive inclusion.
|
||||||
|
+ <system_message level="2" line="3" source="%s" type="WARNING">
|
||||||
|
+ <paragraph>
|
||||||
|
+ circular inclusion in "include" directive:
|
||||||
|
+ %s
|
||||||
|
+ > %s
|
||||||
|
+ > %s
|
||||||
|
+ > test data
|
||||||
|
+ <literal_block xml:space="preserve">
|
||||||
|
+ .. include:: include15.txt
|
||||||
|
+ <paragraph>
|
||||||
|
+ No loop when clipping before the "include" directive:
|
||||||
|
+ <paragraph>
|
||||||
|
+ File "include15.txt": example of rekursive inclusion.
|
||||||
|
+""" % (reldir(include16), reldir(include15),
|
||||||
|
+ reldir(include16), reldir(include15))],
|
||||||
|
+["""\
|
||||||
|
+Circular inclusion with clipping.
|
||||||
|
+
|
||||||
|
+.. include:: %s
|
||||||
|
+ :start-line: 2
|
||||||
|
+""" % include16,
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <paragraph>
|
||||||
|
+ Circular inclusion with clipping.
|
||||||
|
+ <paragraph>
|
||||||
|
+ File "include15.txt": example of rekursive inclusion.
|
||||||
|
+ <paragraph>
|
||||||
|
+ File "include16.txt": example of rekursive inclusion.
|
||||||
|
+ <system_message level="2" line="3" source="%s" type="WARNING">
|
||||||
|
+ <paragraph>
|
||||||
|
+ circular inclusion in "include" directive:
|
||||||
|
+ %s
|
||||||
|
+ > %s
|
||||||
|
+ > %s
|
||||||
|
+ > %s
|
||||||
|
+ > test data
|
||||||
|
+ <literal_block xml:space="preserve">
|
||||||
|
+ .. include:: include15.txt
|
||||||
|
+ <paragraph>
|
||||||
|
+ No loop when clipping before the "include" directive:
|
||||||
|
+ <paragraph>
|
||||||
|
+ File "include15.txt": example of rekursive inclusion.
|
||||||
|
+ <paragraph>
|
||||||
|
+ No loop when clipping before the "include" directive:
|
||||||
|
+ <paragraph>
|
||||||
|
+ File "include15.txt": example of rekursive inclusion.
|
||||||
|
+""" % (reldir(include16), reldir(include15), reldir(include16),
|
||||||
|
+ reldir(include15), reldir(include16))],
|
||||||
|
+["""\
|
||||||
|
+Circular inclusion with specified parser.
|
||||||
|
+
|
||||||
|
+.. include:: %s
|
||||||
|
+ :parser: rst
|
||||||
|
+""" % include15,
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <paragraph>
|
||||||
|
+ Circular inclusion with specified parser.
|
||||||
|
+ <paragraph>
|
||||||
|
+ File "include15.txt": example of rekursive inclusion.
|
||||||
|
+ <paragraph>
|
||||||
|
+ File "include16.txt": example of rekursive inclusion.
|
||||||
|
+ <system_message level="2" line="3" source="%s" type="WARNING">
|
||||||
|
+ <paragraph>
|
||||||
|
+ circular inclusion in "include" directive:
|
||||||
|
+ %s
|
||||||
|
+ > %s
|
||||||
|
+ > %s
|
||||||
|
+ > test data
|
||||||
|
+ <literal_block xml:space="preserve">
|
||||||
|
+ .. include:: include15.txt
|
||||||
|
+ <paragraph>
|
||||||
|
+ No loop when clipping before the "include" directive:
|
||||||
|
+ <paragraph>
|
||||||
|
+ File "include15.txt": example of rekursive inclusion.
|
||||||
|
+""" % (reldir(include16), reldir(include15),
|
||||||
|
+ reldir(include16), reldir(include15))],
|
||||||
|
+["""\
|
||||||
|
+No circular inclusion.
|
||||||
|
+
|
||||||
|
+============================= =============================
|
||||||
|
+.. include:: data/include.txt .. include:: data/include.txt
|
||||||
|
+============================= =============================
|
||||||
|
+""",
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <paragraph>
|
||||||
|
+ No circular inclusion.
|
||||||
|
+ <table>
|
||||||
|
+ <tgroup cols="2">
|
||||||
|
+ <colspec colwidth="29">
|
||||||
|
+ <colspec colwidth="29">
|
||||||
|
+ <tbody>
|
||||||
|
+ <row>
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ Some include text.
|
||||||
|
+ <entry>
|
||||||
|
+ <paragraph>
|
||||||
|
+ Some include text."""],
|
||||||
|
+]
|
||||||
|
+
|
||||||
|
+totest['include-code-2-14'] = [
|
||||||
|
+["""\
|
||||||
|
+Included code
|
||||||
|
+
|
||||||
|
+.. include:: %s
|
||||||
|
+ :code: rst
|
||||||
|
+""" % include1,
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <paragraph>
|
||||||
|
+ Included code
|
||||||
|
+ <literal_block classes="code rst" source="%s" xml:space="preserve">
|
||||||
|
+ <inline classes="generic heading">
|
||||||
|
+ Inclusion 1
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="generic heading">
|
||||||
|
+ -----------
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ This file is used by \n\
|
||||||
|
+ <inline classes="literal string">
|
||||||
|
+ ``test_include.py``
|
||||||
|
+ .
|
||||||
|
+""" % reldir(include1)],
|
||||||
|
+["""\
|
||||||
|
+Included code
|
||||||
|
+
|
||||||
|
+.. include:: %s
|
||||||
|
+ :code: rst
|
||||||
|
+ :number-lines:
|
||||||
|
+""" % include1,
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <paragraph>
|
||||||
|
+ Included code
|
||||||
|
+ <literal_block classes="code rst" source="%s" xml:space="preserve">
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 1 \n\
|
||||||
|
+ <inline classes="generic heading">
|
||||||
|
+ Inclusion 1
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 2 \n\
|
||||||
|
+ <inline classes="generic heading">
|
||||||
|
+ -----------
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 3 \n\
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="ln">
|
||||||
|
+ 4 \n\
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ This file is used by \n\
|
||||||
|
+ <inline classes="literal string">
|
||||||
|
+ ``test_include.py``
|
||||||
|
+ .
|
||||||
|
+""" % reldir(include1)],
|
||||||
|
+["""\
|
||||||
|
+TAB expansion with included code:
|
||||||
|
+
|
||||||
|
+.. include:: %s
|
||||||
|
+ :code: rst
|
||||||
|
+""" % include_literal,
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <paragraph>
|
||||||
|
+ TAB expansion with included code:
|
||||||
|
+ <literal_block classes="code rst" source="%s" xml:space="preserve">
|
||||||
|
+ Literal included this should \n\
|
||||||
|
+ <inline classes="generic strong">
|
||||||
|
+ **not**
|
||||||
|
+ be \n\
|
||||||
|
+ <inline classes="generic emph">
|
||||||
|
+ *marked*
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="name variable">
|
||||||
|
+ `up`
|
||||||
|
+ .
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <- leading raw tab.
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ \n\
|
||||||
|
+ Newlines
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ are
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ normalized.
|
||||||
|
+""" % include_literal],
|
||||||
|
+["""\
|
||||||
|
+Custom TAB expansion with included code:
|
||||||
|
+
|
||||||
|
+.. include:: %s
|
||||||
|
+ :code: rst
|
||||||
|
+ :tab-width: 2
|
||||||
|
+""" % include_literal,
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <paragraph>
|
||||||
|
+ Custom TAB expansion with included code:
|
||||||
|
+ <literal_block classes="code rst" source="%s" xml:space="preserve">
|
||||||
|
+ Literal included this should \n\
|
||||||
|
+ <inline classes="generic strong">
|
||||||
|
+ **not**
|
||||||
|
+ be \n\
|
||||||
|
+ <inline classes="generic emph">
|
||||||
|
+ *marked*
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="name variable">
|
||||||
|
+ `up`
|
||||||
|
+ .
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ <- leading raw tab.
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ \n\
|
||||||
|
+ Newlines
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ are
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ normalized.
|
||||||
|
+""" % include_literal],
|
||||||
|
+["""\
|
||||||
|
+Custom TAB expansion with included code:
|
||||||
|
+
|
||||||
|
+.. include:: %s
|
||||||
|
+ :code: rst
|
||||||
|
+ :tab-width: -1
|
||||||
|
+""" % include_literal,
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <paragraph>
|
||||||
|
+ Custom TAB expansion with included code:
|
||||||
|
+ <literal_block classes="code rst" source="%s" xml:space="preserve">
|
||||||
|
+ Literal included this should \n\
|
||||||
|
+ <inline classes="generic strong">
|
||||||
|
+ **not**
|
||||||
|
+ be \n\
|
||||||
|
+ <inline classes="generic emph">
|
||||||
|
+ *marked*
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="name variable">
|
||||||
|
+ `up`
|
||||||
|
+ .
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ \t<- leading raw tab.
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ \n\
|
||||||
|
+ Newlines
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ are
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ normalized.
|
||||||
|
+""" % include_literal],
|
||||||
|
+["""\
|
||||||
|
+Including includes/include14.txt
|
||||||
|
+
|
||||||
|
+.. include:: %s
|
||||||
|
+""" % include14,
|
||||||
|
+"""\
|
||||||
|
+<document source="test data">
|
||||||
|
+ <paragraph>
|
||||||
|
+ Including includes/include14.txt
|
||||||
|
+ <paragraph>
|
||||||
|
+ Including more/include6.txt as rst-code from includes/include14.txt:
|
||||||
|
+ <literal_block classes="code rst" source="%s" xml:space="preserve">
|
||||||
|
+ In includes/more/include6.txt
|
||||||
|
+ <inline classes="whitespace">
|
||||||
|
+ \n\
|
||||||
|
+ \n\
|
||||||
|
+ <inline classes="punctuation">
|
||||||
|
+ ..
|
||||||
|
+ \n\
|
||||||
|
<inline classes="operator word">
|
||||||
|
include
|
||||||
|
<inline classes="punctuation">
|
||||||
|
--- a/docutils/utils/code_analyzer.py
|
||||||
|
+++ b/docutils/utils/code_analyzer.py
|
||||||
|
@@ -9,11 +9,14 @@
|
||||||
|
from docutils import ApplicationError
|
||||||
|
try:
|
||||||
|
import pygments
|
||||||
|
+ from packaging.version import Version
|
||||||
|
from pygments.lexers import get_lexer_by_name
|
||||||
|
from pygments.formatters.html import _get_ttype_class
|
||||||
|
with_pygments = True
|
||||||
|
+ pygments_version = Version(pygments.__version__)
|
||||||
|
except ImportError:
|
||||||
|
with_pygments = False
|
||||||
|
+ pygments_version = '0'
|
||||||
|
|
||||||
|
# Filter the following token types from the list of class arguments:
|
||||||
|
unstyled_tokens = ['token', # Token (base token type)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user