From 943e3dc057eca53e68ddec51529bd6a1279ebd8e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 29 Apr 2024 06:23:02 +0200 Subject: Adding upstream version 0.18.1. Signed-off-by: Daniel Baumann --- tests/test_renderers/fixtures/amsmath.md | 52 ++ tests/test_renderers/fixtures/containers.md | 31 + tests/test_renderers/fixtures/definition_lists.md | 56 ++ tests/test_renderers/fixtures/directive_options.md | 159 ++++ .../test_renderers/fixtures/directive_parsing.txt | 141 ++++ .../test_renderers/fixtures/docutil_directives.md | 436 +++++++++++ tests/test_renderers/fixtures/docutil_roles.md | 131 ++++ .../fixtures/docutil_syntax_elements.md | 794 ++++++++++++++++++++ .../fixtures/docutil_syntax_extensions.txt | 139 ++++ tests/test_renderers/fixtures/dollarmath.md | 75 ++ tests/test_renderers/fixtures/eval_rst.md | 23 + tests/test_renderers/fixtures/mock_include.md | 62 ++ .../test_renderers/fixtures/mock_include_errors.md | 24 + tests/test_renderers/fixtures/myst-config.txt | 176 +++++ tests/test_renderers/fixtures/reporter_warnings.md | 180 +++++ tests/test_renderers/fixtures/sphinx_directives.md | 441 ++++++++++++ tests/test_renderers/fixtures/sphinx_roles.md | 632 ++++++++++++++++ .../fixtures/sphinx_syntax_elements.md | 800 +++++++++++++++++++++ tests/test_renderers/fixtures/tables.md | 148 ++++ 19 files changed, 4500 insertions(+) create mode 100644 tests/test_renderers/fixtures/amsmath.md create mode 100644 tests/test_renderers/fixtures/containers.md create mode 100644 tests/test_renderers/fixtures/definition_lists.md create mode 100644 tests/test_renderers/fixtures/directive_options.md create mode 100644 tests/test_renderers/fixtures/directive_parsing.txt create mode 100644 tests/test_renderers/fixtures/docutil_directives.md create mode 100644 tests/test_renderers/fixtures/docutil_roles.md create mode 100644 tests/test_renderers/fixtures/docutil_syntax_elements.md create mode 100644 tests/test_renderers/fixtures/docutil_syntax_extensions.txt create mode 100644 tests/test_renderers/fixtures/dollarmath.md create mode 100644 tests/test_renderers/fixtures/eval_rst.md create mode 100644 tests/test_renderers/fixtures/mock_include.md create mode 100644 tests/test_renderers/fixtures/mock_include_errors.md create mode 100644 tests/test_renderers/fixtures/myst-config.txt create mode 100644 tests/test_renderers/fixtures/reporter_warnings.md create mode 100644 tests/test_renderers/fixtures/sphinx_directives.md create mode 100644 tests/test_renderers/fixtures/sphinx_roles.md create mode 100644 tests/test_renderers/fixtures/sphinx_syntax_elements.md create mode 100644 tests/test_renderers/fixtures/tables.md (limited to 'tests/test_renderers/fixtures') diff --git a/tests/test_renderers/fixtures/amsmath.md b/tests/test_renderers/fixtures/amsmath.md new file mode 100644 index 0000000..fe3713e --- /dev/null +++ b/tests/test_renderers/fixtures/amsmath.md @@ -0,0 +1,52 @@ +Single Line: +. +\begin{equation} a \end{equation} +. + + + + \begin{equation} a \end{equation} +. + +Multi Line: +. +\begin{equation} +a +\end{equation} +. + + + + \begin{equation} + a + \end{equation} +. + +Multi Line no number: +. +\begin{equation*} +a +\end{equation*} +. + + + \begin{equation*} + a + \end{equation*} +. + +In list: +. +- \begin{equation} + a = 1 + \end{equation} +. + + + + + + \begin{equation} + a = 1 + \end{equation} +. diff --git a/tests/test_renderers/fixtures/containers.md b/tests/test_renderers/fixtures/containers.md new file mode 100644 index 0000000..f67bea8 --- /dev/null +++ b/tests/test_renderers/fixtures/containers.md @@ -0,0 +1,31 @@ +Basic note: +. +::: {note} +*hallo* +::: +. + + + + + hallo +. + +Admonition with options: +. +::: {admonition} A **title** +:class: other + +*hallo* +::: +. + + + + A + <strong> + title + <paragraph> + <emphasis> + hallo +. diff --git a/tests/test_renderers/fixtures/definition_lists.md b/tests/test_renderers/fixtures/definition_lists.md new file mode 100644 index 0000000..c064fa2 --- /dev/null +++ b/tests/test_renderers/fixtures/definition_lists.md @@ -0,0 +1,56 @@ +Simple: +. +Term **1** + +: Definition *1* + + second paragraph + +Term 2 + ~ Definition 2a + ~ Definition 2b + +Term 3 + : code block + + : > quote + + : other +. +<document source="<src>/index.md"> + <definition_list classes="simple myst"> + <definition_list_item> + <term> + Term + <strong> + 1 + <definition> + <paragraph> + Definition + <emphasis> + 1 + <paragraph> + second paragraph + <definition_list_item> + <term> + Term 2 + <definition> + <paragraph> + Definition 2a + <definition> + <paragraph> + Definition 2b + <definition_list_item> + <term> + Term 3 + <definition> + <literal_block language="none" xml:space="preserve"> + code block + <definition> + <block_quote> + <paragraph> + quote + <definition> + <paragraph> + other +. diff --git a/tests/test_renderers/fixtures/directive_options.md b/tests/test_renderers/fixtures/directive_options.md new file mode 100644 index 0000000..b9ae64a --- /dev/null +++ b/tests/test_renderers/fixtures/directive_options.md @@ -0,0 +1,159 @@ +Test Directive 1: +. +```{restructuredtext-test-directive} +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=[], options={}, content: None +. + +Test Directive 2: +. +```{restructuredtext-test-directive} +foo +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=[], options={}, content: + <literal_block xml:space="preserve"> + foo +. + +Test Directive 3: +. +```{restructuredtext-test-directive} foo +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=['foo'], options={}, content: None +. + +Test Directive 4: +. +```{restructuredtext-test-directive} foo +bar +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=['foo'], options={}, content: + <literal_block xml:space="preserve"> + bar +. + +Test Directive 5: +. +```{restructuredtext-test-directive} foo bar +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=['foo bar'], options={}, content: None +. + +Test Directive 6: +. +```{restructuredtext-test-directive} foo bar +baz +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=['foo bar'], options={}, content: + <literal_block xml:space="preserve"> + baz +. + +Test Directive 7: +. +```{restructuredtext-test-directive} + +foo +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=[], options={}, content: + <literal_block xml:space="preserve"> + foo +. + +Test Directive Options 1: +. +```{restructuredtext-test-directive} +--- +option1: a +option2: b +--- +foo +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=[], options={'option1': 'a', 'option2': 'b'}, content: + <literal_block xml:space="preserve"> + foo +. + +Test Directive Options 2: +. +```{restructuredtext-test-directive} +:option1: a +:option2: b +foo +``` +. +<document source="<src>/index.md"> + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=[], options={'option1': 'a', 'option2': 'b'}, content: + <literal_block xml:space="preserve"> + foo +. + +Test Directive Options Error: +. +```{restructuredtext-test-directive} +:option1 +:option2: b +foo +``` +. +<document source="<src>/index.md"> + <system_message level="3" line="1" source="<src>/index.md" type="ERROR"> + <paragraph> + Directive 'restructuredtext-test-directive': Invalid options YAML: mapping values are not allowed here + in "<unicode string>", line 2, column 8: + option2: b + ^ + <literal_block xml:space="preserve"> + :option1 + :option2: b + foo +. + +Unknown Directive: +. +```{unknown} +``` +. +<document source="<src>/index.md"> + <system_message level="3" line="1" source="<src>/index.md" type="ERROR"> + <paragraph> + Unknown directive type "unknown". + <system_message level="1" line="1" source="<src>/index.md" type="INFO"> + <paragraph> + No directive entry for "unknown" in module "docutils.parsers.rst.languages.en". + Trying "unknown" as canonical directive name. +. diff --git a/tests/test_renderers/fixtures/directive_parsing.txt b/tests/test_renderers/fixtures/directive_parsing.txt new file mode 100644 index 0000000..35878bc --- /dev/null +++ b/tests/test_renderers/fixtures/directive_parsing.txt @@ -0,0 +1,141 @@ +note: content in first line only +. +```{note} a +``` +. +arguments: [] +body: +- a +content_offset: 0 +options: {} +. + +note: content in body only +. +```{note} +a +``` +. +arguments: [] +body: +- a +content_offset: 0 +options: {} +. + +note: content after option +. +```{note} +:class: name +a +``` +. +arguments: [] +body: +- a +content_offset: 1 +options: + class: + - name +. + +note: content after option with new line +. +```{note} +:class: name + +a +``` +. +arguments: [] +body: +- a +content_offset: 2 +options: + class: + - name +. + +note: content after yaml option +. +```{note} +--- +class: name +--- +a +``` +. +arguments: [] +body: +- a +content_offset: 3 +options: + class: + - name +. + +note: content in first line and body +. +```{note} first line +:class: tip + +body line +``` +. +arguments: [] +body: +- first line +- '' +- body line +content_offset: 1 +options: + class: + - tip +. + +admonition: no options, no new line +. +```{admonition} first line +body line +``` +. +arguments: +- first line +body: +- body line +content_offset: 0 +options: {} +. + +admonition: no options, new line +. +```{admonition} first line + +body line +``` +. +arguments: +- first line +body: +- body line +content_offset: 1 +options: {} +. + +admonition: with options +. +```{admonition} first line +:class: tip + +body line +``` +. +arguments: +- first line +body: +- body line +content_offset: 2 +options: + class: + - tip +. diff --git a/tests/test_renderers/fixtures/docutil_directives.md b/tests/test_renderers/fixtures/docutil_directives.md new file mode 100644 index 0000000..e15bf2e --- /dev/null +++ b/tests/test_renderers/fixtures/docutil_directives.md @@ -0,0 +1,436 @@ +-------------------------------- +[attention] (`docutils.parsers.rst.directives.admonitions.Attention`): +. +```{attention} + +a +``` +. +<document source="notset"> + <attention> + <paragraph> + a +. + +-------------------------------- +[caution] (`docutils.parsers.rst.directives.admonitions.Caution`): +. +```{caution} + +a +``` +. +<document source="notset"> + <caution> + <paragraph> + a +. + +-------------------------------- +[danger] (`docutils.parsers.rst.directives.admonitions.Danger`): +. +```{danger} + +a +``` +. +<document source="notset"> + <danger> + <paragraph> + a +. + +-------------------------------- +[error] (`docutils.parsers.rst.directives.admonitions.Error`): +. +```{error} + +a +``` +. +<document source="notset"> + <error> + <paragraph> + a +. + +-------------------------------- +[important] (`docutils.parsers.rst.directives.admonitions.Important`): +. +```{important} + +a +``` +. +<document source="notset"> + <important> + <paragraph> + a +. + +-------------------------------- +[note] (`docutils.parsers.rst.directives.admonitions.Note`): +. +```{note} + +a +``` +. +<document source="notset"> + <note> + <paragraph> + a +. + +-------------------------------- +[tip] (`docutils.parsers.rst.directives.admonitions.Tip`): +. +```{tip} + +a +``` +. +<document source="notset"> + <tip> + <paragraph> + a +. + +-------------------------------- +[hint] (`docutils.parsers.rst.directives.admonitions.Hint`): +. +```{hint} + +a +``` +. +<document source="notset"> + <hint> + <paragraph> + a +. + +-------------------------------- +[warning] (`docutils.parsers.rst.directives.admonitions.Warning`): +. +```{warning} + +a +``` +. +<document source="notset"> + <warning> + <paragraph> + a +. + +-------------------------------- +[admonition] (`docutils.parsers.rst.directives.admonitions.Admonition`): +. +```{admonition} myclass + +a +``` +. +<document source="notset"> + <admonition classes="admonition-myclass"> + <title> + myclass + <paragraph> + a +. + +-------------------------------- +[sidebar] (`docutils.parsers.rst.directives.body.Sidebar`): +. +```{sidebar} sidebar title + +a +``` +. +<document source="notset"> + <sidebar> + <title> + sidebar title + <paragraph> + a +. + +-------------------------------- +[topic] (`docutils.parsers.rst.directives.body.Topic`): +. +```{topic} Topic Title + +a +``` +. +<document source="notset"> + <topic> + <title> + Topic Title + <paragraph> + a +. + +-------------------------------- +[line-block] (`docutils.parsers.rst.directives.body.LineBlock`) SKIP: MockingError: MockState has not yet implemented attribute 'nest_line_block_lines' +. +```{line-block} + + +``` +. +<document source="notset"> +. + +-------------------------------- +[parsed-literal] (`docutils.parsers.rst.directives.body.ParsedLiteral`): +. +```{parsed-literal} + +a +``` +. +<document source="notset"> + <literal_block xml:space="preserve"> + a +. + +-------------------------------- +[rubric] (`docutils.parsers.rst.directives.body.Rubric`): +. +```{rubric} Rubric Title +``` +. +<document source="notset"> + <rubric> + Rubric Title +. + +-------------------------------- +[epigraph] (`docutils.parsers.rst.directives.body.Epigraph`): +. +```{epigraph} + +a + +-- attribution +``` +. +<document source="notset"> + <block_quote classes="epigraph"> + <paragraph> + a + <attribution> + attribution +. + +-------------------------------- +[highlights] (`docutils.parsers.rst.directives.body.Highlights`): +. +```{highlights} + +a + +-- attribution +``` +. +<document source="notset"> + <block_quote classes="highlights"> + <paragraph> + a + <attribution> + attribution +. + +-------------------------------- +[pull-quote] (`docutils.parsers.rst.directives.body.PullQuote`): +. +```{pull-quote} + +a + +-- attribution +``` +. +<document source="notset"> + <block_quote classes="pull-quote"> + <paragraph> + a + <attribution> + attribution +. + +-------------------------------- +[compound] (`docutils.parsers.rst.directives.body.Compound`): +. +```{compound} + +a +``` +. +<document source="notset"> + <compound> + <paragraph> + a +. + +-------------------------------- +[container] (`docutils.parsers.rst.directives.body.Container`): +. +```{container} + +a +``` +. +<document source="notset"> + <container> + <paragraph> + a +. + +-------------------------------- +[image] (`docutils.parsers.rst.directives.images.Image`): +. +```{image} path/to/image +:alt: abc +:name: name +``` +. +<document source="notset"> + <image alt="abc" ids="name" names="name" uri="path/to/image"> +. + +-------------------------------- +[raw] (`docutils.parsers.rst.directives.misc.Raw`): +. +```{raw} raw + +a +``` +. +<document source="notset"> + <raw format="raw" xml:space="preserve"> + a +. + +-------------------------------- +[class] (`docutils.parsers.rst.directives.misc.Class`): +. +```{class} myclass + +a +``` +. +<document source="notset"> + <paragraph classes="myclass"> + a +. + +-------------------------------- +[role] (`docutils.parsers.rst.directives.misc.Role`) + raw (`docutils.parsers.rst.roles.raw_role`): +. +```{role} raw-latex(raw) +:format: latex +``` + +{raw-latex}`\tag{content}` +. +<document source="notset"> + <paragraph> + <raw classes="raw-latex" format="latex" xml:space="preserve"> + \tag{content} +. + +-------------------------------- +[title] (`docutils.parsers.rst.directives.misc.Title`): +. +```{title} title +``` +. +<document source="notset" title="title"> +. + +-------------------------------- +[restructuredtext-test-directive] (`docutils.parsers.rst.directives.misc.TestDirective`): +. +```{restructuredtext-test-directive} +``` +. +<document source="notset"> + <system_message level="1" line="1" source="notset" type="INFO"> + <paragraph> + Directive processed. Type="restructuredtext-test-directive", arguments=[], options={}, content: None +. + +-------------------------------- +[contents] (`docutils.parsers.rst.directives.parts.Contents`): +. +```{contents} Contents +``` +. +<document source="notset"> + <topic classes="contents" ids="contents" names="contents"> + <title> + Contents + <pending> + .. internal attributes: + .transform: docutils.transforms.parts.Contents + .details: +. + +-------------------------------- +[sectnum] (`docutils.parsers.rst.directives.parts.Sectnum`): +. +```{sectnum} +``` +. +<document source="notset"> + <pending> + .. internal attributes: + .transform: docutils.transforms.parts.SectNum + .details: +. + +-------------------------------- +[header] (`docutils.parsers.rst.directives.parts.Header`): +. +```{header} + +a +``` +. +<document source="notset"> + <decoration> + <header> + <paragraph> + a +. + +-------------------------------- +[footer] (`docutils.parsers.rst.directives.parts.Footer`): +. +```{footer} + +a +``` +. +<document source="notset"> + <decoration> + <footer> + <paragraph> + a +. + +-------------------------------- +[target-notes] (`docutils.parsers.rst.directives.references.TargetNotes`): +. +```{target-notes} +``` +. +<document source="notset"> + <pending> + .. internal attributes: + .transform: docutils.transforms.references.TargetNotes + .details: +. diff --git a/tests/test_renderers/fixtures/docutil_roles.md b/tests/test_renderers/fixtures/docutil_roles.md new file mode 100644 index 0000000..51fa48d --- /dev/null +++ b/tests/test_renderers/fixtures/docutil_roles.md @@ -0,0 +1,131 @@ +-------------------------------- +[abbreviation] (`docutils.parsers.rst.roles.GenericRole`): +. +{abbreviation}`a` +. +<document source="notset"> + <paragraph> + <abbreviation> + a +. + +-------------------------------- +[acronym] (`docutils.parsers.rst.roles.GenericRole`): +. +{acronym}`a` +. +<document source="notset"> + <paragraph> + <acronym> + a +. + +-------------------------------- +[emphasis] (`docutils.parsers.rst.roles.GenericRole`): +. +{emphasis}`a` +. +<document source="notset"> + <paragraph> + <emphasis> + a +. + +-------------------------------- +[literal] (`docutils.parsers.rst.roles.GenericRole`): +. +{literal}`a` +. +<document source="notset"> + <paragraph> + <literal> + a +. + +-------------------------------- +[strong] (`docutils.parsers.rst.roles.GenericRole`): +. +{strong}`a` +. +<document source="notset"> + <paragraph> + <strong> + a +. + +-------------------------------- +[subscript] (`docutils.parsers.rst.roles.GenericRole`): +. +{subscript}`a` +. +<document source="notset"> + <paragraph> + <subscript> + a +. + +-------------------------------- +[superscript] (`docutils.parsers.rst.roles.GenericRole`): +. +{superscript}`a` +. +<document source="notset"> + <paragraph> + <superscript> + a +. + +-------------------------------- +[title-reference] (`docutils.parsers.rst.roles.GenericRole`): +. +{title-reference}`t` +. +<document source="notset"> + <paragraph> + <title_reference> + t +. + +-------------------------------- +[pep-reference] (`docutils.parsers.rst.roles.pep_reference_role`): +. +{pep-reference}`0` +. +<document source="notset"> + <paragraph> + <reference refuri="https://peps.python.org/pep-0000"> + PEP 0 +. + +-------------------------------- +[rfc-reference] (`docutils.parsers.rst.roles.rfc_reference_role`): +. +{rfc-reference}`1` +. +<document source="notset"> + <paragraph> + <reference refuri="https://tools.ietf.org/html/rfc1.html"> + RFC 1 +. + +-------------------------------- +[code] (`docutils.parsers.rst.roles.code_role`): +. +{code}`a` +. +<document source="notset"> + <paragraph> + <literal classes="code"> + a +. + +-------------------------------- +[math] (`docutils.parsers.rst.roles.math_role`): +. +{math}`a` +. +<document source="notset"> + <paragraph> + <math> + a +. diff --git a/tests/test_renderers/fixtures/docutil_syntax_elements.md b/tests/test_renderers/fixtures/docutil_syntax_elements.md new file mode 100644 index 0000000..9b59f3a --- /dev/null +++ b/tests/test_renderers/fixtures/docutil_syntax_elements.md @@ -0,0 +1,794 @@ +Raw +. +foo +. +<document source="notset"> + <paragraph> + foo +. + +Hard-break +. +foo\ +bar +. +<document source="notset"> + <paragraph> + foo + <raw format="html" xml:space="preserve"> + <br /> + <raw format="latex" xml:space="preserve"> + \\ + bar +. + +Strong: +. +**foo** +. +<document source="notset"> + <paragraph> + <strong> + foo +. + +Emphasis +. +*foo* +. +<document source="notset"> + <paragraph> + <emphasis> + foo +. + +Escaped Emphasis: +. +\*foo* +. +<document source="notset"> + <paragraph> + *foo* +. + +Mixed Inline +. +a *b* **c** `abc` \\* +. +<document source="notset"> + <paragraph> + a + <emphasis> + b + + <strong> + c + + <literal> + abc + \* +. + +Inline Code: +. +`foo` +. +<document source="notset"> + <paragraph> + <literal> + foo +. + +Heading: +. +# foo +. +<document source="notset"> + <section ids="foo" names="foo"> + <title> + foo +. + +Heading Levels: +. +# a +## b +### c +# d +. +<document source="notset"> + <section ids="a" names="a"> + <title> + a + <section ids="b" names="b"> + <title> + b + <section ids="c" names="c"> + <title> + c + <section ids="d" names="d"> + <title> + d +. + +Block Code: +. + foo +. +<document source="notset"> + <literal_block classes="code" xml:space="preserve"> + foo +. + +Fenced Code: +. +```sh +foo +``` +. +<document source="notset"> + <literal_block classes="code sh" xml:space="preserve"> + foo +. + +Fenced Code no language: +. +``` +foo +``` +. +<document source="notset"> + <literal_block classes="code" xml:space="preserve"> + foo +. + +Fenced Code no language with trailing whitespace: +. +``` +foo +``` +. +<document source="notset"> + <literal_block classes="code" xml:space="preserve"> + foo +. + +Image empty: +. +![]() +. +<document source="notset"> + <paragraph> + <image alt="" uri=""> +. + +Image with alt and title: +. +![alt](src "title") +. +<document source="notset"> + <paragraph> + <image alt="alt" title="title" uri="src"> +. + +Image with escapable html: +. +![alt](http://www.google<>.com) +. +<document source="notset"> + <paragraph> + <image alt="alt" uri="http://www.google%3C%3E.com"> +. + +Block Quote: +. +> *foo* +. +<document source="notset"> + <block_quote> + <paragraph> + <emphasis> + foo +. + +Bullet List: +. +- *foo* +* bar +. +<document source="notset"> + <bullet_list bullet="-"> + <list_item> + <paragraph> + <emphasis> + foo + <bullet_list bullet="*"> + <list_item> + <paragraph> + bar +. + +Nested Bullets +. +- a + - b + - c + - d +. +<document source="notset"> + <bullet_list bullet="-"> + <list_item> + <paragraph> + a + <bullet_list bullet="-"> + <list_item> + <paragraph> + b + <bullet_list bullet="-"> + <list_item> + <paragraph> + c + <list_item> + <paragraph> + d +. + +Enumerated List: +. +1. *foo* + +1) bar + +para + +10. starting +11. enumerator +. +<document source="notset"> + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + <emphasis> + foo + <enumerated_list enumtype="arabic" prefix="" suffix=")"> + <list_item> + <paragraph> + bar + <paragraph> + para + <enumerated_list enumtype="arabic" prefix="" start="10" suffix="."> + <list_item> + <paragraph> + starting + <list_item> + <paragraph> + enumerator +. + +Nested Enumrated List: +. +1. a +2. b + 1. c +. +<document source="notset"> + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + a + <list_item> + <paragraph> + b + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + c +. + +Sphinx Role containing backtick: +. +{code}``a=1{`}`` +. +<document source="notset"> + <paragraph> + <literal classes="code"> + a=1{`} +. + +Target: +. +(target)= +. +<document source="notset"> + <target ids="target" names="target"> +. + +Target with whitespace: +. +(target with space)= +. +<document source="notset"> + <target ids="target-with-space" names="target\ with\ space"> +. + +Referencing: +. +(target)= + +Title +===== + +[alt1](target) + +[](target2) + +[alt2](https://www.google.com) + +[alt3](#target3) +. +<document source="notset"> + <target ids="target" names="target"> + <section ids="title" names="title"> + <title> + Title + <paragraph> + <reference refname="target"> + alt1 + <paragraph> + <reference refname="target2"> + <paragraph> + <reference refuri="https://www.google.com"> + alt2 + <paragraph> + <reference refname="#target3"> + alt3 +. + +Comments: +. +line 1 +% a comment +line 2 +. +<document source="notset"> + <paragraph> + line 1 + <comment xml:space="preserve"> + a comment + <paragraph> + line 2 +. + +Block Break: +. ++++ string +. +<document source="notset"> + <comment classes="block_break" xml:space="preserve"> + string +. + +Link Reference: +. +[name][key] + +[key]: https://www.google.com "a title" +. +<document source="notset"> + <paragraph> + <reference refuri="https://www.google.com" title="a title"> + name +. + +Link Reference short version: +. +[name] + +[name]: https://www.google.com "a title" +. +<document source="notset"> + <paragraph> + <reference refuri="https://www.google.com" title="a title"> + name +. + +Block Quotes: +. +```{epigraph} +a b*c* + +-- a**b** +``` +. +<document source="notset"> + <block_quote classes="epigraph"> + <paragraph> + a b + <emphasis> + c + <attribution> + a + <strong> + b +. + +Link Definition in directive: +. +```{note} +[a] +``` + +[a]: link +. +<document source="notset"> + <note> + <paragraph> + <reference refname="link"> + a +. + +Link Definition in nested directives: +. +```{note} +[ref1]: link +``` + +```{note} +[ref1] +[ref2] +``` + +```{note} +[ref2]: link +``` +. +<document source="notset"> + <note> + <note> + <paragraph> + <reference refname="link"> + ref1 + + [ref2] + <note> +. + +Footnotes: +. +[^a] + +[^a]: footnote*text* +. +<document source="notset"> + <paragraph> + <footnote_reference auto="1" ids="id1" refname="a"> + <transition classes="footnotes"> + <footnote auto="1" ids="a" names="a"> + <paragraph> + footnote + <emphasis> + text +. + +Footnotes nested blocks: +. +[^a] + +[^a]: footnote*text* + + abc +xyz + + > a + + - b + + c + +finish +. +<document source="notset"> + <paragraph> + <footnote_reference auto="1" ids="id1" refname="a"> + <paragraph> + finish + <transition classes="footnotes"> + <footnote auto="1" ids="a" names="a"> + <paragraph> + footnote + <emphasis> + text + <paragraph> + abc + + xyz + <block_quote> + <paragraph> + a + <bullet_list bullet="-"> + <list_item> + <paragraph> + b + <paragraph> + c +. + +Front Matter: +. +--- +a: 1 +b: foo +c: + d: 2 +--- +. +<document source="notset"> + <field_list> + <field> + <field_name> + a + <field_body> + <paragraph> + <literal> + 1 + <field> + <field_name> + b + <field_body> + <paragraph> + <literal> + foo + <field> + <field_name> + c + <field_body> + <paragraph> + <literal> + {"d": 2} +. + +Front Matter Biblio: +. +--- +author: Chris Sewell +authors: Chris Sewell, Chris Hodgraf +organization: EPFL +address: | + 1 Cedar Park Close + Thundersley + Essex +contact: <https://example.com> +version: 1.0 +revision: 1.1 +status: good +date: 2/12/1985 +copyright: MIT +dedication: | + To my *homies* +abstract: + Something something **dark** side +other: Something else +--- +. +<document source="notset"> + <field_list> + <field> + <field_name> + author + <field_body> + <paragraph> + Chris Sewell + <field> + <field_name> + authors + <field_body> + <paragraph> + Chris Sewell, Chris Hodgraf + <field> + <field_name> + organization + <field_body> + <paragraph> + EPFL + <field> + <field_name> + address + <field_body> + <paragraph> + 1 Cedar Park Close + + Thundersley + + Essex + + <field> + <field_name> + contact + <field_body> + <paragraph> + <reference refuri="https://example.com"> + https://example.com + <field> + <field_name> + version + <field_body> + <paragraph> + 1.0 + <field> + <field_name> + revision + <field_body> + <paragraph> + 1.1 + <field> + <field_name> + status + <field_body> + <paragraph> + good + <field> + <field_name> + date + <field_body> + <paragraph> + 2/12/1985 + <field> + <field_name> + copyright + <field_body> + <paragraph> + MIT + <field> + <field_name> + dedication + <field_body> + <paragraph> + To my + <emphasis> + homies + + <field> + <field_name> + abstract + <field_body> + <paragraph> + Something something + <strong> + dark + side + <field> + <field_name> + other + <field_body> + <paragraph> + <literal> + Something else +. + +Front Matter Bad Yaml: +. +--- +a: { +--- +. +<document source="notset"> + <system_message level="2" line="1" source="notset" type="WARNING"> + <paragraph> + Malformed YAML [myst.topmatter] +. + +Front Matter HTML Meta +. +--- +myst: + html_meta: + keywords: Sphinx, documentation, builder + description lang=en: An amusing story + description lang=fr: Un histoire amusant + http-equiv=Content-Type: text/html; charset=ISO-8859-1 +--- +. +<document source="notset"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="Sphinx, documentation, builder" name="keywords"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="An amusing story" lang="en" name="description"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="Un histoire amusant" lang="fr" name="description"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> +. + +Full Test: +. +--- +a: 1 +--- + +(target)= +# header 1 +## sub header 1 + +a *b* **c** `abc` + +## sub header 2 + +x y [a](http://www.xyz.com) z + +--- + +# header 2 + +```::python {a=1} +a = 1 +``` + +[](target) +. +<document source="notset"> + <field_list> + <field> + <field_name> + a + <field_body> + <paragraph> + <literal> + 1 + <target ids="target" names="target"> + <section ids="header-1" names="header\ 1"> + <title> + header 1 + <section ids="sub-header-1" names="sub\ header\ 1"> + <title> + sub header 1 + <paragraph> + a + <emphasis> + b + + <strong> + c + + <literal> + abc + <section ids="sub-header-2" names="sub\ header\ 2"> + <title> + sub header 2 + <paragraph> + x y + <reference refuri="http://www.xyz.com"> + a + z + <transition> + <section ids="header-2" names="header\ 2"> + <title> + header 2 + <literal_block classes="code ::python" xml:space="preserve"> + a = 1 + <paragraph> + <reference refname="target"> +. diff --git a/tests/test_renderers/fixtures/docutil_syntax_extensions.txt b/tests/test_renderers/fixtures/docutil_syntax_extensions.txt new file mode 100644 index 0000000..5efcb68 --- /dev/null +++ b/tests/test_renderers/fixtures/docutil_syntax_extensions.txt @@ -0,0 +1,139 @@ +[dollarmath] --myst-enable-extensions=dollarmath +. +$foo$ + +a $foo +bar$ b + +$$foo$$ + +$$ +a = 1 +$$ +. +<document source="<string>"> + <paragraph> + <math> + foo + <paragraph> + a + <math> + foo + bar + b + <math_block nowrap="False" number="True" xml:space="preserve"> + foo + <math_block nowrap="False" number="True" xml:space="preserve"> + + a = 1 +. + +[amsmath] --myst-enable-extensions=amsmath +. +\begin{equation} a \end{equation} + +\begin{equation} +a +\end{equation} + +\begin{equation*} +a +\end{equation*} +. +<document source="<string>"> + <math_block classes="amsmath" nowrap="True" numbered="True" xml:space="preserve"> + \begin{equation} a \end{equation} + <math_block classes="amsmath" nowrap="True" numbered="True" xml:space="preserve"> + \begin{equation} + a + \end{equation} + <math_block classes="amsmath" nowrap="True" xml:space="preserve"> + \begin{equation*} + a + \end{equation*} +. + +[deflist] --myst-enable-extensions=deflist +. +term +: definition +. +<document source="<string>"> + <definition_list classes="simple myst"> + <definition_list_item> + <term> + term + <definition> + <paragraph> + definition +. + +[fieldlist] --myst-enable-extensions=fieldlist +. +:name: value +. +<document source="<string>"> + <docinfo> + <field classes="name"> + <field_name> + name + <field_body> + <paragraph> + value +. + +[colon_fence] --myst-enable-extensions=colon_fence +. +:::{note} +content +::: +. +<document source="<string>"> + <note> + <paragraph> + content +. + +[replacements] --myst-enable-extensions=replacements +. +(c) (C) (r) (R) (tm) (TM) (p) (P) +- ... +. +<document source="<string>"> + <paragraph> + © © ® ® ™ ™ § § ± … +. + +[strikethrough] --myst-enable-extensions=strikethrough +. +~~foo~~ +. +<document source="<string>"> + <paragraph> + <system_message level="2" line="1" source="<string>" type="WARNING"> + <paragraph> + Strikethrough is currently only supported in HTML output [myst.strikethrough] + <raw format="html" xml:space="preserve"> + <s> + foo + <raw format="html" xml:space="preserve"> + </s> +. + +[tasklist] --myst-enable-extensions=tasklist +. +- [ ] foo +- [x] bar +. +<document source="<string>"> + <bullet_list bullet="-" classes="contains-task-list"> + <list_item classes="task-list-item"> + <paragraph> + <raw format="html" xml:space="preserve"> + <input class="task-list-item-checkbox" disabled="disabled" type="checkbox"> + foo + <list_item classes="task-list-item"> + <paragraph> + <raw format="html" xml:space="preserve"> + <input class="task-list-item-checkbox" checked="checked" disabled="disabled" type="checkbox"> + bar +. diff --git a/tests/test_renderers/fixtures/dollarmath.md b/tests/test_renderers/fixtures/dollarmath.md new file mode 100644 index 0000000..e3e5fd2 --- /dev/null +++ b/tests/test_renderers/fixtures/dollarmath.md @@ -0,0 +1,75 @@ +Inline Math: +. +$foo$ +. +<document source="<src>/index.md"> + <paragraph> + <math> + foo +. + +Inline Math, multi-line: +. +a $foo +bar$ b +. +<document source="<src>/index.md"> + <paragraph> + a + <math> + foo + bar + b +. + +Inline Math, multi-line with line break (invalid): +. +a $foo + +bar$ b +. +<document source="<src>/index.md"> + <paragraph> + a $foo + <paragraph> + bar$ b +. + +Math Block: +. +$$foo$$ +. +<document source="<src>/index.md"> + <math_block nowrap="False" number="True" xml:space="preserve"> + foo +. + +Math Block With Equation Label: +. +$$foo$$ (abc) +. +<document source="<src>/index.md"> + <target ids="equation-abc"> + <math_block docname="index" label="abc" nowrap="False" number="1" xml:space="preserve"> + foo +. + +Math Block multiple: +. +$$ +a = 1 +$$ + +$$ +b = 2 +$$ (a) +. +<document source="<src>/index.md"> + <math_block nowrap="False" number="True" xml:space="preserve"> + + a = 1 + <target ids="equation-a"> + <math_block docname="index" label="a" nowrap="False" number="1" xml:space="preserve"> + + b = 2 +. diff --git a/tests/test_renderers/fixtures/eval_rst.md b/tests/test_renderers/fixtures/eval_rst.md new file mode 100644 index 0000000..9f21bd1 --- /dev/null +++ b/tests/test_renderers/fixtures/eval_rst.md @@ -0,0 +1,23 @@ +eval-rst link +. +```{eval-rst} +`MyST Parser <https://myst-parser.readthedocs.io/>`_ +``` +. +<document source="<src>/index.md"> + <paragraph> + <reference name="MyST Parser" refuri="https://myst-parser.readthedocs.io/"> + MyST Parser + <target ids="myst-parser" names="myst\ parser" refuri="https://myst-parser.readthedocs.io/"> +. + +eval-rst bold +. +```{eval-rst} +**bold** +. +<document source="<src>/index.md"> + <paragraph> + <strong> + bold +. diff --git a/tests/test_renderers/fixtures/mock_include.md b/tests/test_renderers/fixtures/mock_include.md new file mode 100644 index 0000000..32d779e --- /dev/null +++ b/tests/test_renderers/fixtures/mock_include.md @@ -0,0 +1,62 @@ +Basic Include: +. +```{include} other.md +``` +. +<document source="tmpdir/test.md"> + <paragraph> + a + + b + + c +. + +Include with Front Matter (should be ignored): +. +```{include} fmatter.md +``` +. +<document source="tmpdir/test.md"> + <paragraph> + b +. + +Include Literal: +. +```{include} other.md +:literal: True +``` +. +<document source="tmpdir/test.md"> + <literal_block source="tmpdir/other.md" xml:space="preserve"> + a + b + c +. + +Include Literal, line range: +. +```{include} other.md +:literal: True +:start-line: 1 +:end-line: 2 +``` +. +<document source="tmpdir/test.md"> + <literal_block source="tmpdir/other.md" xml:space="preserve"> + b +. + +Include code: +. +```{include} other.md +:code: md +``` +. +<document source="tmpdir/test.md"> + <literal_block classes="code md" source="tmpdir/other.md" xml:space="preserve"> + a + b + c +. diff --git a/tests/test_renderers/fixtures/mock_include_errors.md b/tests/test_renderers/fixtures/mock_include_errors.md new file mode 100644 index 0000000..1e5c2e9 --- /dev/null +++ b/tests/test_renderers/fixtures/mock_include_errors.md @@ -0,0 +1,24 @@ +Missing path: +. +```{include} +``` +. +tmpdir/test.md:1: (ERROR/3) Directive 'include': 1 argument(s) required, 0 supplied +. + +Non-existent path: +. +```{include} other.md +``` +. +tmpdir/test.md:1: (SEVERE/4) Directive "include": error reading file: tmpdir/other.md +[Errno 2] No such file or directory: 'tmpdir/other.md'. +. + +Error in include file: +. +```{include} bad.md +``` +. +tmpdir/bad.md:2: (ERROR/3) Unknown interpreted text role "a". +. diff --git a/tests/test_renderers/fixtures/myst-config.txt b/tests/test_renderers/fixtures/myst-config.txt new file mode 100644 index 0000000..668895a --- /dev/null +++ b/tests/test_renderers/fixtures/myst-config.txt @@ -0,0 +1,176 @@ +[title-to-header] --myst-title-to-header="yes" +. +--- +title: "The title *nested syntax*" +--- + +# Other header +. +<document source="<string>"> + <docinfo> + <field classes="title"> + <field_name> + title + <field_body> + <paragraph> + <literal> + The title *nested syntax* + <section ids="the-title-nested-syntax" names="the\ title\ nested\ syntax"> + <title> + The title + <emphasis> + nested syntax + <section ids="other-header" names="other\ header"> + <title> + Other header +. + +[linkify] --myst-enable-extensions=linkify +. +www.example.com +. +<document source="<string>"> + <paragraph> + <reference refuri="http://www.example.com"> + www.example.com +. + +[gfm-strikethrough] --myst-gfm-only="yes" +. +~~strike~~ +. +<document source="<string>"> + <paragraph> + <system_message level="2" line="1" source="<string>" type="WARNING"> + <paragraph> + Strikethrough is currently only supported in HTML output [myst.strikethrough] + <raw format="html" xml:space="preserve"> + <s> + strike + <raw format="html" xml:space="preserve"> + </s> + +<string>:1: (WARNING/2) Strikethrough is currently only supported in HTML output [myst.strikethrough] +. + +[gfm-disallowed-html] --myst-gfm-only="yes" +. +<strong> <title> <style> <em> + +<blockquote> + <xmp> is disallowed. <XMP> is also disallowed. +</blockquote> +. +<document source="<string>"> + <paragraph> + <raw format="html" xml:space="preserve"> + <strong> + + <raw format="html" xml:space="preserve"> + <title> + + <raw format="html" xml:space="preserve"> + <style> + + <raw format="html" xml:space="preserve"> + <em> + <raw format="html" xml:space="preserve"> + <blockquote> + <xmp> is disallowed. <XMP> is also disallowed. + </blockquote> +. + +[gfm-autolink] --myst-gfm-only="yes" +. +www.commonmark.org + +Visit www.commonmark.org/help for more information. + +www.google.com/search?q=Markup+(business) + +www.google.com/search?q=Markup+(business))) + +(www.google.com/search?q=Markup+(business)) + +(www.google.com/search?q=Markup+(business) + +www.google.com/search?q=(business))+ok + +www.google.com/search?q=commonmark&hl=en + +www.google.com/search?q=commonmark&hl; + +www.commonmark.org/he<lp +. +<document source="<string>"> + <paragraph> + <reference refuri="http://www.commonmark.org"> + www.commonmark.org + <paragraph> + Visit + <reference refuri="http://www.commonmark.org/help"> + www.commonmark.org/help + for more information. + <paragraph> + <reference refuri="http://www.google.com/search?q=Markup+(business)"> + www.google.com/search?q=Markup+(business) + <paragraph> + <reference refuri="http://www.google.com/search?q=Markup+(business)"> + www.google.com/search?q=Markup+(business) + )) + <paragraph> + ( + <reference refuri="http://www.google.com/search?q=Markup+(business)"> + www.google.com/search?q=Markup+(business) + ) + <paragraph> + ( + <reference refuri="http://www.google.com/search?q=Markup+(business)"> + www.google.com/search?q=Markup+(business) + <paragraph> + <reference refuri="http://www.google.com/search?q=(business)"> + www.google.com/search?q=(business) + )+ok + <paragraph> + <reference refuri="http://www.google.com/search?q=commonmark&hl=en"> + www.google.com/search?q=commonmark&hl=en + <paragraph> + <reference refuri="http://www.google.com/search?q=commonmark&hl"> + www.google.com/search?q=commonmark&hl + ; + <paragraph> + <reference refuri="http://www.commonmark.org/he"> + www.commonmark.org/he + <lp +. + +[attrs_image] --myst-enable-extensions=attrs_image +. +![a](b){#id .a width="100%" align=center height=20px}{.b} +. +<document source="<string>"> + <paragraph> + <image align="center" alt="a" classes="a b" height="20px" ids="id" names="id" uri="b" width="100%"> +. + +[attrs_image_warnings] --myst-enable-extensions=attrs_image +. +![a](b){width=1x height=2x align=other } +. +<document source="<string>"> + <paragraph> + <system_message level="2" line="1" source="<string>" type="WARNING"> + <paragraph> + Invalid width value for image: '1x' [myst.image] + <system_message level="2" line="1" source="<string>" type="WARNING"> + <paragraph> + Invalid height value for image: '2x' [myst.image] + <system_message level="2" line="1" source="<string>" type="WARNING"> + <paragraph> + Invalid align value for image: 'other' [myst.image] + <image alt="a" uri="b"> + +<string>:1: (WARNING/2) Invalid width value for image: '1x' [myst.image] +<string>:1: (WARNING/2) Invalid height value for image: '2x' [myst.image] +<string>:1: (WARNING/2) Invalid align value for image: 'other' [myst.image] +. diff --git a/tests/test_renderers/fixtures/reporter_warnings.md b/tests/test_renderers/fixtures/reporter_warnings.md new file mode 100644 index 0000000..e9998b9 --- /dev/null +++ b/tests/test_renderers/fixtures/reporter_warnings.md @@ -0,0 +1,180 @@ +Duplicate Reference definitions: +. +[a]: b +[a]: c +. +<string>:2: (WARNING/2) Duplicate reference definition: A [myst.ref] +. + +Missing Reference: +. +[a](b) +. +<string>:1: (ERROR/3) Unknown target name: "b". +. + +Unknown role: +. +abc + +{xyz}`a` +. +<string>:3: (ERROR/3) Unknown interpreted text role "xyz". +. + +Unknown directive: +. + +```{xyz} +``` +. +<string>:2: (ERROR/3) Unknown directive type "xyz". +. + +Bad Front Matter: +. +--- +a: { +--- +. +<string>:1: (WARNING/2) Malformed YAML [myst.topmatter] +. + +Unknown Front Matter myst key: +. +--- +myst: + unknown: true +--- +. +<string>:1: (WARNING/2) Unknown field: unknown [myst.topmatter] +. + +Invalid Front Matter myst key: +. +--- +myst: + title_to_header: 1 + url_schemes: [1] + substitutions: + key: [] +--- +. +<string>:1: (WARNING/2) 'title_to_header' must be of type <class 'bool'> (got 1 that is a <class 'int'>). [myst.topmatter] +<string>:1: (WARNING/2) 'url_schemes[0]' must be of type <class 'str'> (got 1 that is a <class 'int'>). [myst.topmatter] +<string>:1: (WARNING/2) 'substitutions['key']' must be of type (<class 'str'>, <class 'int'>, <class 'float'>) (got [] that is a <class 'list'>). [myst.topmatter] +. + +Bad HTML Meta +. +--- +myst: + html_meta: + name noequals: value + +--- +. +<string>:: (ERROR/3) Error parsing meta tag attribute "name noequals": no '=' in noequals. +. + +Directive parsing error: +. + +```{class} +``` +. +<string>:2: (ERROR/3) Directive 'class': 1 argument(s) required, 0 supplied +. + +Directive run error: +. + +```{date} +x +``` +. +<string>:2: (ERROR/3) Invalid context: the "date" directive can only be used within a substitution definition. +. + +Do not start headings at H1: +. +## title 1 +. +<string>:1: (WARNING/2) Document headings start at H2, not H1 [myst.header] +. + +Non-consecutive headings: +. +# title 1 +### title 3 +. +<string>:2: (WARNING/2) Non-consecutive header level increase; H1 to H3 [myst.header] +. + +multiple footnote definitions +. +[^a] + +[^a]: definition 1 +[^a]: definition 2 +. +<string>:: (WARNING/2) Multiple footnote definitions found for label: 'a' [myst.footnote] +. + +Warnings in eval-rst +. +some external + +lines + +```{eval-rst} +some internal + +lines + +.. unknown:: some text + +:unknown:`a` +``` +. +<string>:10: (ERROR/3) Unknown directive type "unknown". + +.. unknown:: some text + +<string>:12: (ERROR/3) Unknown interpreted text role "unknown". +. + +bad-option-value +. +```{note} +:class: [1] +``` +. +<string>:1: (ERROR/3) Directive 'note': option "class" value not string (enclose with ""): [1] + +:class: [1] + +. + +header nested in admonition +. +```{note} +# Header +``` +. +<string>:2: (WARNING/2) Disallowed nested header found, converting to rubric [myst.nested_header] +. + +nested parse warning +. +Paragraph + +```{note} +:class: abc +:name: xyz + +{unknown}`a` +``` +. +<string>:7: (ERROR/3) Unknown interpreted text role "unknown". +. diff --git a/tests/test_renderers/fixtures/sphinx_directives.md b/tests/test_renderers/fixtures/sphinx_directives.md new file mode 100644 index 0000000..2b92457 --- /dev/null +++ b/tests/test_renderers/fixtures/sphinx_directives.md @@ -0,0 +1,441 @@ +default-role (`sphinx.directives.DefaultRole`): +. +```{default-role} +``` +. +<document source="<src>/index.md"> +. + +default-domain (`sphinx.directives.DefaultDomain`): +. +```{default-domain} mydomain +``` +. +<document source="<src>/index.md"> +. + +object (`sphinx.directives.ObjectDescription`): +. +```{object} something +``` +. +<document source="<src>/index.md"> + <index entries=""> + <desc classes="object" desctype="object" domain="" noindex="False" objtype="object"> + <desc_signature classes="sig sig-object"> + <desc_name classes="sig-name descname" xml:space="preserve"> + something + <desc_content> +. + +highlight (`sphinx.directives.code.Highlight`): +. +```{highlight} something +``` +. +<document source="<src>/index.md"> + <highlightlang force="False" lang="something" linenothreshold="9223372036854775807"> +. + +code-block (`sphinx.directives.code.CodeBlock`): +. +```{code-block} +:dedent: + + a=1 +``` +. +<document source="<src>/index.md"> + <literal_block force="False" highlight_args="{}" language="default" xml:space="preserve"> + a=1 +. + +sourcecode (`sphinx.directives.code.CodeBlock`): +. +```{sourcecode} +``` +. +<document source="<src>/index.md"> + <literal_block force="False" highlight_args="{}" language="default" xml:space="preserve"> +. + +SKIP: Tested in sphinx builds +. +```{literalinclude} /path/to/file +``` +. +<document source="notset"> + <system_message level="2" line="1" source="notset" type="WARNING"> + <paragraph> + Include file '/srcdir/path/to/file' not found or reading it failed +. + +toctree (`sphinx.directives.other.TocTree`): +. +```{toctree} +``` +. +<document source="<src>/index.md"> + <compound classes="toctree-wrapper"> + <toctree caption="True" entries="" glob="False" hidden="False" includefiles="" includehidden="False" maxdepth="-1" numbered="0" parent="index" titlesonly="False"> +. + +sectionauthor (`sphinx.directives.other.Author`): +. +```{sectionauthor} bob geldof +``` +. +<document source="<src>/index.md"> +. + +moduleauthor (`sphinx.directives.other.Author`): +. +```{moduleauthor} ringo starr +``` +. +<document source="<src>/index.md"> +. + +codeauthor (`sphinx.directives.other.Author`): +. +```{codeauthor} paul mcartney +``` +. +<document source="<src>/index.md"> +. + +index (`sphinx.directives.other.Index`): +. +```{index} something +``` +. +<document source="<src>/index.md"> + <index entries="('single',\ 'something',\ 'index-0',\ '',\ None)" inline="False"> + <target ids="index-0"> +. + +seealso (`sphinx.directives.other.SeeAlso`): +. +```{seealso} + +a +``` +. +<document source="<src>/index.md"> + <seealso> + <paragraph> + a +. + +tabularcolumns (`sphinx.directives.other.TabularColumns`): +. +```{tabularcolumns} spec +``` +. +<document source="<src>/index.md"> + <tabular_col_spec spec="spec"> +. + +centered (`sphinx.directives.other.Centered`): +. +```{centered} text +``` +. +<document source="<src>/index.md"> + <centered> + text +. + +acks (`sphinx.directives.other.Acks`): +. +```{acks} + +- name +``` +. +<document source="<src>/index.md"> + <acks> + <bullet_list bullet="-"> + <list_item> + <paragraph> + name +. + +hlist (`sphinx.directives.other.HList`): +. +```{hlist} + +- item +``` +. +<document source="<src>/index.md"> + <hlist ncolumns="2"> + <hlistcol> + <bullet_list> + <list_item> + <paragraph> + item + <hlistcol> + <bullet_list> +. + +only (`sphinx.directives.other.Only`): +. +```{only} expr +``` +. +<document source="<src>/index.md"> + <only expr="expr"> +. + +SKIP: Tested in sphinx builds +. +```{include} path/to/include +``` +. +<document source="notset"> +. + +figure (`sphinx.directives.patches.Figure`): +. +```{figure} path/to/figure + +*caption* + +legend +``` +. +<document source="<src>/index.md"> + <figure> + <image uri="path/to/figure"> + <caption> + <emphasis> + caption + <legend> + <paragraph> + legend +. + +SKIP: MockingError: MockState has not yet implemented attribute 'nested_list_parse' +. +```{meta} +foo +``` +. +<document source="notset"> +. + +table (`sphinx.directives.patches.RSTTable`): +. +```{table} *title* +:name: name + +| a | b | +|---|---| +| 1 | 2 | +``` +. +<document source="<src>/index.md"> + <table classes="colwidths-auto" ids="name" names="name"> + <title> + <emphasis> + title + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + a + <entry> + <paragraph> + b + <tbody> + <row> + <entry> + <paragraph> + 1 + <entry> + <paragraph> + 2 +. + +csv-table (`sphinx.directives.patches.CSVTable`): +. +```{csv-table} + +"Albatross", 2.99, "On a stick!" +``` +. +<document source="<src>/index.md"> + <table> + <tgroup cols="3"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <tbody> + <row> + <entry> + <paragraph> + Albatross + <entry> + <paragraph> + 2.99 + <entry> + <paragraph> + On a stick! +. + +list-table (`sphinx.directives.patches.ListTable`): +. +```{list-table} + +* - item +``` +. +<document source="<src>/index.md"> + <table> + <tgroup cols="1"> + <colspec colwidth="100"> + <tbody> + <row> + <entry> + <paragraph> + item +. + +code (`sphinx.directives.patches.Code`): +. +```{code} python + +a +``` +. +<document source="<src>/index.md"> + <literal_block force="False" highlight_args="{}" language="python" xml:space="preserve"> + a +. + +math (`sphinx.directives.patches.MathDirective`): +. +```{math} +``` +. +<document source="<src>/index.md"> + <math_block docname="index" label="True" nowrap="False" number="True" xml:space="preserve"> +. + +deprecated (`sphinx.domains.changeset.VersionChange`): +. +```{deprecated} 0.3 +``` +. +<document source="<src>/index.md"> + <versionmodified type="deprecated" version="0.3"> + <paragraph translatable="False"> + <inline classes="versionmodified deprecated"> + Deprecated since version 0.3. +. + +versionadded (`sphinx.domains.changeset.VersionChange`): +. +```{versionadded} 0.2 +``` +. +<document source="<src>/index.md"> + <versionmodified type="versionadded" version="0.2"> + <paragraph translatable="False"> + <inline classes="versionmodified added"> + New in version 0.2. +. + +versionchanged (`sphinx.domains.changeset.VersionChange`): +. +```{versionchanged} 0.1 +``` +. +<document source="<src>/index.md"> + <versionmodified type="versionchanged" version="0.1"> + <paragraph translatable="False"> + <inline classes="versionmodified changed"> + Changed in version 0.1. +. + +glossary (`sphinx.domains.std.Glossary`): +. +```{glossary} + +term 1 : A +term 2 : B + Definition of both terms. +``` +. +<document source="<src>/index.md"> + <glossary> + <definition_list classes="glossary"> + <definition_list_item> + <term ids="term-term-1"> + term 1 + <index entries="('single',\ 'term\ 1',\ 'term-term-1',\ 'main',\ 'A')"> + <term ids="term-term-2"> + term 2 + <index entries="('single',\ 'term\ 2',\ 'term-term-2',\ 'main',\ 'B')"> + <definition> + <paragraph> + Definition of both terms. +. + +SPHINX4-SKIP productionlist (`sphinx.domains.std.ProductionList`): +. +```{productionlist} try_stmt: try1_stmt | try2_stmt +``` +. +<document source="<src>/index.md"> + <productionlist> + <production ids="grammar-token-try_stmt" tokenname="try_stmt" xml:space="preserve"> + try1_stmt | try2_stmt +. + +cmdoption (`sphinx.domains.std.Cmdoption`): +. +```{cmdoption} a +``` +. +<document source="<src>/index.md"> + <index entries="('pair',\ 'command\ line\ option;\ a',\ 'cmdoption-arg-a',\ '',\ None)"> + <desc classes="std cmdoption" desctype="cmdoption" domain="std" noindex="False" objtype="cmdoption"> + <desc_signature allnames="a" classes="sig sig-object" ids="cmdoption-arg-a"> + <desc_name classes="sig-name descname" xml:space="preserve"> + a + <desc_addname classes="sig-prename descclassname" xml:space="preserve"> + <desc_content> +. + +rst:directive (`sphinx.domains.rst.ReSTDirective`): +. +```{rst:directive} a +``` +. +<document source="<src>/index.md"> + <index entries="('single',\ 'a\ (directive)',\ 'directive-a',\ '',\ None)"> + <desc classes="rst directive" desctype="directive" domain="rst" noindex="False" objtype="directive"> + <desc_signature classes="sig sig-object" ids="directive-a"> + <desc_name classes="sig-name descname" xml:space="preserve"> + .. a:: + <desc_content> +. + +SPHINX4-SKIP rst:directive:option (`sphinx.domains.rst.ReSTDirectiveOption`): +. +```{rst:directive:option} a +``` +. +<document source="<src>/index.md"> + <index entries="('single',\ ':a:\ (directive\ option)',\ 'directive-option-a',\ '',\ 'A')"> + <desc classes="rst directive:option" desctype="directive:option" domain="rst" noindex="False" objtype="directive:option"> + <desc_signature classes="sig sig-object" ids="directive-option-a"> + <desc_name classes="sig-name descname" xml:space="preserve"> + :a: + <desc_content> +. diff --git a/tests/test_renderers/fixtures/sphinx_roles.md b/tests/test_renderers/fixtures/sphinx_roles.md new file mode 100644 index 0000000..37683db --- /dev/null +++ b/tests/test_renderers/fixtures/sphinx_roles.md @@ -0,0 +1,632 @@ +c:func (`sphinx.domains.c.CXRefRole`): +. +{c:func}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="c" refexplicit="False" reftarget="a" reftype="func" refwarn="False"> + <literal classes="xref c c-func"> + a() +. + +c:member (`sphinx.domains.c.CObject`): +. +{c:member}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="c" refexplicit="False" reftarget="a" reftype="member" refwarn="False"> + <literal classes="xref c c-member"> + a +. + +c:macro (`sphinx.domains.c.CObject`): +. +{c:macro}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="c" refexplicit="False" reftarget="a" reftype="macro" refwarn="False"> + <literal classes="xref c c-macro"> + a +. + +c:data (`sphinx.domains.c.CXRefRole`): +. +{c:data}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="c" refexplicit="False" reftarget="a" reftype="data" refwarn="False"> + <literal classes="xref c c-data"> + a +. + +c:type (`sphinx.domains.c.CObject`): +. +{c:type}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="c" refexplicit="False" reftarget="a" reftype="type" refwarn="False"> + <literal classes="xref c c-type"> + a +. + +cpp:any (`sphinx.domains.cpp.CPPXRefRole`): +. +{cpp:any}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="any" refwarn="False"> + <literal classes="xref cpp cpp-any"> + a +. + +cpp:class (`sphinx.domains.cpp.CPPClassObject`): +. +{cpp:class}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="class" refwarn="False"> + <literal classes="xref cpp cpp-class"> + a +. + +cpp:struct (`sphinx.domains.cpp.CPPClassObject`): +. +{cpp:struct}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="struct" refwarn="False"> + <literal classes="xref cpp cpp-struct"> + a +. + +cpp:union (`sphinx.domains.cpp.CPPUnionObject`): +. +{cpp:union}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="union" refwarn="False"> + <literal classes="xref cpp cpp-union"> + a +. + +cpp:func (`sphinx.domains.cpp.CPPXRefRole`): +. +{cpp:func}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="func" refwarn="False"> + <literal classes="xref cpp cpp-func"> + a() +. + +cpp:member (`sphinx.domains.cpp.CPPMemberObject`): +. +{cpp:member}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="member" refwarn="False"> + <literal classes="xref cpp cpp-member"> + a +. + +cpp:var (`sphinx.domains.cpp.CPPMemberObject`): +. +{cpp:var}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="var" refwarn="False"> + <literal classes="xref cpp cpp-var"> + a +. + +cpp:type (`sphinx.domains.cpp.CPPTypeObject`): +. +{cpp:type}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="type" refwarn="False"> + <literal classes="xref cpp cpp-type"> + a +. + +cpp:concept (`sphinx.domains.cpp.CPPConceptObject`): +. +{cpp:concept}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="concept" refwarn="False"> + <literal classes="xref cpp cpp-concept"> + a +. + +cpp:enum (`sphinx.domains.cpp.CPPEnumObject`): +. +{cpp:enum}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="enum" refwarn="False"> + <literal classes="xref cpp cpp-enum"> + a +. + +cpp:enumerator (`sphinx.domains.cpp.CPPEnumeratorObject`): +. +{cpp:enumerator}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="cpp" refexplicit="False" reftarget="a" reftype="enumerator" refwarn="False"> + <literal classes="xref cpp cpp-enumerator"> + a +. + +SKIP cpp:expr (`sphinx.domains.cpp.CPPExprRole`): +. +{cpp:expr}`a` +. +<document source="notset"> + <paragraph> + <desc_inline classes="cpp-expr sig sig-inline cpp"> + <pending_xref classname="True" cpp:parent_key="<sphinx.domains.cpp.LookupKey object at 0x7f948a6a73d0>" modname="True" refdomain="cpp" reftarget="a" reftype="identifier"> + <desc_sig_name classes="n"> + a +. + +SKIP cpp:texpr (`sphinx.domains.cpp.CPPExprRole`): +. +{cpp:texpr}`a` +. +<document source="notset"> + <paragraph> + <desc_inline classes="cpp-texpr sig sig-inline cpp"> + <pending_xref classname="True" cpp:parent_key="<sphinx.domains.cpp.LookupKey object at 0x7fac40b5f950>" modname="True" refdomain="cpp" reftarget="a" reftype="identifier"> + <desc_sig_name classes="n"> + a +. + +js:func (`sphinx.domains.javascript.JSXRefRole`): +. +{js:func}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref js:module="True" js:object="True" refdoc="index" refdomain="js" refexplicit="False" reftarget="a" reftype="func" refwarn="False"> + <literal classes="xref js js-func"> + a() +. + +js:meth (`sphinx.domains.javascript.JSXRefRole`): +. +{js:meth}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref js:module="True" js:object="True" refdoc="index" refdomain="js" refexplicit="False" reftarget="a" reftype="meth" refwarn="False"> + <literal classes="xref js js-meth"> + a() +. + +js:class (`sphinx.domains.javascript.JSConstructor`): +. +{js:class}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref js:module="True" js:object="True" refdoc="index" refdomain="js" refexplicit="False" reftarget="a" reftype="class" refwarn="False"> + <literal classes="xref js js-class"> + a() +. + +js:data (`sphinx.domains.javascript.JSObject`): +. +{js:data}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref js:module="True" js:object="True" refdoc="index" refdomain="js" refexplicit="False" reftarget="a" reftype="data" refwarn="False"> + <literal classes="xref js js-data"> + a +. + +js:attr (`sphinx.domains.javascript.JSXRefRole`): +. +{js:attr}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref js:module="True" js:object="True" refdoc="index" refdomain="js" refexplicit="False" reftarget="a" reftype="attr" refwarn="False"> + <literal classes="xref js js-attr"> + a +. + +js:mod (`sphinx.domains.javascript.JSXRefRole`): +. +{js:mod}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref js:module="True" js:object="True" refdoc="index" refdomain="js" refexplicit="False" reftarget="a" reftype="mod" refwarn="False"> + <literal classes="xref js js-mod"> + a +. + +eq (`sphinx.domains.math.MathReferenceRole`): +. +{eq}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="math" refexplicit="False" reftarget="a" reftype="eq" refwarn="True"> + <literal classes="xref eq"> + a +. + +math:numref (`sphinx.domains.math.MathReferenceRole`): +. +{math:numref}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="math" refexplicit="False" reftarget="a" reftype="numref" refwarn="False"> + <literal classes="xref math math-numref"> + a +. + +py:data (`sphinx.domains.python.PyVariable`): +. +{py:data}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="data" refwarn="False"> + <literal classes="xref py py-data"> + a +. + +py:exc (`sphinx.domains.python.PyXRefRole`): +. +{py:exc}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="exc" refwarn="False"> + <literal classes="xref py py-exc"> + a +. + +py:func (`sphinx.domains.python.PyXRefRole`): +. +{py:func}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="func" refwarn="False"> + <literal classes="xref py py-func"> + a() +. + +py:class (`sphinx.domains.python.PyClasslike`): +. +{py:class}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="class" refwarn="False"> + <literal classes="xref py py-class"> + a +. + +py:const (`sphinx.domains.python.PyXRefRole`): +. +{py:const}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="const" refwarn="False"> + <literal classes="xref py py-const"> + a +. + +py:attr (`sphinx.domains.python.PyXRefRole`): +. +{py:attr}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="attr" refwarn="False"> + <literal classes="xref py py-attr"> + a +. + +py:meth (`sphinx.domains.python.PyXRefRole`): +. +{py:meth}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="meth" refwarn="False"> + <literal classes="xref py py-meth"> + a() +. + +py:mod (`sphinx.domains.python.PyXRefRole`): +. +{py:mod}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="mod" refwarn="False"> + <literal classes="xref py py-mod"> + a +. + +py:obj (`sphinx.domains.python.PyXRefRole`): +. +{py:obj}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="a" reftype="obj" refwarn="False"> + <literal classes="xref py py-obj"> + a +. + +rst:role (`sphinx.domains.rst.ReSTRole`): +. +{rst:role}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="rst" refexplicit="False" reftarget="a" reftype="role" refwarn="False"> + <literal classes="xref rst rst-role"> + a +. + +program (`sphinx.domains.std.Program`): +. +{program}`a` +. +<document source="<src>/index.md"> + <paragraph> + <literal_strong classes="program"> + a +. + +option (`sphinx.domains.std.Cmdoption`): +. +{option}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="option" refwarn="True" std:program="True"> + <literal classes="xref std std-option"> + a +. + +envvar (`sphinx.domains.std.EnvVarXRefRole`): +. +{envvar}`a` +. +<document source="<src>/index.md"> + <paragraph> + <index entries="('single',\ 'a',\ 'index-0',\ '',\ None) ('single',\ 'environment\ variable;\ a',\ 'index-0',\ '',\ None)"> + <target ids="index-0"> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="envvar" refwarn="False"> + <literal classes="xref std std-envvar"> + a +. + +index (`sphinx.roles.Index`): +. +{index}`a` +. +<document source="<src>/index.md"> + <paragraph> + <index entries="('single',\ 'a',\ 'index-0',\ '',\ None)"> + <target ids="index-0"> + a +. + +download (`sphinx.roles.XRefRole`): +. +{download}`a` +. +<document source="<src>/index.md"> + <paragraph> + <download_reference refdoc="index" refdomain="" refexplicit="False" reftarget="a" reftype="download" refwarn="False"> + <literal classes="xref download"> + a +. + +any (`sphinx.roles.AnyXRefRole`): +. +{any}`a <alt text>` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="" refexplicit="True" reftarget="alt text" reftype="any" refwarn="True"> + <literal classes="xref any"> + a +. + +pep (`sphinx.roles.PEP`): +. +{pep}`1` +. +<document source="<src>/index.md"> + <paragraph> + <index entries="('single',\ 'Python\ Enhancement\ Proposals;\ PEP\ 1',\ 'index-0',\ '',\ None)"> + <target ids="index-0"> + <reference classes="pep" internal="False" refuri="https://peps.python.org/pep-0001/"> + <strong> + PEP 1 +. + +rfc (`sphinx.roles.RFC`): +. +{rfc}`1` +. +<document source="<src>/index.md"> + <paragraph> + <index entries="('single',\ 'RFC;\ RFC\ 1',\ 'index-0',\ '',\ None)"> + <target ids="index-0"> + <reference classes="rfc" internal="False" refuri="https://datatracker.ietf.org/doc/html/rfc1.html"> + <strong> + RFC 1 +. + +guilabel (`sphinx.roles.GUILabel`): +. +{guilabel}`a` +. +<document source="<src>/index.md"> + <paragraph> + <inline classes="guilabel" rawtext=":guilabel:`a`"> + a +. + +menuselection (`sphinx.roles.MenuSelection`): +. +{menuselection}`a` +. +<document source="<src>/index.md"> + <paragraph> + <inline classes="menuselection" rawtext=":menuselection:`a`"> + a +. + +file (`sphinx.roles.EmphasizedLiteral`): +. +{file}`a` +. +<document source="<src>/index.md"> + <paragraph> + <literal classes="file" role="file"> + a +. + +samp (`sphinx.roles.EmphasizedLiteral`): +. +{samp}`a` +. +<document source="<src>/index.md"> + <paragraph> + <literal classes="samp" role="samp"> + a +. + +SKIP: Non-deterministic output +. +{abbr}`a` +. +<document source="notset"> + <paragraph> + <abbreviation class="<function class_option at 0x1079fb830>> + a +. + +rst:dir (`sphinx.roles.XRefRole`): +. +{rst:dir}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="rst" refexplicit="False" reftarget="a" reftype="dir" refwarn="False"> + <literal classes="xref rst rst-dir"> + a +. + +token (`sphinx.roles.XRefRole`): +. +{token}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="token" refwarn="False"> + <literal classes="xref std std-token"> + a +. + +term (`sphinx.roles.XRefRole`): +. +{term}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="term" refwarn="True"> + <inline classes="xref std std-term"> + a +. + +ref (`sphinx.roles.XRefRole`): +. +{ref}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + a +. + +ref with line breaks (`sphinx.roles.XRefRole`): +. +{ref}`some +text +<and +a +custom reference>` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="True" reftarget="and a custom reference" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + some text +. + +numref (`sphinx.roles.XRefRole`): +. +{numref}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + a +. + +keyword (`sphinx.roles.XRefRole`): +. +{keyword}`a` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="a" reftype="keyword" refwarn="True"> + <literal classes="xref std std-keyword"> + a +. + +doc (`sphinx.roles.XRefRole`): +. +{doc}`this lecture <heavy_tails>` +. +<document source="<src>/index.md"> + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="True" reftarget="heavy_tails" reftype="doc" refwarn="True"> + <inline classes="xref std std-doc"> + this lecture +. diff --git a/tests/test_renderers/fixtures/sphinx_syntax_elements.md b/tests/test_renderers/fixtures/sphinx_syntax_elements.md new file mode 100644 index 0000000..1ac085c --- /dev/null +++ b/tests/test_renderers/fixtures/sphinx_syntax_elements.md @@ -0,0 +1,800 @@ +Raw +. +foo +. +<document source="<src>/index.md"> + <paragraph> + foo +. + +Hard-break +. +foo\ +bar +. +<document source="<src>/index.md"> + <paragraph> + foo + <raw format="html" xml:space="preserve"> + <br /> + <raw format="latex" xml:space="preserve"> + \\ + bar +. + +Strong: +. +**foo** +. +<document source="<src>/index.md"> + <paragraph> + <strong> + foo +. + +Emphasis +. +*foo* +. +<document source="<src>/index.md"> + <paragraph> + <emphasis> + foo +. + +Escaped Emphasis: +. +\*foo* +. +<document source="<src>/index.md"> + <paragraph> + *foo* +. + +Mixed Inline +. +a *b* **c** `abc` \\* +. +<document source="<src>/index.md"> + <paragraph> + a + <emphasis> + b + + <strong> + c + + <literal> + abc + \* +. + +Inline Code: +. +`foo` +. +<document source="<src>/index.md"> + <paragraph> + <literal> + foo +. + +Heading: +. +# foo +. +<document source="<src>/index.md"> + <section ids="foo" names="foo"> + <title> + foo +. + +Heading Levels: +. +# a +## b +### c +# d +. +<document source="<src>/index.md"> + <section ids="a" names="a"> + <title> + a + <section ids="b" names="b"> + <title> + b + <section ids="c" names="c"> + <title> + c + <section ids="d" names="d"> + <title> + d +. + +Block Code: +. + foo +. +<document source="<src>/index.md"> + <literal_block language="none" xml:space="preserve"> + foo +. + +Fenced Code: +. +```sh +foo +``` +. +<document source="<src>/index.md"> + <literal_block language="sh" xml:space="preserve"> + foo +. + +Fenced Code no language: +. +``` +foo +``` +. +<document source="<src>/index.md"> + <literal_block language="default" xml:space="preserve"> + foo +. + +Fenced Code no language with trailing whitespace: +. +``` +foo +``` +. +<document source="<src>/index.md"> + <literal_block language="default" xml:space="preserve"> + foo +. + +Image empty: +. +![]() +. +<document source="<src>/index.md"> + <paragraph> + <image alt="" uri=""> +. + +Image with alt and title: +. +![alt](src "title") +. +<document source="<src>/index.md"> + <paragraph> + <image alt="alt" title="title" uri="src"> +. + +Image with escapable html: +. +![alt](http://www.google<>.com) +. +<document source="<src>/index.md"> + <paragraph> + <image alt="alt" uri="http://www.google%3C%3E.com"> +. + +Block Quote: +. +> *foo* +. +<document source="<src>/index.md"> + <block_quote> + <paragraph> + <emphasis> + foo +. + +Bullet List: +. +- *foo* +* bar +. +<document source="<src>/index.md"> + <bullet_list bullet="-"> + <list_item> + <paragraph> + <emphasis> + foo + <bullet_list bullet="*"> + <list_item> + <paragraph> + bar +. + +Nested Bullets +. +- a + - b + - c + - d +. +<document source="<src>/index.md"> + <bullet_list bullet="-"> + <list_item> + <paragraph> + a + <bullet_list bullet="-"> + <list_item> + <paragraph> + b + <bullet_list bullet="-"> + <list_item> + <paragraph> + c + <list_item> + <paragraph> + d +. + +Enumerated List: +. +1. *foo* + +1) bar + +para + +10. starting +11. enumerator +. +<document source="<src>/index.md"> + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + <emphasis> + foo + <enumerated_list enumtype="arabic" prefix="" suffix=")"> + <list_item> + <paragraph> + bar + <paragraph> + para + <enumerated_list enumtype="arabic" prefix="" start="10" suffix="."> + <list_item> + <paragraph> + starting + <list_item> + <paragraph> + enumerator +. + +Nested Enumrated List: +. +1. a +2. b + 1. c +. +<document source="<src>/index.md"> + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + a + <list_item> + <paragraph> + b + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + c +. + +Sphinx Role containing backtick: +. +{code}``a=1{`}`` +. +<document source="<src>/index.md"> + <paragraph> + <literal classes="code"> + a=1{`} +. + +Target: +. +(target)= +. +<document source="<src>/index.md"> + <target ids="target" names="target"> +. + +Target with whitespace: +. +(target with space)= +. +<document source="<src>/index.md"> + <target ids="target-with-space" names="target\ with\ space"> +. + +Referencing: +. +(target)= + +Title +===== + +[alt1](target) + +[](target2) + +[alt2](https://www.google.com) + +[alt3](#target3) +. +<document source="<src>/index.md"> + <target ids="target" names="target"> + <section ids="title" names="title"> + <title> + Title + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="target" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + alt1 + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="target2" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <reference refuri="https://www.google.com"> + alt2 + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="#target3" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + alt3 +. + +Comments: +. +line 1 +% a comment +line 2 +. +<document source="<src>/index.md"> + <paragraph> + line 1 + <comment xml:space="preserve"> + a comment + <paragraph> + line 2 +. + +Block Break: +. ++++ string +. +<document source="<src>/index.md"> + <comment classes="block_break" xml:space="preserve"> + string +. + +Link Reference: +. +[name][key] + +[key]: https://www.google.com "a title" +. +<document source="<src>/index.md"> + <paragraph> + <reference refuri="https://www.google.com" title="a title"> + name +. + +Link Reference short version: +. +[name] + +[name]: https://www.google.com "a title" +. +<document source="<src>/index.md"> + <paragraph> + <reference refuri="https://www.google.com" title="a title"> + name +. + +Block Quotes: +. +```{epigraph} +a b*c* + +-- a**b** +``` +. +<document source="<src>/index.md"> + <block_quote classes="epigraph"> + <paragraph> + a b + <emphasis> + c + <attribution> + a + <strong> + b +. + +Link Definition in directive: +. +```{note} +[a] +``` + +[a]: link +. +<document source="<src>/index.md"> + <note> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="link" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + a +. + +Link Definition in nested directives: +. +```{note} +[ref1]: link +``` + +```{note} +[ref1] +[ref2] +``` + +```{note} +[ref2]: link +``` +. +<document source="<src>/index.md"> + <note> + <note> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="link" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + ref1 + + [ref2] + <note> +. + +Footnotes: +. +[^a] + +[^a]: footnote*text* +. +<document source="<src>/index.md"> + <paragraph> + <footnote_reference auto="1" ids="id1" refname="a"> + <transition classes="footnotes"> + <footnote auto="1" ids="a" names="a"> + <paragraph> + footnote + <emphasis> + text +. + +Footnotes nested blocks: +. +[^a] + +[^a]: footnote*text* + + abc +xyz + + > a + + - b + + c + +finish +. +<document source="<src>/index.md"> + <paragraph> + <footnote_reference auto="1" ids="id1" refname="a"> + <paragraph> + finish + <transition classes="footnotes"> + <footnote auto="1" ids="a" names="a"> + <paragraph> + footnote + <emphasis> + text + <paragraph> + abc + + xyz + <block_quote> + <paragraph> + a + <bullet_list bullet="-"> + <list_item> + <paragraph> + b + <paragraph> + c +. + +Front Matter: +. +--- +a: 1 +b: foo +c: + d: 2 +--- +. +<document source="<src>/index.md"> + <field_list> + <field> + <field_name> + a + <field_body> + <paragraph> + <literal> + 1 + <field> + <field_name> + b + <field_body> + <paragraph> + <literal> + foo + <field> + <field_name> + c + <field_body> + <paragraph> + <literal> + {"d": 2} +. + +Front Matter Biblio: +. +--- +author: Chris Sewell +authors: Chris Sewell, Chris Hodgraf +organization: EPFL +address: | + 1 Cedar Park Close + Thundersley + Essex +contact: <https://example.com> +version: 1.0 +revision: 1.1 +status: good +date: 2/12/1985 +copyright: MIT +dedication: | + To my *homies* +abstract: + Something something **dark** side +other: Something else +--- +. +<document source="<src>/index.md"> + <field_list> + <field> + <field_name> + author + <field_body> + <paragraph> + Chris Sewell + <field> + <field_name> + authors + <field_body> + <paragraph> + Chris Sewell, Chris Hodgraf + <field> + <field_name> + organization + <field_body> + <paragraph> + EPFL + <field> + <field_name> + address + <field_body> + <paragraph> + 1 Cedar Park Close + + Thundersley + + Essex + + <field> + <field_name> + contact + <field_body> + <paragraph> + <reference refuri="https://example.com"> + https://example.com + <field> + <field_name> + version + <field_body> + <paragraph> + 1.0 + <field> + <field_name> + revision + <field_body> + <paragraph> + 1.1 + <field> + <field_name> + status + <field_body> + <paragraph> + good + <field> + <field_name> + date + <field_body> + <paragraph> + 2/12/1985 + <field> + <field_name> + copyright + <field_body> + <paragraph> + MIT + <field> + <field_name> + dedication + <field_body> + <paragraph> + To my + <emphasis> + homies + + <field> + <field_name> + abstract + <field_body> + <paragraph> + Something something + <strong> + dark + side + <field> + <field_name> + other + <field_body> + <paragraph> + <literal> + Something else +. + +Front Matter Bad Yaml: +. +--- +a: { +--- +. +<document source="<src>/index.md"> + <system_message level="2" line="1" source="<src>/index.md" type="WARNING"> + <paragraph> + Malformed YAML [myst.topmatter] +. + +Front Matter HTML Meta +. +--- +myst: + html_meta: + keywords: Sphinx, documentation, builder + description lang=en: An amusing story + description lang=fr: Un histoire amusant + http-equiv=Content-Type: text/html; charset=ISO-8859-1 +--- +. +<document source="<src>/index.md"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="Sphinx, documentation, builder" name="keywords"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="An amusing story" lang="en" name="description"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="Un histoire amusant" lang="fr" name="description"> + <pending> + .. internal attributes: + .transform: docutils.transforms.components.Filter + .details: + component: 'writer' + format: 'html' + nodes: + <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> +. + +Full Test: +. +--- +a: 1 +--- + +(target)= +# header 1 +## sub header 1 + +a *b* **c** `abc` + +## sub header 2 + +x y [a](http://www.xyz.com) z + +--- + +# header 2 + +```::python {a=1} +a = 1 +``` + +[](target) +. +<document source="<src>/index.md"> + <field_list> + <field> + <field_name> + a + <field_body> + <paragraph> + <literal> + 1 + <target ids="target" names="target"> + <section ids="header-1" names="header\ 1"> + <title> + header 1 + <section ids="sub-header-1" names="sub\ header\ 1"> + <title> + sub header 1 + <paragraph> + a + <emphasis> + b + + <strong> + c + + <literal> + abc + <section ids="sub-header-2" names="sub\ header\ 2"> + <title> + sub header 2 + <paragraph> + x y + <reference refuri="http://www.xyz.com"> + a + z + <transition> + <section ids="header-2" names="header\ 2"> + <title> + header 2 + <literal_block language="::python" xml:space="preserve"> + a = 1 + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="target" reftype="myst" refwarn="True"> + <inline classes="xref myst"> +. diff --git a/tests/test_renderers/fixtures/tables.md b/tests/test_renderers/fixtures/tables.md new file mode 100644 index 0000000..b478b92 --- /dev/null +++ b/tests/test_renderers/fixtures/tables.md @@ -0,0 +1,148 @@ +Simple: +. +a|b +-|- +1|2 +. +<document source="<src>/index.md"> + <table classes="colwidths-auto"> + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + a + <entry> + <paragraph> + b + <tbody> + <row> + <entry> + <paragraph> + 1 + <entry> + <paragraph> + 2 +. + +Header only: +. +| abc | def | +| --- | --- | +. +<document source="<src>/index.md"> + <table classes="colwidths-auto"> + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + abc + <entry> + <paragraph> + def +. + +Aligned: +. +a | b | c +:-|:-:| -: +1 | 2 | 3 +. +<document source="<src>/index.md"> + <table classes="colwidths-auto"> + <tgroup cols="3"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <colspec colwidth="33"> + <thead> + <row> + <entry classes="text-left"> + <paragraph> + a + <entry classes="text-center"> + <paragraph> + b + <entry classes="text-right"> + <paragraph> + c + <tbody> + <row> + <entry classes="text-left"> + <paragraph> + 1 + <entry classes="text-center"> + <paragraph> + 2 + <entry classes="text-right"> + <paragraph> + 3 +. + +Nested syntax: +. +| *a* | __*b*__ | +| --- | -------- | +|c | {sub}`x` | +. +<document source="<src>/index.md"> + <table classes="colwidths-auto"> + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + <emphasis> + a + <entry> + <paragraph> + <strong> + <emphasis> + b + <tbody> + <row> + <entry> + <paragraph> + c + <entry> + <paragraph> + <subscript> + x +. + +External links: +. +a|b +|-|-| +[link-a](https://www.google.com/)|[link-b](https://www.python.org/) +. +<document source="<src>/index.md"> + <table classes="colwidths-auto"> + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + a + <entry> + <paragraph> + b + <tbody> + <row> + <entry> + <paragraph> + <reference refuri="https://www.google.com/"> + link-a + <entry> + <paragraph> + <reference refuri="https://www.python.org/"> + link-b +. -- cgit v1.2.3