summaryrefslogtreecommitdiff
path: root/docutils/test/test_parsers
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-03-29 21:50:15 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-03-29 21:50:15 +0000
commitdaeefe05f59d6132901a2b6e6318cf574e11566c (patch)
tree32f84840a40810a66bf266429a1e42b57092621a /docutils/test/test_parsers
parent6ddacc9d64b3cb4d8a63fce877cd7463cc489bae (diff)
downloaddocutils-daeefe05f59d6132901a2b6e6318cf574e11566c.tar.gz
New wrapper module for "CommonMark" parsers.
The parser names 'commonmark' and 'markdown' now select the first locally installed parser from a list of compatible 3rd-party parser packages (pycmark, myst, and recommonmark). The parsers return slightly different doctrees. This should not matter for HTML output but leads to false negatives with the "include" directive test. Therefore the test case now specifies "recommonmark". The "pycmark" parser defines transformations to comlete nested parsing and clean up non-standard nodes. These transformations must also be run when including a document fragment. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9048 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test/test_parsers')
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_directives/test_include.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_include.py b/docutils/test/test_parsers/test_rst/test_directives/test_include.py
index 99e9a66a4..6fbde68be 100755
--- a/docutils/test/test_parsers/test_rst/test_directives/test_include.py
+++ b/docutils/test/test_parsers/test_rst/test_directives/test_include.py
@@ -14,9 +14,10 @@ from test_parsers import DocutilsTestSupport
from docutils import parsers
from docutils.utils.code_analyzer import with_pygments
-# check markdown parser availability:
-try:
- md_parser_class = parsers.get_parser_class('markdown')
+# optional 3rd-party markdown parser
+md_parser_name = 'recommonmark'
+try: # check availability
+ md_parser_class = parsers.get_parser_class(md_parser_name)
except ImportError:
md_parser_class = None
@@ -1312,17 +1313,16 @@ No circular inclusion.
Some include text."""],
]
-# Parsing with Markdown (recommonmark) is an optional feature depending
-# on 3rd-party modules:
+# Parsing with Markdown is an optional feature depending on 3rd-party modules:
totest['include-markdown'] = [
-["""\
+[f"""\
Include Markdown source.
-.. include:: %s
- :parser: markdown
+.. include:: {include_md}
+ :parser: {md_parser_name}
A paragraph.
-""" % include_md,
+""",
"""\
<document source="test data">
<paragraph>