diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:23:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:23:02 +0000 |
commit | 943e3dc057eca53e68ddec51529bd6a1279ebd8e (patch) | |
tree | 61fb7bac619a56dfbcdcbdb7b0d4d6535fc36fe9 /tests/test_sphinx | |
parent | Initial commit. (diff) | |
download | myst-parser-a833513cb4487f3059fc2e266a571e931e2c1c3c.tar.xz myst-parser-a833513cb4487f3059fc2e266a571e931e2c1c3c.zip |
Adding upstream version 0.18.1.upstream/0.18.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
91 files changed, 5064 insertions, 0 deletions
diff --git a/tests/test_sphinx/conftest.py b/tests/test_sphinx/conftest.py new file mode 100644 index 0000000..4165a31 --- /dev/null +++ b/tests/test_sphinx/conftest.py @@ -0,0 +1,127 @@ +""" +Uses sphinx's pytest fixture to run builds + +usage: + +.. code-block:: python + + @pytest.mark.sphinx( + buildername='html', + srcdir='path/to/source') + def test_basic(app, status, warning, get_sphinx_app_output): + + app.build() + + assert 'build succeeded' in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + output = get_sphinx_app_output(app, buildername='html') + +parameters available to parse to ``@pytest.mark.sphinx``: + +- buildername='html' +- srcdir=None +- testroot='root' (only used if srcdir not set) +- freshenv=False +- confoverrides=None +- status=None +- warning=None +- tags=None +- docutilsconf=None + +""" +import os +import pathlib +import shutil + +import pytest +from bs4 import BeautifulSoup +from sphinx.testing.path import path + +from myst_parser._compat import findall + +SOURCE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "sourcedirs")) + + +@pytest.fixture(scope="session", autouse=True) +def remove_sphinx_builds(): + """remove all build directories from the test folder""" + yield + srcdirs = pathlib.Path(SOURCE_DIR) + for entry in srcdirs.iterdir(): # type: pathlib.Path + if entry.is_dir() and entry.joinpath("_build").exists(): + shutil.rmtree(str(entry.joinpath("_build"))) + + +@pytest.fixture +def get_sphinx_app_output(file_regression): + def read( + app, + buildername="html", + filename="index.html", + encoding="utf-8", + regress_html=False, + regress_ext=".html", + replace=None, + ): + + outpath = path(os.path.join(str(app.srcdir), "_build", buildername, filename)) + if not outpath.exists(): + raise OSError(f"no output file exists: {outpath}") + + try: + # introduced in sphinx 3.0 + content = outpath.read_text(encoding=encoding) + except AttributeError: + content = outpath.text(encoding=encoding) + + if regress_html: + # only regress the inner body, since other sections are non-deterministic + soup = BeautifulSoup(content, "html.parser") + doc_div = soup.findAll("div", {"class": "documentwrapper"})[0] + # pygments 2.11.0 introduces a whitespace tag + for pygment_whitespace in doc_div.select("pre > span.w"): + pygment_whitespace.replace_with(pygment_whitespace.text) + text = doc_div.prettify() + for find, rep in (replace or {}).items(): + text = text.replace(find, rep) + file_regression.check(text, extension=regress_ext, encoding="utf8") + + return content + + return read + + +@pytest.fixture +def get_sphinx_app_doctree(file_regression): + def read( + app, + docname="index", + resolve=False, + regress=False, + replace=None, + regress_ext=".xml", + ): + if resolve: + doctree = app.env.get_and_resolve_doctree(docname, app.builder) + extension = f".resolved{regress_ext}" + else: + doctree = app.env.get_doctree(docname) + extension = regress_ext + + # convert absolute filenames + for node in findall(doctree)( + lambda n: "source" in n and not isinstance(n, str) + ): + node["source"] = pathlib.Path(node["source"]).name + + if regress: + text = doctree.pformat() # type: str + for find, rep in (replace or {}).items(): + text = text.replace(find, rep) + file_regression.check(text, extension=extension) + + return doctree + + return read diff --git a/tests/test_sphinx/sourcedirs/.gitignore b/tests/test_sphinx/sourcedirs/.gitignore new file mode 100644 index 0000000..69fa449 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/.gitignore @@ -0,0 +1 @@ +_build/ diff --git a/tests/test_sphinx/sourcedirs/basic/conf.py b/tests/test_sphinx/sourcedirs/basic/conf.py new file mode 100644 index 0000000..e1c5009 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/basic/conf.py @@ -0,0 +1,2 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] diff --git a/tests/test_sphinx/sourcedirs/basic/content.md b/tests/test_sphinx/sourcedirs/basic/content.md new file mode 100644 index 0000000..ab7b6e2 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/basic/content.md @@ -0,0 +1,104 @@ +--- +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 +other_dict: + key: value +--- + +(target)= + +# Header + +% comment + +````{note} +abcd *abc* [google](https://www.google.com) + + ```{warning} + xyz + ``` + +```` + +```{admonition} Title with [link](target2) +Content +``` + +(target2)= + +```{figure} example.jpg +--- +height: 40px +target: https://www.google.com +--- +Caption +``` + +![*alternative text*](example.jpg) + +<https://www.google.com> + +**{code}`` a=1{`} ``** + +{math}`sdfds` + +**$a=1$** + +$$b=2$$ + +$$c=2$$ (eq:label) + +{eq}`eq:label` + +`` a=1{`} `` + +| a | b | +|-----|--:| +| *a* | 2 | +| [link-a](https://google.com) | [link-b](https://python.org) | + +this +is +a +paragraph +% a comment 2 + +this is a second paragraph + +- a list + - a sub list +% a comment 3 +- new list? + +{ref}`target` {ref}`target2` + ++++ a block break + +[name][key] + +[key]: https://www.google.com "a title" + +``` +def func(a, b=1): + print(a) +``` + +Special substitution references: + +{sub-ref}`wordcount-words` words | {sub-ref}`wordcount-minutes` min read diff --git a/tests/test_sphinx/sourcedirs/basic/example.jpg b/tests/test_sphinx/sourcedirs/basic/example.jpg Binary files differnew file mode 100644 index 0000000..1c1e83e --- /dev/null +++ b/tests/test_sphinx/sourcedirs/basic/example.jpg diff --git a/tests/test_sphinx/sourcedirs/basic/index.md b/tests/test_sphinx/sourcedirs/basic/index.md new file mode 100644 index 0000000..1c9d9c7 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/basic/index.md @@ -0,0 +1,3 @@ +```{toctree} +content +``` diff --git a/tests/test_sphinx/sourcedirs/basic/orphan.md b/tests/test_sphinx/sourcedirs/basic/orphan.md new file mode 100644 index 0000000..c42b7c3 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/basic/orphan.md @@ -0,0 +1,5 @@ +--- +orphan: true +--- + +This is an orphan document, not specified in any toctrees. diff --git a/tests/test_sphinx/sourcedirs/commonmark_only/conf.py b/tests/test_sphinx/sourcedirs/commonmark_only/conf.py new file mode 100644 index 0000000..ef5f1d8 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/commonmark_only/conf.py @@ -0,0 +1,3 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] +myst_commonmark_only = True diff --git a/tests/test_sphinx/sourcedirs/commonmark_only/index.md b/tests/test_sphinx/sourcedirs/commonmark_only/index.md new file mode 100644 index 0000000..4212519 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/commonmark_only/index.md @@ -0,0 +1,7 @@ +# Test + +```{note} +hallo +``` + +{a}`b` diff --git a/tests/test_sphinx/sourcedirs/extended_syntaxes/conf.py b/tests/test_sphinx/sourcedirs/extended_syntaxes/conf.py new file mode 100644 index 0000000..9845000 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/extended_syntaxes/conf.py @@ -0,0 +1,20 @@ +extensions = ["myst_parser"] +language = "en" +exclude_patterns = ["_build"] +myst_disable_syntax = ["emphasis"] +myst_dmath_allow_space = False +myst_dmath_double_inline = True +mathjax_config = {} +myst_enable_extensions = [ + "dollarmath", + "amsmath", + "deflist", + "colon_fence", + "linkify", + "tasklist", +] +myst_number_code_blocks = ["typescript"] +myst_html_meta = { + "description lang=en": "meta description", + "property=og:locale": "en_US", +} diff --git a/tests/test_sphinx/sourcedirs/extended_syntaxes/fun-fish.png b/tests/test_sphinx/sourcedirs/extended_syntaxes/fun-fish.png Binary files differnew file mode 100644 index 0000000..c9a4997 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/extended_syntaxes/fun-fish.png diff --git a/tests/test_sphinx/sourcedirs/extended_syntaxes/index.md b/tests/test_sphinx/sourcedirs/extended_syntaxes/index.md new file mode 100644 index 0000000..e9fcea9 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/extended_syntaxes/index.md @@ -0,0 +1,67 @@ +# Test + +*disabled* + +$a=1$ + +$$x=5$$ + +$$x=5$$ (2) + +$ a=1 $ + +a $$c=3$$ b + +\begin{equation} +b=2 +\end{equation} + +```{math} +c=3 + +d=4 +``` + +Term **1** + +: Definition *1* + + second paragraph + +Term 2 + ~ Definition 2a + ~ Definition 2b + +Term 3 + : code block + + : > quote + + : other + +:::{figure-md} target +:class: other + +![fun-fish](fun-fish.png) + +This is a caption in **Markdown** +::: + +:::{figure-md} other-target +:class: other + +<img src="fun-fish.png" alt="fishy" class="bg-primary mb-1" width="200px"> + +This is a caption in **Markdown** +::: + +linkify URL: www.example.com + +- [ ] hallo +- [x] there + +Numbered code block: + +```typescript +type Result = "pass" | "fail" +``` diff --git a/tests/test_sphinx/sourcedirs/fieldlist/conf.py b/tests/test_sphinx/sourcedirs/fieldlist/conf.py new file mode 100644 index 0000000..1e3d992 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/fieldlist/conf.py @@ -0,0 +1,4 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] + +myst_enable_extensions = ["fieldlist"] diff --git a/tests/test_sphinx/sourcedirs/fieldlist/index.md b/tests/test_sphinx/sourcedirs/fieldlist/index.md new file mode 100644 index 0000000..2ed4856 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/fieldlist/index.md @@ -0,0 +1,19 @@ +:orphan: + +# Test + +:field: + +:*field*: content + +```{py:function} send_message(sender, priority) + +Send a message to a recipient + +:param str sender: The person sending the message +:param priority: The priority of the message, can be a number 1-5 +:type priority: int +:return: the message id +:rtype: int +:raises ValueError: if the message_body exceeds 160 characters +``` diff --git a/tests/test_sphinx/sourcedirs/footnotes/conf.py b/tests/test_sphinx/sourcedirs/footnotes/conf.py new file mode 100644 index 0000000..e1c5009 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/footnotes/conf.py @@ -0,0 +1,2 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] diff --git a/tests/test_sphinx/sourcedirs/footnotes/footnote_md.md b/tests/test_sphinx/sourcedirs/footnotes/footnote_md.md new file mode 100644 index 0000000..ca46d0e --- /dev/null +++ b/tests/test_sphinx/sourcedirs/footnotes/footnote_md.md @@ -0,0 +1,29 @@ +# Footnotes with Markdown + +[^c] + +```{note} +[^d] +``` + +[^a] + +[^a]: some footnote *text* + +[^b]: a footnote before its reference + +[^b] + +[^c]: a footnote referenced first + +[^d]: a footnote referenced in a directive + +[^123] [^123] + +[^123]: multiple references footnote + +[^x]: an unreferenced footnote + +[^e] + +> - [^e]: footnote definition in a block element diff --git a/tests/test_sphinx/sourcedirs/footnotes/footnote_rst.rst b/tests/test_sphinx/sourcedirs/footnotes/footnote_rst.rst new file mode 100644 index 0000000..219f98a --- /dev/null +++ b/tests/test_sphinx/sourcedirs/footnotes/footnote_rst.rst @@ -0,0 +1,26 @@ +Footnotes with rST +------------------ + +[#c]_ + +.. note:: + + [#d]_ + +[#a]_ + +.. [#a] some footnote *text* + +.. [#b] a footnote before its reference + +[#b]_ + +.. [#c] a footnote referenced first + +.. [#d] a footnote referenced in a directive + +[#123]_ [#123]_ + +.. [#123] multiple references footnote + +.. [#x] an unreferenced footnote diff --git a/tests/test_sphinx/sourcedirs/footnotes/index.md b/tests/test_sphinx/sourcedirs/footnotes/index.md new file mode 100644 index 0000000..4e4bc08 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/footnotes/index.md @@ -0,0 +1,4 @@ +```{toctree} +footnote_rst +footnote_md +``` diff --git a/tests/test_sphinx/sourcedirs/gettext/conf.py b/tests/test_sphinx/sourcedirs/gettext/conf.py new file mode 100644 index 0000000..0dff9fe --- /dev/null +++ b/tests/test_sphinx/sourcedirs/gettext/conf.py @@ -0,0 +1,4 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] +copyright = "2020, Executable Book Project" +myst_enable_extensions = ["deflist"] diff --git a/tests/test_sphinx/sourcedirs/gettext/fr/LC_MESSAGES/index.po b/tests/test_sphinx/sourcedirs/gettext/fr/LC_MESSAGES/index.po new file mode 100644 index 0000000..43e5320 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/gettext/fr/LC_MESSAGES/index.po @@ -0,0 +1,127 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) XXXX, Executable Book Project +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2000-01-01 00:00+0000\n" +"PO-Revision-Date: 2000-01-01 00:00+0000\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "**bold** text 1" +msgstr "texte 1 en **gras**" + +msgid "**bold** text 2" +msgstr "texte 2 en **gras**" + +msgid "**bold** text 3" +msgstr "texte 3 en **gras**" + +msgid "**bold** text 4" +msgstr "texte 4 en **gras**" + +msgid "**bold** text 5" +msgstr "texte 5 en **gras**" + +msgid "**bold** text 6" +msgstr "texte 6 en **gras**" + +msgid "**bold** text 7" +msgstr "texte 7 en **gras**" + +msgid "**bold** text 8" +msgstr "texte 8 en **gras**" + +msgid "**bold** text 9" +msgstr "texte 9 en **gras**" + +msgid "**bold** text 10" +msgstr "texte 10 en **gras**" + +msgid "<div markdown=1>\n" +"" +msgstr "<span markdown=1>\n" +"" + +msgid "**bold** text 11" +msgstr "texte 11 en **gras**" + +msgid "Extra ```backticks```" +msgstr "\"```Backtick```\" supplémentaire" + +msgid "</div>\n" +"" +msgstr "</span>\n" +"" + +msgid "**additional** text 12\n" +"" +msgstr "texte 12 **supplémentaire**\n" +"" + +msgid "**additional** text 13\n" +"" +msgstr "texte 13 **supplémentaire**\n" +"" + +msgid "{\n" +" \"additional\": \"text 14\"\n" +"}\n" +"" +msgstr "{\n" +" \"supplémentaire\": \"texte 14\"\n" +"}\n" +"" + +msgid "<h3>**additional** text 15</h3>\n" +"" +msgstr "<h3>texte 15 **supplémentaire**</h3>\n" +"" + +msgid ">>> print('doctest block')\n" +"doctest block\n" +"" +msgstr ">>> print('bloque doctest')\n" +"'bloque doctest\n" +"" + +msgid "<iframe src=\"http://sphinx-doc.org\"></iframe>" +msgstr "<iframe src=\"http://sphinx-doc.org/fr/master/\"></iframe>" + +msgid "![Fun Fish 1](fun-fish.png)" +msgstr "![Poisson amusant 1](poisson-amusant.png)" + +msgid "Fun Fish 1" +msgstr "Poisson amusant 1" + +msgid ".. image:: fun-fish.png" +msgstr ".. image:: poisson-amusant.png" + +msgid "Fun Fish 2" +msgstr "Poisson amusant 2" + +msgid "Fun Fish 3" +msgstr "Poisson amusant 3" + +msgid ".. image:: fun-fish.png\n" +" :alt: Fun Fish 1" +msgstr ".. image:: poisson-amusant.png\n" +" :alt: Poisson amusant 1" + +msgid ".. image:: fun-fish.png\n" +" :alt: Fun Fish 2" +msgstr ".. image:: poisson-amusant.png\n" +" :alt: Poisson amusant 2" + +msgid ".. image:: fun-fish.png\n" +" :alt: Fun Fish 3" +msgstr ".. image:: poisson-amusant.png\n" +" :alt: Poisson amusant 3" diff --git a/tests/test_sphinx/sourcedirs/gettext/fun-fish.png b/tests/test_sphinx/sourcedirs/gettext/fun-fish.png Binary files differnew file mode 100644 index 0000000..c9a4997 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/gettext/fun-fish.png diff --git a/tests/test_sphinx/sourcedirs/gettext/index.md b/tests/test_sphinx/sourcedirs/gettext/index.md new file mode 100644 index 0000000..a721944 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/gettext/index.md @@ -0,0 +1,63 @@ +# **bold** text 1 + +**bold** text 2 + +> **bold** text 3 + +```{eval-rst} +.. note:: + + **bold** text 4 +``` + +* **bold** text 5 + +1. **bold** text 6 + +**bold** text 7 +: **bold** text 8 + +| **bold** text 9 | +| ---------------- | +| **bold** text 10 | + +<div markdown=1> + +**bold** text 11 + +Extra ```backticks``` + +</div> + + **additional** text 12 + +``` +**additional** text 13 +``` + +```json +{ + "additional": "text 14" +} +``` + +<h3>**additional** text 15</h3> + +```python +>>> print('doctest block') +doctest block +``` + +```{raw} html +<iframe src="http://sphinx-doc.org"></iframe> +``` + +![Fun Fish 1](fun-fish.png) + +```{image} fun-fish.png +:alt: Fun Fish 2 +``` + +```{figure} fun-fish.png +:alt: Fun Fish 3 +``` diff --git a/tests/test_sphinx/sourcedirs/gettext/poisson-amusant.png b/tests/test_sphinx/sourcedirs/gettext/poisson-amusant.png Binary files differnew file mode 100644 index 0000000..c9a4997 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/gettext/poisson-amusant.png diff --git a/tests/test_sphinx/sourcedirs/heading_slug_func/conf.py b/tests/test_sphinx/sourcedirs/heading_slug_func/conf.py new file mode 100644 index 0000000..f6612b4 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/heading_slug_func/conf.py @@ -0,0 +1,6 @@ +from docutils.nodes import make_id + +extensions = ["myst_parser"] +exclude_patterns = ["_build"] +myst_heading_anchors = 2 +myst_heading_slug_func = make_id diff --git a/tests/test_sphinx/sourcedirs/heading_slug_func/index.md b/tests/test_sphinx/sourcedirs/heading_slug_func/index.md new file mode 100644 index 0000000..ec11ada --- /dev/null +++ b/tests/test_sphinx/sourcedirs/heading_slug_func/index.md @@ -0,0 +1,3 @@ +# Hyphen - 1 + +## Dot 1.1 diff --git a/tests/test_sphinx/sourcedirs/include_from_rst/conf.py b/tests/test_sphinx/sourcedirs/include_from_rst/conf.py new file mode 100644 index 0000000..a743e3c --- /dev/null +++ b/tests/test_sphinx/sourcedirs/include_from_rst/conf.py @@ -0,0 +1,2 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build", "include.md"] diff --git a/tests/test_sphinx/sourcedirs/include_from_rst/include.md b/tests/test_sphinx/sourcedirs/include_from_rst/include.md new file mode 100644 index 0000000..20f34b9 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/include_from_rst/include.md @@ -0,0 +1,5 @@ +# Markdown + +[target] + +[target]: http://example.com/ diff --git a/tests/test_sphinx/sourcedirs/include_from_rst/index.rst b/tests/test_sphinx/sourcedirs/include_from_rst/index.rst new file mode 100644 index 0000000..0bb3177 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/include_from_rst/index.rst @@ -0,0 +1,5 @@ +Title +===== + +.. include:: include.md + :parser: myst_parser.sphinx_ diff --git a/tests/test_sphinx/sourcedirs/includes/conf.py b/tests/test_sphinx/sourcedirs/includes/conf.py new file mode 100644 index 0000000..4cf4e93 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/conf.py @@ -0,0 +1,2 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build", "*.inc.md", "**/*.inc.md"] diff --git a/tests/test_sphinx/sourcedirs/includes/example1.jpg b/tests/test_sphinx/sourcedirs/includes/example1.jpg Binary files differnew file mode 100644 index 0000000..1c1e83e --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/example1.jpg diff --git a/tests/test_sphinx/sourcedirs/includes/include1.inc.md b/tests/test_sphinx/sourcedirs/includes/include1.inc.md new file mode 100644 index 0000000..3eea6ac --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/include1.inc.md @@ -0,0 +1,12 @@ +--- +orphan: true +--- +(inc_header)= +## A Sub-Heading in Include + +Some text with *syntax* + +```{include} subfolder/include2.inc.md +:relative-images: +:relative-docs: .. +``` diff --git a/tests/test_sphinx/sourcedirs/includes/include_code.py b/tests/test_sphinx/sourcedirs/includes/include_code.py new file mode 100644 index 0000000..3158954 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/include_code.py @@ -0,0 +1,2 @@ +def a_func(param): + print(param) diff --git a/tests/test_sphinx/sourcedirs/includes/include_literal.txt b/tests/test_sphinx/sourcedirs/includes/include_literal.txt new file mode 100644 index 0000000..5bb9418 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/include_literal.txt @@ -0,0 +1,6 @@ +This should be *literal* + +Lots +of +lines +so we can select some diff --git a/tests/test_sphinx/sourcedirs/includes/index.md b/tests/test_sphinx/sourcedirs/includes/index.md new file mode 100644 index 0000000..dc904e3 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/index.md @@ -0,0 +1,31 @@ +# Main Title + +```{include} include1.inc.md +``` + +{ref}`inc_header` + +```{include} include_code.py +:code: python +``` + +```{include} include_code.py +:code: python +:number-lines: 0 +``` + +```{include} include_literal.txt +:literal: +``` + +```{include} include_literal.txt +:literal: +:name: literal_ref +:start-line: 2 +:end-before: lines +:number-lines: 0 +``` + +### A Sub-sub-Heading + +some more text diff --git a/tests/test_sphinx/sourcedirs/includes/subfolder/example2.jpg b/tests/test_sphinx/sourcedirs/includes/subfolder/example2.jpg Binary files differnew file mode 100644 index 0000000..1c1e83e --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/subfolder/example2.jpg diff --git a/tests/test_sphinx/sourcedirs/includes/subfolder/include2.inc.md b/tests/test_sphinx/sourcedirs/includes/subfolder/include2.inc.md new file mode 100644 index 0000000..a6eebcf --- /dev/null +++ b/tests/test_sphinx/sourcedirs/includes/subfolder/include2.inc.md @@ -0,0 +1,21 @@ +## A Sub-Heading in Nested Include + +Some other text with **syntax** + +This relative path will refer to the importing file: + +```{figure} example1.jpg +Caption +``` + +This absolute path will refer to the project root (where the `conf.py` is): + +```{figure} /subfolder/example2.jpg +Caption +``` + +![alt](example2.jpg) + +![alt](https://example.com) + +[text](../index.md) diff --git a/tests/test_sphinx/sourcedirs/mathjax/conf.py b/tests/test_sphinx/sourcedirs/mathjax/conf.py new file mode 100644 index 0000000..b2a70c8 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/mathjax/conf.py @@ -0,0 +1,12 @@ +import sphinx + +extensions = ["myst_parser"] +exclude_patterns = ["_build"] + +if sphinx.version_info[0] <= 3: + mathjax_config = {"tex2jax": {"processClass": "other"}} +else: + mathjax3_config = {"options": {"processHtmlClass": "other"}} + +# this should remove the warning +# suppress_warnings = ["myst.mathjax"] diff --git a/tests/test_sphinx/sourcedirs/mathjax/index.md b/tests/test_sphinx/sourcedirs/mathjax/index.md new file mode 100644 index 0000000..0226511 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/mathjax/index.md @@ -0,0 +1,5 @@ +# Test + +```{math} +a = 1 +``` diff --git a/tests/test_sphinx/sourcedirs/references/conf.py b/tests/test_sphinx/sourcedirs/references/conf.py new file mode 100644 index 0000000..099510a --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references/conf.py @@ -0,0 +1,3 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] +myst_heading_anchors = 2 diff --git a/tests/test_sphinx/sourcedirs/references/file_link.txt b/tests/test_sphinx/sourcedirs/references/file_link.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references/file_link.txt diff --git a/tests/test_sphinx/sourcedirs/references/index.md b/tests/test_sphinx/sourcedirs/references/index.md new file mode 100644 index 0000000..c31bedb --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references/index.md @@ -0,0 +1,54 @@ +(title)= + +# Title with **nested** $a=1$ + +[](https://example.com) + +[plain text](https://example.com) + +[nested *syntax*](https://example.com) + +[](title) + +[plain text](title) + +[nested *syntax*](title) + +[](index.md) + +[plain text](index.md) + +[nested *syntax*](index.md) + +[download **link**](file_link.txt) + +[](subfolder/file_link2.txt) + +```{eval-rst} +.. _insidecodeblock: + +I am inside the eval-rst fence + +Referencing the :ref:`title` + +Still inside the codeblock insidecodeblock_ +``` + +I am outside the [fence](insidecodeblock) + +## Title *anchors* + +```{toctree} +other.md +subfolder/other2.md +``` + +[](#title-anchors) + +[](./#title-anchors) + +[](./other.md#title-anchors) + +[](other.md#title-anchors) + +[](subfolder/other2.md#title-anchors) diff --git a/tests/test_sphinx/sourcedirs/references/other.md b/tests/test_sphinx/sourcedirs/references/other.md new file mode 100644 index 0000000..9dfb9be --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references/other.md @@ -0,0 +1,3 @@ +# Title *anchors* + +a diff --git a/tests/test_sphinx/sourcedirs/references/subfolder/file_link2.txt b/tests/test_sphinx/sourcedirs/references/subfolder/file_link2.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references/subfolder/file_link2.txt diff --git a/tests/test_sphinx/sourcedirs/references/subfolder/other2.md b/tests/test_sphinx/sourcedirs/references/subfolder/other2.md new file mode 100644 index 0000000..6687282 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references/subfolder/other2.md @@ -0,0 +1,3 @@ +# Title *anchors* + +[](../index.md#title-anchors) diff --git a/tests/test_sphinx/sourcedirs/references_singlehtml/conf.py b/tests/test_sphinx/sourcedirs/references_singlehtml/conf.py new file mode 100644 index 0000000..0d760fc --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references_singlehtml/conf.py @@ -0,0 +1,6 @@ +extensions = [ + "myst_parser", +] +master_doc = "index" +exclude_patterns = ["_build"] +myst_heading_anchors = 2 diff --git a/tests/test_sphinx/sourcedirs/references_singlehtml/index.md b/tests/test_sphinx/sourcedirs/references_singlehtml/index.md new file mode 100644 index 0000000..d38d875 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references_singlehtml/index.md @@ -0,0 +1,15 @@ +# Title + +```{toctree} +other/index +``` + +{doc}`other/other` + +{any}`other/other` + +[](./other/other.md) + +[](#title) + +[](./other/other.md#other-title) diff --git a/tests/test_sphinx/sourcedirs/references_singlehtml/other/index.md b/tests/test_sphinx/sourcedirs/references_singlehtml/other/index.md new file mode 100644 index 0000000..3a4fb08 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references_singlehtml/other/index.md @@ -0,0 +1,6 @@ +# Other Index + +```{toctree} +other +other2 +``` diff --git a/tests/test_sphinx/sourcedirs/references_singlehtml/other/other.md b/tests/test_sphinx/sourcedirs/references_singlehtml/other/other.md new file mode 100644 index 0000000..a833673 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references_singlehtml/other/other.md @@ -0,0 +1,9 @@ +# Other Title + +{doc}`other2` + +{any}`other2` + +[](./other2.md) + +[](../index.md#title) diff --git a/tests/test_sphinx/sourcedirs/references_singlehtml/other/other2.md b/tests/test_sphinx/sourcedirs/references_singlehtml/other/other2.md new file mode 100644 index 0000000..f97239e --- /dev/null +++ b/tests/test_sphinx/sourcedirs/references_singlehtml/other/other2.md @@ -0,0 +1 @@ +# Other 2 Title diff --git a/tests/test_sphinx/sourcedirs/substitutions/conf.py b/tests/test_sphinx/sourcedirs/substitutions/conf.py new file mode 100644 index 0000000..57c5d68 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/substitutions/conf.py @@ -0,0 +1,4 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] +myst_enable_extensions = ["substitution"] +myst_substitutions = {"conf": "This was from the conf", "override": "From conf"} diff --git a/tests/test_sphinx/sourcedirs/substitutions/fun-fish.png b/tests/test_sphinx/sourcedirs/substitutions/fun-fish.png Binary files differnew file mode 100644 index 0000000..c9a4997 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/substitutions/fun-fish.png diff --git a/tests/test_sphinx/sourcedirs/substitutions/index.md b/tests/test_sphinx/sourcedirs/substitutions/index.md new file mode 100644 index 0000000..e1dd672 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/substitutions/index.md @@ -0,0 +1,56 @@ +--- +myst: + substitutions: + text: "- text" + text_with_nest: > + output + with *Markdown* + {{ nested }} + nested: nested substitution + admonition: | + prefix + + ```{note} + A note {{ nested }} + ``` + inline_admonition: | + ```{note} + Inline note + ``` + override: Overridden by front matter + +--- + +{{ text_with_nest }} + +{{ admonition }} + +a {{ text }} b + +c {{ text_with_nest }} d + +e {{ inline_admonition }} f + +{{ conf }} + +{{ override }} + +This will process the substitution + +```{parsed-literal} +{{ text_with_nest }} +``` + +This will not process the substitution + +```python +{{ text_with_nest }} +``` + +Using env and filters: + +{{ env.docname | upper }} + +```{toctree} +other.md +``` diff --git a/tests/test_sphinx/sourcedirs/substitutions/other.md b/tests/test_sphinx/sourcedirs/substitutions/other.md new file mode 100644 index 0000000..8681af4 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/substitutions/other.md @@ -0,0 +1,3 @@ +# Other + +{{ override }} diff --git a/tests/test_sphinx/sourcedirs/texi_table/conf.py b/tests/test_sphinx/sourcedirs/texi_table/conf.py new file mode 100644 index 0000000..e1c5009 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/texi_table/conf.py @@ -0,0 +1,2 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] diff --git a/tests/test_sphinx/sourcedirs/texi_table/index.md b/tests/test_sphinx/sourcedirs/texi_table/index.md new file mode 100644 index 0000000..9face4b --- /dev/null +++ b/tests/test_sphinx/sourcedirs/texi_table/index.md @@ -0,0 +1,3 @@ +| foo | bar | +| --- | --- | +| baz | bim | diff --git a/tests/test_sphinx/test_sphinx_builds.py b/tests/test_sphinx/test_sphinx_builds.py new file mode 100644 index 0000000..beba484 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds.py @@ -0,0 +1,565 @@ +"""Uses sphinx's pytest fixture to run builds. + +see conftest.py for fixture usage + +NOTE: sphinx 3 & 4 regress against different output files, +the major difference being sphinx 4 uses docutils 0.17, +which uses semantic HTML tags +(e.g. converting `<div class="section">` to `<section>`) +""" +import os +import re + +import pytest +import sphinx +from docutils import VersionInfo, __version_info__ + +SOURCE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "sourcedirs")) + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "basic"), + freshenv=True, + confoverrides={"myst_enable_extensions": ["dollarmath"]}, +) +def test_basic( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """basic test.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree( + app, + docname="content", + regress=True, + ) + finally: + get_sphinx_app_doctree( + app, + docname="content", + resolve=True, + regress=True, + ) + get_sphinx_app_output( + app, + filename="content.html", + regress_html=True, + regress_ext=f".sphinx{sphinx.version_info[0]}.html", + ) + + assert app.env.metadata["content"] == { + "author": "Chris Sewell", + "authors": ["Chris Sewell", "Chris Hodgraf"], + "organization": "EPFL", + "address": "1 Cedar Park Close\nThundersley\nEssex\n", + "contact": "https://example.com", + "version": "1.0", + "revision": "1.1", + "status": "good", + "date": "2/12/1985", + "copyright": "MIT", + "other": "Something else", + "other_dict": '{"key": "value"}', + "wordcount": {"minutes": 0, "words": 57}, + } + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "references"), + freshenv=True, + confoverrides={"myst_enable_extensions": ["dollarmath"]}, +) +def test_references( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """Test reference resolution.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree(app, docname="index", regress=True) + finally: + try: + get_sphinx_app_doctree(app, docname="index", resolve=True, regress=True) + finally: + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + replace={"Permalink to this headline": "Permalink to this heading"}, + ) + + +@pytest.mark.sphinx( + buildername="singlehtml", + srcdir=os.path.join(SOURCE_DIR, "references_singlehtml"), + freshenv=True, + confoverrides={"nitpicky": True}, +) +def test_references_singlehtml( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """Test reference resolution for singlehtml builds.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + # try: + # get_sphinx_app_doctree(app, docname="index", regress=True) + # finally: + # get_sphinx_app_doctree(app, docname="index", resolve=True, regress=True) + + try: + get_sphinx_app_doctree( + app, + docname="other/other", + regress=True, + replace={"other\\other.md": "other/other.md"}, + ) + finally: + get_sphinx_app_doctree( + app, + docname="other/other", + resolve=True, + regress=True, + replace={"other\\other.md": "other/other.md"}, + ) + + get_sphinx_app_output( + app, + filename="index.html", + buildername="singlehtml", + regress_html=True, + replace={"Permalink to this headline": "Permalink to this heading"}, + ) + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "heading_slug_func"), + freshenv=True, +) +def test_heading_slug_func( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """Test heading_slug_func configuration.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree(app, docname="index", regress=True) + finally: + get_sphinx_app_doctree(app, docname="index", resolve=True, regress=True) + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + replace={"Permalink to this headline": "Permalink to this heading"}, + ) + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "extended_syntaxes"), + freshenv=True, +) +def test_extended_syntaxes( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, + monkeypatch, +): + """test setting addition configuration values.""" + from myst_parser.mdit_to_docutils.sphinx_ import SphinxRenderer + + monkeypatch.setattr(SphinxRenderer, "_random_label", lambda self: "mock-uuid") + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree( + app, + docname="index", + regress=True, + ) + finally: + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + replace={"Permalink to this headline": "Permalink to this heading"}, + ) + + +@pytest.mark.sphinx( + buildername="html", srcdir=os.path.join(SOURCE_DIR, "includes"), freshenv=True +) +def test_includes( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """Test of include directive.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree( + app, + docname="index", + regress=True, + # fix for Windows CI + replace={ + r"subfolder\example2.jpg": "subfolder/example2.jpg", + r"subfolder\\example2.jpg": "subfolder/example2.jpg", + r"subfolder\\\\example2.jpg": "subfolder/example2.jpg", + }, + ) + finally: + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + replace={ + "Permalink to this headline": "Permalink to this heading", + r"'subfolder\\example2'": "'subfolder/example2'", + r'uri="subfolder\\example2"': 'uri="subfolder/example2"', + "_images/example21.jpg": "_images/example2.jpg", + }, + ) + + +@pytest.mark.skipif( + __version_info__ < VersionInfo(0, 17, 0, "final", 0, True), + reason="parser option added in docutils 0.17", +) +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "include_from_rst"), + freshenv=True, +) +def test_include_from_rst( + app, + status, + warning, + get_sphinx_app_doctree, +): + """Test of include directive inside RST file.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + get_sphinx_app_doctree( + app, + docname="index", + regress=True, + regress_ext=".xml", + ) + + +@pytest.mark.skipif( + __version_info__ < VersionInfo(0, 19, 0, "final", 0, True), + reason="Footnote HTML changed in docutils 0.19", +) +@pytest.mark.sphinx( + buildername="html", srcdir=os.path.join(SOURCE_DIR, "footnotes"), freshenv=True +) +def test_footnotes( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """Test of include directive.""" + app.build() + + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree(app, docname="footnote_md", regress=True) + finally: + get_sphinx_app_output( + app, + filename="footnote_md.html", + regress_html=True, + regress_ext=f".sphinx{sphinx.version_info[0]}.html", + ) + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "commonmark_only"), + freshenv=True, +) +def test_commonmark_only( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """test setting addition configuration values.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert "lexer name '{note}'" in warnings + + try: + get_sphinx_app_doctree(app, docname="index", regress=True) + finally: + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + replace={"Permalink to this headline": "Permalink to this heading"}, + ) + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "substitutions"), + freshenv=True, +) +def test_substitutions( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, + file_regression, +): + """test setting addition configuration values.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree(app, docname="index", regress=True) + file_regression.check( + get_sphinx_app_doctree(app, docname="other").pformat(), + extension=".other.xml", + ) + finally: + get_sphinx_app_output(app, filename="index.html", regress_html=True) + + +@pytest.mark.sphinx( + buildername="gettext", srcdir=os.path.join(SOURCE_DIR, "gettext"), freshenv=True +) +def test_gettext( + app, + status, + warning, + get_sphinx_app_output, + file_regression, +): + """Test gettext message extraction.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + output = get_sphinx_app_output(app, filename="index.pot", buildername="gettext") + output = re.sub(r"POT-Creation-Date: [0-9: +-]+", "POT-Creation-Date: ", output) + output = re.sub(r"Copyright \(C\) [0-9]{4}", "Copyright (C) XXXX", output) + + file_regression.check(output, extension=".pot") + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "gettext"), + freshenv=True, + confoverrides={"language": "fr", "gettext_compact": False, "locale_dirs": ["."]}, +) +def test_gettext_html( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """Test gettext message extraction.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree( + app, + docname="index", + regress=True, + ) + finally: + get_sphinx_app_doctree( + app, + docname="index", + resolve=True, + regress=True, + ) + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + regress_ext=f".sphinx{sphinx.version_info[0]}.html", + ) + + +@pytest.mark.sphinx( + buildername="gettext", + srcdir=os.path.join(SOURCE_DIR, "gettext"), + freshenv=True, + confoverrides={ + "gettext_additional_targets": [ + "index", + "literal-block", + "doctest-block", + "raw", + "image", + ], + }, +) +def test_gettext_additional_targets( + app, + status, + warning, + get_sphinx_app_output, + file_regression, +): + """Test gettext message extraction.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + output = get_sphinx_app_output(app, filename="index.pot", buildername="gettext") + output = re.sub(r"POT-Creation-Date: [0-9: +-]+", "POT-Creation-Date: ", output) + output = re.sub(r"Copyright \(C\) [0-9]{4}", "Copyright (C) XXXX", output) + + file_regression.check(output, extension=".pot") + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "mathjax"), + freshenv=True, + confoverrides={"myst_enable_extensions": ["dollarmath"]}, +) +def test_mathjax_warning( + app, + status, + warning, +): + """Test mathjax config override warning.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert ( + "overridden by myst-parser: 'other' -> 'tex2jax_process|mathjax_process|math|output_area'" + in warnings + ) + + +@pytest.mark.sphinx( + buildername="html", + srcdir=os.path.join(SOURCE_DIR, "fieldlist"), + freshenv=True, +) +def test_fieldlist_extension( + app, + status, + warning, + get_sphinx_app_doctree, + get_sphinx_app_output, +): + """test setting addition configuration values.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" + + try: + get_sphinx_app_doctree( + app, + docname="index", + regress=True, + # changed in: + # https://www.sphinx-doc.org/en/master/changes.html#release-4-4-0-released-jan-17-2022 + replace={ + ( + '<literal_strong py:class="True" ' + 'py:module="True" refspecific="True">' + ): "<literal_strong>" + }, + ) + finally: + get_sphinx_app_output( + app, + filename="index.html", + regress_html=True, + regress_ext=f".sphinx{sphinx.version_info[0]}.html", + ) + + +@pytest.mark.sphinx( + buildername="texinfo", + srcdir=os.path.join(SOURCE_DIR, "texi_table"), + freshenv=True, +) +def test_texinfo_table( + app, + status, + warning, +): + """Test that tables can be built with the Texinfo builder.""" + app.build() + assert "build succeeded" in status.getvalue() # Build succeeded + warnings = warning.getvalue().strip() + assert warnings == "" diff --git a/tests/test_sphinx/test_sphinx_builds/test_basic.resolved.xml b/tests/test_sphinx/test_sphinx_builds/test_basic.resolved.xml new file mode 100644 index 0000000..8a12765 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_basic.resolved.xml @@ -0,0 +1,154 @@ +<document source="content.md"> + <topic classes="dedication"> + <title> + Dedication + <paragraph> + To my + <emphasis> + homies + + <topic classes="abstract"> + <title> + Abstract + <paragraph> + Something something + <strong> + dark + side + <target refid="target"> + <section classes="tex2jax_ignore mathjax_ignore" ids="header target" names="header target"> + <title> + Header + <comment xml:space="preserve"> + comment + <note> + <paragraph> + abcd + <emphasis> + abc + + <reference refuri="https://www.google.com"> + google + <warning> + <paragraph> + xyz + <admonition classes="admonition-title-with-link-target2"> + <title> + Title with + <reference internal="True" refid="target2"> + <inline classes="std std-ref"> + link + <paragraph> + Content + <target refid="target2"> + <figure ids="id1 target2" names="target2"> + <reference refuri="https://www.google.com"> + <image candidates="{'*': 'example.jpg'}" height="40px" uri="example.jpg"> + <caption> + Caption + <paragraph> + <image alt="alternative text" candidates="{'*': 'example.jpg'}" uri="example.jpg"> + <paragraph> + <reference refuri="https://www.google.com"> + https://www.google.com + <paragraph> + <strong> + <literal classes="code"> + a=1{`} + <paragraph> + <math> + sdfds + <paragraph> + <strong> + <math> + a=1 + <math_block nowrap="False" number="True" xml:space="preserve"> + b=2 + <target refid="equation-eq-label"> + <math_block docname="content" ids="equation-eq-label" label="eq:label" nowrap="False" number="1" xml:space="preserve"> + c=2 + <paragraph> + <reference internal="True" refid="equation-eq-label"> + (1) + <paragraph> + <literal> + a=1{`} + <table classes="colwidths-auto"> + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + a + <entry classes="text-right"> + <paragraph> + b + <tbody> + <row> + <entry> + <paragraph> + <emphasis> + a + <entry classes="text-right"> + <paragraph> + 2 + <row> + <entry> + <paragraph> + <reference refuri="https://google.com"> + link-a + <entry classes="text-right"> + <paragraph> + <reference refuri="https://python.org"> + link-b + <paragraph> + this + + is + + a + + paragraph + <comment xml:space="preserve"> + a comment 2 + <paragraph> + this is a second paragraph + <bullet_list bullet="-"> + <list_item> + <paragraph> + a list + <bullet_list bullet="-"> + <list_item> + <paragraph> + a sub list + <comment xml:space="preserve"> + a comment 3 + <bullet_list bullet="-"> + <list_item> + <paragraph> + new list? + <paragraph> + <reference internal="True" refid="target"> + <inline classes="std std-ref"> + Header + + <reference internal="True" refid="target2"> + <inline classes="std std-ref"> + Caption + <comment classes="block_break" xml:space="preserve"> + a block break + <paragraph> + <reference refuri="https://www.google.com" title="a title"> + name + <literal_block language="default" linenos="False" xml:space="preserve"> + def func(a, b=1): + print(a) + <paragraph> + Special substitution references: + <paragraph> + 57 + words | + 0 + min read diff --git a/tests/test_sphinx/test_sphinx_builds/test_basic.sphinx4.html b/tests/test_sphinx/test_sphinx_builds/test_basic.sphinx4.html new file mode 100644 index 0000000..743f7a1 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_basic.sphinx4.html @@ -0,0 +1,252 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <div class="dedication topic"> + <p class="topic-title"> + Dedication + </p> + <p> + To my + <em> + homies + </em> + </p> + </div> + <div class="abstract topic"> + <p class="topic-title"> + Abstract + </p> + <p> + Something something + <strong> + dark + </strong> + side + </p> + </div> + <section class="tex2jax_ignore mathjax_ignore" id="header"> + <span id="target"> + </span> + <h1> + Header + <a class="headerlink" href="#header" title="Permalink to this headline"> + ¶ + </a> + </h1> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + abcd + <em> + abc + </em> + <a class="reference external" href="https://www.google.com"> + google + </a> + </p> + <div class="admonition warning"> + <p class="admonition-title"> + Warning + </p> + <p> + xyz + </p> + </div> + </div> + <div class="admonition-title-with-link-target2 admonition"> + <p class="admonition-title"> + Title with + <a class="reference internal" href="#target2"> + <span class="std std-ref"> + link + </span> + </a> + </p> + <p> + Content + </p> + </div> + <figure class="align-default" id="id1"> + <span id="target2"> + </span> + <a class="reference external image-reference" href="https://www.google.com"> + <img alt="_images/example.jpg" src="_images/example.jpg" style="height: 40px;"/> + </a> + <figcaption> + <p> + <span class="caption-text"> + Caption + </span> + <a class="headerlink" href="#id1" title="Permalink to this image"> + ¶ + </a> + </p> + </figcaption> + </figure> + <p> + <img alt="alternative text" src="_images/example.jpg"/> + </p> + <p> + <a class="reference external" href="https://www.google.com"> + https://www.google.com + </a> + </p> + <p> + <strong> + <code class="code docutils literal notranslate"> + <span class="pre"> + a=1{`} + </span> + </code> + </strong> + </p> + <p> + <span class="math notranslate nohighlight"> + \(sdfds\) + </span> + </p> + <p> + <strong> + <span class="math notranslate nohighlight"> + \(a=1\) + </span> + </strong> + </p> + <div class="math notranslate nohighlight"> + \[b=2\] + </div> + <div class="math notranslate nohighlight" id="equation-eq-label"> + <span class="eqno"> + (1) + <a class="headerlink" href="#equation-eq-label" title="Permalink to this equation"> + ¶ + </a> + </span> + \[c=2\] + </div> + <p> + <a class="reference internal" href="#equation-eq-label"> + (1) + </a> + </p> + <p> + <code class="docutils literal notranslate"> + <span class="pre"> + a=1{`} + </span> + </code> + </p> + <table class="colwidths-auto docutils align-default"> + <thead> + <tr class="row-odd"> + <th class="head"> + <p> + a + </p> + </th> + <th class="text-right head"> + <p> + b + </p> + </th> + </tr> + </thead> + <tbody> + <tr class="row-even"> + <td> + <p> + <em> + a + </em> + </p> + </td> + <td class="text-right"> + <p> + 2 + </p> + </td> + </tr> + <tr class="row-odd"> + <td> + <p> + <a class="reference external" href="https://google.com"> + link-a + </a> + </p> + </td> + <td class="text-right"> + <p> + <a class="reference external" href="https://python.org"> + link-b + </a> + </p> + </td> + </tr> + </tbody> + </table> + <p> + this +is +a +paragraph + </p> + <p> + this is a second paragraph + </p> + <ul class="simple"> + <li> + <p> + a list + </p> + <ul> + <li> + <p> + a sub list + </p> + </li> + </ul> + </li> + </ul> + <ul class="simple"> + <li> + <p> + new list? + </p> + </li> + </ul> + <p> + <a class="reference internal" href="#target"> + <span class="std std-ref"> + Header + </span> + </a> + <a class="reference internal" href="#target2"> + <span class="std std-ref"> + Caption + </span> + </a> + </p> + <p> + <a class="reference external" href="https://www.google.com"> + name + </a> + </p> + <div class="highlight-default notranslate"> + <div class="highlight"> + <pre><span></span><span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span> + <span class="nb">print</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> +</pre> + </div> + </div> + <p> + Special substitution references: + </p> + <p> + 57 words | 0 min read + </p> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_basic.sphinx5.html b/tests/test_sphinx/test_sphinx_builds/test_basic.sphinx5.html new file mode 100644 index 0000000..9813b70 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_basic.sphinx5.html @@ -0,0 +1,252 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <div class="topic dedication" role="doc-dedication"> + <p class="topic-title"> + Dedication + </p> + <p> + To my + <em> + homies + </em> + </p> + </div> + <div class="topic abstract" role="doc-abstract"> + <p class="topic-title"> + Abstract + </p> + <p> + Something something + <strong> + dark + </strong> + side + </p> + </div> + <section class="tex2jax_ignore mathjax_ignore" id="header"> + <span id="target"> + </span> + <h1> + Header + <a class="headerlink" href="#header" title="Permalink to this heading"> + ¶ + </a> + </h1> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + abcd + <em> + abc + </em> + <a class="reference external" href="https://www.google.com"> + google + </a> + </p> + <div class="admonition warning"> + <p class="admonition-title"> + Warning + </p> + <p> + xyz + </p> + </div> + </div> + <div class="admonition-title-with-link-target2 admonition"> + <p class="admonition-title"> + Title with + <a class="reference internal" href="#target2"> + <span class="std std-ref"> + link + </span> + </a> + </p> + <p> + Content + </p> + </div> + <figure class="align-default" id="id1"> + <span id="target2"> + </span> + <a class="reference external image-reference" href="https://www.google.com"> + <img alt="_images/example.jpg" src="_images/example.jpg" style="height: 40px;"/> + </a> + <figcaption> + <p> + <span class="caption-text"> + Caption + </span> + <a class="headerlink" href="#id1" title="Permalink to this image"> + ¶ + </a> + </p> + </figcaption> + </figure> + <p> + <img alt="alternative text" src="_images/example.jpg"/> + </p> + <p> + <a class="reference external" href="https://www.google.com"> + https://www.google.com + </a> + </p> + <p> + <strong> + <code class="code docutils literal notranslate"> + <span class="pre"> + a=1{`} + </span> + </code> + </strong> + </p> + <p> + <span class="math notranslate nohighlight"> + \(sdfds\) + </span> + </p> + <p> + <strong> + <span class="math notranslate nohighlight"> + \(a=1\) + </span> + </strong> + </p> + <div class="math notranslate nohighlight"> + \[b=2\] + </div> + <div class="math notranslate nohighlight" id="equation-eq-label"> + <span class="eqno"> + (1) + <a class="headerlink" href="#equation-eq-label" title="Permalink to this equation"> + ¶ + </a> + </span> + \[c=2\] + </div> + <p> + <a class="reference internal" href="#equation-eq-label"> + (1) + </a> + </p> + <p> + <code class="docutils literal notranslate"> + <span class="pre"> + a=1{`} + </span> + </code> + </p> + <table class="docutils align-default"> + <thead> + <tr class="row-odd"> + <th class="head"> + <p> + a + </p> + </th> + <th class="head text-right"> + <p> + b + </p> + </th> + </tr> + </thead> + <tbody> + <tr class="row-even"> + <td> + <p> + <em> + a + </em> + </p> + </td> + <td class="text-right"> + <p> + 2 + </p> + </td> + </tr> + <tr class="row-odd"> + <td> + <p> + <a class="reference external" href="https://google.com"> + link-a + </a> + </p> + </td> + <td class="text-right"> + <p> + <a class="reference external" href="https://python.org"> + link-b + </a> + </p> + </td> + </tr> + </tbody> + </table> + <p> + this +is +a +paragraph + </p> + <p> + this is a second paragraph + </p> + <ul class="simple"> + <li> + <p> + a list + </p> + <ul> + <li> + <p> + a sub list + </p> + </li> + </ul> + </li> + </ul> + <ul class="simple"> + <li> + <p> + new list? + </p> + </li> + </ul> + <p> + <a class="reference internal" href="#target"> + <span class="std std-ref"> + Header + </span> + </a> + <a class="reference internal" href="#target2"> + <span class="std std-ref"> + Caption + </span> + </a> + </p> + <p> + <a class="reference external" href="https://www.google.com"> + name + </a> + </p> + <div class="highlight-default notranslate"> + <div class="highlight"> + <pre><span></span><span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span> + <span class="nb">print</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> +</pre> + </div> + </div> + <p> + Special substitution references: + </p> + <p> + 57 words | 0 min read + </p> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_basic.xml b/tests/test_sphinx/test_sphinx_builds/test_basic.xml new file mode 100644 index 0000000..34b0e3c --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_basic.xml @@ -0,0 +1,155 @@ +<document source="content.md"> + <topic classes="dedication"> + <title> + Dedication + <paragraph> + To my + <emphasis> + homies + + <topic classes="abstract"> + <title> + Abstract + <paragraph> + Something something + <strong> + dark + side + <target refid="target"> + <section classes="tex2jax_ignore mathjax_ignore" ids="header target" names="header target"> + <title> + Header + <comment xml:space="preserve"> + comment + <note> + <paragraph> + abcd + <emphasis> + abc + + <reference refuri="https://www.google.com"> + google + <warning> + <paragraph> + xyz + <admonition classes="admonition-title-with-link-target2"> + <title> + Title with + <pending_xref refdoc="content" refdomain="True" refexplicit="True" reftarget="target2" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + link + <paragraph> + Content + <target refid="target2"> + <figure ids="id1 target2" names="target2"> + <reference refuri="https://www.google.com"> + <image candidates="{'*': 'example.jpg'}" height="40px" uri="example.jpg"> + <caption> + Caption + <paragraph> + <image alt="alternative text" candidates="{'*': 'example.jpg'}" uri="example.jpg"> + <paragraph> + <reference refuri="https://www.google.com"> + https://www.google.com + <paragraph> + <strong> + <literal classes="code"> + a=1{`} + <paragraph> + <math> + sdfds + <paragraph> + <strong> + <math> + a=1 + <math_block nowrap="False" number="True" xml:space="preserve"> + b=2 + <target refid="equation-eq-label"> + <math_block docname="content" ids="equation-eq-label" label="eq:label" nowrap="False" number="1" xml:space="preserve"> + c=2 + <paragraph> + <pending_xref refdoc="content" refdomain="math" refexplicit="False" reftarget="eq:label" reftype="eq" refwarn="True"> + <literal classes="xref eq"> + eq:label + <paragraph> + <literal> + a=1{`} + <table classes="colwidths-auto"> + <tgroup cols="2"> + <colspec colwidth="50"> + <colspec colwidth="50"> + <thead> + <row> + <entry> + <paragraph> + a + <entry classes="text-right"> + <paragraph> + b + <tbody> + <row> + <entry> + <paragraph> + <emphasis> + a + <entry classes="text-right"> + <paragraph> + 2 + <row> + <entry> + <paragraph> + <reference refuri="https://google.com"> + link-a + <entry classes="text-right"> + <paragraph> + <reference refuri="https://python.org"> + link-b + <paragraph> + this + + is + + a + + paragraph + <comment xml:space="preserve"> + a comment 2 + <paragraph> + this is a second paragraph + <bullet_list bullet="-"> + <list_item> + <paragraph> + a list + <bullet_list bullet="-"> + <list_item> + <paragraph> + a sub list + <comment xml:space="preserve"> + a comment 3 + <bullet_list bullet="-"> + <list_item> + <paragraph> + new list? + <paragraph> + <pending_xref refdoc="content" refdomain="std" refexplicit="False" reftarget="target" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + target + + <pending_xref refdoc="content" refdomain="std" refexplicit="False" reftarget="target2" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + target2 + <comment classes="block_break" xml:space="preserve"> + a block break + <paragraph> + <reference refuri="https://www.google.com" title="a title"> + name + <literal_block language="default" xml:space="preserve"> + def func(a, b=1): + print(a) + <paragraph> + Special substitution references: + <paragraph> + 57 + words | + 0 + min read diff --git a/tests/test_sphinx/test_sphinx_builds/test_commonmark_only.html b/tests/test_sphinx/test_sphinx_builds/test_commonmark_only.html new file mode 100644 index 0000000..381996f --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_commonmark_only.html @@ -0,0 +1,28 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="test"> + <h1> + Test + <a class="headerlink" href="#test" title="Permalink to this heading"> + ¶ + </a> + </h1> + <div class="highlight-{note} notranslate"> + <div class="highlight"> + <pre><span></span>hallo +</pre> + </div> + </div> + <p> + {a} + <code class="docutils literal notranslate"> + <span class="pre"> + b + </span> + </code> + </p> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_commonmark_only.xml b/tests/test_sphinx/test_sphinx_builds/test_commonmark_only.xml new file mode 100644 index 0000000..d685466 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_commonmark_only.xml @@ -0,0 +1,10 @@ +<document source="index.md"> + <section ids="test" names="test"> + <title> + Test + <literal_block language="{note}" xml:space="preserve"> + hallo + <paragraph> + {a} + <literal> + b diff --git a/tests/test_sphinx/test_sphinx_builds/test_extended_syntaxes.html b/tests/test_sphinx/test_sphinx_builds/test_extended_syntaxes.html new file mode 100644 index 0000000..cc6e85b --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_extended_syntaxes.html @@ -0,0 +1,166 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section class="tex2jax_ignore mathjax_ignore" id="test"> + <h1> + Test + <a class="headerlink" href="#test" title="Permalink to this heading"> + ¶ + </a> + </h1> + <p> + *disabled* + </p> + <p> + <span class="math notranslate nohighlight"> + \(a=1\) + </span> + </p> + <div class="math notranslate nohighlight"> + \[x=5\] + </div> + <div class="math notranslate nohighlight" id="equation-2"> + <span class="eqno"> + (1) + <a class="headerlink" href="#equation-2" title="Permalink to this equation"> + ¶ + </a> + </span> + \[x=5\] + </div> + <p> + $ a=1 $ + </p> + <p> + a + <div class="math notranslate nohighlight"> + \[c=3\] + </div> + b + </p> + <div class="amsmath math notranslate nohighlight" id="equation-mock-uuid"> + <span class="eqno"> + (2) + <a class="headerlink" href="#equation-mock-uuid" title="Permalink to this equation"> + ¶ + </a> + </span> + \[\begin{equation} +b=2 +\end{equation}\] + </div> + <div class="math notranslate nohighlight"> + \[ \begin{align}\begin{aligned}c=3\\d=4\end{aligned}\end{align} \] + </div> + <dl class="simple myst"> + <dt> + Term **1** + </dt> + <dd> + <p> + Definition *1* + </p> + <p> + second paragraph + </p> + </dd> + <dt> + Term 2 + </dt> + <dd> + <p> + Definition 2a + </p> + </dd> + <dd> + <p> + Definition 2b + </p> + </dd> + <dt> + Term 3 + </dt> + <dd> + <div class="highlight-none notranslate"> + <div class="highlight"> + <pre><span></span>code block +</pre> + </div> + </div> + </dd> + <dd> + <blockquote> + <div> + <p> + quote + </p> + </div> + </blockquote> + </dd> + <dd> + <p> + other + </p> + </dd> + </dl> + <figure class="other align-default" id="target"> + <img alt="fun-fish" src="_images/fun-fish.png"/> + <figcaption> + <p> + <span class="caption-text"> + This is a caption in **Markdown** + </span> + <a class="headerlink" href="#target" title="Permalink to this image"> + ¶ + </a> + </p> + </figcaption> + </figure> + <figure class="other align-default" id="other-target"> + <a class="bg-primary mb-1 reference internal image-reference" href="_images/fun-fish.png"> + <img alt="fishy" class="bg-primary mb-1" src="_images/fun-fish.png" style="width: 200px;"/> + </a> + <figcaption> + <p> + <span class="caption-text"> + This is a caption in **Markdown** + </span> + <a class="headerlink" href="#other-target" title="Permalink to this image"> + ¶ + </a> + </p> + </figcaption> + </figure> + <p> + linkify URL: + <a class="reference external" href="http://www.example.com"> + www.example.com + </a> + </p> + <ul class="contains-task-list simple"> + <li class="task-list-item"> + <p> + <input class="task-list-item-checkbox" disabled="disabled" type="checkbox"/> + hallo + </p> + </li> + <li class="task-list-item"> + <p> + <input checked="checked" class="task-list-item-checkbox" disabled="disabled" type="checkbox"/> + there + </p> + </li> + </ul> + <p> + Numbered code block: + </p> + <div class="highlight-typescript notranslate"> + <div class="highlight"> + <pre><span></span><span class="linenos">1</span><span class="kr">type</span> <span class="nx">Result</span> <span class="o">=</span> <span class="s2">"pass"</span> <span class="o">|</span> <span class="s2">"fail"</span> +</pre> + </div> + </div> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_extended_syntaxes.xml b/tests/test_sphinx/test_sphinx_builds/test_extended_syntaxes.xml new file mode 100644 index 0000000..8cefbe3 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_extended_syntaxes.xml @@ -0,0 +1,90 @@ +<document source="index.md"> + <meta content="meta description" lang="en" name="description"> + <meta content="en_US" property="og:locale"> + <section classes="tex2jax_ignore mathjax_ignore" ids="test" names="test"> + <title> + Test + <paragraph> + *disabled* + <paragraph> + <math> + a=1 + <math_block nowrap="False" number="True" xml:space="preserve"> + x=5 + <target refid="equation-2"> + <math_block docname="index" ids="equation-2" label="2" nowrap="False" number="1" xml:space="preserve"> + x=5 + <paragraph> + $ a=1 $ + <paragraph> + a + <math_block nowrap="False" number="True" xml:space="preserve"> + c=3 + b + <target refid="equation-mock-uuid"> + <math_block classes="amsmath" docname="index" ids="equation-mock-uuid" label="mock-uuid" nowrap="True" number="2" xml:space="preserve"> + \begin{equation} + b=2 + \end{equation} + <math_block docname="index" label="True" nowrap="False" number="True" xml:space="preserve"> + c=3 + + d=4 + <definition_list classes="simple myst"> + <definition_list_item> + <term> + Term **1** + <definition> + <paragraph> + Definition *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 + <figure classes="other" ids="target" names="target"> + <image alt="fun-fish" candidates="{'*': 'fun-fish.png'}" uri="fun-fish.png"> + <caption> + This is a caption in **Markdown** + <figure classes="other" ids="other-target" names="other-target"> + <image alt="fishy" candidates="{'*': 'fun-fish.png'}" classes="bg-primary mb-1" uri="fun-fish.png" width="200px"> + <caption> + This is a caption in **Markdown** + <paragraph> + linkify URL: + <reference refuri="http://www.example.com"> + www.example.com + <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"> + hallo + <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"> + there + <paragraph> + Numbered code block: + <literal_block language="typescript" linenos="True" xml:space="preserve"> + type Result = "pass" | "fail" diff --git a/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.sphinx4.html b/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.sphinx4.html new file mode 100644 index 0000000..bef86e9 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.sphinx4.html @@ -0,0 +1,131 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="test"> + <h1> + Test + <a class="headerlink" href="#test" title="Permalink to this headline"> + ¶ + </a> + </h1> + <dl class="myst field-list simple"> + <dt class="field-odd"> + field + </dt> + <dd class="field-odd"> + <p> + </p> + </dd> + <dt class="field-even"> + <em> + field + </em> + </dt> + <dd class="field-even"> + <p> + content + </p> + </dd> + </dl> + <dl class="py function"> + <dt class="sig sig-object py" id="send_message"> + <span class="sig-name descname"> + <span class="pre"> + send_message + </span> + </span> + <span class="sig-paren"> + ( + </span> + <em class="sig-param"> + <span class="n"> + <span class="pre"> + sender + </span> + </span> + </em> + , + <em class="sig-param"> + <span class="n"> + <span class="pre"> + priority + </span> + </span> + </em> + <span class="sig-paren"> + ) + </span> + <a class="headerlink" href="#send_message" title="Permalink to this definition"> + ¶ + </a> + </dt> + <dd> + <p> + Send a message to a recipient + </p> + <dl class="myst field-list simple"> + <dt class="field-odd"> + Parameters + </dt> + <dd class="field-odd"> + <ul class="simple"> + <li> + <p> + <strong> + sender + </strong> + ( + <em> + str + </em> + ) – The person sending the message + </p> + </li> + <li> + <p> + <strong> + priority + </strong> + ( + <em> + int + </em> + ) – The priority of the message, can be a number 1-5 + </p> + </li> + </ul> + </dd> + <dt class="field-even"> + Returns + </dt> + <dd class="field-even"> + <p> + the message id + </p> + </dd> + <dt class="field-odd"> + Return type + </dt> + <dd class="field-odd"> + <p> + int + </p> + </dd> + <dt class="field-even"> + Raises + </dt> + <dd class="field-even"> + <p> + <strong> + ValueError + </strong> + – if the message_body exceeds 160 characters + </p> + </dd> + </dl> + </dd> + </dl> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.sphinx5.html b/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.sphinx5.html new file mode 100644 index 0000000..8548f3d --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.sphinx5.html @@ -0,0 +1,149 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="test"> + <h1> + Test + <a class="headerlink" href="#test" title="Permalink to this heading"> + ¶ + </a> + </h1> + <dl class="myst field-list simple"> + <dt class="field-odd"> + field + <span class="colon"> + : + </span> + </dt> + <dd class="field-odd"> + <p> + </p> + </dd> + <dt class="field-even"> + <em> + field + </em> + <span class="colon"> + : + </span> + </dt> + <dd class="field-even"> + <p> + content + </p> + </dd> + </dl> + <dl class="py function"> + <dt class="sig sig-object py" id="send_message"> + <span class="sig-name descname"> + <span class="pre"> + send_message + </span> + </span> + <span class="sig-paren"> + ( + </span> + <em class="sig-param"> + <span class="n"> + <span class="pre"> + sender + </span> + </span> + </em> + , + <em class="sig-param"> + <span class="n"> + <span class="pre"> + priority + </span> + </span> + </em> + <span class="sig-paren"> + ) + </span> + <a class="headerlink" href="#send_message" title="Permalink to this definition"> + ¶ + </a> + </dt> + <dd> + <p> + Send a message to a recipient + </p> + <dl class="myst field-list simple"> + <dt class="field-odd"> + Parameters + <span class="colon"> + : + </span> + </dt> + <dd class="field-odd"> + <ul class="simple"> + <li> + <p> + <strong> + sender + </strong> + ( + <em> + str + </em> + ) – The person sending the message + </p> + </li> + <li> + <p> + <strong> + priority + </strong> + ( + <em> + int + </em> + ) – The priority of the message, can be a number 1-5 + </p> + </li> + </ul> + </dd> + <dt class="field-even"> + Returns + <span class="colon"> + : + </span> + </dt> + <dd class="field-even"> + <p> + the message id + </p> + </dd> + <dt class="field-odd"> + Return type + <span class="colon"> + : + </span> + </dt> + <dd class="field-odd"> + <p> + int + </p> + </dd> + <dt class="field-even"> + Raises + <span class="colon"> + : + </span> + </dt> + <dd class="field-even"> + <p> + <strong> + ValueError + </strong> + – if the message_body exceeds 160 characters + </p> + </dd> + </dl> + </dd> + </dl> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.xml b/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.xml new file mode 100644 index 0000000..1fb20d4 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_fieldlist_extension.xml @@ -0,0 +1,82 @@ +<document source="index.md"> + <section ids="test" names="test"> + <title> + Test + <field_list classes="myst"> + <field> + <field_name> + field + <field_body> + <field> + <field_name> + <emphasis> + field + <field_body> + <paragraph> + content + <index entries="('pair',\ 'built-in\ function;\ send_message()',\ 'send_message',\ '',\ None)"> + <desc classes="py function" desctype="function" domain="py" noindex="False" objtype="function"> + <desc_signature class="" classes="sig sig-object" fullname="send_message" ids="send_message" module="True"> + <desc_name classes="sig-name descname" xml:space="preserve"> + send_message + <desc_parameterlist xml:space="preserve"> + <desc_parameter xml:space="preserve"> + <desc_sig_name classes="n"> + sender + <desc_parameter xml:space="preserve"> + <desc_sig_name classes="n"> + priority + <desc_content> + <paragraph> + Send a message to a recipient + <field_list classes="myst"> + <field> + <field_name> + Parameters + <field_body> + <bullet_list> + <list_item> + <paragraph> + <literal_strong> + sender + ( + <pending_xref py:class="True" py:module="True" refdomain="py" refexplicit="False" refspecific="True" reftarget="str" reftype="class"> + <literal_emphasis> + str + ) + – + The person sending the message + <list_item> + <paragraph> + <literal_strong> + priority + ( + <pending_xref py:class="True" py:module="True" refdomain="py" refexplicit="False" refspecific="True" reftarget="int" reftype="class"> + <literal_emphasis> + int + ) + – + The priority of the message, can be a number 1-5 + <field> + <field_name> + Returns + <field_body> + <paragraph> + the message id + <field> + <field_name> + Return type + <field_body> + <paragraph> + <pending_xref py:class="True" py:module="True" refdomain="py" refexplicit="False" refspecific="True" reftarget="int" reftype="class"> + int + <field> + <field_name> + Raises + <field_body> + <paragraph> + <pending_xref py:class="True" py:module="True" refdomain="py" refexplicit="False" refspecific="True" reftarget="ValueError" reftype="exc"> + <literal_strong> + ValueError + – + if the message_body exceeds 160 characters diff --git a/tests/test_sphinx/test_sphinx_builds/test_footnotes.sphinx4.html b/tests/test_sphinx/test_sphinx_builds/test_footnotes.sphinx4.html new file mode 100644 index 0000000..70cfb54 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_footnotes.sphinx4.html @@ -0,0 +1,147 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="footnotes-with-markdown"> + <h1> + Footnotes with Markdown + <a class="headerlink" href="#footnotes-with-markdown" title="Permalink to this headline"> + ¶ + </a> + </h1> + <p> + <a class="footnote-reference brackets" href="#c" id="id1"> + 1 + </a> + </p> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + <a class="footnote-reference brackets" href="#d" id="id2"> + 2 + </a> + </p> + </div> + <p> + <a class="footnote-reference brackets" href="#a" id="id3"> + 3 + </a> + </p> + <p> + <a class="footnote-reference brackets" href="#b" id="id4"> + 4 + </a> + </p> + <p> + <a class="footnote-reference brackets" href="#id8" id="id5"> + 123 + </a> + <a class="footnote-reference brackets" href="#id8" id="id6"> + 123 + </a> + </p> + <p> + <a class="footnote-reference brackets" href="#e" id="id7"> + 5 + </a> + </p> + <blockquote> + <div> + <ul class="simple"> + <li> + </li> + </ul> + </div> + </blockquote> + <hr class="footnotes docutils"/> + <dl class="footnote brackets"> + <dt class="label" id="c"> + <span class="brackets"> + <a class="fn-backref" href="#id1"> + 1 + </a> + </span> + </dt> + <dd> + <p> + a footnote referenced first + </p> + </dd> + <dt class="label" id="d"> + <span class="brackets"> + <a class="fn-backref" href="#id2"> + 2 + </a> + </span> + </dt> + <dd> + <p> + a footnote referenced in a directive + </p> + </dd> + <dt class="label" id="a"> + <span class="brackets"> + <a class="fn-backref" href="#id3"> + 3 + </a> + </span> + </dt> + <dd> + <p> + some footnote + <em> + text + </em> + </p> + </dd> + <dt class="label" id="b"> + <span class="brackets"> + <a class="fn-backref" href="#id4"> + 4 + </a> + </span> + </dt> + <dd> + <p> + a footnote before its reference + </p> + </dd> + <dt class="label" id="id8"> + <span class="brackets"> + 123 + </span> + <span class="fn-backref"> + ( + <a href="#id5"> + 1 + </a> + , + <a href="#id6"> + 2 + </a> + ) + </span> + </dt> + <dd> + <p> + multiple references footnote + </p> + </dd> + <dt class="label" id="e"> + <span class="brackets"> + <a class="fn-backref" href="#id7"> + 5 + </a> + </span> + </dt> + <dd> + <p> + footnote definition in a block element + </p> + </dd> + </dl> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_footnotes.sphinx5.html b/tests/test_sphinx/test_sphinx_builds/test_footnotes.sphinx5.html new file mode 100644 index 0000000..546739c --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_footnotes.sphinx5.html @@ -0,0 +1,213 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="footnotes-with-markdown"> + <h1> + Footnotes with Markdown + <a class="headerlink" href="#footnotes-with-markdown" title="Permalink to this heading"> + ¶ + </a> + </h1> + <p> + <a class="footnote-reference brackets" href="#c" id="id1" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 1 + <span class="fn-bracket"> + ] + </span> + </a> + </p> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + <a class="footnote-reference brackets" href="#d" id="id2" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 2 + <span class="fn-bracket"> + ] + </span> + </a> + </p> + </div> + <p> + <a class="footnote-reference brackets" href="#a" id="id3" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 3 + <span class="fn-bracket"> + ] + </span> + </a> + </p> + <p> + <a class="footnote-reference brackets" href="#b" id="id4" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 4 + <span class="fn-bracket"> + ] + </span> + </a> + </p> + <p> + <a class="footnote-reference brackets" href="#id8" id="id5" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 123 + <span class="fn-bracket"> + ] + </span> + </a> + <a class="footnote-reference brackets" href="#id8" id="id6" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 123 + <span class="fn-bracket"> + ] + </span> + </a> + </p> + <p> + <a class="footnote-reference brackets" href="#e" id="id7" role="doc-noteref"> + <span class="fn-bracket"> + [ + </span> + 5 + <span class="fn-bracket"> + ] + </span> + </a> + </p> + <blockquote> + <div> + <ul class="simple"> + <li> + </li> + </ul> + </div> + </blockquote> + <hr class="footnotes docutils"/> + <aside class="footnote-list brackets"> + <aside class="footnote brackets" id="c" role="note"> + <span class="label"> + <span class="fn-bracket"> + [ + </span> + <a href="#id1" role="doc-backlink"> + 1 + </a> + <span class="fn-bracket"> + ] + </span> + </span> + <p> + a footnote referenced first + </p> + </aside> + <aside class="footnote brackets" id="d" role="note"> + <span class="label"> + <span class="fn-bracket"> + [ + </span> + <a href="#id2" role="doc-backlink"> + 2 + </a> + <span class="fn-bracket"> + ] + </span> + </span> + <p> + a footnote referenced in a directive + </p> + </aside> + <aside class="footnote brackets" id="a" role="note"> + <span class="label"> + <span class="fn-bracket"> + [ + </span> + <a href="#id3" role="doc-backlink"> + 3 + </a> + <span class="fn-bracket"> + ] + </span> + </span> + <p> + some footnote + <em> + text + </em> + </p> + </aside> + <aside class="footnote brackets" id="b" role="note"> + <span class="label"> + <span class="fn-bracket"> + [ + </span> + <a href="#id4" role="doc-backlink"> + 4 + </a> + <span class="fn-bracket"> + ] + </span> + </span> + <p> + a footnote before its reference + </p> + </aside> + <aside class="footnote brackets" id="id8" role="note"> + <span class="label"> + <span class="fn-bracket"> + [ + </span> + 123 + <span class="fn-bracket"> + ] + </span> + </span> + <span class="backrefs"> + ( + <a href="#id5" role="doc-backlink"> + 1 + </a> + , + <a href="#id6" role="doc-backlink"> + 2 + </a> + ) + </span> + <p> + multiple references footnote + </p> + </aside> + <aside class="footnote brackets" id="e" role="note"> + <span class="label"> + <span class="fn-bracket"> + [ + </span> + <a href="#id7" role="doc-backlink"> + 5 + </a> + <span class="fn-bracket"> + ] + </span> + </span> + <p> + footnote definition in a block element + </p> + </aside> + </aside> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_footnotes.xml b/tests/test_sphinx/test_sphinx_builds/test_footnotes.xml new file mode 100644 index 0000000..950d4f8 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_footnotes.xml @@ -0,0 +1,62 @@ +<document source="footnote_md.md"> + <section ids="footnotes-with-markdown" names="footnotes\ with\ markdown"> + <title> + Footnotes with Markdown + <paragraph> + <footnote_reference auto="1" docname="footnote_md" ids="id1" refid="c"> + 1 + <note> + <paragraph> + <footnote_reference auto="1" docname="footnote_md" ids="id2" refid="d"> + 2 + <paragraph> + <footnote_reference auto="1" docname="footnote_md" ids="id3" refid="a"> + 3 + <paragraph> + <footnote_reference auto="1" docname="footnote_md" ids="id4" refid="b"> + 4 + <paragraph> + <footnote_reference docname="footnote_md" ids="id5" refid="id8"> + 123 + + <footnote_reference docname="footnote_md" ids="id6" refid="id8"> + 123 + <paragraph> + <footnote_reference auto="1" docname="footnote_md" ids="id7" refid="e"> + 5 + <block_quote> + <bullet_list bullet="-"> + <list_item> + <transition classes="footnotes"> + <footnote auto="1" backrefs="id1" docname="footnote_md" ids="c" names="c"> + <label> + 1 + <paragraph> + a footnote referenced first + <footnote auto="1" backrefs="id2" docname="footnote_md" ids="d" names="d"> + <label> + 2 + <paragraph> + a footnote referenced in a directive + <footnote auto="1" backrefs="id3" docname="footnote_md" ids="a" names="a"> + <label> + 3 + <paragraph> + some footnote + <emphasis> + text + <footnote auto="1" backrefs="id4" docname="footnote_md" ids="b" names="b"> + <label> + 4 + <paragraph> + a footnote before its reference + <footnote backrefs="id5 id6" docname="footnote_md" ids="id8" names="123"> + <label> + 123 + <paragraph> + multiple references footnote + <footnote auto="1" backrefs="id7" docname="footnote_md" ids="e" names="e"> + <label> + 5 + <paragraph> + footnote definition in a block element diff --git a/tests/test_sphinx/test_sphinx_builds/test_gettext.pot b/tests/test_sphinx/test_sphinx_builds/test_gettext.pot new file mode 100644 index 0000000..933b8b6 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_gettext.pot @@ -0,0 +1,81 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) XXXX, Executable Book Project +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../index.md:1 +msgid "**bold** text 1" +msgstr "" + +#: ../../index.md:3 +msgid "**bold** text 2" +msgstr "" + +#: ../../index.md:5 +msgid "**bold** text 3" +msgstr "" + +#: ../../index.md:10 +msgid "**bold** text 4" +msgstr "" + +#: ../../index.md:13 +msgid "**bold** text 5" +msgstr "" + +#: ../../index.md:15 +msgid "**bold** text 6" +msgstr "" + +#: ../../index.md:17 +msgid "**bold** text 7" +msgstr "" + +#: ../../index.md:18 +msgid "**bold** text 8" +msgstr "" + +#: ../../index.md:0 +msgid "**bold** text 9" +msgstr "" + +#: ../../index.md:0 +msgid "**bold** text 10" +msgstr "" + +#: ../../index.md:26 +msgid "**bold** text 11" +msgstr "" + +#: ../../index.md:28 +msgid "Extra ```backticks```" +msgstr "" + +#: ../../index.md:55 +msgid "![Fun Fish 1](fun-fish.png)" +msgstr "" + +#: ../../index.md:55 +msgid "Fun Fish 1" +msgstr "" + +#: ../../index.md:57 +msgid "Fun Fish 2" +msgstr "" + +#: ../../index.md:61 +msgid "Fun Fish 3" +msgstr "" diff --git a/tests/test_sphinx/test_sphinx_builds/test_gettext_additional_targets.pot b/tests/test_sphinx/test_sphinx_builds/test_gettext_additional_targets.pot new file mode 100644 index 0000000..11c51d4 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_gettext_additional_targets.pot @@ -0,0 +1,129 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) XXXX, Executable Book Project +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../index.md:1 +msgid "**bold** text 1" +msgstr "" + +#: ../../index.md:3 +msgid "**bold** text 2" +msgstr "" + +#: ../../index.md:5 +msgid "**bold** text 3" +msgstr "" + +#: ../../index.md:10 +msgid "**bold** text 4" +msgstr "" + +#: ../../index.md:13 +msgid "**bold** text 5" +msgstr "" + +#: ../../index.md:15 +msgid "**bold** text 6" +msgstr "" + +#: ../../index.md:17 +msgid "**bold** text 7" +msgstr "" + +#: ../../index.md:18 +msgid "**bold** text 8" +msgstr "" + +#: ../../index.md:0 +msgid "**bold** text 9" +msgstr "" + +#: ../../index.md:0 +msgid "**bold** text 10" +msgstr "" + +#: ../../index.md:24 +msgid "<div markdown=1>\n" +"" +msgstr "" + +#: ../../index.md:26 +msgid "**bold** text 11" +msgstr "" + +#: ../../index.md:28 +msgid "Extra ```backticks```" +msgstr "" + +#: ../../index.md:30 +msgid "</div>\n" +"" +msgstr "" + +#: ../../index.md:32 +msgid "**additional** text 12\n" +"" +msgstr "" + +#: ../../index.md:34 +msgid "**additional** text 13\n" +"" +msgstr "" + +#: ../../index.md:38 +msgid "{\n" +" \"additional\": \"text 14\"\n" +"}\n" +"" +msgstr "" + +#: ../../index.md:44 +msgid "<h3>**additional** text 15</h3>\n" +"" +msgstr "" + +#: ../../index.md:46 +msgid ">>> print('doctest block')\n" +"doctest block\n" +"" +msgstr "" + +#: ../../index.md:51 +msgid "<iframe src=\"http://sphinx-doc.org\"></iframe>" +msgstr "" + +#: ../../index.md:55 +msgid "![Fun Fish 1](fun-fish.png)" +msgstr "" + +#: ../../index.md:55 +msgid "Fun Fish 1" +msgstr "" + +#: ../../index.md:55 +#: ../../index.md:57 +#: ../../index.md:61 +msgid ".. image:: fun-fish.png" +msgstr "" + +#: ../../index.md:57 +msgid "Fun Fish 2" +msgstr "" + +#: ../../index.md:61 +msgid "Fun Fish 3" +msgstr "" diff --git a/tests/test_sphinx/test_sphinx_builds/test_gettext_html.resolved.xml b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.resolved.xml new file mode 100644 index 0000000..231ca33 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.resolved.xml @@ -0,0 +1,93 @@ +<document source="index.md"> + <section ids="bold-text-1" names="bold\ text\ 1 texte\ 1\ en\ gras"> + <title> + texte 1 en + <strong> + gras + <paragraph> + texte 2 en + <strong> + gras + <block_quote> + <paragraph> + texte 3 en + <strong> + gras + <note> + <paragraph> + texte 4 en + <strong> + gras + <bullet_list bullet="*"> + <list_item> + <paragraph> + texte 5 en + <strong> + gras + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + texte 6 en + <strong> + gras + <definition_list classes="simple myst"> + <definition_list_item> + <term> + texte 7 en + <strong> + gras + <definition> + <paragraph> + texte 8 en + <strong> + gras + <table classes="colwidths-auto"> + <tgroup cols="1"> + <colspec colwidth="100"> + <thead> + <row> + <entry> + <paragraph> + texte 9 en + <strong> + gras + <tbody> + <row> + <entry> + <paragraph> + texte 10 en + <strong> + gras + <raw format="html" xml:space="preserve"> + <div markdown=1> + <paragraph> + texte 11 en + <strong> + gras + <paragraph> + « + <literal> + Backtick + » supplémentaire + <raw format="html" xml:space="preserve"> + </div> + <literal_block language="none" linenos="False" xml:space="preserve"> + **additional** text 12 + <literal_block language="default" linenos="False" xml:space="preserve"> + **additional** text 13 + <literal_block language="json" linenos="False" xml:space="preserve"> + { + "additional": "text 14" + } + <raw format="html" xml:space="preserve"> + <h3>**additional** text 15</h3> + <literal_block language="python" linenos="False" xml:space="preserve"> + >>> print('doctest block') + doctest block + <raw format="html" xml:space="preserve"> + <iframe src="http://sphinx-doc.org"></iframe> + <paragraph> + <image alt="Poisson amusant 1" candidates="{'*': 'poisson-amusant.png'}" uri="poisson-amusant.png"> + <image alt="Poisson amusant 2" candidates="{'*': 'fun-fish.png'}" uri="fun-fish.png"> + <figure> + <image alt="Poisson amusant 3" candidates="{'*': 'fun-fish.png'}" uri="fun-fish.png"> diff --git a/tests/test_sphinx/test_sphinx_builds/test_gettext_html.sphinx4.html b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.sphinx4.html new file mode 100644 index 0000000..825048a --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.sphinx4.html @@ -0,0 +1,162 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="bold-text-1"> + <h1> + texte 1 en + <strong> + gras + </strong> + <a class="headerlink" href="#bold-text-1" title="Lien permanent vers ce titre"> + ¶ + </a> + </h1> + <p> + texte 2 en + <strong> + gras + </strong> + </p> + <blockquote> + <div> + <p> + texte 3 en + <strong> + gras + </strong> + </p> + </div> + </blockquote> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + texte 4 en + <strong> + gras + </strong> + </p> + </div> + <ul class="simple"> + <li> + <p> + texte 5 en + <strong> + gras + </strong> + </p> + </li> + </ul> + <ol class="arabic simple"> + <li> + <p> + texte 6 en + <strong> + gras + </strong> + </p> + </li> + </ol> + <dl class="simple myst"> + <dt> + texte 7 en + <strong> + gras + </strong> + </dt> + <dd> + <p> + texte 8 en + <strong> + gras + </strong> + </p> + </dd> + </dl> + <table class="colwidths-auto docutils align-default"> + <thead> + <tr class="row-odd"> + <th class="head"> + <p> + texte 9 en + <strong> + gras + </strong> + </p> + </th> + </tr> + </thead> + <tbody> + <tr class="row-even"> + <td> + <p> + texte 10 en + <strong> + gras + </strong> + </p> + </td> + </tr> + </tbody> + </table> + <div markdown="1"> + <p> + texte 11 en + <strong> + gras + </strong> + </p> + <p> + « + <code class="docutils literal notranslate"> + <span class="pre"> + Backtick + </span> + </code> + » supplémentaire + </p> + </div> + <div class="highlight-none notranslate"> + <div class="highlight"> + <pre><span></span>**additional** text 12 +</pre> + </div> + </div> + <div class="highlight-default notranslate"> + <div class="highlight"> + <pre><span></span><span class="o">**</span><span class="n">additional</span><span class="o">**</span> <span class="n">text</span> <span class="mi">13</span> +</pre> + </div> + </div> + <div class="highlight-json notranslate"> + <div class="highlight"> + <pre><span></span><span class="p">{</span> + <span class="nt">"additional"</span><span class="p">:</span> <span class="s2">"text 14"</span> +<span class="p">}</span> +</pre> + </div> + </div> + <h3> + **additional** text 15 + </h3> + <div class="highlight-python notranslate"> + <div class="highlight"> + <pre><span></span><span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="s1">'doctest block'</span><span class="p">)</span> +<span class="go">doctest block</span> +</pre> + </div> + </div> + <iframe src="http://sphinx-doc.org"> + </iframe> + <p> + <img alt="Poisson amusant 1" src="_images/poisson-amusant.png"/> + </p> + <img alt="Poisson amusant 2" src="_images/fun-fish.png"/> + <figure class="align-default"> + <img alt="Poisson amusant 3" src="_images/fun-fish.png"/> + </figure> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_gettext_html.sphinx5.html b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.sphinx5.html new file mode 100644 index 0000000..469e188 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.sphinx5.html @@ -0,0 +1,162 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="bold-text-1"> + <h1> + texte 1 en + <strong> + gras + </strong> + <a class="headerlink" href="#bold-text-1" title="Lien permanent vers cette rubrique"> + ¶ + </a> + </h1> + <p> + texte 2 en + <strong> + gras + </strong> + </p> + <blockquote> + <div> + <p> + texte 3 en + <strong> + gras + </strong> + </p> + </div> + </blockquote> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + texte 4 en + <strong> + gras + </strong> + </p> + </div> + <ul class="simple"> + <li> + <p> + texte 5 en + <strong> + gras + </strong> + </p> + </li> + </ul> + <ol class="arabic simple"> + <li> + <p> + texte 6 en + <strong> + gras + </strong> + </p> + </li> + </ol> + <dl class="simple myst"> + <dt> + texte 7 en + <strong> + gras + </strong> + </dt> + <dd> + <p> + texte 8 en + <strong> + gras + </strong> + </p> + </dd> + </dl> + <table class="docutils align-default"> + <thead> + <tr class="row-odd"> + <th class="head"> + <p> + texte 9 en + <strong> + gras + </strong> + </p> + </th> + </tr> + </thead> + <tbody> + <tr class="row-even"> + <td> + <p> + texte 10 en + <strong> + gras + </strong> + </p> + </td> + </tr> + </tbody> + </table> + <div markdown="1"> + <p> + texte 11 en + <strong> + gras + </strong> + </p> + <p> + « + <code class="docutils literal notranslate"> + <span class="pre"> + Backtick + </span> + </code> + » supplémentaire + </p> + </div> + <div class="highlight-none notranslate"> + <div class="highlight"> + <pre><span></span>**additional** text 12 +</pre> + </div> + </div> + <div class="highlight-default notranslate"> + <div class="highlight"> + <pre><span></span><span class="o">**</span><span class="n">additional</span><span class="o">**</span> <span class="n">text</span> <span class="mi">13</span> +</pre> + </div> + </div> + <div class="highlight-json notranslate"> + <div class="highlight"> + <pre><span></span><span class="p">{</span> + <span class="nt">"additional"</span><span class="p">:</span> <span class="s2">"text 14"</span> +<span class="p">}</span> +</pre> + </div> + </div> + <h3> + **additional** text 15 + </h3> + <div class="highlight-python notranslate"> + <div class="highlight"> + <pre><span></span><span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="s1">'doctest block'</span><span class="p">)</span> +<span class="go">doctest block</span> +</pre> + </div> + </div> + <iframe src="http://sphinx-doc.org"> + </iframe> + <p> + <img alt="Poisson amusant 1" src="_images/poisson-amusant.png"/> + </p> + <img alt="Poisson amusant 2" src="_images/fun-fish.png"/> + <figure class="align-default"> + <img alt="Poisson amusant 3" src="_images/fun-fish.png"/> + </figure> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_gettext_html.xml b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.xml new file mode 100644 index 0000000..dfc5f41 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_gettext_html.xml @@ -0,0 +1,93 @@ +<document source="index.md"> + <section ids="bold-text-1" names="bold\ text\ 1 texte\ 1\ en\ gras"> + <title> + texte 1 en + <strong> + gras + <paragraph> + texte 2 en + <strong> + gras + <block_quote> + <paragraph> + texte 3 en + <strong> + gras + <note> + <paragraph> + texte 4 en + <strong> + gras + <bullet_list bullet="*"> + <list_item> + <paragraph> + texte 5 en + <strong> + gras + <enumerated_list enumtype="arabic" prefix="" suffix="."> + <list_item> + <paragraph> + texte 6 en + <strong> + gras + <definition_list classes="simple myst"> + <definition_list_item> + <term> + texte 7 en + <strong> + gras + <definition> + <paragraph> + texte 8 en + <strong> + gras + <table classes="colwidths-auto"> + <tgroup cols="1"> + <colspec colwidth="100"> + <thead> + <row> + <entry> + <paragraph> + texte 9 en + <strong> + gras + <tbody> + <row> + <entry> + <paragraph> + texte 10 en + <strong> + gras + <raw format="html" xml:space="preserve"> + <div markdown=1> + <paragraph> + texte 11 en + <strong> + gras + <paragraph> + « + <literal> + Backtick + » supplémentaire + <raw format="html" xml:space="preserve"> + </div> + <literal_block language="none" xml:space="preserve"> + **additional** text 12 + <literal_block language="default" xml:space="preserve"> + **additional** text 13 + <literal_block language="json" xml:space="preserve"> + { + "additional": "text 14" + } + <raw format="html" xml:space="preserve"> + <h3>**additional** text 15</h3> + <literal_block language="python" xml:space="preserve"> + >>> print('doctest block') + doctest block + <raw format="html" xml:space="preserve"> + <iframe src="http://sphinx-doc.org"></iframe> + <paragraph> + <image alt="Poisson amusant 1" candidates="{'*': 'poisson-amusant.png'}" uri="poisson-amusant.png"> + <image alt="Poisson amusant 2" candidates="{'*': 'fun-fish.png'}" uri="fun-fish.png"> + <figure> + <image alt="Poisson amusant 3" candidates="{'*': 'fun-fish.png'}" uri="fun-fish.png"> diff --git a/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.html b/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.html new file mode 100644 index 0000000..67c4415 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.html @@ -0,0 +1,22 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="hyphen-1"> + <h1> + Hyphen - 1 + <a class="headerlink" href="#hyphen-1" title="Permalink to this heading"> + ¶ + </a> + </h1> + <section id="dot-1-1"> + <h2> + Dot 1.1 + <a class="headerlink" href="#dot-1-1" title="Permalink to this heading"> + ¶ + </a> + </h2> + </section> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.resolved.xml b/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.resolved.xml new file mode 100644 index 0000000..e48908d --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.resolved.xml @@ -0,0 +1,7 @@ +<document source="index.md"> + <section ids="hyphen-1" myst-anchor="index.md#hyphen-1" names="hyphen\ -\ 1"> + <title> + Hyphen - 1 + <section ids="dot-1-1" myst-anchor="index.md#dot-1-1" names="dot\ 1.1"> + <title> + Dot 1.1 diff --git a/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.xml b/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.xml new file mode 100644 index 0000000..e48908d --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_heading_slug_func.xml @@ -0,0 +1,7 @@ +<document source="index.md"> + <section ids="hyphen-1" myst-anchor="index.md#hyphen-1" names="hyphen\ -\ 1"> + <title> + Hyphen - 1 + <section ids="dot-1-1" myst-anchor="index.md#dot-1-1" names="dot\ 1.1"> + <title> + Dot 1.1 diff --git a/tests/test_sphinx/test_sphinx_builds/test_include_from_rst.xml b/tests/test_sphinx/test_sphinx_builds/test_include_from_rst.xml new file mode 100644 index 0000000..9248bd3 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_include_from_rst.xml @@ -0,0 +1,10 @@ +<document source="index.rst"> + <section ids="title" names="title"> + <title> + Title + <section ids="markdown" names="markdown"> + <title> + Markdown + <paragraph> + <reference refuri="http://example.com/"> + target diff --git a/tests/test_sphinx/test_sphinx_builds/test_includes.html b/tests/test_sphinx/test_sphinx_builds/test_includes.html new file mode 100644 index 0000000..41eb1ee --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_includes.html @@ -0,0 +1,135 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="main-title"> + <h1> + Main Title + <a class="headerlink" href="#main-title" title="Permalink to this heading"> + ¶ + </a> + </h1> + <section id="a-sub-heading-in-include"> + <span id="inc-header"> + </span> + <h2> + A Sub-Heading in Include + <a class="headerlink" href="#a-sub-heading-in-include" title="Permalink to this heading"> + ¶ + </a> + </h2> + <p> + Some text with + <em> + syntax + </em> + </p> + </section> + <section id="a-sub-heading-in-nested-include"> + <h2> + A Sub-Heading in Nested Include + <a class="headerlink" href="#a-sub-heading-in-nested-include" title="Permalink to this heading"> + ¶ + </a> + </h2> + <p> + Some other text with + <strong> + syntax + </strong> + </p> + <p> + This relative path will refer to the importing file: + </p> + <figure class="align-default" id="id1"> + <img alt="_images/example1.jpg" src="_images/example1.jpg"/> + <figcaption> + <p> + <span class="caption-text"> + Caption + </span> + <a class="headerlink" href="#id1" title="Permalink to this image"> + ¶ + </a> + </p> + </figcaption> + </figure> + <p> + This absolute path will refer to the project root (where the + <code class="docutils literal notranslate"> + <span class="pre"> + conf.py + </span> + </code> + is): + </p> + <figure class="align-default" id="id2"> + <img alt="_images/example2.jpg" src="_images/example2.jpg"/> + <figcaption> + <p> + <span class="caption-text"> + Caption + </span> + <a class="headerlink" href="#id2" title="Permalink to this image"> + ¶ + </a> + </p> + </figcaption> + </figure> + <p> + <img alt="alt" src="_images/example2.jpg"/> + </p> + <p> + <img alt="alt" src="https://example.com"/> + </p> + <p> + <a class="reference internal" href="#"> + <span class="doc std std-doc"> + text + </span> + </a> + </p> + <p> + <a class="reference internal" href="#inc-header"> + <span class="std std-ref"> + A Sub-Heading in Include + </span> + </a> + </p> + <div class="code python highlight-default notranslate"> + <div class="highlight"> + <pre><span></span><span class="k">def</span> <span class="nf">a_func</span><span class="p">(</span><span class="n">param</span><span class="p">):</span> + <span class="nb">print</span><span class="p">(</span><span class="n">param</span><span class="p">)</span> +</pre> + </div> + </div> + <pre class="code python literal-block"><small class="ln">0 </small><code data-lineno="0 "><span class="keyword">def</span> <span class="name function">a_func</span><span class="punctuation">(</span><span class="name">param</span><span class="punctuation">):</span> +</code><small class="ln">1 </small><code data-lineno="1 "> <span class="name builtin">print</span><span class="punctuation">(</span><span class="name">param</span><span class="punctuation">)</span></code></pre> + <div class="highlight-default notranslate"> + <div class="highlight"> + <pre><span></span><span class="n">This</span> <span class="n">should</span> <span class="n">be</span> <span class="o">*</span><span class="n">literal</span><span class="o">*</span> + +<span class="n">Lots</span> +<span class="n">of</span> +<span class="n">lines</span> +<span class="n">so</span> <span class="n">we</span> <span class="n">can</span> <span class="n">select</span> <span class="n">some</span> +</pre> + </div> + </div> + <pre class="literal-block" id="literal-ref"><span class="ln">0 </span>Lots +<span class="ln">1 </span>of</pre> + <section id="a-sub-sub-heading"> + <h3> + A Sub-sub-Heading + <a class="headerlink" href="#a-sub-sub-heading" title="Permalink to this heading"> + ¶ + </a> + </h3> + <p> + some more text + </p> + </section> + </section> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_includes.xml b/tests/test_sphinx/test_sphinx_builds/test_includes.xml new file mode 100644 index 0000000..1e8779c --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_includes.xml @@ -0,0 +1,113 @@ +<document source="index.md"> + <section ids="main-title" names="main\ title"> + <title> + Main Title + <target refid="inc-header"> + <section ids="a-sub-heading-in-include inc-header" names="a\ sub-heading\ in\ include inc_header"> + <title> + A Sub-Heading in Include + <paragraph> + Some text with + <emphasis> + syntax + <section ids="a-sub-heading-in-nested-include" names="a\ sub-heading\ in\ nested\ include"> + <title> + A Sub-Heading in Nested Include + <paragraph> + Some other text with + <strong> + syntax + <paragraph> + This relative path will refer to the importing file: + <figure ids="id1"> + <image candidates="{'*': 'example1.jpg'}" uri="example1.jpg"> + <caption> + Caption + <paragraph> + This absolute path will refer to the project root (where the + <literal> + conf.py + is): + <figure ids="id2"> + <image candidates="{'*': 'subfolder/example2.jpg'}" uri="subfolder/example2.jpg"> + <caption> + Caption + <paragraph> + <image alt="alt" candidates="{'*': 'subfolder/example2.jpg'}" uri="subfolder/example2.jpg"> + <paragraph> + <image alt="alt" candidates="{'?': 'https://example.com'}" uri="https://example.com"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="index.md" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + text + <paragraph> + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="inc_header" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + inc_header + <literal_block classes="code python" source="include_code.py" xml:space="preserve"> + <inline classes="keyword"> + def + + <inline classes="name function"> + a_func + <inline classes="punctuation"> + ( + <inline classes="name"> + param + <inline classes="punctuation"> + ): + + + <inline classes="name builtin"> + print + <inline classes="punctuation"> + ( + <inline classes="name"> + param + <inline classes="punctuation"> + ) + <literal_block classes="code python" source="include_code.py" xml:space="preserve"> + <inline classes="ln"> + 0 + <inline classes="keyword"> + def + + <inline classes="name function"> + a_func + <inline classes="punctuation"> + ( + <inline classes="name"> + param + <inline classes="punctuation"> + ): + + <inline classes="ln"> + 1 + + <inline classes="name builtin"> + print + <inline classes="punctuation"> + ( + <inline classes="name"> + param + <inline classes="punctuation"> + ) + <literal_block source="include_literal.txt" xml:space="preserve"> + This should be *literal* + + Lots + of + lines + so we can select some + <literal_block ids="literal-ref" names="literal_ref" source="include_literal.txt" xml:space="preserve"> + <inline classes="ln"> + 0 + Lots + <inline classes="ln"> + 1 + of + <section ids="a-sub-sub-heading" names="a\ sub-sub-heading"> + <title> + A Sub-sub-Heading + <paragraph> + some more text diff --git a/tests/test_sphinx/test_sphinx_builds/test_references.html b/tests/test_sphinx/test_sphinx_builds/test_references.html new file mode 100644 index 0000000..a6d4036 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_references.html @@ -0,0 +1,195 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section class="tex2jax_ignore mathjax_ignore" id="title-with-nested-a-1"> + <span id="title"> + </span> + <h1> + Title with + <strong> + nested + </strong> + <span class="math notranslate nohighlight"> + \(a=1\) + </span> + <a class="headerlink" href="#title-with-nested-a-1" title="Permalink to this heading"> + ¶ + </a> + </h1> + <p> + <a class="reference external" href="https://example.com"> + </a> + </p> + <p> + <a class="reference external" href="https://example.com"> + plain text + </a> + </p> + <p> + <a class="reference external" href="https://example.com"> + nested + <em> + syntax + </em> + </a> + </p> + <p> + <a class="reference internal" href="#title"> + <span class="std std-ref"> + Title with nested a=1 + </span> + </a> + </p> + <p> + <a class="reference internal" href="#title"> + <span class="std std-ref"> + plain text + </span> + </a> + </p> + <p> + <a class="reference internal" href="#title"> + <span class="std std-ref"> + nested + <em> + syntax + </em> + </span> + </a> + </p> + <p> + <a class="reference internal" href="#"> + <span class="doc std std-doc"> + Title with nested a=1 + </span> + </a> + </p> + <p> + <a class="reference internal" href="#"> + <span class="doc std std-doc"> + plain text + </span> + </a> + </p> + <p> + <a class="reference internal" href="#"> + <span class="doc std std-doc"> + nested + <em> + syntax + </em> + </span> + </a> + </p> + <p> + <a class="reference download internal" download="" href="_downloads/ab0d698fdd2b6a81c34b5ed380fe6f61/file_link.txt"> + <span class="xref download myst"> + download + <strong> + link + </strong> + </span> + </a> + </p> + <p> + <a class="reference download internal" download="" href="_downloads/1952147a8403903cb78cecf56f049085/file_link2.txt"> + <span class="xref download myst"> + subfolder/file_link2.txt + </span> + </a> + </p> + <p id="insidecodeblock"> + I am inside the eval-rst fence + </p> + <p> + Referencing the + <a class="reference internal" href="#title"> + <span class="std std-ref"> + Title with nested a=1 + </span> + </a> + </p> + <p> + Still inside the codeblock + <a class="reference internal" href="#insidecodeblock"> + insidecodeblock + </a> + </p> + <p> + I am outside the + <a class="reference internal" href="#insidecodeblock"> + <span class="std std-ref"> + fence + </span> + </a> + </p> + <section id="title-anchors"> + <h2> + Title + <em> + anchors + </em> + <a class="headerlink" href="#title-anchors" title="Permalink to this heading"> + ¶ + </a> + </h2> + <div class="toctree-wrapper compound"> + <ul> + <li class="toctree-l1"> + <a class="reference internal" href="other.html"> + Title + <em> + anchors + </em> + </a> + </li> + <li class="toctree-l1"> + <a class="reference internal" href="subfolder/other2.html"> + Title + <em> + anchors + </em> + </a> + </li> + </ul> + </div> + <p> + <a class="reference internal" href="#title-anchors"> + <span class="std std-doc"> + Title anchors + </span> + </a> + </p> + <p> + <a class="reference internal" href="#title-anchors"> + <span class="std std-doc"> + Title anchors + </span> + </a> + </p> + <p> + <a class="reference internal" href="other.html#title-anchors"> + <span class="std std-doc"> + Title anchors + </span> + </a> + </p> + <p> + <a class="reference internal" href="other.html#title-anchors"> + <span class="std std-doc"> + Title anchors + </span> + </a> + </p> + <p> + <a class="reference internal" href="subfolder/other2.html#title-anchors"> + <span class="std std-doc"> + Title anchors + </span> + </a> + </p> + </section> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_references.resolved.xml b/tests/test_sphinx/test_sphinx_builds/test_references.resolved.xml new file mode 100644 index 0000000..9c6a4ca --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_references.resolved.xml @@ -0,0 +1,115 @@ +<document source="index.md"> + <target refid="title"> + <section classes="tex2jax_ignore mathjax_ignore" ids="title-with-nested-a-1 title" myst-anchor="index.md#title-with-nested" names="title\ with\ nested\ a=1 title"> + <title> + Title with + <strong> + nested + + <math> + a=1 + <paragraph> + <reference refuri="https://example.com"> + <paragraph> + <reference refuri="https://example.com"> + plain text + <paragraph> + <reference refuri="https://example.com"> + nested + <emphasis> + syntax + <paragraph> + <reference internal="True" refid="title"> + <inline classes="std std-ref"> + Title with nested a=1 + <paragraph> + <reference internal="True" refid="title"> + <inline classes="std std-ref"> + plain text + <paragraph> + <reference internal="True" refid="title"> + <inline classes="std std-ref"> + nested + <emphasis> + syntax + <paragraph> + <reference internal="True" refuri=""> + <inline classes="doc std std-doc"> + Title with nested a=1 + <paragraph> + <reference internal="True" refuri=""> + <inline classes="doc std std-doc"> + plain text + <paragraph> + <reference internal="True" refuri=""> + <inline classes="doc std std-doc"> + nested + <emphasis> + syntax + <paragraph> + <download_reference filename="ab0d698fdd2b6a81c34b5ed380fe6f61/file_link.txt" refdoc="index" refdomain="True" refexplicit="True" reftarget="file_link.txt" reftype="myst" refwarn="False"> + <inline classes="xref download myst"> + download + <strong> + link + <paragraph> + <download_reference filename="1952147a8403903cb78cecf56f049085/file_link2.txt" refdoc="index" refdomain="True" refexplicit="False" reftarget="subfolder/file_link2.txt" reftype="myst" refwarn="False"> + <inline classes="xref download myst"> + subfolder/file_link2.txt + <target refid="insidecodeblock"> + <paragraph ids="insidecodeblock" names="insidecodeblock"> + I am inside the eval-rst fence + <paragraph> + Referencing the + <reference internal="True" refid="title"> + <inline classes="std std-ref"> + Title with nested a=1 + <paragraph> + Still inside the codeblock + <reference name="insidecodeblock" refid="insidecodeblock"> + insidecodeblock + <paragraph> + I am outside the + <reference internal="True" refid="insidecodeblock"> + <inline classes="std std-ref"> + fence + <section ids="title-anchors" myst-anchor="index.md#title-anchors" names="title\ anchors"> + <title> + Title + <emphasis> + anchors + <compound classes="toctree-wrapper"> + <compact_paragraph toctree="True"> + <bullet_list> + <list_item classes="toctree-l1"> + <compact_paragraph classes="toctree-l1"> + <reference anchorname="" internal="True" refuri="other.html"> + Title + <emphasis> + anchors + <list_item classes="toctree-l1"> + <compact_paragraph classes="toctree-l1"> + <reference anchorname="" internal="True" refuri="subfolder/other2.html"> + Title + <emphasis> + anchors + <paragraph> + <reference internal="True" refid="title-anchors"> + <inline classes="std std-doc"> + Title anchors + <paragraph> + <reference internal="True" refid="title-anchors"> + <inline classes="std std-doc"> + Title anchors + <paragraph> + <reference internal="True" refuri="other.html#title-anchors"> + <inline classes="std std-doc"> + Title anchors + <paragraph> + <reference internal="True" refuri="other.html#title-anchors"> + <inline classes="std std-doc"> + Title anchors + <paragraph> + <reference internal="True" refuri="subfolder/other2.html#title-anchors"> + <inline classes="std std-doc"> + Title anchors diff --git a/tests/test_sphinx/test_sphinx_builds/test_references.xml b/tests/test_sphinx/test_sphinx_builds/test_references.xml new file mode 100644 index 0000000..03bfb8d --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_references.xml @@ -0,0 +1,95 @@ +<document source="index.md"> + <target refid="title"> + <section classes="tex2jax_ignore mathjax_ignore" ids="title-with-nested-a-1 title" myst-anchor="index.md#title-with-nested" names="title\ with\ nested\ a=1 title"> + <title> + Title with + <strong> + nested + + <math> + a=1 + <paragraph> + <reference refuri="https://example.com"> + <paragraph> + <reference refuri="https://example.com"> + plain text + <paragraph> + <reference refuri="https://example.com"> + nested + <emphasis> + syntax + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="title" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="title" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + plain text + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="title" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + nested + <emphasis> + syntax + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="index.md" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="index.md" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + plain text + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="index.md" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + nested + <emphasis> + syntax + <paragraph> + <download_reference filename="ab0d698fdd2b6a81c34b5ed380fe6f61/file_link.txt" refdoc="index" refdomain="True" refexplicit="True" reftarget="file_link.txt" reftype="myst" refwarn="False"> + <inline classes="xref download myst"> + download + <strong> + link + <paragraph> + <download_reference filename="1952147a8403903cb78cecf56f049085/file_link2.txt" refdoc="index" refdomain="True" refexplicit="False" reftarget="subfolder/file_link2.txt" reftype="myst" refwarn="False"> + <inline classes="xref download myst"> + subfolder/file_link2.txt + <target refid="insidecodeblock"> + <paragraph ids="insidecodeblock" names="insidecodeblock"> + I am inside the eval-rst fence + <paragraph> + Referencing the + <pending_xref refdoc="index" refdomain="std" refexplicit="False" reftarget="title" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + title + <paragraph> + Still inside the codeblock + <reference name="insidecodeblock" refid="insidecodeblock"> + insidecodeblock + <paragraph> + I am outside the + <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="insidecodeblock" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + fence + <section ids="title-anchors" myst-anchor="index.md#title-anchors" names="title\ anchors"> + <title> + Title + <emphasis> + anchors + <compound classes="toctree-wrapper"> + <toctree caption="True" entries="(None,\ 'other') (None,\ 'subfolder/other2')" glob="False" hidden="False" includefiles="other subfolder/other2" includehidden="False" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="False"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="#title-anchors" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="./#title-anchors" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="./other.md#title-anchors" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="other.md#title-anchors" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="subfolder/other2.md#title-anchors" reftype="myst" refwarn="True"> + <inline classes="xref myst"> diff --git a/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.html b/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.html new file mode 100644 index 0000000..b3d98a9 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.html @@ -0,0 +1,111 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <section id="title"> + <h1> + Title + <a class="headerlink" href="#title" title="Permalink to this heading"> + ¶ + </a> + </h1> + <div class="toctree-wrapper compound"> + <span id="document-other/index"> + </span> + <section id="other-index"> + <h2> + Other Index + <a class="headerlink" href="#other-index" title="Permalink to this heading"> + ¶ + </a> + </h2> + <div class="toctree-wrapper compound"> + <span id="document-other/other"> + </span> + <section id="other-title"> + <h3> + Other Title + <a class="headerlink" href="#other-title" title="Permalink to this heading"> + ¶ + </a> + </h3> + <p> + <a class="reference internal" href="index.html#document-other/other2"> + <span class="doc"> + Other 2 Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="index.html#document-other/other2"> + <span class="doc"> + Other 2 Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="index.html#document-other/other2"> + <span class="doc std std-doc"> + Other 2 Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="index.html#title"> + <span class="std std-doc"> + Title + </span> + </a> + </p> + </section> + <span id="document-other/other2"> + </span> + <section id="other-2-title"> + <h3> + Other 2 Title + <a class="headerlink" href="#other-2-title" title="Permalink to this heading"> + ¶ + </a> + </h3> + </section> + </div> + </section> + </div> + <p> + <a class="reference internal" href="index.html#document-other/other"> + <span class="doc"> + Other Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="index.html#document-other/other"> + <span class="doc"> + Other Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="index.html#document-other/other"> + <span class="doc std std-doc"> + Other Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="#title"> + <span class="std std-doc"> + Title + </span> + </a> + </p> + <p> + <a class="reference internal" href="index.html#other-title"> + <span class="std std-doc"> + Other Title + </span> + </a> + </p> + </section> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.resolved.xml b/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.resolved.xml new file mode 100644 index 0000000..606e769 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.resolved.xml @@ -0,0 +1,20 @@ +<document source="other.md"> + <section ids="other-title" myst-anchor="other/other.md#other-title" names="other\ title"> + <title> + Other Title + <paragraph> + <reference internal="True" refuri="index.html#document-other/other2"> + <inline classes="doc"> + Other 2 Title + <paragraph> + <reference internal="True" refuri="index.html#document-other/other2"> + <inline classes="doc doc doc"> + Other 2 Title + <paragraph> + <reference internal="True" refuri="index.html#document-other/other2"> + <inline classes="doc std std-doc"> + Other 2 Title + <paragraph> + <reference internal="True" refuri="index.html#document-index#title"> + <inline classes="std std-doc"> + Title diff --git a/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.xml b/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.xml new file mode 100644 index 0000000..a209b4f --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_references_singlehtml.xml @@ -0,0 +1,18 @@ +<document source="other.md"> + <section ids="other-title" myst-anchor="other/other.md#other-title" names="other\ title"> + <title> + Other Title + <paragraph> + <pending_xref refdoc="other/other" refdomain="std" refexplicit="False" reftarget="other2" reftype="doc" refwarn="True"> + <inline classes="xref std std-doc"> + other2 + <paragraph> + <pending_xref refdoc="other/other" refdomain="" refexplicit="False" reftarget="other2" reftype="any" refwarn="True"> + <literal classes="xref any"> + other2 + <paragraph> + <pending_xref refdoc="other/other" refdomain="True" refexplicit="False" reftarget="./other2.md" reftype="myst" refwarn="True"> + <inline classes="xref myst"> + <paragraph> + <pending_xref refdoc="other/other" refdomain="True" refexplicit="False" reftarget="../index.md#title" reftype="myst" refwarn="True"> + <inline classes="xref myst"> diff --git a/tests/test_sphinx/test_sphinx_builds/test_substitutions.html b/tests/test_sphinx/test_sphinx_builds/test_substitutions.html new file mode 100644 index 0000000..c5b3f43 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_substitutions.html @@ -0,0 +1,82 @@ +<div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + <p> + output with + <em> + Markdown + </em> + nested substitution + </p> + <p> + prefix + </p> + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + A note nested substitution + </p> + </div> + <p> + a - text b + </p> + <p> + c output with + <em> + Markdown + </em> + nested substitution + d + </p> + <p> + e + <div class="admonition note"> + <p class="admonition-title"> + Note + </p> + <p> + Inline note + </p> + </div> + f + </p> + <p> + This was from the conf + </p> + <p> + Overridden by front matter + </p> + <p> + This will process the substitution + </p> + <pre class="literal-block">output with <em>Markdown</em> nested substitution +</pre> + <p> + This will not process the substitution + </p> + <div class="highlight-python notranslate"> + <div class="highlight"> + <pre><span></span><span class="p">{{</span> <span class="n">text_with_nest</span> <span class="p">}}</span> +</pre> + </div> + </div> + <p> + Using env and filters: + </p> + <p> + INDEX + </p> + <div class="toctree-wrapper compound"> + <ul> + <li class="toctree-l1"> + <a class="reference internal" href="other.html"> + Other + </a> + </li> + </ul> + </div> + </div> + </div> +</div> diff --git a/tests/test_sphinx/test_sphinx_builds/test_substitutions.other.xml b/tests/test_sphinx/test_sphinx_builds/test_substitutions.other.xml new file mode 100644 index 0000000..b8f94f5 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_substitutions.other.xml @@ -0,0 +1,6 @@ +<document source="other.md"> + <section ids="other" names="other"> + <title> + Other + <paragraph> + From conf diff --git a/tests/test_sphinx/test_sphinx_builds/test_substitutions.xml b/tests/test_sphinx/test_sphinx_builds/test_substitutions.xml new file mode 100644 index 0000000..9a63ee2 --- /dev/null +++ b/tests/test_sphinx/test_sphinx_builds/test_substitutions.xml @@ -0,0 +1,55 @@ +<document source="index.md"> + <paragraph> + output with + <emphasis> + Markdown + + nested substitution + <paragraph> + prefix + <note> + <paragraph> + A note + nested substitution + <paragraph> + a + - text + b + <paragraph> + c + output with + <emphasis> + Markdown + + nested substitution + + d + <paragraph> + e + <note> + <paragraph> + Inline note + f + <paragraph> + This was from the conf + <paragraph> + Overridden by front matter + <paragraph> + This will process the substitution + <literal_block xml:space="preserve"> + output with + <emphasis> + Markdown + + nested substitution + + <paragraph> + This will not process the substitution + <literal_block language="python" xml:space="preserve"> + {{ text_with_nest }} + <paragraph> + Using env and filters: + <paragraph> + INDEX + <compound classes="toctree-wrapper"> + <toctree caption="True" entries="(None,\ 'other')" glob="False" hidden="False" includefiles="other" includehidden="False" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="False"> |