diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:25:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:25:40 +0000 |
commit | cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a (patch) | |
tree | 18dcde1a8d1f5570a77cd0c361de3b490d02c789 /tests/roots | |
parent | Initial commit. (diff) | |
download | sphinx-cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a.tar.xz sphinx-cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a.zip |
Adding upstream version 7.2.6.upstream/7.2.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/roots')
826 files changed, 13966 insertions, 0 deletions
diff --git a/tests/roots/test-add_enumerable_node/conf.py b/tests/roots/test-add_enumerable_node/conf.py new file mode 100644 index 0000000..8c3a568 --- /dev/null +++ b/tests/roots/test-add_enumerable_node/conf.py @@ -0,0 +1,7 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) +extensions = ['enumerable_node'] + +numfig = True diff --git a/tests/roots/test-add_enumerable_node/enumerable_node.py b/tests/roots/test-add_enumerable_node/enumerable_node.py new file mode 100644 index 0000000..782365e --- /dev/null +++ b/tests/roots/test-add_enumerable_node/enumerable_node.py @@ -0,0 +1,62 @@ +from docutils import nodes +from docutils.parsers.rst import Directive + + +class my_figure(nodes.figure): + pass + + +def visit_my_figure(self, node): + self.visit_figure(node) + + +def depart_my_figure(self, node): + self.depart_figure(node) + + +class MyFigure(Directive): + required_arguments = 1 + has_content = True + + def run(self): + figure_node = my_figure() + figure_node += nodes.image(uri=self.arguments[0]) + figure_node += nodes.caption(text=''.join(self.content)) + return [figure_node] + + +class numbered_text(nodes.Element): + pass + + +def visit_numbered_text(self, node): + self.body.append(self.starttag(node, 'div')) + self.add_fignumber(node) + self.body.append(node['title']) + self.body.append('</div>') + raise nodes.SkipNode + + +def get_title(node): + return node['title'] + + +class NumberedText(Directive): + required_arguments = 1 + final_argument_whitespace = True + + def run(self): + return [numbered_text(title=self.arguments[0])] + + +def setup(app): + # my-figure + app.add_enumerable_node(my_figure, 'figure', + html=(visit_my_figure, depart_my_figure)) + app.add_directive('my-figure', MyFigure) + + # numbered_label + app.add_enumerable_node(numbered_text, 'original', get_title, + html=(visit_numbered_text, None)) + app.add_directive('numbered-text', NumberedText) + app.config.numfig_format.setdefault('original', 'No.%s') diff --git a/tests/roots/test-add_enumerable_node/index.rst b/tests/roots/test-add_enumerable_node/index.rst new file mode 100644 index 0000000..98b858e --- /dev/null +++ b/tests/roots/test-add_enumerable_node/index.rst @@ -0,0 +1,48 @@ +======================== +test-add_enumerable_node +======================== + +.. toctree:: + :numbered: + + +First section +============= + +.. _first_figure: + +.. figure:: rimg.png + + First figure + +.. _first_my_figure: + +.. my-figure:: rimg.png + + First my figure + +.. _first_numbered_text: + +.. numbered-text:: Hello world + +.. _second_numbered_text: + +.. numbered-text:: Hello Sphinx + +Second section +============== + +.. _second_my_figure: + +.. my-figure:: rimg.png + + Second my figure + +Reference section +================= + +* first_figure is :numref:`first_figure` +* first_my_figure is :numref:`first_my_figure` +* second_my_figure is :numref:`second_my_figure` +* first numbered_text is :numref:`first_numbered_text` +* second numbered_text is :numref:`second_numbered_text` diff --git a/tests/roots/test-add_enumerable_node/rimg.png b/tests/roots/test-add_enumerable_node/rimg.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-add_enumerable_node/rimg.png diff --git a/tests/roots/test-add_source_parser-conflicts-with-users-setting/conf.py b/tests/roots/test-add_source_parser-conflicts-with-users-setting/conf.py new file mode 100644 index 0000000..3ad5491 --- /dev/null +++ b/tests/roots/test-add_source_parser-conflicts-with-users-setting/conf.py @@ -0,0 +1,17 @@ +import os +import sys + +from docutils.parsers import Parser + +sys.path.insert(0, os.path.abspath('.')) + + +class DummyTestParser(Parser): + supported = ('dummy',) + + +extensions = ['source_parser'] +source_suffix = ['.rst', '.test'] +source_parsers = { + '.test': DummyTestParser +} diff --git a/tests/roots/test-add_source_parser-conflicts-with-users-setting/source_parser.py b/tests/roots/test-add_source_parser-conflicts-with-users-setting/source_parser.py new file mode 100644 index 0000000..69ad02d --- /dev/null +++ b/tests/roots/test-add_source_parser-conflicts-with-users-setting/source_parser.py @@ -0,0 +1,10 @@ +from docutils.parsers import Parser + + +class TestSourceParser(Parser): + supported = ('test',) + + +def setup(app): + app.add_source_suffix('.test', 'test') + app.add_source_parser(TestSourceParser) diff --git a/tests/roots/test-add_source_parser/conf.py b/tests/roots/test-add_source_parser/conf.py new file mode 100644 index 0000000..2acd4d2 --- /dev/null +++ b/tests/roots/test-add_source_parser/conf.py @@ -0,0 +1,8 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + + +extensions = ['source_parser'] +source_suffix = ['.rst'] diff --git a/tests/roots/test-add_source_parser/source_parser.py b/tests/roots/test-add_source_parser/source_parser.py new file mode 100644 index 0000000..69ad02d --- /dev/null +++ b/tests/roots/test-add_source_parser/source_parser.py @@ -0,0 +1,10 @@ +from docutils.parsers import Parser + + +class TestSourceParser(Parser): + supported = ('test',) + + +def setup(app): + app.add_source_suffix('.test', 'test') + app.add_source_parser(TestSourceParser) diff --git a/tests/roots/test-api-set-translator/conf.py b/tests/roots/test-api-set-translator/conf.py new file mode 100644 index 0000000..3b56c39 --- /dev/null +++ b/tests/roots/test-api-set-translator/conf.py @@ -0,0 +1,72 @@ +# set this by test +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + +from docutils.writers.docutils_xml import XMLTranslator + +from sphinx.writers.html import HTML5Translator +from sphinx.writers.latex import LaTeXTranslator +from sphinx.writers.manpage import ManualPageTranslator +from sphinx.writers.texinfo import TexinfoTranslator +from sphinx.writers.text import TextTranslator + +project = 'test' + + +class ConfHTMLTranslator(HTML5Translator): + pass + + +class ConfDirHTMLTranslator(HTML5Translator): + pass + + +class ConfSingleHTMLTranslator(HTML5Translator): + pass + + +class ConfPickleTranslator(HTML5Translator): + pass + + +class ConfJsonTranslator(HTML5Translator): + pass + + +class ConfLaTeXTranslator(LaTeXTranslator): + pass + + +class ConfManualPageTranslator(ManualPageTranslator): + pass + + +class ConfTexinfoTranslator(TexinfoTranslator): + pass + + +class ConfTextTranslator(TextTranslator): + pass + + +class ConfXMLTranslator(XMLTranslator): + pass + + +class ConfPseudoXMLTranslator(XMLTranslator): + pass + + +def setup(app): + app.set_translator('html', ConfHTMLTranslator) + app.set_translator('dirhtml', ConfDirHTMLTranslator) + app.set_translator('singlehtml', ConfSingleHTMLTranslator) + app.set_translator('pickle', ConfPickleTranslator) + app.set_translator('json', ConfJsonTranslator) + app.set_translator('latex', ConfLaTeXTranslator) + app.set_translator('man', ConfManualPageTranslator) + app.set_translator('texinfo', ConfTexinfoTranslator) + app.set_translator('text', ConfTextTranslator) + app.set_translator('xml', ConfXMLTranslator) + app.set_translator('pseudoxml', ConfPseudoXMLTranslator) diff --git a/tests/roots/test-api-set-translator/index.rst b/tests/roots/test-api-set-translator/index.rst new file mode 100644 index 0000000..4a7d692 --- /dev/null +++ b/tests/roots/test-api-set-translator/index.rst @@ -0,0 +1,3 @@ +======================= +Test API set_translator +======================= diff --git a/tests/roots/test-api-set-translator/nonext/conf.py b/tests/roots/test-api-set-translator/nonext/conf.py new file mode 100644 index 0000000..f93e4da --- /dev/null +++ b/tests/roots/test-api-set-translator/nonext/conf.py @@ -0,0 +1,6 @@ +import os +import sys + +sys.path.insert(0, os.path.dirname(os.path.abspath('.'))) + +project = 'test' diff --git a/tests/roots/test-api-set-translator/translator.py b/tests/roots/test-api-set-translator/translator.py new file mode 100644 index 0000000..3adbf76 --- /dev/null +++ b/tests/roots/test-api-set-translator/translator.py @@ -0,0 +1,5 @@ +from sphinx.writers.html import HTML5Translator + + +class ExtHTMLTranslator(HTML5Translator): + pass diff --git a/tests/roots/test-apidoc-duplicates/fish_licence/halibut.cpython-38-x86_64-linux-gnu.so b/tests/roots/test-apidoc-duplicates/fish_licence/halibut.cpython-38-x86_64-linux-gnu.so new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-apidoc-duplicates/fish_licence/halibut.cpython-38-x86_64-linux-gnu.so diff --git a/tests/roots/test-apidoc-duplicates/fish_licence/halibut.pyx b/tests/roots/test-apidoc-duplicates/fish_licence/halibut.pyx new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-apidoc-duplicates/fish_licence/halibut.pyx diff --git a/tests/roots/test-apidoc-pep420/a/b/c/__init__.py b/tests/roots/test-apidoc-pep420/a/b/c/__init__.py new file mode 100644 index 0000000..5b727c1 --- /dev/null +++ b/tests/roots/test-apidoc-pep420/a/b/c/__init__.py @@ -0,0 +1 @@ +"Package C" diff --git a/tests/roots/test-apidoc-pep420/a/b/c/d.py b/tests/roots/test-apidoc-pep420/a/b/c/d.py new file mode 100644 index 0000000..63b0e34 --- /dev/null +++ b/tests/roots/test-apidoc-pep420/a/b/c/d.py @@ -0,0 +1 @@ +"Module d" diff --git a/tests/roots/test-apidoc-pep420/a/b/e/__init__.py b/tests/roots/test-apidoc-pep420/a/b/e/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-apidoc-pep420/a/b/e/__init__.py diff --git a/tests/roots/test-apidoc-pep420/a/b/e/f.py b/tests/roots/test-apidoc-pep420/a/b/e/f.py new file mode 100644 index 0000000..a09affe --- /dev/null +++ b/tests/roots/test-apidoc-pep420/a/b/e/f.py @@ -0,0 +1 @@ +"Module f" diff --git a/tests/roots/test-apidoc-pep420/a/b/x/y.py b/tests/roots/test-apidoc-pep420/a/b/x/y.py new file mode 100644 index 0000000..46bc245 --- /dev/null +++ b/tests/roots/test-apidoc-pep420/a/b/x/y.py @@ -0,0 +1 @@ +"Module y" diff --git a/tests/roots/test-apidoc-subpackage-in-toc/parent/__init__.py b/tests/roots/test-apidoc-subpackage-in-toc/parent/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-apidoc-subpackage-in-toc/parent/__init__.py diff --git a/tests/roots/test-apidoc-subpackage-in-toc/parent/child/__init__.py b/tests/roots/test-apidoc-subpackage-in-toc/parent/child/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-apidoc-subpackage-in-toc/parent/child/__init__.py diff --git a/tests/roots/test-apidoc-subpackage-in-toc/parent/child/foo.py b/tests/roots/test-apidoc-subpackage-in-toc/parent/child/foo.py new file mode 100644 index 0000000..810c96e --- /dev/null +++ b/tests/roots/test-apidoc-subpackage-in-toc/parent/child/foo.py @@ -0,0 +1 @@ +"foo" diff --git a/tests/roots/test-apidoc-toc/mypackage/__init__.py b/tests/roots/test-apidoc-toc/mypackage/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-apidoc-toc/mypackage/__init__.py diff --git a/tests/roots/test-apidoc-toc/mypackage/main.py b/tests/roots/test-apidoc-toc/mypackage/main.py new file mode 100755 index 0000000..f532813 --- /dev/null +++ b/tests/roots/test-apidoc-toc/mypackage/main.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import os + +import mod_resource +import mod_something + +if __name__ == "__main__": + print(f"Hello, world! -> something returns: {mod_something.something()}") + + res_path = \ + os.path.join(os.path.dirname(mod_resource.__file__), 'resource.txt') + with open(res_path, encoding='utf-8') as f: + text = f.read() + print(f"From mod_resource:resource.txt -> {text}") diff --git a/tests/roots/test-apidoc-toc/mypackage/no_init/foo.py b/tests/roots/test-apidoc-toc/mypackage/no_init/foo.py new file mode 100644 index 0000000..ece50cb --- /dev/null +++ b/tests/roots/test-apidoc-toc/mypackage/no_init/foo.py @@ -0,0 +1 @@ +MESSAGE = "There's no __init__.py in this folder, hence we should be left out" diff --git a/tests/roots/test-apidoc-toc/mypackage/resource/__init__.py b/tests/roots/test-apidoc-toc/mypackage/resource/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-apidoc-toc/mypackage/resource/__init__.py diff --git a/tests/roots/test-apidoc-toc/mypackage/resource/resource.txt b/tests/roots/test-apidoc-toc/mypackage/resource/resource.txt new file mode 100644 index 0000000..c04433e --- /dev/null +++ b/tests/roots/test-apidoc-toc/mypackage/resource/resource.txt @@ -0,0 +1 @@ +This is a text resource to be included in this otherwise empty module. No python contents here. diff --git a/tests/roots/test-apidoc-toc/mypackage/something/__init__.py b/tests/roots/test-apidoc-toc/mypackage/something/__init__.py new file mode 100644 index 0000000..6401e43 --- /dev/null +++ b/tests/roots/test-apidoc-toc/mypackage/something/__init__.py @@ -0,0 +1 @@ +"Subpackage Something" diff --git a/tests/roots/test-apidoc-trailing-underscore/package_/__init__.py b/tests/roots/test-apidoc-trailing-underscore/package_/__init__.py new file mode 100644 index 0000000..b09612b --- /dev/null +++ b/tests/roots/test-apidoc-trailing-underscore/package_/__init__.py @@ -0,0 +1 @@ +""" A package with trailing underscores """ diff --git a/tests/roots/test-apidoc-trailing-underscore/package_/module_.py b/tests/roots/test-apidoc-trailing-underscore/package_/module_.py new file mode 100644 index 0000000..e16461c --- /dev/null +++ b/tests/roots/test-apidoc-trailing-underscore/package_/module_.py @@ -0,0 +1,9 @@ +""" A module with a trailing underscore """ + + +class SomeClass_: + """ A class with a trailing underscore """ + + +def some_function_(some_arg_): + """ A function with a trailing underscore in name and argument """ diff --git a/tests/roots/test-autosummary/conf.py b/tests/roots/test-autosummary/conf.py new file mode 100644 index 0000000..46cf4fa --- /dev/null +++ b/tests/roots/test-autosummary/conf.py @@ -0,0 +1,12 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] + +# The suffix of source filenames. +source_suffix = '.rst' +autosummary_generate = True + +exclude_patterns = ['_build'] diff --git a/tests/roots/test-autosummary/dummy_module.py b/tests/roots/test-autosummary/dummy_module.py new file mode 100644 index 0000000..4adc031 --- /dev/null +++ b/tests/roots/test-autosummary/dummy_module.py @@ -0,0 +1,85 @@ +""" +.. autosummary:: + + module_attr + C.class_attr + C.instance_attr + C.prop_attr1 + C.prop_attr2 + C.C2 +""" + + +def withSentence(): + '''I have a sentence which + spans multiple lines. Then I have + more stuff + ''' + pass + + +def noSentence(): + '''this doesn't start with a + capital. so it's not considered + a sentence + ''' + pass + + +def emptyLine(): + '''This is the real summary + + However, it did't end with a period. + ''' + pass + + +#: This is a module attribute +#: +#: value is integer. +module_attr = 1 + + +class C: + ''' + My C class + + with class_attr attribute + ''' + + #: This is a class attribute + #: + #: value is integer. + class_attr = 42 + + def __init__(self): + #: This is an instance attribute + #: + #: value is a string + self.instance_attr = "42" + + def _prop_attr_get(self): + """ + This is a function docstring + + return value is string. + """ + return 'spam egg' + + prop_attr1 = property(_prop_attr_get) + + prop_attr2 = property(_prop_attr_get) + """ + This is a attribute docstring + + value is string. + """ + + class C2: + ''' + This is a nested inner class docstring + ''' + + +def func(arg_, *args, **kwargs): + """Test function take an argument ended with underscore.""" diff --git a/tests/roots/test-autosummary/index.rst b/tests/roots/test-autosummary/index.rst new file mode 100644 index 0000000..5ddc4bd --- /dev/null +++ b/tests/roots/test-autosummary/index.rst @@ -0,0 +1,8 @@ + +.. autosummary:: + :nosignatures: + :toctree: + + dummy_module + underscore_module_ + sphinx diff --git a/tests/roots/test-autosummary/sphinx.rst b/tests/roots/test-autosummary/sphinx.rst new file mode 100644 index 0000000..fc1a35a --- /dev/null +++ b/tests/roots/test-autosummary/sphinx.rst @@ -0,0 +1,31 @@ +Autosummary test +================ + +.. autosummary:: + :toctree: generated + + sphinx.application.Sphinx + +.. currentmodule:: sphinx.application + +.. autoclass:: TemplateBridge + + Basic test + + .. autosummary:: + + render -- some ignored stuff goes here + render_string More ignored stuff + + Test with tildes + + .. autosummary:: + + ~TemplateBridge.render + ~TemplateBridge.render_string + + Methods: + + .. automethod:: render + + .. automethod:: render_string diff --git a/tests/roots/test-autosummary/underscore_module_.py b/tests/roots/test-autosummary/underscore_module_.py new file mode 100644 index 0000000..8584e60 --- /dev/null +++ b/tests/roots/test-autosummary/underscore_module_.py @@ -0,0 +1,15 @@ +""" +module with trailing underscores everywhere +""" + + +class class_: + """ Class """ + def method_(_arg): + """ Method """ + pass + + +def function_(_arg): + """ Function """ + pass diff --git a/tests/roots/test-basic/conf.py b/tests/roots/test-basic/conf.py new file mode 100644 index 0000000..e274bde --- /dev/null +++ b/tests/roots/test-basic/conf.py @@ -0,0 +1,3 @@ +latex_documents = [ + ('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report') +] diff --git a/tests/roots/test-basic/index.rst b/tests/roots/test-basic/index.rst new file mode 100644 index 0000000..af12ed6 --- /dev/null +++ b/tests/roots/test-basic/index.rst @@ -0,0 +1,31 @@ +The basic Sphinx documentation for testing +========================================== + +Sphinx is a tool that makes it easy to create intelligent and beautiful +documentation for Python projects (or other documents consisting of multiple +reStructuredText sources), written by Georg Brandl. It was originally created +for the new Python documentation, and has excellent facilities for Python +project documentation, but C/C++ is supported as well, and more languages are +planned. + +Sphinx uses reStructuredText as its markup language, and many of its strengths +come from the power and straightforwardness of reStructuredText and its parsing +and translating suite, the Docutils. + +features +-------- + +Among its features are the following: + +* Output formats: HTML (including derivative formats such as HTML Help, Epub + and Qt Help), plain text, manual pages and LaTeX or direct PDF output + using rst2pdf +* Extensive cross-references: semantic markup and automatic links + for functions, classes, glossary terms and similar pieces of information +* Hierarchical structure: easy definition of a document tree, with automatic + links to siblings, parents and children +* Automatic indices: general index as well as a module index +* Code handling: automatic highlighting using the Pygments highlighter +* Flexible HTML output using the Jinja 2 templating engine +* Various extensions are available, e.g. for automatic testing of snippets + and inclusion of appropriately formatted docstrings diff --git a/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/_static/extra.css b/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/_static/extra.css new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/_static/extra.css diff --git a/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/_static/mytheme.css b/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/_static/mytheme.css new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/_static/mytheme.css diff --git a/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/theme.conf b/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/theme.conf new file mode 100644 index 0000000..c87296e --- /dev/null +++ b/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/theme.conf @@ -0,0 +1,3 @@ +[theme] +inherit = basic +stylesheet = mytheme.css, extra.css diff --git a/tests/roots/test-build-html-theme-having-multiple-stylesheets/conf.py b/tests/roots/test-build-html-theme-having-multiple-stylesheets/conf.py new file mode 100644 index 0000000..3cb43d6 --- /dev/null +++ b/tests/roots/test-build-html-theme-having-multiple-stylesheets/conf.py @@ -0,0 +1,2 @@ +html_theme_path = ['_themes'] +html_theme = 'mytheme' diff --git a/tests/roots/test-build-html-theme-having-multiple-stylesheets/index.rst b/tests/roots/test-build-html-theme-having-multiple-stylesheets/index.rst new file mode 100644 index 0000000..b8b81f9 --- /dev/null +++ b/tests/roots/test-build-html-theme-having-multiple-stylesheets/index.rst @@ -0,0 +1,2 @@ +test-build-html-theme-having-multiple-stylesheets +================================================= diff --git a/tests/roots/test-build-html-translator/conf.py b/tests/roots/test-build-html-translator/conf.py new file mode 100644 index 0000000..89448d4 --- /dev/null +++ b/tests/roots/test-build-html-translator/conf.py @@ -0,0 +1,16 @@ +from sphinx.writers.html import HTML5Translator + +project = 'test' + + +class ConfHTMLTranslator(HTML5Translator): + depart_with_node = 0 + + def depart_admonition(self, node=None): + if node is not None: + self.depart_with_node += 1 + HTML5Translator.depart_admonition(self, node) + + +def setup(app): + app.set_translator('html', ConfHTMLTranslator) diff --git a/tests/roots/test-build-html-translator/index.rst b/tests/roots/test-build-html-translator/index.rst new file mode 100644 index 0000000..1610d2b --- /dev/null +++ b/tests/roots/test-build-html-translator/index.rst @@ -0,0 +1,24 @@ +======================= +Test HTML admonitions +======================= + +.. seealso:: test + +.. note:: test + +.. warning:: test + +.. attention:: test + +.. caution:: test + +.. danger:: test + +.. error:: test + +.. hint:: test + +.. important:: test + +.. tip:: test + diff --git a/tests/roots/test-build-text/conf.py b/tests/roots/test-build-text/conf.py new file mode 100644 index 0000000..fd9eefb --- /dev/null +++ b/tests/roots/test-build-text/conf.py @@ -0,0 +1,2 @@ +source_suffix = '.txt' +exclude_patterns = ['_build'] diff --git a/tests/roots/test-build-text/doc1.txt b/tests/roots/test-build-text/doc1.txt new file mode 100644 index 0000000..da1909a --- /dev/null +++ b/tests/roots/test-build-text/doc1.txt @@ -0,0 +1,2 @@ +Section A +========= diff --git a/tests/roots/test-build-text/doc2.txt b/tests/roots/test-build-text/doc2.txt new file mode 100644 index 0000000..ebc88e9 --- /dev/null +++ b/tests/roots/test-build-text/doc2.txt @@ -0,0 +1,9 @@ +Section B +========= + +Sub Ba +------ + +Sub Bb +------ + diff --git a/tests/roots/test-build-text/index.txt b/tests/roots/test-build-text/index.txt new file mode 100644 index 0000000..ca9f8dc --- /dev/null +++ b/tests/roots/test-build-text/index.txt @@ -0,0 +1,11 @@ +.. toctree:: + :numbered: + + doc1 + doc2 + maxwidth + lineblock + nonascii_title + nonascii_table + nonascii_maxwidth + table diff --git a/tests/roots/test-build-text/lineblock.txt b/tests/roots/test-build-text/lineblock.txt new file mode 100644 index 0000000..b9cd0ed --- /dev/null +++ b/tests/roots/test-build-text/lineblock.txt @@ -0,0 +1,6 @@ +* one + + | line-block 1 + | line-block 2 + +followed paragraph. diff --git a/tests/roots/test-build-text/listitems.txt b/tests/roots/test-build-text/listitems.txt new file mode 100644 index 0000000..f0952d8 --- /dev/null +++ b/tests/roots/test-build-text/listitems.txt @@ -0,0 +1,4 @@ +.. seealso:: + + * item 1 + * item 2 diff --git a/tests/roots/test-build-text/maxwidth.txt b/tests/roots/test-build-text/maxwidth.txt new file mode 100644 index 0000000..c36f8a0 --- /dev/null +++ b/tests/roots/test-build-text/maxwidth.txt @@ -0,0 +1,6 @@ +.. seealso:: ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham + +* ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham +* ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham + +spam egg diff --git a/tests/roots/test-build-text/nonascii_maxwidth.txt b/tests/roots/test-build-text/nonascii_maxwidth.txt new file mode 100644 index 0000000..e9f0fd9 --- /dev/null +++ b/tests/roots/test-build-text/nonascii_maxwidth.txt @@ -0,0 +1,5 @@ +abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc + +日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 + +abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 diff --git a/tests/roots/test-build-text/nonascii_table.txt b/tests/roots/test-build-text/nonascii_table.txt new file mode 100644 index 0000000..709e0f2 --- /dev/null +++ b/tests/roots/test-build-text/nonascii_table.txt @@ -0,0 +1,7 @@ +.. list-table:: + + - - spam + - egg + + - - 日本語 + - 日本語 diff --git a/tests/roots/test-build-text/nonascii_title.txt b/tests/roots/test-build-text/nonascii_title.txt new file mode 100644 index 0000000..6d3b1f6 --- /dev/null +++ b/tests/roots/test-build-text/nonascii_title.txt @@ -0,0 +1,2 @@ +日本語 +====== diff --git a/tests/roots/test-build-text/table.txt b/tests/roots/test-build-text/table.txt new file mode 100644 index 0000000..adc8b37 --- /dev/null +++ b/tests/roots/test-build-text/table.txt @@ -0,0 +1,7 @@ ++-----+-----+ +| XXX | XXX | ++-----+-----+ +| | XXX | ++-----+-----+ +| XXX | | ++-----+-----+ diff --git a/tests/roots/test-build-text/table_colspan.txt b/tests/roots/test-build-text/table_colspan.txt new file mode 100644 index 0000000..4ae6637 --- /dev/null +++ b/tests/roots/test-build-text/table_colspan.txt @@ -0,0 +1,7 @@ ++-----+-----+ +| XXX | XXX | ++-----+-----+ +| | XXX | ++-----+ | +| XXX | | ++-----+-----+ diff --git a/tests/roots/test-build-text/table_colspan_and_rowspan.txt b/tests/roots/test-build-text/table_colspan_and_rowspan.txt new file mode 100644 index 0000000..82d3607 --- /dev/null +++ b/tests/roots/test-build-text/table_colspan_and_rowspan.txt @@ -0,0 +1,7 @@ ++-----------+-----+ +| AAA | BBB | ++-----+-----+ | +| | XXX | | +| +-----+-----+ +| DDD | CCC | ++-----+-----------+ diff --git a/tests/roots/test-build-text/table_colspan_left.txt b/tests/roots/test-build-text/table_colspan_left.txt new file mode 100644 index 0000000..dbfa324 --- /dev/null +++ b/tests/roots/test-build-text/table_colspan_left.txt @@ -0,0 +1,7 @@ ++-----+-----+ +| XXX | XXX | ++-----+-----+ +| | XXX | +| +-----+ +| XXX | | ++-----+-----+ diff --git a/tests/roots/test-build-text/table_rowspan.txt b/tests/roots/test-build-text/table_rowspan.txt new file mode 100644 index 0000000..36c30eb --- /dev/null +++ b/tests/roots/test-build-text/table_rowspan.txt @@ -0,0 +1,7 @@ ++-----+-----+ +| XXXXXXXXX | ++-----+-----+ +| | XXX | ++-----+-----+ +| XXX | | ++-----+-----+ diff --git a/tests/roots/test-builder-dirhtml/bar.rst b/tests/roots/test-builder-dirhtml/bar.rst new file mode 100644 index 0000000..11f287a --- /dev/null +++ b/tests/roots/test-builder-dirhtml/bar.rst @@ -0,0 +1,4 @@ +.. _bar: + +bar +=== diff --git a/tests/roots/test-builder-dirhtml/conf.py b/tests/roots/test-builder-dirhtml/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-builder-dirhtml/conf.py diff --git a/tests/roots/test-builder-dirhtml/foo/foo_1.rst b/tests/roots/test-builder-dirhtml/foo/foo_1.rst new file mode 100644 index 0000000..6db0ea5 --- /dev/null +++ b/tests/roots/test-builder-dirhtml/foo/foo_1.rst @@ -0,0 +1,4 @@ +.. _foo_1: + +foo/foo_1 +========= diff --git a/tests/roots/test-builder-dirhtml/foo/foo_2.rst b/tests/roots/test-builder-dirhtml/foo/foo_2.rst new file mode 100644 index 0000000..fae7f26 --- /dev/null +++ b/tests/roots/test-builder-dirhtml/foo/foo_2.rst @@ -0,0 +1,4 @@ +.. _foo_2: + +foo/foo_2 +========= diff --git a/tests/roots/test-builder-dirhtml/foo/index.rst b/tests/roots/test-builder-dirhtml/foo/index.rst new file mode 100644 index 0000000..92d473c --- /dev/null +++ b/tests/roots/test-builder-dirhtml/foo/index.rst @@ -0,0 +1,9 @@ +.. _foo: + +foo/index +========= + +.. toctree:: + + foo_1 + foo_2 diff --git a/tests/roots/test-builder-dirhtml/index.rst b/tests/roots/test-builder-dirhtml/index.rst new file mode 100644 index 0000000..274e177 --- /dev/null +++ b/tests/roots/test-builder-dirhtml/index.rst @@ -0,0 +1,9 @@ +.. _index: + +index +===== + +.. toctree:: + + foo/index + bar diff --git a/tests/roots/test-builder-gettext-dont-rebuild-mo/bom.rst b/tests/roots/test-builder-gettext-dont-rebuild-mo/bom.rst new file mode 100644 index 0000000..3fea824 --- /dev/null +++ b/tests/roots/test-builder-gettext-dont-rebuild-mo/bom.rst @@ -0,0 +1,5 @@ +File with UTF-8 BOM +=================== + +This file has a UTF-8 "BOM". + diff --git a/tests/roots/test-builder-gettext-dont-rebuild-mo/conf.py b/tests/roots/test-builder-gettext-dont-rebuild-mo/conf.py new file mode 100644 index 0000000..d13f727 --- /dev/null +++ b/tests/roots/test-builder-gettext-dont-rebuild-mo/conf.py @@ -0,0 +1 @@ +language = 'xx' diff --git a/tests/roots/test-builder-gettext-dont-rebuild-mo/index.rst b/tests/roots/test-builder-gettext-dont-rebuild-mo/index.rst new file mode 100644 index 0000000..7ff38c5 --- /dev/null +++ b/tests/roots/test-builder-gettext-dont-rebuild-mo/index.rst @@ -0,0 +1,6 @@ +The basic Sphinx documentation for testing +========================================== + +.. toctree:: + + bom diff --git a/tests/roots/test-builder-gettext-dont-rebuild-mo/xx/LC_MESSAGES/bom.po b/tests/roots/test-builder-gettext-dont-rebuild-mo/xx/LC_MESSAGES/bom.po new file mode 100644 index 0000000..c6025eb --- /dev/null +++ b/tests/roots/test-builder-gettext-dont-rebuild-mo/xx/LC_MESSAGES/bom.po @@ -0,0 +1,12 @@ +#, fuzzy +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "File with UTF-8 BOM" +msgstr "Datei mit UTF-8" + +msgid "This file has a UTF-8 \"BOM\"." +msgstr "This file has umlauts: äöü." diff --git a/tests/roots/test-changes/base.rst b/tests/roots/test-changes/base.rst new file mode 100644 index 0000000..a1b2839 --- /dev/null +++ b/tests/roots/test-changes/base.rst @@ -0,0 +1,20 @@ +Version markup +-------------- + +.. versionadded:: 0.6 + Some funny **stuff**. + +.. versionchanged:: 0.6 + Even more funny stuff. + +.. deprecated:: 0.6 + Boring stuff. + +.. versionadded:: 1.2 + + First paragraph of versionadded. + +.. versionchanged:: 1.2 + First paragraph of versionchanged. + + Second paragraph of versionchanged. diff --git a/tests/roots/test-changes/c-api.rst b/tests/roots/test-changes/c-api.rst new file mode 100644 index 0000000..f0ad413 --- /dev/null +++ b/tests/roots/test-changes/c-api.rst @@ -0,0 +1,24 @@ +.. highlight:: c + + +Memory +====== + +.. c:function:: void* Test_Malloc(size_t n) + + Allocate *n* bytes of memory. + + .. versionchanged:: 0.6 + + Can now be replaced with a different allocator. + +System +------ + +Access to the system allocator. + +.. versionadded:: 0.6 + +.. c:function:: void* Test_SysMalloc(size_t n) + + Allocate *n* bytes of memory using system allocator. diff --git a/tests/roots/test-changes/conf.py b/tests/roots/test-changes/conf.py new file mode 100644 index 0000000..c3b2169 --- /dev/null +++ b/tests/roots/test-changes/conf.py @@ -0,0 +1,4 @@ +project = 'Sphinx ChangesBuilder tests' +copyright = '2007-2023 by the Sphinx team, see AUTHORS' +version = '0.6' +release = '0.6alpha1' diff --git a/tests/roots/test-changes/contents.rst b/tests/roots/test-changes/contents.rst new file mode 100644 index 0000000..ced8026 --- /dev/null +++ b/tests/roots/test-changes/contents.rst @@ -0,0 +1,13 @@ +Index for ChangesBuilder tests +============================== + +Contents: + +.. toctree:: + :maxdepth: 2 + :caption: Table of Contents + :name: mastertoc + + base + c-api + library/utils diff --git a/tests/roots/test-changes/library/utils.rst b/tests/roots/test-changes/library/utils.rst new file mode 100644 index 0000000..8644699 --- /dev/null +++ b/tests/roots/test-changes/library/utils.rst @@ -0,0 +1,25 @@ +:mod:`utils` --- Fake utilities module for tests +================================================ + +.. module:: utils + :synopsis: Utility functions + +-------------- + +The :mod:`utils` module is a pretend python module for changes testing. + + +Classes +------- + +.. class:: Path + + Class for handling paths. + + .. versionadded:: 0.5 + + Innovative new way to handle paths. + + .. deprecated:: 0.6 + + So, that was a bad idea it turns out. diff --git a/tests/roots/test-circular/conf.py b/tests/roots/test-circular/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-circular/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-circular/index.rst b/tests/roots/test-circular/index.rst new file mode 100644 index 0000000..294e674 --- /dev/null +++ b/tests/roots/test-circular/index.rst @@ -0,0 +1,4 @@ +.. toctree:: + + sub + diff --git a/tests/roots/test-circular/sub.rst b/tests/roots/test-circular/sub.rst new file mode 100644 index 0000000..cebfd65 --- /dev/null +++ b/tests/roots/test-circular/sub.rst @@ -0,0 +1,3 @@ +.. toctree:: + + index diff --git a/tests/roots/test-config/conf.py b/tests/roots/test-config/conf.py new file mode 100644 index 0000000..0027d87 --- /dev/null +++ b/tests/roots/test-config/conf.py @@ -0,0 +1,3 @@ +project = 'Sphinx <Tests>' +release = '0.6alpha1' +templates_path = ['_templates'] diff --git a/tests/roots/test-copyright-multiline/conf.py b/tests/roots/test-copyright-multiline/conf.py new file mode 100644 index 0000000..a2b7b68 --- /dev/null +++ b/tests/roots/test-copyright-multiline/conf.py @@ -0,0 +1,9 @@ +copyright = ( + '2006', + '2006-2009, Alice', + '2010-2013, Bob', + '2014-2017, Charlie', + '2018-2021, David', + '2022-2025, Eve', +) +html_theme = 'basic' diff --git a/tests/roots/test-copyright-multiline/index.rst b/tests/roots/test-copyright-multiline/index.rst new file mode 100644 index 0000000..aa32ae6 --- /dev/null +++ b/tests/roots/test-copyright-multiline/index.rst @@ -0,0 +1,3 @@ +======================== +test-copyright-multiline +======================== diff --git a/tests/roots/test-correct-year/conf.py b/tests/roots/test-correct-year/conf.py new file mode 100644 index 0000000..814c08b --- /dev/null +++ b/tests/roots/test-correct-year/conf.py @@ -0,0 +1 @@ +copyright = '2006-2009, Author' diff --git a/tests/roots/test-correct-year/index.rst b/tests/roots/test-correct-year/index.rst new file mode 100644 index 0000000..938dfd5 --- /dev/null +++ b/tests/roots/test-correct-year/index.rst @@ -0,0 +1,4 @@ +================= +test-correct-year +================= + diff --git a/tests/roots/test-default_role/conf.py b/tests/roots/test-default_role/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-default_role/conf.py diff --git a/tests/roots/test-default_role/foo.rst b/tests/roots/test-default_role/foo.rst new file mode 100644 index 0000000..00e5ae5 --- /dev/null +++ b/tests/roots/test-default_role/foo.rst @@ -0,0 +1,4 @@ +foo.rst +======= + +`OK` button diff --git a/tests/roots/test-default_role/index.rst b/tests/roots/test-default_role/index.rst new file mode 100644 index 0000000..34c1855 --- /dev/null +++ b/tests/roots/test-default_role/index.rst @@ -0,0 +1,6 @@ +default_role +============ + +.. default-role:: pep + +`8` diff --git a/tests/roots/test-directive-code/caption.rst b/tests/roots/test-directive-code/caption.rst new file mode 100644 index 0000000..77c5c38 --- /dev/null +++ b/tests/roots/test-directive-code/caption.rst @@ -0,0 +1,52 @@ +Caption +======= + +References +---------- + +See :numref:`name *test* rb` and :numref:`name **test** py`. + +See :ref:`Ruby <name *test* rb>` and :ref:`Python <name **test** py>`. + + +Code blocks +----------- + +.. code-block:: ruby + :caption: caption *test* rb + + def ruby? + false + end + + +Literal Include +--------------- + +.. literalinclude:: literal.inc + :language: python + :caption: caption **test** py + :lines: 10-11 + + +Named Code blocks +----------------- + +.. code-block:: ruby + :name: name *test* rb + :caption: caption *test* rbnamed + + def ruby? + false + end + + +Named Literal Include +--------------------- + +.. literalinclude:: literal.inc + :language: python + :name: name **test** py + :caption: caption **test** pynamed + :lines: 10-11 + diff --git a/tests/roots/test-directive-code/classes.rst b/tests/roots/test-directive-code/classes.rst new file mode 100644 index 0000000..e9aa5d9 --- /dev/null +++ b/tests/roots/test-directive-code/classes.rst @@ -0,0 +1,21 @@ +classes +======= + +Code blocks +----------- + +.. code-block:: ruby + :class: foo bar + :name: code_block + + def ruby? + false + end + + +Literal Includes +---------------- + +.. literalinclude:: literal.inc + :class: bar baz + :name: literal_include diff --git a/tests/roots/test-directive-code/conf.py b/tests/roots/test-directive-code/conf.py new file mode 100644 index 0000000..f1e3a2c --- /dev/null +++ b/tests/roots/test-directive-code/conf.py @@ -0,0 +1,2 @@ +exclude_patterns = ['_build'] +numfig = True diff --git a/tests/roots/test-directive-code/dedent.rst b/tests/roots/test-directive-code/dedent.rst new file mode 100644 index 0000000..66ac91c --- /dev/null +++ b/tests/roots/test-directive-code/dedent.rst @@ -0,0 +1,64 @@ +dedent option +------------- + +.. code-block:: + + First line + Second line + Third line + Fourth line + +ReST has no fixed indent and only a change in indentation is significant not the amount [1]_. +Thus, the following code inside the code block is not indent even it looks so with respect to the previous block. + +.. code-block:: + + First line + Second line + Third line + Fourth line + +Having an option "fixates" the indent to be 3 spaces, thus the code inside the code block is indented by 4 spaces. + +.. code-block:: + :class: dummy + + First line + Second line + Third line + Fourth line + +The code has 6 spaces indent, minus 4 spaces dedent should yield a 2 space indented code in the output. + +.. code-block:: + :dedent: 4 + + First line + Second line + Third line + Fourth line + +Dedenting by zero, should not strip any spaces and be a no-op. + +.. note:: + This can be used as an alternative to ``:class: dummy`` above, to fixate the ReST indentation of the block. + +.. code-block:: + :dedent: 0 + + First line + Second line + Third line + Fourth line + +Dedent without argument should autostrip common whitespace at the beginning. + +.. code-block:: + :dedent: + + First line + Second line + Third line + Fourth line + +.. [1] https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#indentation diff --git a/tests/roots/test-directive-code/emphasize.rst b/tests/roots/test-directive-code/emphasize.rst new file mode 100644 index 0000000..95db574 --- /dev/null +++ b/tests/roots/test-directive-code/emphasize.rst @@ -0,0 +1,7 @@ +Literal Includes with Highlighted Lines +======================================= + +.. literalinclude:: target.py + :language: python + :emphasize-lines: 5-6, 13-15, 24- + diff --git a/tests/roots/test-directive-code/empty.inc b/tests/roots/test-directive-code/empty.inc new file mode 100644 index 0000000..b28b04f --- /dev/null +++ b/tests/roots/test-directive-code/empty.inc @@ -0,0 +1,3 @@ + + + diff --git a/tests/roots/test-directive-code/error.inc b/tests/roots/test-directive-code/error.inc new file mode 100644 index 0000000..4728280 --- /dev/null +++ b/tests/roots/test-directive-code/error.inc @@ -0,0 +1 @@ +not a python script! diff --git a/tests/roots/test-directive-code/force.rst b/tests/roots/test-directive-code/force.rst new file mode 100644 index 0000000..1834b3a --- /dev/null +++ b/tests/roots/test-directive-code/force.rst @@ -0,0 +1,16 @@ +force option +============ + +.. code:: python + :force: + + not a python script! + +.. code-block:: python + :force: + + not a python script! + +.. literalinclude:: error.inc + :language: python + :force: diff --git a/tests/roots/test-directive-code/highlight.rst b/tests/roots/test-directive-code/highlight.rst new file mode 100644 index 0000000..4191b58 --- /dev/null +++ b/tests/roots/test-directive-code/highlight.rst @@ -0,0 +1,20 @@ +highlight +--------- + +.. code-block:: + + "A code-block without no language" + +.. code-block:: python2 + + "A code-block with language argument" + +.. highlight:: python3 + +.. code-block:: + + "A code-block without no language after highlight directive" + +.. code-block:: python2 + + "A code-block without language argument after highlight directive" diff --git a/tests/roots/test-directive-code/index.rst b/tests/roots/test-directive-code/index.rst new file mode 100644 index 0000000..dab6b70 --- /dev/null +++ b/tests/roots/test-directive-code/index.rst @@ -0,0 +1,25 @@ +test-directive-code +=================== + +.. toctree:: + :glob: + + * + + +Code blocks +----------- + +.. code-block:: ruby + :linenos: + + def ruby? + false + end + + +Literal Includes +---------------- + +.. literalinclude:: literal.inc + :language: python diff --git a/tests/roots/test-directive-code/linenos.rst b/tests/roots/test-directive-code/linenos.rst new file mode 100644 index 0000000..a8e5b69 --- /dev/null +++ b/tests/roots/test-directive-code/linenos.rst @@ -0,0 +1,18 @@ +Literal Includes with Line Numbers +================================== + +.. literalinclude:: literal.inc + :language: python + :linenos: + +.. literalinclude:: literal.inc + :language: python + :lineno-start: 200 + +.. literalinclude:: literal.inc + :language: python + :lines: 5-9 + :lineno-match: + +.. literalinclude:: empty.inc + :lineno-match: diff --git a/tests/roots/test-directive-code/linenothreshold.rst b/tests/roots/test-directive-code/linenothreshold.rst new file mode 100644 index 0000000..09ee67e --- /dev/null +++ b/tests/roots/test-directive-code/linenothreshold.rst @@ -0,0 +1,23 @@ +Code Blocks and Literal Includes with Line Numbers via linenothreshold +====================================================================== + +.. highlight:: python + :linenothreshold: 5 + +.. code-block:: + + class Foo: + pass + + class Bar: + def baz(): + pass + +.. code-block:: + + # comment + value = True + +.. literalinclude:: literal.inc + +.. literalinclude:: literal-short.inc diff --git a/tests/roots/test-directive-code/literal-diff.inc b/tests/roots/test-directive-code/literal-diff.inc new file mode 100644 index 0000000..f9c21e3 --- /dev/null +++ b/tests/roots/test-directive-code/literal-diff.inc @@ -0,0 +1,13 @@ +# Literally included file using Python highlighting + +foo = "Including Unicode characters: üöä" + +class Foo: + pass + +class Bar: + def baz(self): + pass + +# comment after Bar class +def bar(): pass diff --git a/tests/roots/test-directive-code/literal-short.inc b/tests/roots/test-directive-code/literal-short.inc new file mode 100644 index 0000000..7a07a3f --- /dev/null +++ b/tests/roots/test-directive-code/literal-short.inc @@ -0,0 +1,3 @@ +# Very small literal include (linenothreshold check) + +value = True diff --git a/tests/roots/test-directive-code/literal.inc b/tests/roots/test-directive-code/literal.inc new file mode 100644 index 0000000..fa8f0ca --- /dev/null +++ b/tests/roots/test-directive-code/literal.inc @@ -0,0 +1,13 @@ +# Literally included file using Python highlighting + +foo = "Including Unicode characters: üöä" + +class Foo: + pass + +class Bar: + def baz(): + pass + +# comment after Bar class definition +def bar(): pass diff --git a/tests/roots/test-directive-code/namedblocks.rst b/tests/roots/test-directive-code/namedblocks.rst new file mode 100644 index 0000000..5779bc9 --- /dev/null +++ b/tests/roots/test-directive-code/namedblocks.rst @@ -0,0 +1,28 @@ +Named Blocks +============ + +References to named blocks +-------------------------- + +See :ref:`the ruby code <some ruby code>` and +also :ref:`the python code <some python code>`. + + +Named Code block +---------------- + +.. code-block:: ruby + :name: some ruby code + + def ruby? + false + end + + +Named Literal Include +--------------------- + +.. literalinclude:: literal.inc + :language: python + :name: some python code + diff --git a/tests/roots/test-directive-code/py-decorators.inc b/tests/roots/test-directive-code/py-decorators.inc new file mode 100644 index 0000000..012d5d5 --- /dev/null +++ b/tests/roots/test-directive-code/py-decorators.inc @@ -0,0 +1,15 @@ +# Literally included file using Python highlighting + +@class_decorator +@other_decorator() +class TheClass(object): + + @method_decorator + @other_decorator() + def the_method(): + pass + +@function_decorator +@other_decorator() +def the_function(): + pass diff --git a/tests/roots/test-directive-code/py-decorators.rst b/tests/roots/test-directive-code/py-decorators.rst new file mode 100644 index 0000000..31417f5 --- /dev/null +++ b/tests/roots/test-directive-code/py-decorators.rst @@ -0,0 +1,17 @@ +py-decorators +============= + +Various decorators +------------------ + +.. literalinclude:: py-decorators.inc + :name: literal_include_pydecorators_1 + :pyobject: TheClass + +.. literalinclude:: py-decorators.inc + :name: literal_include_pydecorators_2 + :pyobject: TheClass.the_method + +.. literalinclude:: py-decorators.inc + :name: literal_include_pydecorators_3 + :pyobject: the_function diff --git a/tests/roots/test-directive-code/python.rst b/tests/roots/test-directive-code/python.rst new file mode 100644 index 0000000..794c190 --- /dev/null +++ b/tests/roots/test-directive-code/python.rst @@ -0,0 +1,13 @@ +===========================
+Literal Includes for python
+===========================
+
+block start with blank or comment
+=================================
+
+.. literalinclude:: target.py
+ :pyobject: block_start_with_comment
+
+.. literalinclude:: target.py
+ :pyobject: block_start_with_blank
+
diff --git a/tests/roots/test-directive-code/target.py b/tests/roots/test-directive-code/target.py new file mode 100644 index 0000000..b95dffb --- /dev/null +++ b/tests/roots/test-directive-code/target.py @@ -0,0 +1,26 @@ +# Literally included file using Python highlighting + +foo = "Including Unicode characters: üöä" + +class Foo: + pass + +class Bar: + def baz(): + pass + +# comment after Bar class definition +def bar(): pass + +def block_start_with_comment(): + # Comment + return 1 + +def block_start_with_blank(): + + return 1 + + +class Qux: + def quux(self): + pass diff --git a/tests/roots/test-directive-csv-table/conf.py b/tests/roots/test-directive-csv-table/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-directive-csv-table/conf.py diff --git a/tests/roots/test-directive-csv-table/example.csv b/tests/roots/test-directive-csv-table/example.csv new file mode 100644 index 0000000..eb039aa --- /dev/null +++ b/tests/roots/test-directive-csv-table/example.csv @@ -0,0 +1 @@ +foo,bar,baz diff --git a/tests/roots/test-directive-csv-table/subdir/example.csv b/tests/roots/test-directive-csv-table/subdir/example.csv new file mode 100644 index 0000000..32fe56f --- /dev/null +++ b/tests/roots/test-directive-csv-table/subdir/example.csv @@ -0,0 +1 @@ +FOO,BAR,BAZ diff --git a/tests/roots/test-directive-include/bar.txt b/tests/roots/test-directive-include/bar.txt new file mode 100644 index 0000000..c0fef4c --- /dev/null +++ b/tests/roots/test-directive-include/bar.txt @@ -0,0 +1 @@ +Text from :file:`bar.txt`. diff --git a/tests/roots/test-directive-include/baz/baz.rst b/tests/roots/test-directive-include/baz/baz.rst new file mode 100644 index 0000000..0b74be0 --- /dev/null +++ b/tests/roots/test-directive-include/baz/baz.rst @@ -0,0 +1,6 @@ +Baz +=== + +.. include:: foo.rst + +Baz was here. diff --git a/tests/roots/test-directive-include/conf.py b/tests/roots/test-directive-include/conf.py new file mode 100644 index 0000000..a476858 --- /dev/null +++ b/tests/roots/test-directive-include/conf.py @@ -0,0 +1,2 @@ +project = 'test-directive-include' +exclude_patterns = ['_build'] diff --git a/tests/roots/test-directive-include/foo.rst b/tests/roots/test-directive-include/foo.rst new file mode 100644 index 0000000..0f82e66 --- /dev/null +++ b/tests/roots/test-directive-include/foo.rst @@ -0,0 +1 @@ +The #magical foo. diff --git a/tests/roots/test-directive-include/text.txt b/tests/roots/test-directive-include/text.txt new file mode 100644 index 0000000..b7ea15d --- /dev/null +++ b/tests/roots/test-directive-include/text.txt @@ -0,0 +1 @@ +This is plain text. diff --git a/tests/roots/test-directive-only/conf.py b/tests/roots/test-directive-only/conf.py new file mode 100644 index 0000000..191d0f5 --- /dev/null +++ b/tests/roots/test-directive-only/conf.py @@ -0,0 +1,2 @@ +project = 'test-directive-only' +exclude_patterns = ['_build'] diff --git a/tests/roots/test-directive-only/index.rst b/tests/roots/test-directive-only/index.rst new file mode 100644 index 0000000..80ec003 --- /dev/null +++ b/tests/roots/test-directive-only/index.rst @@ -0,0 +1,6 @@ +test-directive-only +=================== + +.. toctree:: + + only diff --git a/tests/roots/test-directive-only/only.rst b/tests/roots/test-directive-only/only.rst new file mode 100644 index 0000000..4a3eb48 --- /dev/null +++ b/tests/roots/test-directive-only/only.rst @@ -0,0 +1,203 @@ + +1. Sections in only directives +============================== + +Testing sections in only directives. + +.. only:: nonexisting_tag + + Skipped Section + --------------- + Should not be here. + +.. only:: not nonexisting_tag + + 1.1. Section + ------------ + Should be here. + +1.2. Section +------------ + +.. only:: not nonexisting_tag + + 1.2.1. Subsection + ~~~~~~~~~~~~~~~~~ + Should be here. + +.. only:: nonexisting_tag + + Skipped Subsection + ~~~~~~~~~~~~~~~~~~ + Should not be here. + +1.3. Section +------------ + +1.3.1. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +1.4. Section +------------ + +.. only:: not nonexisting_tag + + 1.4.1. Subsection + ~~~~~~~~~~~~~~~~~ + Should be here. + +1.5. Section +------------ + +.. only:: not nonexisting_tag + + 1.5.1. Subsection + ~~~~~~~~~~~~~~~~~ + Should be here. + +1.5.2. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +1.6. Section +------------ + +1.6.1. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +.. only:: not nonexisting_tag + + 1.6.2. Subsection + ~~~~~~~~~~~~~~~~~ + Should be here. + +1.6.3. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +1.7. Section +------------ + +1.7.1. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +.. only:: not nonexisting_tag + + 1.7.1.1. Subsubsection + ...................... + Should be here. + +1.8. Section +------------ + +1.8.1. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +1.8.1.1. Subsubsection +...................... +Should be here. + +.. only:: not nonexisting_tag + + 1.8.1.2. Subsubsection + ...................... + Should be here. + +1.9. Section +------------ + +.. only:: nonexisting_tag + + Skipped Subsection + ~~~~~~~~~~~~~~~~~~ + +1.9.1. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +1.9.1.1. Subsubsection +...................... +Should be here. + +.. only:: not nonexisting_tag + + 1.10. Section + ------------- + Should be here. + +1.11. Section +------------- + +Text before subsection 11.1. + +.. only:: not nonexisting_tag + + More text before subsection 11.1. + + 1.11.1. Subsection + ~~~~~~~~~~~~~~~~~~ + Should be here. + +Text after subsection 11.1. + +.. only:: not nonexisting_tag + + 1.12. Section + ------------- + Should be here. + + 1.12.1. Subsection + ~~~~~~~~~~~~~~~~~~ + Should be here. + + 1.13. Section + ------------- + Should be here. + +.. only:: not nonexisting_tag + + 1.14. Section + ------------- + Should be here. + + .. only:: not nonexisting_tag + + 1.14.1. Subsection + ~~~~~~~~~~~~~~~~~~ + Should be here. + + 1.15. Section + ------------- + Should be here. + +.. only:: nonexisting_tag + + Skipped document level heading + ============================== + Should not be here. + +.. only:: not nonexisting_tag + + 2. Included document level heading + ================================== + Should be here. + +3. Document level heading +========================= +Should be here. + +.. only:: nonexisting_tag + + Skipped document level heading + ============================== + Should not be here. + +.. only:: not nonexisting_tag + + 4. Another included document level heading + ========================================== + Should be here. diff --git a/tests/roots/test-directives-raw/conf.py b/tests/roots/test-directives-raw/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-directives-raw/conf.py diff --git a/tests/roots/test-directives-raw/index.rst b/tests/roots/test-directives-raw/index.rst new file mode 100644 index 0000000..401ab73 --- /dev/null +++ b/tests/roots/test-directives-raw/index.rst @@ -0,0 +1,40 @@ +test-directives-raw +=================== + +HTML +---- + +standard +^^^^^^^^ + +.. raw:: html + + standalone raw directive (HTML) + +with substitution +^^^^^^^^^^^^^^^^^ + +HTML: abc |HTML_RAW| ghi + +.. |HTML_RAW| raw:: html + + def + +LaTeX +----- + +standard +^^^^^^^^ + +.. raw:: latex + + standalone raw directive (LaTeX) + +with substitution +^^^^^^^^^^^^^^^^^ + +LaTeX: abc |LATEX_RAW| ghi + +.. |LATEX_RAW| raw:: latex + + def diff --git a/tests/roots/test-docutilsconf/conf.py b/tests/roots/test-docutilsconf/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-docutilsconf/conf.py diff --git a/tests/roots/test-docutilsconf/docutils.conf b/tests/roots/test-docutilsconf/docutils.conf new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-docutilsconf/docutils.conf diff --git a/tests/roots/test-docutilsconf/index.rst b/tests/roots/test-docutilsconf/index.rst new file mode 100644 index 0000000..d292e32 --- /dev/null +++ b/tests/roots/test-docutilsconf/index.rst @@ -0,0 +1,6 @@ +test-docutilsconf +================== + +Sphinx [1]_ + +.. [1] Python Documentation Generator diff --git a/tests/roots/test-domain-c-c_maximum_signature_line_length/conf.py b/tests/roots/test-domain-c-c_maximum_signature_line_length/conf.py new file mode 100644 index 0000000..ba480ed --- /dev/null +++ b/tests/roots/test-domain-c-c_maximum_signature_line_length/conf.py @@ -0,0 +1 @@ +c_maximum_signature_line_length = len("str hello(str name)") - 1 diff --git a/tests/roots/test-domain-c-c_maximum_signature_line_length/index.rst b/tests/roots/test-domain-c-c_maximum_signature_line_length/index.rst new file mode 100644 index 0000000..be20940 --- /dev/null +++ b/tests/roots/test-domain-c-c_maximum_signature_line_length/index.rst @@ -0,0 +1,4 @@ +domain-c-c_maximum_signature_line_length +======================================== + +.. c:function:: str hello(str name) diff --git a/tests/roots/test-domain-c-intersphinx/conf.py b/tests/roots/test-domain-c-intersphinx/conf.py new file mode 100644 index 0000000..c176af7 --- /dev/null +++ b/tests/roots/test-domain-c-intersphinx/conf.py @@ -0,0 +1,4 @@ +exclude_patterns = ['_build'] +extensions = [ + 'sphinx.ext.intersphinx', +] diff --git a/tests/roots/test-domain-c-intersphinx/index.rst b/tests/roots/test-domain-c-intersphinx/index.rst new file mode 100644 index 0000000..5d6d3e0 --- /dev/null +++ b/tests/roots/test-domain-c-intersphinx/index.rst @@ -0,0 +1,62 @@ +.. c:member:: void __member = _member + + - :any:`_member` + - :c:member:`_member` + - :c:var:`_member` + - :c:data:`_member` + +.. c:member:: void __var = _var + + - :any:`_var` + - :c:member:`_var` + - :c:var:`_var` + - :c:data:`_var` + +.. c:member:: void __function = _function + + - :any:`_function` + - :c:func:`_function` + - :c:type:`_function` + +.. c:member:: void __macro = _macro + + - :any:`_macro` + - :c:macro:`_macro` + +.. c:type:: _struct __struct + struct _struct __structTagged + + - :any:`_struct` + - :c:struct:`_struct` + - :c:type:`_struct` + +.. c:type:: _union __union + union _union __unionTagged + + - :any:`_union` + - :c:union:`_union` + - :c:type:`_union` + +.. c:type:: _enum __enum + enum _enum __enumTagged + + - :any:`_enum` + - :c:enum:`_enum` + - :c:type:`_enum` + +.. c:member:: void __enumerator = _enumerator + + - :any:`_enumerator` + - :c:enumerator:`_enumerator` + +.. c:type:: _type __type + + - :any:`_type` + - :c:type:`_type` + +.. c:member:: void __functionParam = _functionParam.param + + - :any:`_functionParam.param` + - :c:member:`_functionParam.param` + - :c:var:`_functionParam.param` + - :c:data:`_functionParam.param` diff --git a/tests/roots/test-domain-c/anon-dup-decl.rst b/tests/roots/test-domain-c/anon-dup-decl.rst new file mode 100644 index 0000000..743ae2f --- /dev/null +++ b/tests/roots/test-domain-c/anon-dup-decl.rst @@ -0,0 +1,7 @@ +.. c:namespace:: anon_dup_decl_ns + +.. c:struct:: anon_dup_decl + + .. c:struct:: @a.A + .. c:struct:: @b.A + .. c:struct:: A diff --git a/tests/roots/test-domain-c/conf.py b/tests/roots/test-domain-c/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-domain-c/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-domain-c/field-role.rst b/tests/roots/test-domain-c/field-role.rst new file mode 100644 index 0000000..5452db5 --- /dev/null +++ b/tests/roots/test-domain-c/field-role.rst @@ -0,0 +1,4 @@ +.. c:function:: void f(int a, int *b) + + :param int a: + :param int* b: diff --git a/tests/roots/test-domain-c/function_param_target.rst b/tests/roots/test-domain-c/function_param_target.rst new file mode 100644 index 0000000..d316d7b --- /dev/null +++ b/tests/roots/test-domain-c/function_param_target.rst @@ -0,0 +1,7 @@ +.. c:namespace:: function_param_target + +.. c:function:: void f(int i) + + - :c:var:`i` + +- :c:var:`f.i` diff --git a/tests/roots/test-domain-c/index.rst b/tests/roots/test-domain-c/index.rst new file mode 100644 index 0000000..4febd63 --- /dev/null +++ b/tests/roots/test-domain-c/index.rst @@ -0,0 +1,54 @@ +.. c:namespace:: index + +test-domain-c +============= + +directives +---------- + +.. c:function:: int hello(const char *name) + + :rtype: int + +.. c:function:: MyStruct hello2(char *name) + + :rtype: MyStruct + +.. c:member:: float Sphinx.version +.. c:var:: int version + +.. c:macro:: IS_SPHINX +.. c:macro:: SPHINX(arg1, arg2) + +.. c:struct:: MyStruct +.. c:union:: MyUnion +.. c:enum:: MyEnum + + .. c:enumerator:: MyEnumerator + + :c:enumerator:`MyEnumerator` + + :c:enumerator:`MyEnumerator` + +:c:enumerator:`MyEnumerator` + +.. c:type:: Sphinx +.. c:type:: int SphinxVersionNum + + +.. c:struct:: A + + .. c:union:: @data + + .. c:member:: int a + +- :c:member:`A.@data.a` +- :c:member:`A.a` + +- :c:expr:`unsigned int` +- :c:texpr:`unsigned int` + +.. c:var:: A a + +- :c:expr:`a->b` +- :c:texpr:`a->b` diff --git a/tests/roots/test-domain-c/namespace.rst b/tests/roots/test-domain-c/namespace.rst new file mode 100644 index 0000000..c220d38 --- /dev/null +++ b/tests/roots/test-domain-c/namespace.rst @@ -0,0 +1,21 @@ +.. c:namespace:: NS + +.. c:var:: int NSVar + +.. c:namespace:: NULL + +.. c:var:: int NULLVar + +.. c:namespace:: NSDummy + +.. c:namespace:: 0 + +.. c:var:: int ZeroVar + +.. c:namespace-push:: NS2.NS3 + +.. c:var:: int NS2NS3Var + +.. c:namespace-pop:: + +.. c:var:: int PopVar diff --git a/tests/roots/test-domain-c/ns_lookup.rst b/tests/roots/test-domain-c/ns_lookup.rst new file mode 100644 index 0000000..87f9d68 --- /dev/null +++ b/tests/roots/test-domain-c/ns_lookup.rst @@ -0,0 +1,13 @@ +.. c:namespace:: ns_lookup + +.. c:var:: int i + +.. c:function:: void f(int j) + + - :c:var:`i` + - :c:var:`j` + - :c:expr:`i` + - :c:expr:`j` + +- :c:var:`i` +- :c:expr:`i` diff --git a/tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/conf.py b/tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/conf.py new file mode 100644 index 0000000..1eb3a64 --- /dev/null +++ b/tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/conf.py @@ -0,0 +1 @@ +cpp_maximum_signature_line_length = len("str hello(str name)") - 1 diff --git a/tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/index.rst b/tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/index.rst new file mode 100644 index 0000000..425908c --- /dev/null +++ b/tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/index.rst @@ -0,0 +1,4 @@ +domain-cpp-cpp_maximum_signature_line_length +============================================ + +.. cpp:function:: str hello(str name) diff --git a/tests/roots/test-domain-cpp-intersphinx/conf.py b/tests/roots/test-domain-cpp-intersphinx/conf.py new file mode 100644 index 0000000..c176af7 --- /dev/null +++ b/tests/roots/test-domain-cpp-intersphinx/conf.py @@ -0,0 +1,4 @@ +exclude_patterns = ['_build'] +extensions = [ + 'sphinx.ext.intersphinx', +] diff --git a/tests/roots/test-domain-cpp-intersphinx/index.rst b/tests/roots/test-domain-cpp-intersphinx/index.rst new file mode 100644 index 0000000..9ed9493 --- /dev/null +++ b/tests/roots/test-domain-cpp-intersphinx/index.rst @@ -0,0 +1,112 @@ +.. cpp:type:: _class __class + + - :any:`_class` + - :cpp:any:`_class` + - :cpp:class:`_class` + - :cpp:struct:`_class` + - :cpp:type:`_class` + +.. cpp:type:: _struct __struct + + - :any:`_struct` + - :cpp:any:`_struct` + - :cpp:class:`_struct` + - :cpp:struct:`_struct` + - :cpp:type:`_struct` + +.. cpp:type:: _union __union + + - :any:`_union` + - :cpp:any:`_union` + - :cpp:union:`_union` + - :cpp:type:`_union` + +.. cpp:member:: void __function = _function + + - :any:`_function` + - :cpp:any:`_function` + - :cpp:func:`_function` + - :cpp:type:`_function` + +.. cpp:member:: void __member = _member + + - :any:`_member` + - :cpp:any:`_member` + - :cpp:member:`_member` + - :cpp:var:`_member` + +.. cpp:member:: void __var = _var + + - :any:`_var` + - :cpp:any:`_var` + - :cpp:member:`_var` + - :cpp:var:`_var` + +.. cpp:type:: _type __type + + - :any:`_type` + - :cpp:any:`_type` + - :cpp:type:`_type` + +.. cpp:function:: template<_concept T> void __concept() + + - :any:`_concept` + - :cpp:any:`_concept` + - :cpp:concept:`_concept` + +.. cpp:type:: _enum __enum + + - :any:`_enum` + - :cpp:any:`_enum` + - :cpp:enum:`_enum` + - :cpp:type:`_enum` + +.. cpp:type:: _enumStruct __enumStruct + + - :any:`_enumStruct` + - :cpp:any:`_enumStruct` + - :cpp:enum:`_enumStruct` + - :cpp:type:`_enumStruct` + +.. cpp:type:: _enumClass __enumClass + + - :any:`_enumClass` + - :cpp:any:`_enumClass` + - :cpp:enum:`_enumClass` + - :cpp:type:`_enumClass` + +.. cpp:member:: void __enumerator = _enumerator + + - :any:`_enumerator` + - :cpp:any:`_enumerator` + - :cpp:enumerator:`_enumerator` + +.. cpp:member:: void __scopedEnumerator = _enumStruct::_scopedEnumerator + + - :any:`_enumStruct::_scopedEnumerator` + - :cpp:any:`_enumStruct::_scopedEnumerator` + - :cpp:enumerator:`_enumStruct::_scopedEnumerator` + +.. cpp:member:: void __enumerator2 = _enum::_enumerator + + - :any:`_enum::_enumerator` + - :cpp:any:`_enum::_enumerator` + - :cpp:enumerator:`_enum::_enumerator` + +.. cpp:member:: void __functionParam = _functionParam::param + + - :any:`_functionParam::param` + - :cpp:any:`_functionParam::param` + - :cpp:member:`_functionParam::param` + - :cpp:var:`_functionParam::param` + +.. cpp:type:: _templateParam::TParam __templateParam + + - :any:`_templateParam::TParam` + - :cpp:any:`_templateParam::TParam` + - :cpp:type:`_templateParam::TParam` + - :cpp:member:`_templateParam::TParam` + - :cpp:var:`_templateParam::TParam` + - :cpp:class:`_templateParam::TParam` + - :cpp:struct:`_templateParam::TParam` + - :cpp:union:`_templateParam::TParam` diff --git a/tests/roots/test-domain-cpp/anon-dup-decl.rst b/tests/roots/test-domain-cpp/anon-dup-decl.rst new file mode 100644 index 0000000..89a9c95 --- /dev/null +++ b/tests/roots/test-domain-cpp/anon-dup-decl.rst @@ -0,0 +1,4 @@ +.. cpp:namespace:: anon_dup_decl +.. cpp:class:: @a::A +.. cpp:class:: @b::A +.. cpp:class:: A diff --git a/tests/roots/test-domain-cpp/any-role.rst b/tests/roots/test-domain-cpp/any-role.rst new file mode 100644 index 0000000..24b415e --- /dev/null +++ b/tests/roots/test-domain-cpp/any-role.rst @@ -0,0 +1,17 @@ +any role +-------- + +* :cpp:any:`Sphinx` +* :cpp:any:`Sphinx::version` +* :cpp:any:`version` +* :cpp:any:`List` +* :cpp:any:`MyEnum` + +* ref function without parens :cpp:any:`paren_1` +* ref function with parens :cpp:any:`paren_2()` +* ref function without parens, explicit title :cpp:any:`paren_3_title <paren_3>` +* ref function with parens, explicit title :cpp:any:`paren_4_title <paren_4()>` +* ref op call without parens :cpp:any:`paren_5::operator()` +* ref op call with parens :cpp:any:`paren_6::operator()()` +* ref op call without parens, explicit title :cpp:any:`paren_7_title <paren_7::operator()>` +* ref op call with parens, explicit title :cpp:any:`paren_8_title <paren_8::operator()()>` diff --git a/tests/roots/test-domain-cpp/backslash.rst b/tests/roots/test-domain-cpp/backslash.rst new file mode 100644 index 0000000..c93e68e --- /dev/null +++ b/tests/roots/test-domain-cpp/backslash.rst @@ -0,0 +1 @@ +.. cpp:var:: char c = '\\' diff --git a/tests/roots/test-domain-cpp/conf.py b/tests/roots/test-domain-cpp/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-domain-cpp/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-domain-cpp/field-role.rst b/tests/roots/test-domain-cpp/field-role.rst new file mode 100644 index 0000000..1711a88 --- /dev/null +++ b/tests/roots/test-domain-cpp/field-role.rst @@ -0,0 +1,5 @@ +.. cpp:function:: void f() + + :throws int: + :throws int*: + diff --git a/tests/roots/test-domain-cpp/index.rst b/tests/roots/test-domain-cpp/index.rst new file mode 100644 index 0000000..2df5ec8 --- /dev/null +++ b/tests/roots/test-domain-cpp/index.rst @@ -0,0 +1,53 @@ +test-domain-cpp +=============== + +directives +---------- + +.. cpp:class:: public Sphinx + + The description of Sphinx class. + +.. cpp:function:: int hello(char *name) + + The description of hello function. + +.. cpp:member:: float Sphinx::version + + The description of Sphinx::version. + +.. cpp:var:: int version + + The description of version. + +.. cpp:type:: std::vector<int> List + + The description of List type. + +.. cpp:enum:: MyEnum + + An unscoped enum. + + .. cpp:enumerator:: A + +.. cpp:enum-class:: MyScopedEnum + + A scoped enum. + + .. cpp:enumerator:: B + +.. cpp:enum-struct:: protected MyScopedVisibilityEnum : std::underlying_type<MySpecificEnum>::type + + A scoped enum with non-default visibility, and with a specified underlying type. + + .. cpp:enumerator:: B + + +.. cpp:function:: void paren_1(int, float) +.. cpp:function:: void paren_2(int, float) +.. cpp:function:: void paren_3(int, float) +.. cpp:function:: void paren_4(int, float) +.. cpp:function:: void paren_5::operator()(int) +.. cpp:function:: void paren_6::operator()(int) +.. cpp:function:: void paren_7::operator()(int) +.. cpp:function:: void paren_8::operator()(int) diff --git a/tests/roots/test-domain-cpp/lookup-key-overload.rst b/tests/roots/test-domain-cpp/lookup-key-overload.rst new file mode 100644 index 0000000..2011e26 --- /dev/null +++ b/tests/roots/test-domain-cpp/lookup-key-overload.rst @@ -0,0 +1,8 @@ +.. default-domain:: cpp + +.. namespace:: lookup_key_overload + +.. function:: void g(int a) +.. function:: void g(double b) + + :var:`b` diff --git a/tests/roots/test-domain-cpp/multi-decl-lookup.rst b/tests/roots/test-domain-cpp/multi-decl-lookup.rst new file mode 100644 index 0000000..9706d18 --- /dev/null +++ b/tests/roots/test-domain-cpp/multi-decl-lookup.rst @@ -0,0 +1,24 @@ +.. default-domain:: cpp + +.. namespace:: multi_decl_lookup + +.. function:: void f1(int a) + void f1(double b) + + - a: :var:`a` + - b: :var:`b` + +.. function:: template<typename T> void f2(int a) + template<typename U> void f2(double b) + + - T: :type:`T` + - U: :type:`U` + + +.. class:: template<typename T> A + template<typename U> B + + .. function:: void f3() + + - T: :type:`T` + - U: :type:`U` diff --git a/tests/roots/test-domain-cpp/roles-targets-ok.rst b/tests/roots/test-domain-cpp/roles-targets-ok.rst new file mode 100644 index 0000000..783f7b9 --- /dev/null +++ b/tests/roots/test-domain-cpp/roles-targets-ok.rst @@ -0,0 +1,170 @@ +.. default-domain:: cpp + +.. namespace:: RolesTargetsOk + +.. class:: Class + + :cpp:any:`Class` + :class:`Class` + :struct:`Class` + union + func + member + var + :type:`Class` + concept + enum + enumerator + +.. union:: Union + + :cpp:any:`Union` + class + struct + :union:`Union` + func + member + var + :type:`Union` + concept + enum + enumerator + +.. function:: void Function() + + :cpp:any:`Function` + class + struct + union + :func:`Function` + member + var + :type:`Function` + concept + enum + enumerator + +.. var:: int Variable + + :cpp:any:`Variable` + class + struct + union + function + :member:`Variable` + :var:`Variables` + type + concept + enum + enumerator + +.. type:: Type = void + + :cpp:any:`Type` + class + struct + union + function + member + var + :type:`Type` + concept + enum + enumerator + +.. concept:: template<typename T> Concept + + :cpp:any:`Concept` + class + struct + union + function + member + var + type + :concept:`Concept` + enum + enumerator + +.. enum-struct:: Enum + + :cpp:any:`Enum` + class + struct + union + function + member + var + :type:`Enum` + concept + :enum:`Enum` + enumerator + + .. enumerator:: Enumerator + + :cpp:any:`Enumerator` + class + struct + union + function + member + var + type + concept + enum + :enumerator:`Enumerator` + +.. class:: template<typename TParamType, \ + int TParamVar, \ + template<typename> typename TParamTemplate \ + > ClassTemplate + + :cpp:any:`TParamType` + :class:`TParamType` + :struct:`TParamType` + :union:`TParamType` + function + :member:`TParamType` + :var:`TParamType` + :type:`TParamType` + concept + enum + enumerator + + :cpp:any:`TParamVar` + :class:`TParamVar` + :struct:`TParamVar` + :union:`TParamVar` + function + :member:`TParamVar` + :var:`TParamVar` + :type:`TParamVar` + concept + enum + enumerator + + :cpp:any:`TParamTemplate` + :class:`TParamTemplate` + :struct:`TParamTemplate` + :union:`TParamTemplate` + function + :member:`TParamTemplate` + :var:`TParamTemplate` + :type:`TParamTemplate` + concept + enum + enumerator + +.. function:: void FunctionParams(int FunctionParam) + + :cpp:any:`FunctionParam` + class + struct + union + function + :member:`FunctionParam` + :var:`FunctionParam` + type + concept + enum + enumerator diff --git a/tests/roots/test-domain-cpp/roles-targets-warn.rst b/tests/roots/test-domain-cpp/roles-targets-warn.rst new file mode 100644 index 0000000..57083ff --- /dev/null +++ b/tests/roots/test-domain-cpp/roles-targets-warn.rst @@ -0,0 +1,158 @@ +.. default-domain:: cpp + +.. namespace:: RolesTargetsWarn + +.. class:: Class + + class + struct + :union:`Class` + :func:`Class` + :member:`Class` + :var:`Class` + type + :concept:`Class` + :enum:`Class` + :enumerator:`Class` + +.. union:: Union + + :class:`Union` + :struct:`Union` + union + :func:`Union` + :member:`Union` + :var:`Union` + type + :concept:`Union` + :enum:`Union` + :enumerator:`Union` + +.. function:: void Function() + + :class:`Function` + :struct:`Function` + :union:`Function` + func + :member:`Function` + :var:`Function` + type + :concept:`Function` + :enum:`Function` + :enumerator:`Function` + +.. var:: int Variable + + :class:`Variable` + :struct:`Variable` + :union:`Variable` + :func:`Variable` + member + var + :type:`Variable` + :concept:`Variable` + :enum:`Variable` + :enumerator:`Variable` + +.. type:: Type = void + + :class:`Type` + :struct:`Type` + :union:`Type` + :func:`Type` + :member:`Type` + :var:`Type` + type + :concept:`Type` + :enum:`Type` + :enumerator:`Type` + +.. concept:: template<typename T> Concept + + :class:`Concept` + :struct:`Concept` + :union:`Concept` + :func:`Concept` + :member:`Concept` + :var:`Concept` + :type:`Concept` + concept + :enum:`Concept` + :enumerator:`Concept` + +.. enum-struct:: Enum + + :class:`Enum` + :struct:`Enum` + :union:`Enum` + :func:`Enum` + :member:`Enum` + :var:`Enum` + type + :concept:`Enum` + enum + :enumerator:`Enum` + + .. enumerator:: Enumerator + + :class:`Enumerator` + :struct:`Enumerator` + :union:`Enumerator` + :func:`Enumerator` + :member:`Enumerator` + :var:`Enumerator` + :type:`Enumerator` + :concept:`Enumerator` + :enum:`Enumerator` + enumerator + +.. class:: template<typename TParamType, \ + int TParamVar, \ + template<typename> typename TParamTemplate \ + > ClassTemplate + + class + struct + union + :func:`TParamType` + member + var + type + :concept:`TParamType` + :enum:`TParamType` + :enumerator:`TParamType` + + class + struct + union + :func:`TParamVar` + member + var + type + :concept:`TParamVar` + :enum:`TParamVar` + :enumerator:`TParamVar` + + class + struct + union + :func:`TParamTemplate` + member + var + type + :concept:`TParamTemplate` + :enum:`TParamTemplate` + :enumerator:`TParamTemplate` + +.. function:: void FunctionParams(int FunctionParam) + + :class:`FunctionParam` + :struct:`FunctionParam` + :union:`FunctionParam` + :func:`FunctionParam` + member + var + :type:`FunctionParam` + :concept:`FunctionParam` + :enum:`FunctionParam` + :enumerator:`FunctionParam` diff --git a/tests/roots/test-domain-cpp/roles.rst b/tests/roots/test-domain-cpp/roles.rst new file mode 100644 index 0000000..afd2ede --- /dev/null +++ b/tests/roots/test-domain-cpp/roles.rst @@ -0,0 +1,17 @@ +roles +----- + +* :cpp:class:`Sphinx` +* :cpp:member:`Sphinx::version` +* :cpp:var:`version` +* :cpp:type:`List` +* :cpp:enum:`MyEnum` + +* ref function without parens :cpp:func:`paren_1` +* ref function with parens :cpp:func:`paren_2()` +* ref function without parens, explicit title :cpp:func:`paren_3_title <paren_3>` +* ref function with parens, explicit title :cpp:func:`paren_4_title <paren_4()>` +* ref op call without parens :cpp:func:`paren_5::operator()` +* ref op call with parens :cpp:func:`paren_6::operator()()` +* ref op call without parens, explicit title :cpp:func:`paren_7_title <paren_7::operator()>` +* ref op call with parens, explicit title :cpp:func:`paren_8_title <paren_8::operator()()>` diff --git a/tests/roots/test-domain-cpp/roles2.rst b/tests/roots/test-domain-cpp/roles2.rst new file mode 100644 index 0000000..644b827 --- /dev/null +++ b/tests/roots/test-domain-cpp/roles2.rst @@ -0,0 +1,5 @@ +Check that we don't crash just because we misuse a role. + +.. cpp:class:: A + +:cpp:func:`A` diff --git a/tests/roots/test-domain-cpp/semicolon.rst b/tests/roots/test-domain-cpp/semicolon.rst new file mode 100644 index 0000000..e6b370e --- /dev/null +++ b/tests/roots/test-domain-cpp/semicolon.rst @@ -0,0 +1,14 @@ +.. cpp:class:: Class; +.. cpp:struct:: Struct; +.. cpp:union:: Union; +.. cpp:function:: void f(); +.. cpp:member:: int member; +.. cpp:var:: int var; +.. cpp:type:: Type; +.. cpp:type:: int TypeDef; +.. cpp:type:: Alias = int; +.. cpp:concept:: template<typename T> Concept; +.. cpp:enum:: Enum; +.. cpp:enum-struct:: EnumStruct; +.. cpp:enum-class:: EnumClass; +.. cpp:enumerator:: Enumerator; diff --git a/tests/roots/test-domain-cpp/warn-template-param-qualified-name.rst b/tests/roots/test-domain-cpp/warn-template-param-qualified-name.rst new file mode 100644 index 0000000..49a650d --- /dev/null +++ b/tests/roots/test-domain-cpp/warn-template-param-qualified-name.rst @@ -0,0 +1,11 @@ +.. default-domain:: cpp + +.. class:: template<typename T> A + + .. type:: N1 = T::typeOk + + - Not ok, warn: :type:`T::typeWarn` + + .. type:: N2 = T::U::typeOk + + - Not ok, warn: :type:`T::U::typeWarn` diff --git a/tests/roots/test-domain-cpp/xref_consistency.rst b/tests/roots/test-domain-cpp/xref_consistency.rst new file mode 100644 index 0000000..cb33000 --- /dev/null +++ b/tests/roots/test-domain-cpp/xref_consistency.rst @@ -0,0 +1,12 @@ +xref consistency +---------------- + +.. cpp:namespace:: xref_consistency + +.. cpp:class:: item + +code-role: :code:`item` +any-role: :any:`item` +cpp-any-role: :cpp:any:`item` +cpp-expr-role: :cpp:expr:`item` +cpp-texpr-role: :cpp:texpr:`item` diff --git a/tests/roots/test-domain-js-javascript_maximum_signature_line_length/conf.py b/tests/roots/test-domain-js-javascript_maximum_signature_line_length/conf.py new file mode 100644 index 0000000..d7c9331 --- /dev/null +++ b/tests/roots/test-domain-js-javascript_maximum_signature_line_length/conf.py @@ -0,0 +1 @@ +javascript_maximum_signature_line_length = 1 diff --git a/tests/roots/test-domain-js-javascript_maximum_signature_line_length/index.rst b/tests/roots/test-domain-js-javascript_maximum_signature_line_length/index.rst new file mode 100644 index 0000000..b79fc1a --- /dev/null +++ b/tests/roots/test-domain-js-javascript_maximum_signature_line_length/index.rst @@ -0,0 +1,6 @@ +domain-js-maximum_signature_line_length +======================================= + +.. js:function:: hello(name) + +.. js:function:: foo([a, [b, ]]c, d[, e, f]) diff --git a/tests/roots/test-domain-js/conf.py b/tests/roots/test-domain-js/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-domain-js/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-domain-js/index.rst b/tests/roots/test-domain-js/index.rst new file mode 100644 index 0000000..fb6b8c3 --- /dev/null +++ b/tests/roots/test-domain-js/index.rst @@ -0,0 +1,7 @@ +test-domain-js +============== + +.. toctree:: + + roles + module diff --git a/tests/roots/test-domain-js/module.rst b/tests/roots/test-domain-js/module.rst new file mode 100644 index 0000000..1fe6a21 --- /dev/null +++ b/tests/roots/test-domain-js/module.rst @@ -0,0 +1,27 @@ +module +======= + +.. js:module:: module_a.submodule + +* Link to :js:class:`ModTopLevel` + +.. js:class:: ModTopLevel + + * Link to :js:meth:`mod_child_1` + * Link to :js:meth:`ModTopLevel.mod_child_1` + +.. js:method:: ModTopLevel.mod_child_1 + + * Link to :js:meth:`mod_child_2` + +.. js:method:: ModTopLevel.mod_child_2 + + * Link to :js:meth:`module_a.submodule.ModTopLevel.mod_child_1` + +.. js:module:: module_b.submodule + +* Link to :js:class:`ModTopLevel` + +.. js:class:: ModTopLevel + + * Link to :js:mod:`module_a.submodule` diff --git a/tests/roots/test-domain-js/roles.rst b/tests/roots/test-domain-js/roles.rst new file mode 100644 index 0000000..4b6acf1 --- /dev/null +++ b/tests/roots/test-domain-js/roles.rst @@ -0,0 +1,48 @@ +roles +===== + +.. js:class:: TopLevel + +.. js:function:: top_level + +* :js:class:`TopLevel` +* :js:func:`top_level` + + +.. js:class:: NestedParentA + + * Link to :js:func:`child_1` + + .. js:function:: child_1() + + * Link to :js:func:`NestedChildA.subchild_2` + * Link to :js:func:`child_2` + * Link to :any:`any_child` + + .. js:function:: any_child() + + * Link to :js:class:`NestedChildA` + + .. js:class:: NestedChildA + + .. js:function:: subchild_1() + + * Link to :js:func:`subchild_2` + + .. js:function:: subchild_2() + + Link to :js:func:`NestedParentA.child_1` + + .. js:function:: child_2() + + Link to :js:func:`NestedChildA.subchild_1` + +.. js:class:: NestedParentB + + * Link to :js:func:`child_1` + + .. js:function:: child_1() + + * Link to :js:class:`NestedParentB` + +* :js:class:`NestedParentA.NestedChildA` diff --git a/tests/roots/test-domain-py-python_maximum_signature_line_length/conf.py b/tests/roots/test-domain-py-python_maximum_signature_line_length/conf.py new file mode 100644 index 0000000..45f620d --- /dev/null +++ b/tests/roots/test-domain-py-python_maximum_signature_line_length/conf.py @@ -0,0 +1 @@ +python_maximum_signature_line_length = 1 diff --git a/tests/roots/test-domain-py-python_maximum_signature_line_length/index.rst b/tests/roots/test-domain-py-python_maximum_signature_line_length/index.rst new file mode 100644 index 0000000..75e4683 --- /dev/null +++ b/tests/roots/test-domain-py-python_maximum_signature_line_length/index.rst @@ -0,0 +1,6 @@ +domain-py-maximum_signature_line_length +======================================= + +.. py:function:: hello(name: str) -> str + +.. py:function:: foo([a, [b, ]]c, d[, e, f]) diff --git a/tests/roots/test-domain-py-python_use_unqualified_type_names/conf.py b/tests/roots/test-domain-py-python_use_unqualified_type_names/conf.py new file mode 100644 index 0000000..c81bfe4 --- /dev/null +++ b/tests/roots/test-domain-py-python_use_unqualified_type_names/conf.py @@ -0,0 +1 @@ +python_use_unqualified_type_names = True diff --git a/tests/roots/test-domain-py-python_use_unqualified_type_names/index.rst b/tests/roots/test-domain-py-python_use_unqualified_type_names/index.rst new file mode 100644 index 0000000..a6850a0 --- /dev/null +++ b/tests/roots/test-domain-py-python_use_unqualified_type_names/index.rst @@ -0,0 +1,12 @@ +domain-py-smart_reference +========================= + +.. py:class:: Name + :module: foo + + :param name: blah blah + :type name: foo.Name + :param age: blah blah + :type age: foo.Age + +.. py:function:: hello(name: foo.Name, age: foo.Age) diff --git a/tests/roots/test-domain-py-xref-warning/conf.py b/tests/roots/test-domain-py-xref-warning/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-domain-py-xref-warning/conf.py diff --git a/tests/roots/test-domain-py-xref-warning/index.rst b/tests/roots/test-domain-py-xref-warning/index.rst new file mode 100644 index 0000000..6f2cab7 --- /dev/null +++ b/tests/roots/test-domain-py-xref-warning/index.rst @@ -0,0 +1,7 @@ +test-domain-py-xref-warning +=========================== + +.. _existing-label: + +:ref:`no-label` +:ref:`existing-label` diff --git a/tests/roots/test-domain-py/abbr.rst b/tests/roots/test-domain-py/abbr.rst new file mode 100644 index 0000000..67f1157 --- /dev/null +++ b/tests/roots/test-domain-py/abbr.rst @@ -0,0 +1,10 @@ +abbrev +====== + +.. currentmodule:: module_a.submodule + +* normal: :py:meth:`module_a.submodule.ModTopLevel.mod_child_1` +* relative: :py:meth:`.ModTopLevel.mod_child_1` +* short name: :py:meth:`~module_a.submodule.ModTopLevel.mod_child_1` +* relative + short name: :py:meth:`~.ModTopLevel.mod_child_1` +* short name + relative: :py:meth:`~.ModTopLevel.mod_child_1` diff --git a/tests/roots/test-domain-py/canonical.rst b/tests/roots/test-domain-py/canonical.rst new file mode 100644 index 0000000..34becfd --- /dev/null +++ b/tests/roots/test-domain-py/canonical.rst @@ -0,0 +1,12 @@ +caninical +========= + +:py:class:`.Foo` +:any:`Foo` +:any:`module.Foo` +:any:`original.module.Foo` + +.. py:module:: canonical + +.. py:class:: Foo + :canonical: original.module.Foo diff --git a/tests/roots/test-domain-py/conf.py b/tests/roots/test-domain-py/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-domain-py/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-domain-py/index.rst b/tests/roots/test-domain-py/index.rst new file mode 100644 index 0000000..b24bbea --- /dev/null +++ b/tests/roots/test-domain-py/index.rst @@ -0,0 +1,10 @@ +test-domain-py +============== + +.. toctree:: + + roles + module + module_option + abbr + canonical diff --git a/tests/roots/test-domain-py/module.rst b/tests/roots/test-domain-py/module.rst new file mode 100644 index 0000000..4a28068 --- /dev/null +++ b/tests/roots/test-domain-py/module.rst @@ -0,0 +1,60 @@ +module +====== + +.. py:module:: module_a.submodule + +* Link to :py:class:`ModTopLevel` + +.. py:class:: ModTopLevel + + * Link to :py:meth:`mod_child_1` + * Link to :py:meth:`ModTopLevel.mod_child_1` + +.. py:method:: ModTopLevel.mod_child_1 + + * Link to :py:meth:`mod_child_2` + +.. py:method:: ModTopLevel.mod_child_2 + + * Link to :py:meth:`module_a.submodule.ModTopLevel.mod_child_1` + +.. py:property:: ModTopLevel.prop + + * Link to :py:attr:`prop attribute <.prop>` + * Link to :py:meth:`prop method <.prop>` + +.. py:currentmodule:: None + +.. py:class:: ModNoModule + +.. py:module:: module_b.submodule + +* Link to :py:class:`ModTopLevel` + +.. py:class:: ModTopLevel + + * Link to :py:class:`ModNoModule` + +.. py:function:: foo(x, y) + + :param x: param x + :type x: int + :param y: param y + :type y: tuple(str, float) + :rtype: list + +.. py:attribute:: attr1 + + :type: ModTopLevel + +.. py:attribute:: attr2 + + :type: :doc:`index` + +.. py:module:: exceptions + +.. py:exception:: Exception + +.. py:module:: object + +.. py:function:: sum() diff --git a/tests/roots/test-domain-py/module_option.rst b/tests/roots/test-domain-py/module_option.rst new file mode 100644 index 0000000..1dec2ce --- /dev/null +++ b/tests/roots/test-domain-py/module_option.rst @@ -0,0 +1,25 @@ +module_option +============= + +.. py:class:: B + :module: test.extra + + This is also a test. + + + .. py:method:: B.baz() + :module: test.extra + + Does something similar to :meth:`foo`. + + + .. py:method:: B.foo() + :module: test.extra + + Does something. + + + .. py:method:: B.test() + :module: test.extra + + Does something completely unrelated to :meth:`foo` diff --git a/tests/roots/test-domain-py/roles.rst b/tests/roots/test-domain-py/roles.rst new file mode 100644 index 0000000..6bff2d2 --- /dev/null +++ b/tests/roots/test-domain-py/roles.rst @@ -0,0 +1,48 @@ +roles +===== + +.. py:class:: TopLevel + +.. py:method:: top_level + +* :py:class:`TopLevel` +* :py:meth:`top_level` + + +.. py:class:: NestedParentA + + * Link to :py:meth:`child_1` + + .. py:method:: child_1() + + * Link to :py:meth:`NestedChildA.subchild_2` + * Link to :py:meth:`child_2` + * Link to :any:`any_child` + + .. py:method:: any_child() + + * Link to :py:class:`NestedChildA` + + .. py:class:: NestedChildA + + .. py:method:: subchild_1() + + * Link to :py:meth:`subchild_2` + + .. py:method:: subchild_2() + + Link to :py:meth:`NestedParentA.child_1` + + .. py:method:: child_2() + + Link to :py:meth:`NestedChildA.subchild_1` + +.. py:class:: NestedParentB + + * Link to :py:meth:`child_1` + + .. py:method:: child_1() + + * Link to :py:class:`NestedParentB` + +* :py:class:`NestedParentA.NestedChildA` diff --git a/tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme1/theme.conf b/tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme1/theme.conf new file mode 100644 index 0000000..89e03bb --- /dev/null +++ b/tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme1/theme.conf @@ -0,0 +1,2 @@ +[theme] +inherit = basic diff --git a/tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme2/theme.conf b/tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme2/theme.conf new file mode 100644 index 0000000..a68c018 --- /dev/null +++ b/tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme2/theme.conf @@ -0,0 +1,2 @@ +[theme] +inherit = base_theme1 diff --git a/tests/roots/test-double-inheriting-theme/conf.py b/tests/roots/test-double-inheriting-theme/conf.py new file mode 100644 index 0000000..3667b02 --- /dev/null +++ b/tests/roots/test-double-inheriting-theme/conf.py @@ -0,0 +1,4 @@ +templates_path = ['_templates'] +html_theme = 'base_theme2' +html_theme_path = ['base_themes_dir'] +exclude_patterns = ['_build'] diff --git a/tests/roots/test-double-inheriting-theme/index.rst b/tests/roots/test-double-inheriting-theme/index.rst new file mode 100644 index 0000000..e67f7ff --- /dev/null +++ b/tests/roots/test-double-inheriting-theme/index.rst @@ -0,0 +1,3 @@ +============================ +Test double inheriting theme +============================ diff --git a/tests/roots/test-environment-record-dependencies/api.rst b/tests/roots/test-environment-record-dependencies/api.rst new file mode 100644 index 0000000..acfb896 --- /dev/null +++ b/tests/roots/test-environment-record-dependencies/api.rst @@ -0,0 +1,4 @@ +API +=== + +.. automodule:: example_module diff --git a/tests/roots/test-environment-record-dependencies/conf.py b/tests/roots/test-environment-record-dependencies/conf.py new file mode 100644 index 0000000..107480e --- /dev/null +++ b/tests/roots/test-environment-record-dependencies/conf.py @@ -0,0 +1,5 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) +extensions = ['sphinx.ext.autodoc'] diff --git a/tests/roots/test-environment-record-dependencies/example_module.py b/tests/roots/test-environment-record-dependencies/example_module.py new file mode 100644 index 0000000..d12dc74 --- /dev/null +++ b/tests/roots/test-environment-record-dependencies/example_module.py @@ -0,0 +1,2 @@ +def example_function(): + return 42 diff --git a/tests/roots/test-environment-record-dependencies/index.rst b/tests/roots/test-environment-record-dependencies/index.rst new file mode 100644 index 0000000..21d88a0 --- /dev/null +++ b/tests/roots/test-environment-record-dependencies/index.rst @@ -0,0 +1,3 @@ +.. toctree:: + + api diff --git a/tests/roots/test-epub-anchor-id/conf.py b/tests/roots/test-epub-anchor-id/conf.py new file mode 100644 index 0000000..2a56f1f --- /dev/null +++ b/tests/roots/test-epub-anchor-id/conf.py @@ -0,0 +1,2 @@ +def setup(app): + app.add_crossref_type(directivename="setting", rolename="setting") diff --git a/tests/roots/test-epub-anchor-id/index.rst b/tests/roots/test-epub-anchor-id/index.rst new file mode 100644 index 0000000..75e3c60 --- /dev/null +++ b/tests/roots/test-epub-anchor-id/index.rst @@ -0,0 +1,13 @@ +test-epub-anchor-id +=================== + +.. setting:: STATICFILES_FINDERS + +blah blah blah + +.. setting:: STATICFILES_SECTION + +blah blah blah +============== + +see :setting:`STATICFILES_FINDERS` diff --git a/tests/roots/test-ext-autodoc/autodoc_dummy_bar.py b/tests/roots/test-ext-autodoc/autodoc_dummy_bar.py new file mode 100644 index 0000000..3b5bbfd --- /dev/null +++ b/tests/roots/test-ext-autodoc/autodoc_dummy_bar.py @@ -0,0 +1,6 @@ +from bug2437.autodoc_dummy_foo import Foo + + +class Bar: + """Dummy class Bar with alias.""" + my_name = Foo diff --git a/tests/roots/test-ext-autodoc/autodoc_dummy_module.py b/tests/roots/test-ext-autodoc/autodoc_dummy_module.py new file mode 100644 index 0000000..c05d96e --- /dev/null +++ b/tests/roots/test-ext-autodoc/autodoc_dummy_module.py @@ -0,0 +1,6 @@ +from dummy import * + + +def test(): + """Dummy function using dummy.*""" + dummy_function() diff --git a/tests/roots/test-ext-autodoc/bug2437/__init__.py b/tests/roots/test-ext-autodoc/bug2437/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-ext-autodoc/bug2437/__init__.py diff --git a/tests/roots/test-ext-autodoc/bug2437/autodoc_dummy_foo.py b/tests/roots/test-ext-autodoc/bug2437/autodoc_dummy_foo.py new file mode 100644 index 0000000..9c954d8 --- /dev/null +++ b/tests/roots/test-ext-autodoc/bug2437/autodoc_dummy_foo.py @@ -0,0 +1,3 @@ +class Foo: + """Dummy class Foo.""" + pass diff --git a/tests/roots/test-ext-autodoc/circular_import/__init__.py b/tests/roots/test-ext-autodoc/circular_import/__init__.py new file mode 100644 index 0000000..402678d --- /dev/null +++ b/tests/roots/test-ext-autodoc/circular_import/__init__.py @@ -0,0 +1 @@ +from circular_import.c import SomeClass diff --git a/tests/roots/test-ext-autodoc/circular_import/a.py b/tests/roots/test-ext-autodoc/circular_import/a.py new file mode 100644 index 0000000..97ad9d8 --- /dev/null +++ b/tests/roots/test-ext-autodoc/circular_import/a.py @@ -0,0 +1 @@ +X = 42 diff --git a/tests/roots/test-ext-autodoc/circular_import/b.py b/tests/roots/test-ext-autodoc/circular_import/b.py new file mode 100644 index 0000000..c9b8ad5 --- /dev/null +++ b/tests/roots/test-ext-autodoc/circular_import/b.py @@ -0,0 +1,4 @@ +import typing + +if typing.TYPE_CHECKING: + from circular_import import SomeClass diff --git a/tests/roots/test-ext-autodoc/circular_import/c.py b/tests/roots/test-ext-autodoc/circular_import/c.py new file mode 100644 index 0000000..0a8829e --- /dev/null +++ b/tests/roots/test-ext-autodoc/circular_import/c.py @@ -0,0 +1,6 @@ +import circular_import.a +import circular_import.b + + +class SomeClass: + X = circular_import.a.X diff --git a/tests/roots/test-ext-autodoc/conf.py b/tests/roots/test-ext-autodoc/conf.py new file mode 100644 index 0000000..979a709 --- /dev/null +++ b/tests/roots/test-ext-autodoc/conf.py @@ -0,0 +1,15 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autodoc'] + +# The suffix of source filenames. +source_suffix = '.rst' + +autodoc_mock_imports = [ + 'dummy' +] + +nitpicky = True diff --git a/tests/roots/test-ext-autodoc/index.rst b/tests/roots/test-ext-autodoc/index.rst new file mode 100644 index 0000000..eb10829 --- /dev/null +++ b/tests/roots/test-ext-autodoc/index.rst @@ -0,0 +1,15 @@ + +.. automodule:: autodoc_dummy_module + :members: + +.. automodule:: bug2437.autodoc_dummy_foo + :members: + +.. automodule:: autodoc_dummy_bar + :members: + +.. autofunction:: target.typehints.incr + +.. autofunction:: target.overload.sum + +.. autofunction:: target.typehints.tuple_args diff --git a/tests/roots/test-ext-autodoc/target/TYPE_CHECKING.py b/tests/roots/test-ext-autodoc/target/TYPE_CHECKING.py new file mode 100644 index 0000000..85aea3a --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/TYPE_CHECKING.py @@ -0,0 +1,16 @@ +from __future__ import annotations + +from gettext import NullTranslations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from collections.abc import Iterable + from io import StringIO + + +class Foo: + attr1: StringIO + + +def spam(ham: Iterable[str]) -> tuple[NullTranslations, bool]: + pass diff --git a/tests/roots/test-ext-autodoc/target/__init__.py b/tests/roots/test-ext-autodoc/target/__init__.py new file mode 100644 index 0000000..d7ee4ac --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/__init__.py @@ -0,0 +1,204 @@ +import enum +from io import StringIO + +from ._functions_to_import import function_to_be_imported + +__all__ = ['Class'] + +#: documentation for the integer +integer = 1 + + +def raises(exc, func, *args, **kwds): + """Raise AssertionError if ``func(*args, **kwds)`` does not raise *exc*.""" + pass + + +class CustomEx(Exception): + """My custom exception.""" + + def f(self): + """Exception method.""" + + +def _funky_classmethod(name, b, c, d, docstring=None): + """Generates a classmethod for a class from a template by filling out + some arguments.""" + def template(cls, a, b, c, d=4, e=5, f=6): + return a, b, c, d, e, f + from functools import partial + function = partial(template, b=b, c=c, d=d) + function.__name__ = name + function.__doc__ = docstring + return classmethod(function) + + +class Class: + """Class to document.""" + + def meth(self): + """Function.""" + + def undocmeth(self): + pass + + def skipmeth(self): + """Method that should be skipped.""" + + def excludemeth(self): + """Method that should be excluded.""" + + # should not be documented + skipattr = 'foo' + + #: should be documented -- süß + attr = 'bar' + + docattr = 'baz' + """should likewise be documented -- süß""" + + udocattr = 'quux' + """should be documented as well - süß""" + + # initialized to any class imported from another module + mdocattr = StringIO() + """should be documented as well - süß""" + + roger = _funky_classmethod("roger", 2, 3, 4) + + moore = _funky_classmethod("moore", 9, 8, 7, + docstring="moore(a, e, f) -> happiness") + + def __init__(self, arg): + self.inst_attr_inline = None #: an inline documented instance attr + #: a documented instance attribute + self.inst_attr_comment = None + self.inst_attr_string = None + """a documented instance attribute""" + self._private_inst_attr = None #: a private instance attribute + + def __special1__(self): + """documented special method""" + + def __special2__(self): + # undocumented special method + pass + + +class CustomDict(dict): + """Docstring.""" + + +def function(foo, *args, **kwds): + """ + Return spam. + """ + pass + + +class Outer: + """Foo""" + + class Inner: + """Foo""" + + def meth(self): + """Foo""" + + # should be documented as an alias + factory = dict + + +class InnerChild(Outer.Inner): + """InnerChild docstring""" + + +class DocstringSig: + def __new__(cls, *new_args, **new_kwargs): + """__new__(cls, d, e=1) -> DocstringSig +First line of docstring + + rest of docstring + """ + + def __init__(self, *init_args, **init_kwargs): + """__init__(self, a, b=1) -> None +First line of docstring + + rest of docstring + """ + + def meth(self): + """meth(FOO, BAR=1) -> BAZ +First line of docstring + + rest of docstring + """ + + def meth2(self): + """First line, no signature + Second line followed by indentation:: + + indented line + """ + + @property + def prop1(self): + """DocstringSig.prop1(self) + First line of docstring + """ + return 123 + + @property + def prop2(self): + """First line of docstring + Second line of docstring + """ + return 456 + + +class StrRepr(str): + """docstring""" + + def __repr__(self): + return self + + +class AttCls: + a1 = StrRepr('hello\nworld') + a2 = None + + +class InstAttCls: + """Class with documented class and instance attributes.""" + + #: Doc comment for class attribute InstAttCls.ca1. + #: It can have multiple lines. + ca1 = 'a' + + ca2 = 'b' #: Doc comment for InstAttCls.ca2. One line only. + + ca3 = 'c' + """Docstring for class attribute InstAttCls.ca3.""" + + def __init__(self): + #: Doc comment for instance attribute InstAttCls.ia1 + self.ia1 = 'd' + + self.ia2 = 'e' + """Docstring for instance attribute InstAttCls.ia2.""" + + +class CustomIter: + def __init__(self): + """Create a new `CustomIter`.""" + self.values = range(10) + + def __iter__(self): + """Iterate squares of each value.""" + for i in self.values: + yield i ** 2 + + def snafucate(self): + """Makes this snafucated.""" + print("snafucated") diff --git a/tests/roots/test-ext-autodoc/target/_functions_to_import.py b/tests/roots/test-ext-autodoc/target/_functions_to_import.py new file mode 100644 index 0000000..7663e97 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/_functions_to_import.py @@ -0,0 +1,8 @@ +from typing import TYPE_CHECKING, Optional + +if TYPE_CHECKING: + from sphinx.application import Sphinx + + +def function_to_be_imported(app: Optional["Sphinx"]) -> str: + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/abstractmethods.py b/tests/roots/test-ext-autodoc/target/abstractmethods.py new file mode 100644 index 0000000..a4396d5 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/abstractmethods.py @@ -0,0 +1,29 @@ +from abc import abstractmethod + + +class Base(): + def meth(self): + pass + + @abstractmethod + def abstractmeth(self): + pass + + @staticmethod + @abstractmethod + def staticmeth(): + pass + + @classmethod + @abstractmethod + def classmeth(cls): + pass + + @property + @abstractmethod + def prop(self): + pass + + @abstractmethod + async def coroutinemeth(self): + pass diff --git a/tests/roots/test-ext-autodoc/target/annotated.py b/tests/roots/test-ext-autodoc/target/annotated.py new file mode 100644 index 0000000..5b87518 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/annotated.py @@ -0,0 +1,8 @@ +from __future__ import annotations + +from typing import Annotated + + +def hello(name: Annotated[str, "attribute"]) -> None: + """docstring""" + pass diff --git a/tests/roots/test-ext-autodoc/target/autoclass_content.py b/tests/roots/test-ext-autodoc/target/autoclass_content.py new file mode 100644 index 0000000..52b9806 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/autoclass_content.py @@ -0,0 +1,47 @@ +class A: + """A class having no __init__, no __new__""" + + +class B: + """A class having __init__(no docstring), no __new__""" + def __init__(self): + pass + + +class C: + """A class having __init__, no __new__""" + def __init__(self): + """__init__ docstring""" + + +class D: + """A class having no __init__, __new__(no docstring)""" + def __new__(cls): + pass + + +class E: + """A class having no __init__, __new__""" + def __new__(cls): + """__new__ docstring""" + + +class F: + """A class having both __init__ and __new__""" + def __init__(self): + """__init__ docstring""" + + def __new__(cls): + """__new__ docstring""" + + +class G(C): + """A class inherits __init__ without docstring.""" + def __init__(self): + pass + + +class H(E): + """A class inherits __new__ without docstring.""" + def __init__(self): + pass diff --git a/tests/roots/test-ext-autodoc/target/autodoc_type_aliases.py b/tests/roots/test-ext-autodoc/target/autodoc_type_aliases.py new file mode 100644 index 0000000..f2c07a0 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/autodoc_type_aliases.py @@ -0,0 +1,49 @@ +from __future__ import annotations + +import io +from typing import Optional, overload + +myint = int + +#: docstring +variable: myint + +#: docstring +variable2 = None # type: myint + +#: docstring +variable3: Optional[myint] + + +def read(r: io.BytesIO) -> io.StringIO: + """docstring""" + + +def sum(x: myint, y: myint) -> myint: + """docstring""" + return x + y + + +@overload +def mult(x: myint, y: myint) -> myint: + ... + + +@overload +def mult(x: float, y: float) -> float: + ... + + +def mult(x, y): + """docstring""" + return x, y + + +class Foo: + """docstring""" + + #: docstring + attr1: myint + + def __init__(self): + self.attr2: myint = None #: docstring diff --git a/tests/roots/test-ext-autodoc/target/bound_method.py b/tests/roots/test-ext-autodoc/target/bound_method.py new file mode 100644 index 0000000..d48b9ee --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/bound_method.py @@ -0,0 +1,7 @@ +class Cls: + def method(self): + """Method docstring""" + pass + + +bound_method = Cls().method diff --git a/tests/roots/test-ext-autodoc/target/cached_property.py b/tests/roots/test-ext-autodoc/target/cached_property.py new file mode 100644 index 0000000..712d1d9 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/cached_property.py @@ -0,0 +1,12 @@ +from functools import cached_property + + +class Foo: + @cached_property + def prop(self) -> int: + return 1 + + @cached_property + def prop_with_type_comment(self): + # type: () -> int + return 1 diff --git a/tests/roots/test-ext-autodoc/target/callable.py b/tests/roots/test-ext-autodoc/target/callable.py new file mode 100644 index 0000000..6fcd505 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/callable.py @@ -0,0 +1,13 @@ +class Callable(): + """A callable object that behaves like a function.""" + + def __call__(self, arg1, arg2, **kwargs): + pass + + def method(self, arg1, arg2): + """docstring of Callable.method().""" + pass + + +function = Callable() +method = function.method diff --git a/tests/roots/test-ext-autodoc/target/canonical/__init__.py b/tests/roots/test-ext-autodoc/target/canonical/__init__.py new file mode 100644 index 0000000..4ca2b33 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/canonical/__init__.py @@ -0,0 +1 @@ +from target.canonical.original import Bar, Foo diff --git a/tests/roots/test-ext-autodoc/target/canonical/original.py b/tests/roots/test-ext-autodoc/target/canonical/original.py new file mode 100644 index 0000000..42049b2 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/canonical/original.py @@ -0,0 +1,15 @@ +class Foo: + """docstring""" + + def meth(self): + """docstring""" + + +def bar(): + class Bar: + """docstring""" + + return Bar + + +Bar = bar() diff --git a/tests/roots/test-ext-autodoc/target/classes.py b/tests/roots/test-ext-autodoc/target/classes.py new file mode 100644 index 0000000..e5cce7a --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/classes.py @@ -0,0 +1,44 @@ +from __future__ import annotations + +from inspect import Parameter, Signature +from typing import List, Union + + +class Foo: + pass + + +class Bar: + def __init__(self, x, y): + pass + + +class Baz: + def __new__(cls, x, y): + pass + + +class Qux: + __signature__ = Signature(parameters=[Parameter('foo', Parameter.POSITIONAL_OR_KEYWORD), + Parameter('bar', Parameter.POSITIONAL_OR_KEYWORD)]) + + def __init__(self, x, y): + pass + + +class Quux(List[Union[int, float]]): + """A subclass of List[Union[int, float]]""" + pass + + +class Corge(Quux): + pass + + +Alias = Foo + +#: docstring +OtherAlias = Bar + +#: docstring +IntAlias = int diff --git a/tests/roots/test-ext-autodoc/target/coroutine.py b/tests/roots/test-ext-autodoc/target/coroutine.py new file mode 100644 index 0000000..f977b6e --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/coroutine.py @@ -0,0 +1,37 @@ +import asyncio +from functools import wraps + + +class AsyncClass: + async def do_coroutine(self): + """A documented coroutine function""" + attr_coro_result = await _other_coro_func() + + @classmethod + async def do_coroutine2(cls): + """A documented coroutine classmethod""" + pass + + @staticmethod + async def do_coroutine3(): + """A documented coroutine staticmethod""" + pass + + async def do_asyncgen(self): + """A documented async generator""" + yield + + +async def _other_coro_func(): + return "run" + + +def myawait(f): + @wraps(f) + def wrapper(*args, **kwargs): + awaitable = f(*args, **kwargs) + return asyncio.run(awaitable) + return wrapper + + +sync_func = myawait(_other_coro_func) diff --git a/tests/roots/test-ext-autodoc/target/cython.pyx b/tests/roots/test-ext-autodoc/target/cython.pyx new file mode 100644 index 0000000..5d0329a --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/cython.pyx @@ -0,0 +1,13 @@ +# cython: binding=True +# cython: language_level=3str + +def foo(x: int, *args, y: str, **kwargs): + """Docstring.""" + + +class Class: + """Docstring.""" + + def meth(self, name: str, age: int = 0) -> None: + """Docstring.""" + pass diff --git a/tests/roots/test-ext-autodoc/target/decorator.py b/tests/roots/test-ext-autodoc/target/decorator.py new file mode 100644 index 0000000..faad3ff --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/decorator.py @@ -0,0 +1,53 @@ +from functools import wraps + + +def deco1(func): + """docstring for deco1""" + @wraps(func) + def wrapper(): + return func() + + return wrapper + + +def deco2(condition, message): + """docstring for deco2""" + def decorator(func): + def wrapper(): + return func() + + return wrapper + return decorator + + +@deco1 +def foo(name=None, age=None): + pass + + +class Bar: + @deco1 + def meth(self, name=None, age=None): + pass + + +class Baz: + @deco1 + def __init__(self, name=None, age=None): + pass + + +class Qux: + @deco1 + def __new__(self, name=None, age=None): + pass + + +class _Metaclass(type): + @deco1 + def __call__(self, name=None, age=None): + pass + + +class Quux(metaclass=_Metaclass): + pass diff --git a/tests/roots/test-ext-autodoc/target/descriptor.py b/tests/roots/test-ext-autodoc/target/descriptor.py new file mode 100644 index 0000000..2857c99 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/descriptor.py @@ -0,0 +1,31 @@ +class CustomDataDescriptor: + """Descriptor class docstring.""" + + def __init__(self, doc): + self.__doc__ = doc + + def __get__(self, obj, type=None): + if obj is None: + return self + return 42 + + def meth(self): + """Function.""" + return "The Answer" + + +class CustomDataDescriptorMeta(type): + """Descriptor metaclass docstring.""" + + +class CustomDataDescriptor2(CustomDataDescriptor): + """Descriptor class with custom metaclass docstring.""" + __metaclass__ = CustomDataDescriptorMeta + + +class Class: + descr = CustomDataDescriptor("Descriptor instance docstring.") + + @property + def prop(self): + """Property.""" diff --git a/tests/roots/test-ext-autodoc/target/docstring_signature.py b/tests/roots/test-ext-autodoc/target/docstring_signature.py new file mode 100644 index 0000000..981d936 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/docstring_signature.py @@ -0,0 +1,33 @@ +class A: + """A(foo, bar)""" + + +class B: + """B(foo, bar)""" + def __init__(self): + """B(foo, bar, baz)""" + + +class C: + """C(foo, bar)""" + def __new__(cls): + """C(foo, bar, baz)""" + + +class D: + def __init__(self): + """D(foo, bar, baz)""" + + +class E: + def __init__(self): + """E(foo: int, bar: int, baz: int) -> None \\ + E(foo: str, bar: str, baz: str) -> None \\ + E(foo: float, bar: float, baz: float)""" + + +class F: + def __init__(self): + """F(foo: int, bar: int, baz: int) -> None + F(foo: str, bar: str, baz: str) -> None + F(foo: float, bar: float, baz: float)""" diff --git a/tests/roots/test-ext-autodoc/target/empty_all.py b/tests/roots/test-ext-autodoc/target/empty_all.py new file mode 100644 index 0000000..c094cff --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/empty_all.py @@ -0,0 +1,16 @@ +""" +docsting of empty_all module. +""" +__all__ = [] + + +def foo(): + """docstring""" + + +def bar(): + """docstring""" + + +def baz(): + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/enums.py b/tests/roots/test-ext-autodoc/target/enums.py new file mode 100644 index 0000000..c69455f --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/enums.py @@ -0,0 +1,23 @@ +import enum + + +class EnumCls(enum.Enum): + """ + this is enum class + """ + + #: doc for val1 + val1 = 12 + val2 = 23 #: doc for val2 + val3 = 34 + """doc for val3""" + val4 = 34 + + def say_hello(self): + """a method says hello to you.""" + pass + + @classmethod + def say_goodbye(cls): + """a classmethod says good-bye to you.""" + pass diff --git a/tests/roots/test-ext-autodoc/target/final.py b/tests/roots/test-ext-autodoc/target/final.py new file mode 100644 index 0000000..a8c3860 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/final.py @@ -0,0 +1,16 @@ +from __future__ import annotations + +import typing +from typing import final + + +@typing.final +class Class: + """docstring""" + + @final + def meth1(self): + """docstring""" + + def meth2(self): + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/functions.py b/tests/roots/test-ext-autodoc/target/functions.py new file mode 100644 index 0000000..b62aa70 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/functions.py @@ -0,0 +1,19 @@ +from functools import partial + + +def func(): + pass + + +async def coroutinefunc(): + pass + + +async def asyncgenerator(): + yield + +partial_func = partial(func) +partial_coroutinefunc = partial(coroutinefunc) + +builtin_func = print +partial_builtin_func = partial(print) diff --git a/tests/roots/test-ext-autodoc/target/generic_class.py b/tests/roots/test-ext-autodoc/target/generic_class.py new file mode 100644 index 0000000..1ec8058 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/generic_class.py @@ -0,0 +1,13 @@ +from __future__ import annotations + +from typing import Generic, TypeVar + +T = TypeVar('T') + + +# Test that typing.Generic's __new__ method does not mask our class' +# __init__ signature. +class A(Generic[T]): + """docstring for A""" + def __init__(self, a, b=None): + pass diff --git a/tests/roots/test-ext-autodoc/target/genericalias.py b/tests/roots/test-ext-autodoc/target/genericalias.py new file mode 100644 index 0000000..06026fb --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/genericalias.py @@ -0,0 +1,16 @@ +from __future__ import annotations + +from typing import Callable, List + +#: A list of int +T = List[int] + +C = Callable[[int], None] # a generic alias not having a doccomment + + +class Class: + #: A list of int + T = List[int] + +#: A list of Class +L = List[Class] diff --git a/tests/roots/test-ext-autodoc/target/hide_value.py b/tests/roots/test-ext-autodoc/target/hide_value.py new file mode 100644 index 0000000..1d53aab --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/hide_value.py @@ -0,0 +1,19 @@ +#: docstring +#: +#: :meta hide-value: +SENTINEL1 = object() + +#: :meta hide-value: +SENTINEL2 = object() + + +class Foo: + """docstring""" + + #: docstring + #: + #: :meta hide-value: + SENTINEL1 = object() + + #: :meta hide-value: + SENTINEL2 = object() diff --git a/tests/roots/test-ext-autodoc/target/imported_members.py b/tests/roots/test-ext-autodoc/target/imported_members.py new file mode 100644 index 0000000..ee6e5b3 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/imported_members.py @@ -0,0 +1 @@ +from .partialfunction import func2, func3 diff --git a/tests/roots/test-ext-autodoc/target/inheritance.py b/tests/roots/test-ext-autodoc/target/inheritance.py new file mode 100644 index 0000000..e06f7a8 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/inheritance.py @@ -0,0 +1,25 @@ +class Base: + #: docstring + inheritedattr = None + + def inheritedmeth(self): + """Inherited function.""" + + @classmethod + def inheritedclassmeth(cls): + """Inherited class method.""" + + @staticmethod + def inheritedstaticmeth(cls): + """Inherited static method.""" + + +class Derived(Base): + def inheritedmeth(self): + # no docstring here + pass + + +class MyList(list): + def meth(self): + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/instance_variable.py b/tests/roots/test-ext-autodoc/target/instance_variable.py new file mode 100644 index 0000000..1d393bc --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/instance_variable.py @@ -0,0 +1,11 @@ +class Foo: + def __init__(self): + self.attr1 = None #: docstring foo + self.attr2 = None #: docstring foo + + +class Bar(Foo): + def __init__(self): + self.attr2 = None #: docstring bar + self.attr3 = None #: docstring bar + self.attr4 = None diff --git a/tests/roots/test-ext-autodoc/target/literal.py b/tests/roots/test-ext-autodoc/target/literal.py new file mode 100644 index 0000000..4340e51 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/literal.py @@ -0,0 +1,24 @@ +from __future__ import annotations + +from enum import Enum +from typing import Literal, TypeVar + + +class MyEnum(Enum): + a = 1 + + +T = TypeVar('T', bound=Literal[1234]) +"""docstring""" + + +U = TypeVar('U', bound=Literal[MyEnum.a]) +"""docstring""" + + +def bar(x: Literal[1234]): + """docstring""" + + +def foo(x: Literal[MyEnum.a]): + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/metadata.py b/tests/roots/test-ext-autodoc/target/metadata.py new file mode 100644 index 0000000..7a4488f --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/metadata.py @@ -0,0 +1,2 @@ +def foo(): + """:meta metadata-only-docstring:""" diff --git a/tests/roots/test-ext-autodoc/target/methods.py b/tests/roots/test-ext-autodoc/target/methods.py new file mode 100644 index 0000000..ad5a6a9 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/methods.py @@ -0,0 +1,29 @@ +from functools import partialmethod + + +class Base(): + def meth(self): + pass + + @staticmethod + def staticmeth(): + pass + + @classmethod + def classmeth(cls): + pass + + @property + def prop(self): + pass + + partialmeth = partialmethod(meth) + + async def coroutinemeth(self): + pass + + partial_coroutinemeth = partialmethod(coroutinemeth) + + +class Inherited(Base): + pass diff --git a/tests/roots/test-ext-autodoc/target/module.py b/tests/roots/test-ext-autodoc/target/module.py new file mode 100644 index 0000000..fe3b490 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/module.py @@ -0,0 +1,14 @@ +undocumented = 1 + +#: docstring +documented = 1 + +undoc_annotated: int + +#: docstring +annotated: int + +__special__ = 1 + +#: docstring +__documented_special__ = 1 diff --git a/tests/roots/test-ext-autodoc/target/name_conflict/__init__.py b/tests/roots/test-ext-autodoc/target/name_conflict/__init__.py new file mode 100644 index 0000000..0a6f496 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/name_conflict/__init__.py @@ -0,0 +1,6 @@ +from .foo import bar + + +class foo: + """docstring of target.name_conflict::foo.""" + pass diff --git a/tests/roots/test-ext-autodoc/target/name_conflict/foo.py b/tests/roots/test-ext-autodoc/target/name_conflict/foo.py new file mode 100644 index 0000000..bb83ca0 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/name_conflict/foo.py @@ -0,0 +1,2 @@ +class bar: + """docstring of target.name_conflict.foo::bar.""" diff --git a/tests/roots/test-ext-autodoc/target/name_mangling.py b/tests/roots/test-ext-autodoc/target/name_mangling.py new file mode 100644 index 0000000..269b51d --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/name_mangling.py @@ -0,0 +1,11 @@ +class Foo: + #: name of Foo + __name = None + __age = None + + +class Bar(Foo): + __address = None + + #: a member having mangled-like name + _Baz__email = None diff --git a/tests/roots/test-ext-autodoc/target/need_mocks.py b/tests/roots/test-ext-autodoc/target/need_mocks.py new file mode 100644 index 0000000..881220b --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/need_mocks.py @@ -0,0 +1,42 @@ +import missing_module +import missing_package1.missing_module1 +from missing_module import missing_name +from missing_package2 import missing_module2 +from missing_package3.missing_module3 import missing_name + +import sphinx.missing_module4 +from sphinx.missing_module4 import missing_name2 + + +@missing_name(int) +def decoratedFunction(): + """decoratedFunction docstring""" + return None + + +def func(arg: missing_module.Class): + """a function takes mocked object as an argument""" + pass + + +class TestAutodoc: + """TestAutodoc docstring.""" + + #: docstring + Alias = missing_module2.Class + + @missing_name + def decoratedMethod(self): + """TestAutodoc::decoratedMethod docstring""" + return None + + +class Inherited(missing_module.Class): + """docstring""" + pass + + +sphinx.missing_module4.missing_function(len(missing_name2)) + +#: docstring +Alias = missing_module2.Class diff --git a/tests/roots/test-ext-autodoc/target/overload.py b/tests/roots/test-ext-autodoc/target/overload.py new file mode 100644 index 0000000..4bcb6ea --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/overload.py @@ -0,0 +1,90 @@ +from __future__ import annotations + +from typing import Any, overload + + +@overload +def sum(x: int, y: int = 0) -> int: + ... + + +@overload +def sum(x: float, y: float = 0.0) -> float: + ... + + +@overload +def sum(x: str, y: str = ...) -> str: + ... + + +def sum(x, y=None): + """docstring""" + return x + y + + +class Math: + """docstring""" + + @overload + def sum(self, x: int, y: int = 0) -> int: + ... + + @overload + def sum(self, x: float, y: float = 0.0) -> float: + ... + + @overload + def sum(self, x: str, y: str = ...) -> str: + ... + + def sum(self, x, y=None): + """docstring""" + return x + y + + +class Foo: + """docstring""" + + @overload + def __new__(cls, x: int, y: int) -> Foo: + ... + + @overload + def __new__(cls, x: str, y: str) -> Foo: + ... + + def __new__(cls, x, y): + pass + + +class Bar: + """docstring""" + + @overload + def __init__(cls, x: int, y: int) -> None: + ... + + @overload + def __init__(cls, x: str, y: str) -> None: + ... + + def __init__(cls, x, y): + pass + + +class Meta(type): + @overload + def __call__(cls, x: int, y: int) -> Any: + ... + + @overload + def __call__(cls, x: str, y: str) -> Any: + ... + + def __call__(cls, x, y): + pass + + +class Baz(metaclass=Meta): + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/overload2.py b/tests/roots/test-ext-autodoc/target/overload2.py new file mode 100644 index 0000000..e901f79 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/overload2.py @@ -0,0 +1,5 @@ +from target.overload import Bar + + +class Baz(Bar): + pass diff --git a/tests/roots/test-ext-autodoc/target/partialfunction.py b/tests/roots/test-ext-autodoc/target/partialfunction.py new file mode 100644 index 0000000..3be63ee --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/partialfunction.py @@ -0,0 +1,12 @@ +from functools import partial + + +def func1(a, b, c): + """docstring of func1""" + pass + + +func2 = partial(func1, 1) +func3 = partial(func2, 2) +func3.__doc__ = "docstring of func3" +func4 = partial(func3, 3) diff --git a/tests/roots/test-ext-autodoc/target/partialmethod.py b/tests/roots/test-ext-autodoc/target/partialmethod.py new file mode 100644 index 0000000..20d75e9 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/partialmethod.py @@ -0,0 +1,17 @@ +from functools import partialmethod + + +class Cell: + """An example for partialmethod. + + refs: https://docs.python.jp/3/library/functools.html#functools.partialmethod + """ + + def set_state(self, state): + """Update state of cell to *state*.""" + + #: Make a cell alive. + set_alive = partialmethod(set_state, True) + + # a partialmethod with no docstring + set_dead = partialmethod(set_state, False) diff --git a/tests/roots/test-ext-autodoc/target/pep570.py b/tests/roots/test-ext-autodoc/target/pep570.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/pep570.py diff --git a/tests/roots/test-ext-autodoc/target/pep604.py b/tests/roots/test-ext-autodoc/target/pep604.py new file mode 100644 index 0000000..9b1f94a --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/pep604.py @@ -0,0 +1,16 @@ +from __future__ import annotations + +attr: int | str #: docstring + + +def sum(x: int | str, y: int | str) -> int | str: + """docstring""" + + +class Foo: + """docstring""" + + attr: int | str #: docstring + + def meth(self, x: int | str, y: int | str) -> int | str: + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/preserve_defaults.py b/tests/roots/test-ext-autodoc/target/preserve_defaults.py new file mode 100644 index 0000000..86e1038 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/preserve_defaults.py @@ -0,0 +1,60 @@ +from __future__ import annotations + +from datetime import datetime +from typing import Any + +CONSTANT = 'foo' +SENTINEL = object() + + +def foo(name: str = CONSTANT, + sentinel: Any = SENTINEL, + now: datetime = datetime.now(), + color: int = 0xFFFFFF, + *, + kwarg1, + kwarg2 = 0xFFFFFF) -> None: + """docstring""" + + +class Class: + """docstring""" + + def meth(self, name: str = CONSTANT, sentinel: Any = SENTINEL, + now: datetime = datetime.now(), color: int = 0xFFFFFF, + *, kwarg1, kwarg2 = 0xFFFFFF) -> None: + """docstring""" + + @classmethod + def clsmeth(cls, name: str = CONSTANT, sentinel: Any = SENTINEL, + now: datetime = datetime.now(), color: int = 0xFFFFFF, + *, kwarg1, kwarg2 = 0xFFFFFF) -> None: + """docstring""" + + +get_sentinel = lambda custom=SENTINEL: custom +"""docstring""" + + +class MultiLine: + """docstring""" + + # The properties will raise a silent SyntaxError because "lambda self: 1" + # will be detected as a function to update the default values of. However, + # only prop3 will not fail because it's on a single line whereas the others + # will fail to parse. + + prop1 = property( + lambda self: 1, doc="docstring") + + prop2 = property( + lambda self: 2, doc="docstring" + ) + + prop3 = property(lambda self: 3, doc="docstring") + + prop4 = (property + (lambda self: 4, doc="docstring")) + + prop5 = property\ + (lambda self: 5, doc="docstring") diff --git a/tests/roots/test-ext-autodoc/target/preserve_defaults_special_constructs.py b/tests/roots/test-ext-autodoc/target/preserve_defaults_special_constructs.py new file mode 100644 index 0000000..0fdb11a --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/preserve_defaults_special_constructs.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +from collections import namedtuple +from dataclasses import dataclass, field +from typing import NamedTuple, TypedDict + +#: docstring +SENTINEL = object() + + +#: docstring +ze_lambda = lambda z=SENTINEL: None + + +def foo(x, y, z=SENTINEL): + """docstring""" + + +@dataclass +class DataClass: + """docstring""" + a: int + b: object = SENTINEL + c: list[int] = field(default_factory=lambda: [1, 2, 3]) + + +@dataclass(init=False) +class DataClassNoInit: + """docstring""" + a: int + b: object = SENTINEL + c: list[int] = field(default_factory=lambda: [1, 2, 3]) + + +class MyTypedDict(TypedDict): + """docstring""" + a: int + b: object + c: list[int] + + +class MyNamedTuple1(NamedTuple): + """docstring""" + a: int + b: object = object() + c: list[int] = [1, 2, 3] + + +class MyNamedTuple2(namedtuple('Base', ('a', 'b'), defaults=(0, SENTINEL))): + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/private.py b/tests/roots/test-ext-autodoc/target/private.py new file mode 100644 index 0000000..e463448 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/private.py @@ -0,0 +1,27 @@ +def private_function(name): + """private_function is a docstring(). + + :meta private: + """ + +def _public_function(name): + """public_function is a docstring(). + + :meta public: + """ + + +PRIVATE_CONSTANT = None #: :meta private: +_PUBLIC_CONSTANT = None #: :meta public: + + +class Foo: + #: A public class attribute whose name starts with an underscore. + #: + #: :meta public: + _public_attribute = 47 + + #: A private class attribute whose name does not start with an underscore. + #: + #: :meta private: + private_attribute = 11 diff --git a/tests/roots/test-ext-autodoc/target/process_docstring.py b/tests/roots/test-ext-autodoc/target/process_docstring.py new file mode 100644 index 0000000..6005943 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/process_docstring.py @@ -0,0 +1,8 @@ +def func(): + """ + first line + --- + second line + --- + third line + """ diff --git a/tests/roots/test-ext-autodoc/target/properties.py b/tests/roots/test-ext-autodoc/target/properties.py new file mode 100644 index 0000000..018f51e --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/properties.py @@ -0,0 +1,22 @@ +class Foo: + """docstring""" + + @property + def prop1(self) -> int: + """docstring""" + + @classmethod + @property + def prop2(self) -> int: + """docstring""" + + @property + def prop1_with_type_comment(self): + # type: () -> int + """docstring""" + + @classmethod + @property + def prop2_with_type_comment(self): + # type: () -> int + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/singledispatch.py b/tests/roots/test-ext-autodoc/target/singledispatch.py new file mode 100644 index 0000000..3dd5aaf --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/singledispatch.py @@ -0,0 +1,36 @@ +import inspect +from functools import singledispatch + + +def assign_signature(func): + # This is intended to cover more complex signature-rewriting decorators. + func.__signature__ = inspect.signature(func) + return func + + +@singledispatch +def func(arg, kwarg=None): + """A function for general use.""" + pass + + +@func.register(int) +@func.register(float) +def _func_int(arg, kwarg=None): + """A function for int.""" + pass + + +@func.register(str) +@assign_signature +def _func_str(arg, kwarg=None): + """A function for str.""" + pass + + +@func.register +def _func_dict(arg: dict, kwarg=None): + """A function for dict.""" + # This function tests for specifying type through annotations + pass + diff --git a/tests/roots/test-ext-autodoc/target/singledispatchmethod.py b/tests/roots/test-ext-autodoc/target/singledispatchmethod.py new file mode 100644 index 0000000..fb92293 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/singledispatchmethod.py @@ -0,0 +1,27 @@ +from functools import singledispatchmethod + + +class Foo: + """docstring""" + + @singledispatchmethod + def meth(self, arg, kwarg=None): + """A method for general use.""" + pass + + @meth.register(int) + @meth.register(float) + def _meth_int(self, arg, kwarg=None): + """A method for int.""" + pass + + @meth.register(str) + def _meth_str(self, arg, kwarg=None): + """A method for str.""" + pass + + @meth.register + def _meth_dict(self, arg: dict, kwarg=None): + """A method for dict.""" + # This function tests for specifying type through annotations + pass diff --git a/tests/roots/test-ext-autodoc/target/slots.py b/tests/roots/test-ext-autodoc/target/slots.py new file mode 100644 index 0000000..75c7a4a --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/slots.py @@ -0,0 +1,22 @@ +class Foo: + """docstring""" + + __slots__ = ['attr'] + + +class Bar: + """docstring""" + + __slots__ = {'attr1': 'docstring of attr1', + 'attr2': 'docstring of attr2', + 'attr3': None} + __annotations__ = {'attr1': int} + + def __init__(self): + self.attr2 = None #: docstring of instance attr2 + + +class Baz: + """docstring""" + + __slots__ = 'attr' diff --git a/tests/roots/test-ext-autodoc/target/sort_by_all.py b/tests/roots/test-ext-autodoc/target/sort_by_all.py new file mode 100644 index 0000000..03def47 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/sort_by_all.py @@ -0,0 +1,25 @@ +__all__ = ['baz', 'foo', 'Bar'] + + +def foo(): + pass + + +class Bar: + pass + + +def baz(): + pass + + +def qux(): + pass + + +class Quux: + pass + + +def foobar(): + pass diff --git a/tests/roots/test-ext-autodoc/target/typed_vars.py b/tests/roots/test-ext-autodoc/target/typed_vars.py new file mode 100644 index 0000000..0fe7468 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/typed_vars.py @@ -0,0 +1,34 @@ +#: attr1 +attr1: str = '' +#: attr2 +attr2: str +#: attr3 +attr3 = '' # type: str + + +class _Descriptor: + def __init__(self, name): + self.__doc__ = f"This is {name}" + def __get__(self): + pass + + +class Class: + attr1: int = 0 + attr2: int + attr3 = 0 # type: int + + descr4: int = _Descriptor("descr4") + + def __init__(self): + self.attr4: int = 0 #: attr4 + self.attr5: int #: attr5 + self.attr6 = 0 # type: int + """attr6""" + + +class Derived(Class): + attr7: int + + +Alias = Derived diff --git a/tests/roots/test-ext-autodoc/target/typehints.py b/tests/roots/test-ext-autodoc/target/typehints.py new file mode 100644 index 0000000..9071594 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/typehints.py @@ -0,0 +1,105 @@ +from __future__ import annotations + +import pathlib +from typing import Any, Tuple, TypeVar, Union + +CONST1: int +#: docstring +CONST2: int = 1 +#: docstring +CONST3: pathlib.PurePosixPath = pathlib.PurePosixPath("/a/b/c") +#: docstring +T = TypeVar("T", bound=pathlib.PurePosixPath) + + +def incr(a: int, b: int = 1) -> int: + return a + b + + +def decr(a, b = 1): + # type: (int, int) -> int + return a - b + + +class Math: + CONST1: int + CONST2: int = 1 + CONST3: pathlib.PurePosixPath = pathlib.PurePosixPath("/a/b/c") + + def __init__(self, s: str, o: Any = None) -> None: + pass + + def incr(self, a: int, b: int = 1) -> int: + return a + b + + def decr(self, a, b = 1): + # type: (int, int) -> int + return a - b + + def nothing(self): + # type: () -> None + pass + + def horse(self, + a, # type: str + b, # type: int + ): + # type: (...) -> None + return + + @property + def prop(self) -> int: + return 0 + + @property + def path(self) -> pathlib.PurePosixPath: + return pathlib.PurePosixPath("/a/b/c") + + +def tuple_args(x: tuple[int, int | str]) -> tuple[int, int]: + pass + + +class NewAnnotation: + def __new__(cls, i: int) -> NewAnnotation: + pass + + +class NewComment: + def __new__(cls, i): + # type: (int) -> NewComment + pass + + +class _MetaclassWithCall(type): + def __call__(cls, a: int): + pass + + +class SignatureFromMetaclass(metaclass=_MetaclassWithCall): + pass + + +def complex_func(arg1, arg2, arg3=None, *args, **kwargs): + # type: (str, List[int], Tuple[int, Union[str, Unknown]], *str, **str) -> None + pass + + +def missing_attr(c, + a, # type: str + b=None # type: Optional[str] + ): + # type: (...) -> str + return a + (b or "") + + +class _ClassWithDocumentedInit: + """Class docstring.""" + + def __init__(self, x: int, *args: int, **kwargs: int) -> None: + """Init docstring. + + :param x: Some integer + :param args: Some integer + :param kwargs: Some integer + """ diff --git a/tests/roots/test-ext-autodoc/target/typevar.py b/tests/roots/test-ext-autodoc/target/typevar.py new file mode 100644 index 0000000..1a02f3e --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/typevar.py @@ -0,0 +1,32 @@ +from __future__ import annotations + +from datetime import date +from typing import NewType, TypeVar + +#: T1 +T1 = TypeVar("T1") + +T2 = TypeVar("T2") # A TypeVar not having doc comment + +#: T3 +T3 = TypeVar("T3", int, str) + +#: T4 +T4 = TypeVar("T4", covariant=True) + +#: T5 +T5 = TypeVar("T5", contravariant=True) + +#: T6 +T6 = NewType("T6", date) + +#: T7 +T7 = TypeVar("T7", bound=int) + + +class Class: + #: T1 + T1 = TypeVar("T1") + + #: T6 + T6 = NewType("T6", date) diff --git a/tests/roots/test-ext-autodoc/target/uninitialized_attributes.py b/tests/roots/test-ext-autodoc/target/uninitialized_attributes.py new file mode 100644 index 0000000..e0f229c --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/uninitialized_attributes.py @@ -0,0 +1,8 @@ +class Base: + attr1: int #: docstring + attr2: str + + +class Derived(Base): + attr3: int #: docstring + attr4: str diff --git a/tests/roots/test-ext-autodoc/target/wrappedfunction.py b/tests/roots/test-ext-autodoc/target/wrappedfunction.py new file mode 100644 index 0000000..064d777 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/wrappedfunction.py @@ -0,0 +1,17 @@ +from __future__ import annotations + +from contextlib import contextmanager +from functools import lru_cache +from typing import Generator + + +@lru_cache(maxsize=None) +def slow_function(message, timeout): + """This function is slow.""" + print(message) + + +@contextmanager +def feeling_good(x: int, y: int) -> Generator: + """You'll feel better in this context!""" + yield diff --git a/tests/roots/test-ext-autosectionlabel-prefix-document/conf.py b/tests/roots/test-ext-autosectionlabel-prefix-document/conf.py new file mode 100644 index 0000000..78fb56c --- /dev/null +++ b/tests/roots/test-ext-autosectionlabel-prefix-document/conf.py @@ -0,0 +1,2 @@ +extensions = ['sphinx.ext.autosectionlabel'] +autosectionlabel_prefix_document = True diff --git a/tests/roots/test-ext-autosectionlabel-prefix-document/index.rst b/tests/roots/test-ext-autosectionlabel-prefix-document/index.rst new file mode 100644 index 0000000..d767373 --- /dev/null +++ b/tests/roots/test-ext-autosectionlabel-prefix-document/index.rst @@ -0,0 +1,37 @@ +========================================= +test-ext-autosectionlabel-prefix-document +========================================= + + +Introduce of Sphinx +=================== + +Installation +============ + +For Windows users +----------------- + +For UNIX users +-------------- + +Linux +^^^^^ + +FreeBSD +^^^^^^^ + +This one's got an apostrophe +---------------------------- + + +References +========== + +* :ref:`index:Introduce of Sphinx` +* :ref:`index:Installation` +* :ref:`index:For Windows users` +* :ref:`index:For UNIX users` +* :ref:`index:Linux` +* :ref:`index:FreeBSD` +* :ref:`index:This one's got an apostrophe` diff --git a/tests/roots/test-ext-autosectionlabel/conf.py b/tests/roots/test-ext-autosectionlabel/conf.py new file mode 100644 index 0000000..31e93ff --- /dev/null +++ b/tests/roots/test-ext-autosectionlabel/conf.py @@ -0,0 +1 @@ +extensions = ['sphinx.ext.autosectionlabel'] diff --git a/tests/roots/test-ext-autosectionlabel/index.rst b/tests/roots/test-ext-autosectionlabel/index.rst new file mode 100644 index 0000000..133206e --- /dev/null +++ b/tests/roots/test-ext-autosectionlabel/index.rst @@ -0,0 +1,37 @@ +========================= +test-ext-autosectionlabel +========================= + + +Introduce of Sphinx +=================== + +Installation +============ + +For Windows users +----------------- + +For UNIX users +-------------- + +Linux +^^^^^ + +FreeBSD +^^^^^^^ + +This one's got an apostrophe +---------------------------- + +References +========== + +* :ref:`test-ext-autosectionlabel` +* :ref:`Introduce of Sphinx` +* :ref:`Installation` +* :ref:`For Windows users` +* :ref:`For UNIX users` +* :ref:`Linux` +* :ref:`FreeBSD` +* :ref:`This one's got an apostrophe` diff --git a/tests/roots/test-ext-autosummary-filename-map/autosummary_dummy_module.py b/tests/roots/test-ext-autosummary-filename-map/autosummary_dummy_module.py new file mode 100644 index 0000000..b88e335 --- /dev/null +++ b/tests/roots/test-ext-autosummary-filename-map/autosummary_dummy_module.py @@ -0,0 +1,23 @@ +from __future__ import annotations + +from os import path +from typing import Union + + +class Foo: + class Bar: + pass + + def __init__(self): + pass + + def bar(self): + pass + + @property + def baz(self): + pass + + +def bar(x: int | str, y: int = 1) -> None: + pass diff --git a/tests/roots/test-ext-autosummary-filename-map/conf.py b/tests/roots/test-ext-autosummary-filename-map/conf.py new file mode 100644 index 0000000..17e2fa4 --- /dev/null +++ b/tests/roots/test-ext-autosummary-filename-map/conf.py @@ -0,0 +1,11 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True +autosummary_filename_map = { + "autosummary_dummy_module": "module_mangled", + "autosummary_dummy_module.bar": "bar" +} diff --git a/tests/roots/test-ext-autosummary-filename-map/index.rst b/tests/roots/test-ext-autosummary-filename-map/index.rst new file mode 100644 index 0000000..57d902b --- /dev/null +++ b/tests/roots/test-ext-autosummary-filename-map/index.rst @@ -0,0 +1,9 @@ + +.. autosummary:: + :toctree: generated + :caption: An autosummary + + autosummary_dummy_module + autosummary_dummy_module.Foo + autosummary_dummy_module.Foo.bar + autosummary_dummy_module.bar diff --git a/tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/__init__.py b/tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/__init__.py new file mode 100644 index 0000000..0a7d9f3 --- /dev/null +++ b/tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/__init__.py @@ -0,0 +1 @@ +from .autosummary_dummy_module import Bar, foo diff --git a/tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/autosummary_dummy_module.py b/tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/autosummary_dummy_module.py new file mode 100644 index 0000000..9c93f06 --- /dev/null +++ b/tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/autosummary_dummy_module.py @@ -0,0 +1,8 @@ +class Bar: + """Bar class""" + pass + + +def foo(): + """Foo function""" + pass diff --git a/tests/roots/test-ext-autosummary-imported_members/conf.py b/tests/roots/test-ext-autosummary-imported_members/conf.py new file mode 100644 index 0000000..77af668 --- /dev/null +++ b/tests/roots/test-ext-autosummary-imported_members/conf.py @@ -0,0 +1,8 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True +autosummary_imported_members = True diff --git a/tests/roots/test-ext-autosummary-imported_members/index.rst b/tests/roots/test-ext-autosummary-imported_members/index.rst new file mode 100644 index 0000000..1c55126 --- /dev/null +++ b/tests/roots/test-ext-autosummary-imported_members/index.rst @@ -0,0 +1,7 @@ +test-ext-autosummary-imported_members +===================================== + +.. autosummary:: + :toctree: generated + + autosummary_dummy_package diff --git a/tests/roots/test-ext-autosummary-mock_imports/conf.py b/tests/roots/test-ext-autosummary-mock_imports/conf.py new file mode 100644 index 0000000..121f814 --- /dev/null +++ b/tests/roots/test-ext-autosummary-mock_imports/conf.py @@ -0,0 +1,8 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True +autosummary_mock_imports = ['unknown'] diff --git a/tests/roots/test-ext-autosummary-mock_imports/foo.py b/tests/roots/test-ext-autosummary-mock_imports/foo.py new file mode 100644 index 0000000..ab4460e --- /dev/null +++ b/tests/roots/test-ext-autosummary-mock_imports/foo.py @@ -0,0 +1,6 @@ +import unknown + + +class Foo(unknown.Class): + """Foo class""" + pass diff --git a/tests/roots/test-ext-autosummary-mock_imports/index.rst b/tests/roots/test-ext-autosummary-mock_imports/index.rst new file mode 100644 index 0000000..f6044ed --- /dev/null +++ b/tests/roots/test-ext-autosummary-mock_imports/index.rst @@ -0,0 +1,7 @@ +test-ext-autosummary-mock_imports +================================= + +.. autosummary:: + :toctree: generated + + foo diff --git a/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/__init__.py b/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/__init__.py new file mode 100644 index 0000000..82f2060 --- /dev/null +++ b/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/__init__.py @@ -0,0 +1,13 @@ +from .autosummary_dummy_module import Bar, PublicBar, foo, public_foo + + +def baz(): + """Baz function""" + pass + + +def public_baz(): + """Public Baz function""" + + +__all__ = ["PublicBar", "public_foo", "public_baz", "extra_dummy_module"] diff --git a/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/autosummary_dummy_module.py b/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/autosummary_dummy_module.py new file mode 100644 index 0000000..ef89e22 --- /dev/null +++ b/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/autosummary_dummy_module.py @@ -0,0 +1,20 @@ +class Bar: + """Bar class""" + + pass + + +class PublicBar: + """Public Bar class""" + + pass + + +def foo(): + """Foo function""" + pass + + +def public_foo(): + """Public Foo function""" + pass diff --git a/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/extra_dummy_module.py b/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/extra_dummy_module.py new file mode 100644 index 0000000..ef89e22 --- /dev/null +++ b/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/extra_dummy_module.py @@ -0,0 +1,20 @@ +class Bar: + """Bar class""" + + pass + + +class PublicBar: + """Public Bar class""" + + pass + + +def foo(): + """Foo function""" + pass + + +def public_foo(): + """Public Foo function""" + pass diff --git a/tests/roots/test-ext-autosummary-module_all/conf.py b/tests/roots/test-ext-autosummary-module_all/conf.py new file mode 100644 index 0000000..c6ff534 --- /dev/null +++ b/tests/roots/test-ext-autosummary-module_all/conf.py @@ -0,0 +1,8 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True +autosummary_ignore_module_all = False diff --git a/tests/roots/test-ext-autosummary-module_all/index.rst b/tests/roots/test-ext-autosummary-module_all/index.rst new file mode 100644 index 0000000..cd638ad --- /dev/null +++ b/tests/roots/test-ext-autosummary-module_all/index.rst @@ -0,0 +1,8 @@ +test-ext-autosummary-module_all +=============================== + +.. autosummary:: + :toctree: generated + :recursive: + + autosummary_dummy_package_all diff --git a/tests/roots/test-ext-autosummary-recursive/conf.py b/tests/roots/test-ext-autosummary-recursive/conf.py new file mode 100644 index 0000000..1c0d022 --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/conf.py @@ -0,0 +1,7 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True diff --git a/tests/roots/test-ext-autosummary-recursive/index.rst b/tests/roots/test-ext-autosummary-recursive/index.rst new file mode 100644 index 0000000..5855bfa --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/index.rst @@ -0,0 +1,15 @@ +API Reference +============= + +.. rubric:: Packages + +.. autosummary:: + :toctree: generated + :recursive: + + package + +.. autosummary:: + :toctree: generated + + package2 diff --git a/tests/roots/test-ext-autosummary-recursive/package/__init__.py b/tests/roots/test-ext-autosummary-recursive/package/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/package/__init__.py diff --git a/tests/roots/test-ext-autosummary-recursive/package/module.py b/tests/roots/test-ext-autosummary-recursive/package/module.py new file mode 100644 index 0000000..c76e733 --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/package/module.py @@ -0,0 +1,13 @@ +from os import * + + +class Foo: + def __init__(self): + pass + + def bar(self): + pass + + @property + def baz(self): + pass diff --git a/tests/roots/test-ext-autosummary-recursive/package/module_importfail.py b/tests/roots/test-ext-autosummary-recursive/package/module_importfail.py new file mode 100644 index 0000000..5c6ce56 --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/package/module_importfail.py @@ -0,0 +1,2 @@ +# Fail module import in a catastrophic way +raise SystemExit(1) diff --git a/tests/roots/test-ext-autosummary-recursive/package/package/__init__.py b/tests/roots/test-ext-autosummary-recursive/package/package/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/package/package/__init__.py diff --git a/tests/roots/test-ext-autosummary-recursive/package/package/module.py b/tests/roots/test-ext-autosummary-recursive/package/package/module.py new file mode 100644 index 0000000..c76e733 --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/package/package/module.py @@ -0,0 +1,13 @@ +from os import * + + +class Foo: + def __init__(self): + pass + + def bar(self): + pass + + @property + def baz(self): + pass diff --git a/tests/roots/test-ext-autosummary-recursive/package2/__init__.py b/tests/roots/test-ext-autosummary-recursive/package2/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/package2/__init__.py diff --git a/tests/roots/test-ext-autosummary-recursive/package2/module.py b/tests/roots/test-ext-autosummary-recursive/package2/module.py new file mode 100644 index 0000000..c76e733 --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/package2/module.py @@ -0,0 +1,13 @@ +from os import * + + +class Foo: + def __init__(self): + pass + + def bar(self): + pass + + @property + def baz(self): + pass diff --git a/tests/roots/test-ext-autosummary-skip-member/conf.py b/tests/roots/test-ext-autosummary-skip-member/conf.py new file mode 100644 index 0000000..7c8f0e9 --- /dev/null +++ b/tests/roots/test-ext-autosummary-skip-member/conf.py @@ -0,0 +1,20 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True +autodoc_default_options = {'members': True} + + +def skip_member(app, what, name, obj, skip, options): + if name == 'skipmeth': + return True + elif name == '_privatemeth': + return False + + +def setup(app): + app.connect('autodoc-skip-member', skip_member) diff --git a/tests/roots/test-ext-autosummary-skip-member/index.rst b/tests/roots/test-ext-autosummary-skip-member/index.rst new file mode 100644 index 0000000..c376a13 --- /dev/null +++ b/tests/roots/test-ext-autosummary-skip-member/index.rst @@ -0,0 +1,4 @@ +.. autosummary:: + :toctree: generate + + target.Foo diff --git a/tests/roots/test-ext-autosummary-skip-member/target.py b/tests/roots/test-ext-autosummary-skip-member/target.py new file mode 100644 index 0000000..fdf557e --- /dev/null +++ b/tests/roots/test-ext-autosummary-skip-member/target.py @@ -0,0 +1,14 @@ +class Foo: + """docstring of Foo.""" + + def meth(self): + """docstring of meth.""" + pass + + def skipmeth(self): + """docstring of skipmeth.""" + pass + + def _privatemeth(self): + """docstring of _privatemeth.""" + pass diff --git a/tests/roots/test-ext-autosummary-template/_templates/empty.rst b/tests/roots/test-ext-autosummary-template/_templates/empty.rst new file mode 100644 index 0000000..7f7204c --- /dev/null +++ b/tests/roots/test-ext-autosummary-template/_templates/empty.rst @@ -0,0 +1 @@ +EMPTY diff --git a/tests/roots/test-ext-autosummary-template/conf.py b/tests/roots/test-ext-autosummary-template/conf.py new file mode 100644 index 0000000..cc23635 --- /dev/null +++ b/tests/roots/test-ext-autosummary-template/conf.py @@ -0,0 +1,10 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True +autodoc_default_options = {'members': True} +templates_path = ['_templates'] diff --git a/tests/roots/test-ext-autosummary-template/index.rst b/tests/roots/test-ext-autosummary-template/index.rst new file mode 100644 index 0000000..c9f28b0 --- /dev/null +++ b/tests/roots/test-ext-autosummary-template/index.rst @@ -0,0 +1,5 @@ +.. autosummary:: + :toctree: generate + :template: empty.rst + + target.Foo diff --git a/tests/roots/test-ext-autosummary-template/target.py b/tests/roots/test-ext-autosummary-template/target.py new file mode 100644 index 0000000..c607b59 --- /dev/null +++ b/tests/roots/test-ext-autosummary-template/target.py @@ -0,0 +1,2 @@ +class Foo: + """docstring of Foo.""" diff --git a/tests/roots/test-ext-autosummary/autosummary_class_module.py b/tests/roots/test-ext-autosummary/autosummary_class_module.py new file mode 100644 index 0000000..f13de17 --- /dev/null +++ b/tests/roots/test-ext-autosummary/autosummary_class_module.py @@ -0,0 +1,2 @@ +class Class(): + pass diff --git a/tests/roots/test-ext-autosummary/autosummary_dummy_inherited_module.py b/tests/roots/test-ext-autosummary/autosummary_dummy_inherited_module.py new file mode 100644 index 0000000..2b3d2da --- /dev/null +++ b/tests/roots/test-ext-autosummary/autosummary_dummy_inherited_module.py @@ -0,0 +1,13 @@ +from autosummary_dummy_module import Foo + + +class InheritedAttrClass(Foo): + + def __init__(self): + #: other docstring + self.subclassattr = "subclassattr" + + super().__init__() + + +__all__ = ["InheritedAttrClass"] diff --git a/tests/roots/test-ext-autosummary/autosummary_dummy_module.py b/tests/roots/test-ext-autosummary/autosummary_dummy_module.py new file mode 100644 index 0000000..2d8829a --- /dev/null +++ b/tests/roots/test-ext-autosummary/autosummary_dummy_module.py @@ -0,0 +1,68 @@ +from os import path +from typing import Union + +from autosummary_class_module import Class + +__all__ = [ + "CONSTANT1", + "Exc", + "Foo", + "_Baz", + "bar", + "qux", + "path", +] + +#: module variable +CONSTANT1 = None +CONSTANT2 = None + + +class Foo: + #: class variable + CONSTANT3 = None + CONSTANT4 = None + + class Bar: + pass + + def __init__(self): + #: docstring + self.value = 1 + + def bar(self): + pass + + @property + def baz(self): + pass + + +class _Baz: + pass + + +def bar(x: Union[int, str], y: int = 1) -> None: + pass + + +def _quux(): + pass + + +class Exc(Exception): + pass + + +class _Exc(Exception): + pass + + +#: a module-level attribute +qux = 2 +#: a module-level attribute that has been excluded from __all__ +quuz = 2 + +considered_as_imported = Class() +non_imported_member = Class() +""" This attribute has a docstring, so it is recognized as a not-imported member """ diff --git a/tests/roots/test-ext-autosummary/autosummary_importfail.py b/tests/roots/test-ext-autosummary/autosummary_importfail.py new file mode 100644 index 0000000..5c6ce56 --- /dev/null +++ b/tests/roots/test-ext-autosummary/autosummary_importfail.py @@ -0,0 +1,2 @@ +# Fail module import in a catastrophic way +raise SystemExit(1) diff --git a/tests/roots/test-ext-autosummary/conf.py b/tests/roots/test-ext-autosummary/conf.py new file mode 100644 index 0000000..55c769c --- /dev/null +++ b/tests/roots/test-ext-autosummary/conf.py @@ -0,0 +1,10 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True + +# The suffix of source filenames. +source_suffix = '.rst' diff --git a/tests/roots/test-ext-autosummary/index.rst b/tests/roots/test-ext-autosummary/index.rst new file mode 100644 index 0000000..08bd0f0 --- /dev/null +++ b/tests/roots/test-ext-autosummary/index.rst @@ -0,0 +1,18 @@ + +:autolink:`autosummary_dummy_module.Foo` + +:autolink:`autosummary_importfail` + +.. autosummary:: + :toctree: generated + :caption: An autosummary + + autosummary_dummy_module + autosummary_dummy_module.Foo + autosummary_dummy_module.Foo.Bar + autosummary_dummy_module.Foo.value + autosummary_dummy_module.bar + autosummary_dummy_module.qux + autosummary_dummy_inherited_module.InheritedAttrClass + autosummary_dummy_inherited_module.InheritedAttrClass.subclassattr + autosummary_importfail diff --git a/tests/roots/test-ext-coverage/conf.py b/tests/roots/test-ext-coverage/conf.py new file mode 100644 index 0000000..d3ec6e8 --- /dev/null +++ b/tests/roots/test-ext-coverage/conf.py @@ -0,0 +1,12 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage'] + +coverage_ignore_pyobjects = [ + r'^coverage_ignored(\..*)?$', + r'\.Ignored$', + r'\.Documented\.ignored\d$', +] diff --git a/tests/roots/test-ext-coverage/coverage_ignored.py b/tests/roots/test-ext-coverage/coverage_ignored.py new file mode 100644 index 0000000..b762955 --- /dev/null +++ b/tests/roots/test-ext-coverage/coverage_ignored.py @@ -0,0 +1,22 @@ +class Documented: + """Documented""" + + def ignored1(self): + pass + + def ignored2(self): + pass + + def not_ignored1(self): + pass + + def not_ignored2(self): + pass + + +class Ignored: + pass + + +class NotIgnored: + pass diff --git a/tests/roots/test-ext-coverage/coverage_not_ignored.py b/tests/roots/test-ext-coverage/coverage_not_ignored.py new file mode 100644 index 0000000..b762955 --- /dev/null +++ b/tests/roots/test-ext-coverage/coverage_not_ignored.py @@ -0,0 +1,22 @@ +class Documented: + """Documented""" + + def ignored1(self): + pass + + def ignored2(self): + pass + + def not_ignored1(self): + pass + + def not_ignored2(self): + pass + + +class Ignored: + pass + + +class NotIgnored: + pass diff --git a/tests/roots/test-ext-coverage/index.rst b/tests/roots/test-ext-coverage/index.rst new file mode 100644 index 0000000..b846898 --- /dev/null +++ b/tests/roots/test-ext-coverage/index.rst @@ -0,0 +1,6 @@ +.. automodule:: coverage_ignored + :members: + + +.. automodule:: coverage_not_ignored + :members: diff --git a/tests/roots/test-ext-doctest-skipif/conf.py b/tests/roots/test-ext-doctest-skipif/conf.py new file mode 100644 index 0000000..6f54982 --- /dev/null +++ b/tests/roots/test-ext-doctest-skipif/conf.py @@ -0,0 +1,16 @@ +extensions = ['sphinx.ext.doctest'] + +project = 'test project for the doctest :skipif: directive' +root_doc = 'skipif' +source_suffix = '.txt' +exclude_patterns = ['_build'] + +doctest_global_setup = ''' +from tests.test_ext_doctest import record + +record('doctest_global_setup', 'body', True) +''' + +doctest_global_cleanup = ''' +record('doctest_global_cleanup', 'body', True) +''' diff --git a/tests/roots/test-ext-doctest-skipif/skipif.txt b/tests/roots/test-ext-doctest-skipif/skipif.txt new file mode 100644 index 0000000..c5bd398 --- /dev/null +++ b/tests/roots/test-ext-doctest-skipif/skipif.txt @@ -0,0 +1,81 @@ +Testing the doctest extension's `:skipif:` option +================================================= + +testsetup +--------- + +.. testsetup:: group-skipif + :skipif: record('testsetup', ':skipif:', True) != 'this will be True' + + record('testsetup', 'body', True) + +.. testsetup:: group-skipif + :skipif: record('testsetup', ':skipif:', False) == 'this will be False' + + record('testsetup', 'body', False) + + +doctest +------- +.. doctest:: group-skipif + :skipif: record('doctest', ':skipif:', True) != 'this will be True' + + >>> print(record('doctest', 'body', True)) + The test is skipped, and this expected text is ignored + + +.. doctest:: + :skipif: record('doctest', ':skipif:', False) == 'this will be False' + + >>> print(record('doctest', 'body', False)) + Recorded doctest body False + + +testcode and testoutput +----------------------- + +testcode skipped +~~~~~~~~~~~~~~~~ + +.. testcode:: group-skipif + :skipif: record('testcode', ':skipif:', True) != 'this will be True' + + print(record('testcode', 'body', True)) + +.. testoutput:: group-skipif + :skipif: record('testoutput-1', ':skipif:', True) != 'this will be True' + + The previous testcode is skipped, and the :skipif: condition is True, + so this testoutput is ignored + +testcode executed +~~~~~~~~~~~~~~~~~ + +.. testcode:: group-skipif + :skipif: record('testcode', ':skipif:', False) == 'this will be False' + + print(record('testcode', 'body', False)) + +.. testoutput:: group-skipif + :skipif: record('testoutput-2', ':skipif:', False) == 'this will be False' + + Recorded testcode body False + +.. testoutput:: group-skipif + :skipif: record('testoutput-2', ':skipif:', True) != 'this will be True' + + The :skipif: condition is False, so this testoutput is ignored + + +testcleanup +----------- + +.. testcleanup:: group-skipif + :skipif: record('testcleanup', ':skipif:', True) != 'this will be True' + + record('testcleanup', 'body', True) + +.. testcleanup:: group-skipif + :skipif: record('testcleanup', ':skipif:', False) == 'this will be False' + + record('testcleanup', 'body', False) diff --git a/tests/roots/test-ext-doctest-with-autodoc/conf.py b/tests/roots/test-ext-doctest-with-autodoc/conf.py new file mode 100644 index 0000000..1ec1dd9 --- /dev/null +++ b/tests/roots/test-ext-doctest-with-autodoc/conf.py @@ -0,0 +1,7 @@ +import sys +from os import path + +sys.path.insert(0, path.abspath(path.dirname(__file__))) + +project = 'test project for doctest + autodoc reporting' +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest'] diff --git a/tests/roots/test-ext-doctest-with-autodoc/dir/__init__.py b/tests/roots/test-ext-doctest-with-autodoc/dir/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-ext-doctest-with-autodoc/dir/__init__.py diff --git a/tests/roots/test-ext-doctest-with-autodoc/dir/bar.py b/tests/roots/test-ext-doctest-with-autodoc/dir/bar.py new file mode 100644 index 0000000..122fdf7 --- /dev/null +++ b/tests/roots/test-ext-doctest-with-autodoc/dir/bar.py @@ -0,0 +1,4 @@ +""" +>>> 'dir/bar.py:2' + +""" diff --git a/tests/roots/test-ext-doctest-with-autodoc/dir/inner.rst b/tests/roots/test-ext-doctest-with-autodoc/dir/inner.rst new file mode 100644 index 0000000..b2ee47f --- /dev/null +++ b/tests/roots/test-ext-doctest-with-autodoc/dir/inner.rst @@ -0,0 +1,4 @@ +>>> 'dir/inner.rst:1' + +.. automodule:: dir.bar + :members: diff --git a/tests/roots/test-ext-doctest-with-autodoc/foo.py b/tests/roots/test-ext-doctest-with-autodoc/foo.py new file mode 100644 index 0000000..9f62a19 --- /dev/null +++ b/tests/roots/test-ext-doctest-with-autodoc/foo.py @@ -0,0 +1,5 @@ +""" + +>>> 'foo.py:3' + +""" diff --git a/tests/roots/test-ext-doctest-with-autodoc/index.rst b/tests/roots/test-ext-doctest-with-autodoc/index.rst new file mode 100644 index 0000000..09d1239 --- /dev/null +++ b/tests/roots/test-ext-doctest-with-autodoc/index.rst @@ -0,0 +1,4 @@ +.. automodule:: foo + :members: + +>>> 'index.rst:4' diff --git a/tests/roots/test-ext-doctest/conf.py b/tests/roots/test-ext-doctest/conf.py new file mode 100644 index 0000000..d0e8b10 --- /dev/null +++ b/tests/roots/test-ext-doctest/conf.py @@ -0,0 +1,6 @@ +extensions = ['sphinx.ext.doctest'] + +project = 'test project for doctest' +root_doc = 'doctest' +source_suffix = '.txt' +exclude_patterns = ['_build'] diff --git a/tests/roots/test-ext-doctest/doctest.txt b/tests/roots/test-ext-doctest/doctest.txt new file mode 100644 index 0000000..04780cf --- /dev/null +++ b/tests/roots/test-ext-doctest/doctest.txt @@ -0,0 +1,163 @@ +Testing the doctest extension +============================= + +Simple doctest blocks +--------------------- + +>>> 1+1 +2 +>>> 1/0 +Traceback (most recent call last): + ... +ZeroDivisionError: integer division or modulo by zero + + +Special directives +------------------ + +* doctest + + .. doctest:: + + >>> 1+1 + 2 + >>> 1/0 + Traceback (most recent call last): + ... + ZeroDivisionError: integer division or modulo by zero + +* testcode/testoutput + + .. testcode:: + + print(1+1) + + .. testoutput:: + + 2 + + .. testcode:: + + 1/0 + + .. testoutput:: + + Traceback (most recent call last): + ... + ZeroDivisionError: integer division or modulo by zero + +* testsetup + + .. testsetup:: * + + def squared(x): + return x * x + + .. doctest:: + + >>> squared(2) + 4 + + .. testcode:: + + print(squared(2)) + + .. testoutput:: + + 4 + + >>> squared(2) + 4 + +* options for doctest/testcode/testoutput blocks + + .. testcode:: + :hide: + + print('Output text.') + + .. testoutput:: + :hide: + :options: +NORMALIZE_WHITESPACE + + Output text. + + .. doctest:: + :pyversion: >= 2.0 + + >>> a = 3 + >>> a + 3 + + .. doctest:: + :pyversion: < 2.0 + + >>> a = 3 + >>> a + 4 + +* grouping + + .. testsetup:: group1 + + def add(x, y): + return x + y + + + ``add`` is now known in "group1", but not in others. + + .. doctest:: group1 + + >>> add(1, 1) + 2 + + .. doctest:: group2 + + >>> add(1, 1) + Traceback (most recent call last): + ... + NameError: name 'add' is not defined + + Interleaving testcode/testoutput: + + .. testcode:: group1 + + print(squared(3)) + + .. testcode:: group2 + + print(squared(4)) + + .. testoutput:: group1 + + 9 + + .. testoutput:: group2 + + 16 + + +.. testcleanup:: * + + from tests import test_ext_doctest + test_ext_doctest.cleanup_call() + +non-ASCII result +---------------- + +>>> print('umlauts: äöü.') +umlauts: äöü. +>>> print('Japanese: 日本語') +Japanese: 日本語 + +keep control char in raw string +------------------------------- + +.. doctest:: + + >>> print('one\ntwo') + one + two + >>> print(r'one\ntwo') + one\ntwo + diff --git a/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/conf.py b/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/conf.py new file mode 100644 index 0000000..f463449 --- /dev/null +++ b/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/conf.py @@ -0,0 +1,6 @@ +extensions = ['sphinx.ext.extlinks'] +extlinks = { + 'user': ('https://github.com/%s', '@%s'), + 'repo': ('https://github.com/%s', 'project %s'), +} +extlinks_detect_hardcoded_links = True diff --git a/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/index.rst b/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/index.rst new file mode 100644 index 0000000..162b361 --- /dev/null +++ b/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/index.rst @@ -0,0 +1,24 @@ +test-ext-extlinks-hardcoded-urls +================================ + +.. Links generated by extlinks extension should not raise any warnings. +.. Only hardcoded URLs are affected. + +:user:`octocat` + +:repo:`sphinx-doc/sphinx` + +.. hardcoded replaceable link which can be replaced as +.. :repo:`octocat` or :user:`octocat` + +https://github.com/octocat + +`inline replaceable link <https://github.com/octocat>`_ + +`replaceable link`_ + +`non replaceable link <https://github.com/sphinx-doc/sphinx/pulls>`_ + +.. hyperlinks + +.. _replaceable link: https://github.com/octocat diff --git a/tests/roots/test-ext-extlinks-hardcoded-urls/conf.py b/tests/roots/test-ext-extlinks-hardcoded-urls/conf.py new file mode 100644 index 0000000..db0b341 --- /dev/null +++ b/tests/roots/test-ext-extlinks-hardcoded-urls/conf.py @@ -0,0 +1,3 @@ +extensions = ['sphinx.ext.extlinks'] +extlinks = {'issue': ('https://github.com/sphinx-doc/sphinx/issues/%s', 'issue %s')} +extlinks_detect_hardcoded_links = True diff --git a/tests/roots/test-ext-extlinks-hardcoded-urls/index.rst b/tests/roots/test-ext-extlinks-hardcoded-urls/index.rst new file mode 100644 index 0000000..ada6f07 --- /dev/null +++ b/tests/roots/test-ext-extlinks-hardcoded-urls/index.rst @@ -0,0 +1,28 @@ +test-ext-extlinks-hardcoded-urls +================================ + +.. Links generated by extlinks extension should not raise any warnings. +.. Only hardcoded URLs are affected. + +:issue:`1` + +.. hardcoded replaceable link + +https://github.com/sphinx-doc/sphinx/issues/1 + +`inline replaceable link <https://github.com/sphinx-doc/sphinx/issues/1>`_ + +`replaceable link`_ + +.. hardcoded non-replaceable link + +https://github.com/sphinx-doc/sphinx/pulls/1 + +`inline non-replaceable link <https://github.com/sphinx-doc/sphinx/pulls/1>`_ + +`non-replaceable link`_ + +.. hyperlinks + +.. _replaceable link: https://github.com/sphinx-doc/sphinx/issues/1 +.. _non-replaceable link: https://github.com/sphinx-doc/sphinx/pulls/1 diff --git a/tests/roots/test-ext-githubpages/conf.py b/tests/roots/test-ext-githubpages/conf.py new file mode 100644 index 0000000..3577096 --- /dev/null +++ b/tests/roots/test-ext-githubpages/conf.py @@ -0,0 +1 @@ +extensions = ['sphinx.ext.githubpages'] diff --git a/tests/roots/test-ext-githubpages/index.rst b/tests/roots/test-ext-githubpages/index.rst new file mode 100644 index 0000000..711847f --- /dev/null +++ b/tests/roots/test-ext-githubpages/index.rst @@ -0,0 +1,3 @@ +githubpages +=========== + diff --git a/tests/roots/test-ext-graphviz/_static/images/test.svg b/tests/roots/test-ext-graphviz/_static/images/test.svg new file mode 100644 index 0000000..6134f44 --- /dev/null +++ b/tests/roots/test-ext-graphviz/_static/images/test.svg @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg version="1.1" + height="128" width="128" + xmlns="http://www.w3.org/2000/svg"> + + <rect width="100%" height="100%" fill="red" /> + +</svg> diff --git a/tests/roots/test-ext-graphviz/conf.py b/tests/roots/test-ext-graphviz/conf.py new file mode 100644 index 0000000..317457f --- /dev/null +++ b/tests/roots/test-ext-graphviz/conf.py @@ -0,0 +1,3 @@ +extensions = ['sphinx.ext.graphviz'] +exclude_patterns = ['_build'] +html_static_path = ["_static"] diff --git a/tests/roots/test-ext-graphviz/graph.dot b/tests/roots/test-ext-graphviz/graph.dot new file mode 100644 index 0000000..ca57244 --- /dev/null +++ b/tests/roots/test-ext-graphviz/graph.dot @@ -0,0 +1,3 @@ +digraph { + bar -> baz +} diff --git a/tests/roots/test-ext-graphviz/graph.xx.dot b/tests/roots/test-ext-graphviz/graph.xx.dot new file mode 100644 index 0000000..e5add5c --- /dev/null +++ b/tests/roots/test-ext-graphviz/graph.xx.dot @@ -0,0 +1,3 @@ +digraph { + BAR -> BAZ +} diff --git a/tests/roots/test-ext-graphviz/index.rst b/tests/roots/test-ext-graphviz/index.rst new file mode 100644 index 0000000..cb0f069 --- /dev/null +++ b/tests/roots/test-ext-graphviz/index.rst @@ -0,0 +1,43 @@ +graphviz +======== + +.. digraph:: foo + :caption: caption of graph + + bar -> baz + +.. |graph| digraph:: bar + + bar -> baz + +Hello |graph| graphviz world + +.. digraph:: foo + :graphviz_dot: neato + :class: neato_graph + + baz -> qux + + +.. graphviz:: graph.dot + +.. digraph:: bar + :align: right + :caption: on *right* + + foo -> bar + +.. digraph:: foo + :align: center + + centered + +.. graphviz:: + :align: center + + digraph test { + foo [label="foo", URL="#graphviz", target="_parent"] + bar [label="bar", image="./_static/images/test.svg"] + baz [label="baz", URL="./_static/images/test.svg"] + foo -> bar -> baz + } diff --git a/tests/roots/test-ext-ifconfig/conf.py b/tests/roots/test-ext-ifconfig/conf.py new file mode 100644 index 0000000..e82ec79 --- /dev/null +++ b/tests/roots/test-ext-ifconfig/conf.py @@ -0,0 +1,10 @@ +extensions = ['sphinx.ext.ifconfig'] +exclude_patterns = ['_build'] + +confval1 = True + + +def setup(app): + app.add_config_value('confval1', False, None) + app.add_config_value('confval2', False, None) + app.add_config_value('false_config', False, None) diff --git a/tests/roots/test-ext-ifconfig/index.rst b/tests/roots/test-ext-ifconfig/index.rst new file mode 100644 index 0000000..f7fabcc --- /dev/null +++ b/tests/roots/test-ext-ifconfig/index.rst @@ -0,0 +1,21 @@ +ifconfig +======== + +.. ifconfig:: confval1 + + spam + +.. ifconfig:: confval2 + + egg + +Issue 10496 regression test +=========================== + +.. ifconfig:: false_config + + `Link 1 <https://link1.example>`__ + +.. ifconfig:: false_config + + `Link 2 <https://link2.example>`__ diff --git a/tests/roots/test-ext-imgconverter/conf.py b/tests/roots/test-ext-imgconverter/conf.py new file mode 100644 index 0000000..6a2e75d --- /dev/null +++ b/tests/roots/test-ext-imgconverter/conf.py @@ -0,0 +1 @@ +extensions = ['sphinx.ext.imgconverter'] diff --git a/tests/roots/test-ext-imgconverter/img.pdf b/tests/roots/test-ext-imgconverter/img.pdf Binary files differnew file mode 100644 index 0000000..cacbd85 --- /dev/null +++ b/tests/roots/test-ext-imgconverter/img.pdf diff --git a/tests/roots/test-ext-imgconverter/index.rst b/tests/roots/test-ext-imgconverter/index.rst new file mode 100644 index 0000000..f8ef1d6 --- /dev/null +++ b/tests/roots/test-ext-imgconverter/index.rst @@ -0,0 +1,5 @@ +test-ext-imgconverter +===================== + +.. image:: svgimg.svg +.. image:: img.pdf diff --git a/tests/roots/test-ext-imgconverter/svgimg.svg b/tests/roots/test-ext-imgconverter/svgimg.svg new file mode 100644 index 0000000..2bae0b9 --- /dev/null +++ b/tests/roots/test-ext-imgconverter/svgimg.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="60" width="60"> + <circle cx="40" cy="40" r="24" style="stroke:#000000; fill:#ffffff"/> +</svg> diff --git a/tests/roots/test-ext-imgmockconverter/1/svgimg.svg b/tests/roots/test-ext-imgmockconverter/1/svgimg.svg new file mode 100644 index 0000000..981e301 --- /dev/null +++ b/tests/roots/test-ext-imgmockconverter/1/svgimg.svg @@ -0,0 +1,3 @@ +<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> + <circle cx="50" cy="50" r="50" /> +</svg> diff --git a/tests/roots/test-ext-imgmockconverter/2/svgimg.svg b/tests/roots/test-ext-imgmockconverter/2/svgimg.svg new file mode 100644 index 0000000..2bae0b9 --- /dev/null +++ b/tests/roots/test-ext-imgmockconverter/2/svgimg.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="60" width="60"> + <circle cx="40" cy="40" r="24" style="stroke:#000000; fill:#ffffff"/> +</svg> diff --git a/tests/roots/test-ext-imgmockconverter/conf.py b/tests/roots/test-ext-imgmockconverter/conf.py new file mode 100644 index 0000000..679bb5a --- /dev/null +++ b/tests/roots/test-ext-imgmockconverter/conf.py @@ -0,0 +1,5 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) +extensions = ['mocksvgconverter'] diff --git a/tests/roots/test-ext-imgmockconverter/index.rst b/tests/roots/test-ext-imgmockconverter/index.rst new file mode 100644 index 0000000..bc665f6 --- /dev/null +++ b/tests/roots/test-ext-imgmockconverter/index.rst @@ -0,0 +1,6 @@ +test-ext-imgconverter +===================== + +.. image:: ./1/svgimg.svg +.. image:: ./2/svgimg.svg + diff --git a/tests/roots/test-ext-imgmockconverter/mocksvgconverter.py b/tests/roots/test-ext-imgmockconverter/mocksvgconverter.py new file mode 100644 index 0000000..43368de --- /dev/null +++ b/tests/roots/test-ext-imgmockconverter/mocksvgconverter.py @@ -0,0 +1,39 @@ +""" + Does foo.svg --> foo.pdf with no change to the file. +""" + +import shutil + +from sphinx.transforms.post_transforms.images import ImageConverter + +if False: + # For type annotation + from typing import Any, Dict # NOQA + + from sphinx.application import Sphinx # NOQA + +class MyConverter(ImageConverter): + conversion_rules = [ + ('image/svg+xml', 'application/pdf'), + ] + + def is_available(self): + # type: () -> bool + return True + + def convert(self, _from, _to): + # type: (unicode, unicode) -> bool + """Mock converts the image from SVG to PDF.""" + shutil.copyfile(_from, _to) + return True + + +def setup(app): + # type: (Sphinx) -> Dict[unicode, Any] + app.add_post_transform(MyConverter) + + return { + 'version': 'builtin', + 'parallel_read_safe': True, + 'parallel_write_safe': True, + } diff --git a/tests/roots/test-ext-inheritance_diagram/conf.py b/tests/roots/test-ext-inheritance_diagram/conf.py new file mode 100644 index 0000000..d3778d5 --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/conf.py @@ -0,0 +1,6 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.inheritance_diagram', 'sphinx.ext.intersphinx'] diff --git a/tests/roots/test-ext-inheritance_diagram/example/__init__.py b/tests/roots/test-ext-inheritance_diagram/example/__init__.py new file mode 100644 index 0000000..2f85c08 --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/example/__init__.py @@ -0,0 +1 @@ +# example.py diff --git a/tests/roots/test-ext-inheritance_diagram/example/sphinx.py b/tests/roots/test-ext-inheritance_diagram/example/sphinx.py new file mode 100644 index 0000000..2bfbf4c --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/example/sphinx.py @@ -0,0 +1,5 @@ +# example.sphinx + + +class DummyClass: + pass diff --git a/tests/roots/test-ext-inheritance_diagram/external/other.py b/tests/roots/test-ext-inheritance_diagram/external/other.py new file mode 100644 index 0000000..a4ce8a7 --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/external/other.py @@ -0,0 +1,5 @@ +from test import Alice + + +class Bob(Alice): + pass diff --git a/tests/roots/test-ext-inheritance_diagram/index.rst b/tests/roots/test-ext-inheritance_diagram/index.rst new file mode 100644 index 0000000..e694fb0 --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/index.rst @@ -0,0 +1,18 @@ +============================ +test-ext-inheritance_diagram +============================ + +.. inheritance-diagram:: test.Foo + +.. inheritance-diagram:: test.Foo + :caption: Test Foo! + +.. inheritance-diagram:: test.DocSubDir2 + +.. py:class:: test.DocHere + +.. py:class:: test.DocMainLevel + +.. inheritance-diagram:: external.other.Bob + +.. py:class:: test.Alice diff --git a/tests/roots/test-ext-inheritance_diagram/subdir/page1.rst b/tests/roots/test-ext-inheritance_diagram/subdir/page1.rst new file mode 100644 index 0000000..3001b02 --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/subdir/page1.rst @@ -0,0 +1,9 @@ +================================================ +test-ext-inheritance_diagram subdirectory page 1 +================================================ + +.. inheritance-diagram:: test.DocMainLevel + +.. inheritance-diagram:: test.DocSubDir2 + +.. py:class:: test.DocSubDir1 diff --git a/tests/roots/test-ext-inheritance_diagram/subdir/page2.rst b/tests/roots/test-ext-inheritance_diagram/subdir/page2.rst new file mode 100644 index 0000000..720e2d8 --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/subdir/page2.rst @@ -0,0 +1,5 @@ +================================================ +test-ext-inheritance_diagram subdirectory page 2 +================================================ + +.. py:class:: test.DocSubDir2 diff --git a/tests/roots/test-ext-inheritance_diagram/test.py b/tests/roots/test-ext-inheritance_diagram/test.py new file mode 100644 index 0000000..efb1c2a --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/test.py @@ -0,0 +1,22 @@ +class Foo: + pass + + +class DocHere(Foo): + pass + + +class DocSubDir1(DocHere): + pass + + +class DocSubDir2(DocSubDir1): + pass + + +class DocMainLevel(Foo): + pass + + +class Alice(object): + pass diff --git a/tests/roots/test-ext-intersphinx-cppdomain/conf.py b/tests/roots/test-ext-intersphinx-cppdomain/conf.py new file mode 100644 index 0000000..9485eb2 --- /dev/null +++ b/tests/roots/test-ext-intersphinx-cppdomain/conf.py @@ -0,0 +1 @@ +extensions = ['sphinx.ext.intersphinx'] diff --git a/tests/roots/test-ext-intersphinx-cppdomain/index.rst b/tests/roots/test-ext-intersphinx-cppdomain/index.rst new file mode 100644 index 0000000..bf67d52 --- /dev/null +++ b/tests/roots/test-ext-intersphinx-cppdomain/index.rst @@ -0,0 +1,8 @@ +test-ext-intersphinx-cppdomain +============================== + +.. cpp:namespace:: foo + +:cpp:class:`Bar` + +.. cpp:function:: foons::bartype FooBarBaz() diff --git a/tests/roots/test-ext-intersphinx-role/conf.py b/tests/roots/test-ext-intersphinx-role/conf.py new file mode 100644 index 0000000..a54f5c2 --- /dev/null +++ b/tests/roots/test-ext-intersphinx-role/conf.py @@ -0,0 +1,3 @@ +extensions = ['sphinx.ext.intersphinx'] +# the role should not honor this conf var +intersphinx_disabled_reftypes = ['*'] diff --git a/tests/roots/test-ext-intersphinx-role/index.rst b/tests/roots/test-ext-intersphinx-role/index.rst new file mode 100644 index 0000000..58edb7a --- /dev/null +++ b/tests/roots/test-ext-intersphinx-role/index.rst @@ -0,0 +1,44 @@ +- ``module1`` is only defined in ``inv``: + :external:py:mod:`module1` + +.. py:module:: module2 + +- ``module2`` is defined here and also in ``inv``, but should resolve to inv: + :external:py:mod:`module2` + +- ``module3`` is not defined anywhere, so should warn: + :external:py:mod:`module3` + +.. py:module:: module10 + +- ``module10`` is only defined here, but should still not be resolved to: + :external:py:mod:`module10` + +- a function in inv: + :external:py:func:`module1.func` +- a method, but with old style inventory prefix, which shouldn't work: + :external:py:meth:`inv:Foo.bar` +- a non-existing role: + :external:py:nope:`something` + +.. default-domain:: cpp + +- a type where the default domain is used to find the role: + :external:type:`std::uint8_t` +- a non-existing role in default domain: + :external:nope:`somethingElse` + +- two roles in ``std`` which can be found without a default domain: + + - :external:doc:`docname` + - :external:option:`ls -l` + + +- a function with explicit inventory: + :external+inv:c:func:`CFunc` +- a class with explicit non-existing inventory, which also has upper-case in name: + :external+invNope:cpp:class:`foo::Bar` + + +- explicit title: + :external:cpp:type:`FoonsTitle <foons>` diff --git a/tests/roots/test-ext-math-compat/conf.py b/tests/roots/test-ext-math-compat/conf.py new file mode 100644 index 0000000..85e3950 --- /dev/null +++ b/tests/roots/test-ext-math-compat/conf.py @@ -0,0 +1,20 @@ +from docutils import nodes +from docutils.parsers.rst import Directive + +extensions = ['sphinx.ext.mathjax'] + + +def my_math_role(role, rawtext, text, lineno, inliner, options={}, content=[]): + text = 'E = mc^2' + return [nodes.math(text, text)], [] + + +class MyMathDirective(Directive): + def run(self): + text = 'E = mc^2' + return [nodes.math_block(text, text)] + + +def setup(app): + app.add_role('my_math', my_math_role) + app.add_directive('my-math', MyMathDirective) diff --git a/tests/roots/test-ext-math-compat/index.rst b/tests/roots/test-ext-math-compat/index.rst new file mode 100644 index 0000000..208878c --- /dev/null +++ b/tests/roots/test-ext-math-compat/index.rst @@ -0,0 +1,21 @@ +Test Math +========= + +inline +------ + +Inline: :math:`E=mc^2` +Inline my math: :my_math:`:-)` + +block +----- + +.. math:: a^2+b^2=c^2 + +Second math + +.. math:: e^{i\pi}+1=0 + +Multi math equations + +.. my-math:: diff --git a/tests/roots/test-ext-math-simple/conf.py b/tests/roots/test-ext-math-simple/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-ext-math-simple/conf.py diff --git a/tests/roots/test-ext-math-simple/index.rst b/tests/roots/test-ext-math-simple/index.rst new file mode 100644 index 0000000..a455d89 --- /dev/null +++ b/tests/roots/test-ext-math-simple/index.rst @@ -0,0 +1,4 @@ +Test Math +========= + +.. math:: a^2+b^2=c^2 diff --git a/tests/roots/test-ext-math/conf.py b/tests/roots/test-ext-math/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-ext-math/conf.py diff --git a/tests/roots/test-ext-math/index.rst b/tests/roots/test-ext-math/index.rst new file mode 100644 index 0000000..221284a --- /dev/null +++ b/tests/roots/test-ext-math/index.rst @@ -0,0 +1,25 @@ +Test Math +========= + +.. toctree:: + :numbered: 1 + + math + page + nomath + +.. math:: a^2+b^2=c^2 + +Inline :math:`E=mc^2` + +Second math + +.. math:: e^{i\pi}+1=0 + +Multi math equations + +.. math:: + + S &= \pi r^2 + + V &= \frac{4}{3} \pi r^3 diff --git a/tests/roots/test-ext-math/math.rst b/tests/roots/test-ext-math/math.rst new file mode 100644 index 0000000..c05c3a0 --- /dev/null +++ b/tests/roots/test-ext-math/math.rst @@ -0,0 +1,31 @@ +Test math extensions :math:`E = m c^2` +====================================== + +This is inline math: :math:`a^2 + b^2 = c^2`. + +.. math:: a^2 + b^2 = c^2 + +.. math:: + + a + 1 < b + +.. math:: + :label: foo + + e^{i\pi} = 1 + +.. math:: + :label: + + e^{ix} = \cos x + i\sin x + +.. math:: + + n \in \mathbb N + +.. math:: + :nowrap: + + a + 1 < b + +Referencing equation :eq:`foo` and :math:numref:`foo`. diff --git a/tests/roots/test-ext-math/nomath.rst b/tests/roots/test-ext-math/nomath.rst new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-ext-math/nomath.rst diff --git a/tests/roots/test-ext-math/page.rst b/tests/roots/test-ext-math/page.rst new file mode 100644 index 0000000..ef80409 --- /dev/null +++ b/tests/roots/test-ext-math/page.rst @@ -0,0 +1,9 @@ +Test multiple pages +=================== + +.. math:: + :label: bar + + a = b + 1 + +Referencing equations :eq:`foo` and :eq:`bar`. diff --git a/tests/roots/test-ext-napoleon/conf.py b/tests/roots/test-ext-napoleon/conf.py new file mode 100644 index 0000000..502fb5a --- /dev/null +++ b/tests/roots/test-ext-napoleon/conf.py @@ -0,0 +1,5 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) +extensions = ['sphinx.ext.napoleon'] diff --git a/tests/roots/test-ext-napoleon/index.rst b/tests/roots/test-ext-napoleon/index.rst new file mode 100644 index 0000000..4c013b7 --- /dev/null +++ b/tests/roots/test-ext-napoleon/index.rst @@ -0,0 +1,6 @@ +test-ext-napoleon +================= + +.. toctree:: + + typehints diff --git a/tests/roots/test-ext-napoleon/mypackage/__init__.py b/tests/roots/test-ext-napoleon/mypackage/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-ext-napoleon/mypackage/__init__.py diff --git a/tests/roots/test-ext-napoleon/mypackage/typehints.py b/tests/roots/test-ext-napoleon/mypackage/typehints.py new file mode 100644 index 0000000..526b78e --- /dev/null +++ b/tests/roots/test-ext-napoleon/mypackage/typehints.py @@ -0,0 +1,11 @@ +def hello(x: int, *args: int, **kwargs: int) -> None: + """ + Parameters + ---------- + x + X + *args + Additional arguments. + **kwargs + Extra arguments. + """ diff --git a/tests/roots/test-ext-napoleon/typehints.rst b/tests/roots/test-ext-napoleon/typehints.rst new file mode 100644 index 0000000..43c61f6 --- /dev/null +++ b/tests/roots/test-ext-napoleon/typehints.rst @@ -0,0 +1,5 @@ +typehints +========= + +.. automodule:: mypackage.typehints + :members: diff --git a/tests/roots/test-ext-todo/bar.rst b/tests/roots/test-ext-todo/bar.rst new file mode 100644 index 0000000..6804a68 --- /dev/null +++ b/tests/roots/test-ext-todo/bar.rst @@ -0,0 +1,4 @@ +bar +=== + +.. todo:: todo in bar diff --git a/tests/roots/test-ext-todo/conf.py b/tests/roots/test-ext-todo/conf.py new file mode 100644 index 0000000..64b749e --- /dev/null +++ b/tests/roots/test-ext-todo/conf.py @@ -0,0 +1 @@ +extensions = ['sphinx.ext.todo'] diff --git a/tests/roots/test-ext-todo/foo.rst b/tests/roots/test-ext-todo/foo.rst new file mode 100644 index 0000000..12e9f63 --- /dev/null +++ b/tests/roots/test-ext-todo/foo.rst @@ -0,0 +1,10 @@ +foo +=== + +.. todo:: todo in foo + +.. py:function:: hello() + + :param bug: #5800 + + .. todo:: todo in param field diff --git a/tests/roots/test-ext-todo/index.rst b/tests/roots/test-ext-todo/index.rst new file mode 100644 index 0000000..781473d --- /dev/null +++ b/tests/roots/test-ext-todo/index.rst @@ -0,0 +1,11 @@ +test for sphinx.ext.todo +======================== + +.. toctree:: + + foo + bar + +.. todolist:: + +.. todolist:: diff --git a/tests/roots/test-ext-viewcode-find/conf.py b/tests/roots/test-ext-viewcode-find/conf.py new file mode 100644 index 0000000..18f97f4 --- /dev/null +++ b/tests/roots/test-ext-viewcode-find/conf.py @@ -0,0 +1,3 @@ +extensions = ['sphinx.ext.viewcode'] +exclude_patterns = ['_build'] +viewcode_follow_imported_members = False diff --git a/tests/roots/test-ext-viewcode-find/index.rst b/tests/roots/test-ext-viewcode-find/index.rst new file mode 100644 index 0000000..7eb416a --- /dev/null +++ b/tests/roots/test-ext-viewcode-find/index.rst @@ -0,0 +1,38 @@ +viewcode +======== + +.. py:module:: not_a_package + +.. py:function:: func1(a, b) + + This is func1 + +.. py:function:: not_a_package.submodule.func1(a, b) + + This is func1 + +.. py:module:: not_a_package.submodule + +.. py:class:: Class1 + + This is Class1 + +.. py:class:: Class3 + + This is Class3 + +.. py:class:: not_a_package.submodule.Class1 + + This is Class1 + +.. literalinclude:: not_a_package/__init__.py + :language: python + :pyobject: func1 + +.. literalinclude:: not_a_package/submodule.py + :language: python + :pyobject: func1 + +.. py:attribute:: not_a_package.submodule.Class3.class_attr + + This is the class attribute class_attr diff --git a/tests/roots/test-ext-viewcode-find/not_a_package/__init__.py b/tests/roots/test-ext-viewcode-find/not_a_package/__init__.py new file mode 100644 index 0000000..2382935 --- /dev/null +++ b/tests/roots/test-ext-viewcode-find/not_a_package/__init__.py @@ -0,0 +1 @@ +from .submodule import Class1, func1 diff --git a/tests/roots/test-ext-viewcode-find/not_a_package/submodule.py b/tests/roots/test-ext-viewcode-find/not_a_package/submodule.py new file mode 100644 index 0000000..ba8be78 --- /dev/null +++ b/tests/roots/test-ext-viewcode-find/not_a_package/submodule.py @@ -0,0 +1,31 @@ +""" +submodule +""" +raise RuntimeError('This module should not get imported') + + +def decorator(f): + return f + + +@decorator +def func1(a, b): + """ + this is func1 + """ + return a, b + + +@decorator +class Class1: + """ + this is Class1 + """ + + +class Class3: + """ + this is Class3 + """ + class_attr = 42 + """this is the class attribute class_attr""" diff --git a/tests/roots/test-ext-viewcode/conf.py b/tests/roots/test-ext-viewcode/conf.py new file mode 100644 index 0000000..5e07214 --- /dev/null +++ b/tests/roots/test-ext-viewcode/conf.py @@ -0,0 +1,24 @@ +import os +import sys + +source_dir = os.path.abspath('.') +if source_dir not in sys.path: + sys.path.insert(0, source_dir) +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] +exclude_patterns = ['_build'] + + +if 'test_linkcode' in tags: + extensions.remove('sphinx.ext.viewcode') + extensions.append('sphinx.ext.linkcode') + + def linkcode_resolve(domain, info): + if domain == 'py': + fn = info['module'].replace('.', '/') + return "http://foobar/source/%s.py" % fn + elif domain == "js": + return "http://foobar/js/" + info['fullname'] + elif domain in ("c", "cpp"): + return f"http://foobar/{domain}/{''.join(info['names'])}" + else: + raise AssertionError() diff --git a/tests/roots/test-ext-viewcode/index.rst b/tests/roots/test-ext-viewcode/index.rst new file mode 100644 index 0000000..e7956e7 --- /dev/null +++ b/tests/roots/test-ext-viewcode/index.rst @@ -0,0 +1,39 @@ +viewcode +======== + +.. py:module:: spam + +.. autofunction:: func1 + +.. autofunction:: func2 + +.. autofunction:: spam.mod1.func1 + +.. autofunction:: spam.mod2.func2 + +.. autofunction:: Class1 + +.. autofunction:: Class2 + +.. autofunction:: spam.mod1.Class1 + +.. autofunction:: spam.mod2.Class2 + + +.. literalinclude:: spam/__init__.py + :language: python + :pyobject: func1 + +.. literalinclude:: spam/mod1.py + :language: python + :pyobject: func1 + +.. autoclass:: spam.mod3.Class3 + :members: + +.. automodule:: spam.mod3 + :members: + +.. toctree:: + + objects diff --git a/tests/roots/test-ext-viewcode/objects.rst b/tests/roots/test-ext-viewcode/objects.rst new file mode 100644 index 0000000..114adbf --- /dev/null +++ b/tests/roots/test-ext-viewcode/objects.rst @@ -0,0 +1,169 @@ +Testing object descriptions +=========================== + +.. function:: func_without_module(a, b, *c[, d]) + + Does something. + +.. function:: func_without_body() + +.. function:: func_noindex + :no-index: + +.. function:: func_with_module + :module: foolib + +Referring to :func:`func with no index <func_noindex>`. +Referring to :func:`nothing <>`. + +.. module:: mod + :synopsis: Module synopsis. + :platform: UNIX + +.. function:: func_in_module + +.. class:: Cls + + .. method:: meth1 + + .. staticmethod:: meths + + .. attribute:: attr + +.. explicit class given +.. method:: Cls.meth2 + +.. explicit module given +.. exception:: Error(arg1, arg2) + :module: errmod + +.. data:: var + + +.. currentmodule:: None + +.. function:: func_without_module2() -> annotation + +.. object:: long(parameter, \ + list) + another one + +.. class:: TimeInt + + Has only one parameter (triggers special behavior...) + + :param moo: |test| + :type moo: |test| + +.. |test| replace:: Moo + +.. class:: Time(hour, minute, isdst) + + :param year: The year. + :type year: TimeInt + :param TimeInt minute: The minute. + :param isdst: whether it's DST + :type isdst: * some complex + * expression + :returns: a new :class:`Time` instance + :rtype: :class:`Time` + :raises ValueError: if the values are out of range + :ivar int hour: like *hour* + :ivar minute: like *minute* + :vartype minute: int + :param hour: Some parameter + :type hour: DuplicateType + :param hour: Duplicate param. Should not lead to crashes. + :type hour: DuplicateType + :param .Cls extcls: A class from another module. + + +C items +======= + +.. c:function:: Sphinx_DoSomething() + +.. c:member:: SphinxStruct.member + +.. c:macro:: SPHINX_USE_PYTHON + +.. c:type:: SphinxType + +.. c:var:: sphinx_global + + +Javascript items +================ + +.. js:function:: foo() + +.. js:data:: bar + +.. documenting the method of any object +.. js:function:: bar.baz(href, callback[, errback]) + + :param string href: The location of the resource. + :param callback: Gets called with the data returned by the resource. + :throws InvalidHref: If the `href` is invalid. + :returns: `undefined` + +.. js:attribute:: bar.spam + +References +========== + +Referencing :class:`mod.Cls` or :Class:`mod.Cls` should be the same. + +With target: :c:func:`Sphinx_DoSomething()` (parentheses are handled), +:c:member:`SphinxStruct.member`, :c:macro:`SPHINX_USE_PYTHON`, +:c:type:`SphinxType *` (pointer is handled), :c:data:`sphinx_global`. + +Without target: :c:func:`CFunction`. :c:func:`!malloc`. + +:js:func:`foo()` +:js:func:`foo` + +:js:data:`bar` +:js:func:`bar.baz()` +:js:func:`bar.baz` +:js:func:`~bar.baz()` + +:js:attr:`bar.baz` + + +Others +====== + +.. envvar:: HOME + +.. program:: python + +.. cmdoption:: -c command + +.. program:: perl + +.. cmdoption:: -c + +.. option:: +p + +Link to :option:`perl +p`. + + +User markup +=========== + +.. userdesc:: myobj:parameter + + Description of userdesc. + + +Referencing :userdescrole:`myobj`. + + +CPP domain +========== + +.. cpp:class:: n::Array<T,d> + + .. cpp:function:: T& operator[]( unsigned j ) + const T& operator[]( unsigned j ) const diff --git a/tests/roots/test-ext-viewcode/spam/__init__.py b/tests/roots/test-ext-viewcode/spam/__init__.py new file mode 100644 index 0000000..6219042 --- /dev/null +++ b/tests/roots/test-ext-viewcode/spam/__init__.py @@ -0,0 +1,2 @@ +from .mod1 import Class1, func1 +from .mod2 import Class2, func2 diff --git a/tests/roots/test-ext-viewcode/spam/mod1.py b/tests/roots/test-ext-viewcode/spam/mod1.py new file mode 100644 index 0000000..a078328 --- /dev/null +++ b/tests/roots/test-ext-viewcode/spam/mod1.py @@ -0,0 +1,30 @@ +""" +mod1 +""" + + +def decorator(f): + return f + + +@decorator +def func1(a, b): + """ + this is func1 + """ + return a, b + + +@decorator +class Class1: + """ + this is Class1 + """ + + +class Class3: + """ + this is Class3 + """ + class_attr = 42 + """this is the class attribute class_attr""" diff --git a/tests/roots/test-ext-viewcode/spam/mod2.py b/tests/roots/test-ext-viewcode/spam/mod2.py new file mode 100644 index 0000000..72cb089 --- /dev/null +++ b/tests/roots/test-ext-viewcode/spam/mod2.py @@ -0,0 +1,22 @@ +""" +mod2 +""" + + +def decorator(f): + return f + + +@decorator +def func2(a, b): + """ + this is func2 + """ + return a, b + + +@decorator +class Class2: + """ + this is Class2 + """ diff --git a/tests/roots/test-ext-viewcode/spam/mod3.py b/tests/roots/test-ext-viewcode/spam/mod3.py new file mode 100644 index 0000000..812c9b5 --- /dev/null +++ b/tests/roots/test-ext-viewcode/spam/mod3.py @@ -0,0 +1,3 @@ +from spam.mod1 import Class3 + +__all__ = ('Class3',) diff --git a/tests/roots/test-extensions/conf.py b/tests/roots/test-extensions/conf.py new file mode 100644 index 0000000..9a3cbc8 --- /dev/null +++ b/tests/roots/test-extensions/conf.py @@ -0,0 +1,4 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) diff --git a/tests/roots/test-extensions/read_parallel.py b/tests/roots/test-extensions/read_parallel.py new file mode 100644 index 0000000..a3e052f --- /dev/null +++ b/tests/roots/test-extensions/read_parallel.py @@ -0,0 +1,4 @@ +def setup(app): + return { + 'parallel_read_safe': True + } diff --git a/tests/roots/test-extensions/read_serial.py b/tests/roots/test-extensions/read_serial.py new file mode 100644 index 0000000..c55570a --- /dev/null +++ b/tests/roots/test-extensions/read_serial.py @@ -0,0 +1,4 @@ +def setup(app): + return { + 'parallel_read_safe': False + } diff --git a/tests/roots/test-extensions/write_parallel.py b/tests/roots/test-extensions/write_parallel.py new file mode 100644 index 0000000..ebc48ef --- /dev/null +++ b/tests/roots/test-extensions/write_parallel.py @@ -0,0 +1,4 @@ +def setup(app): + return { + 'parallel_write_safe': True, + } diff --git a/tests/roots/test-extensions/write_serial.py b/tests/roots/test-extensions/write_serial.py new file mode 100644 index 0000000..75494ce --- /dev/null +++ b/tests/roots/test-extensions/write_serial.py @@ -0,0 +1,4 @@ +def setup(app): + return { + 'parallel_write_safe': False + } diff --git a/tests/roots/test-footnotes/bar.rst b/tests/roots/test-footnotes/bar.rst new file mode 100644 index 0000000..660c663 --- /dev/null +++ b/tests/roots/test-footnotes/bar.rst @@ -0,0 +1,6 @@ +bar +=== + +Same footnote number [1]_ in bar.rst + +.. [1] footnote in bar diff --git a/tests/roots/test-footnotes/baz.rst b/tests/roots/test-footnotes/baz.rst new file mode 100644 index 0000000..af496c5 --- /dev/null +++ b/tests/roots/test-footnotes/baz.rst @@ -0,0 +1,6 @@ +baz +=== + +Auto footnote number [#]_ in baz.rst + +.. [#] footnote in baz diff --git a/tests/roots/test-footnotes/conf.py b/tests/roots/test-footnotes/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-footnotes/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-footnotes/index.rst b/tests/roots/test-footnotes/index.rst new file mode 100644 index 0000000..f2c5d0e --- /dev/null +++ b/tests/roots/test-footnotes/index.rst @@ -0,0 +1,188 @@ +=============== +test-footenotes +=============== + +.. toctree:: + + bar + baz + +.. contents:: + :local: + +The section with a reference to [AuthorYear]_ +============================================= + +.. figure:: rimg.png + + This is the figure caption with a reference to [AuthorYear]_. + +.. list-table:: The table title with a reference to [AuthorYear]_ + :header-rows: 1 + + * - Header1 + - Header2 + * - Content + - Content + +.. rubric:: The rubric title with a reference to [AuthorYear]_ + +.. [#] First + +* First footnote: [#]_ +* Second footnote: [1]_ +* `Sphinx <http://sphinx-doc.org/>`_ +* Third footnote: [#]_ +* Fourth footnote: [#named]_ +* `URL including tilde <http://sphinx-doc.org/~test/>`_ +* GitHub Page: `https://github.com/sphinx-doc/sphinx <https://github.com/sphinx-doc/sphinx>`_ +* Mailing list: `sphinx-dev@googlegroups.com <mailto:sphinx-dev@googlegroups.com>`_ + +.. [AuthorYear] Author, Title, Year +.. [1] Second +.. [#] Third [#]_ +.. [#] Footnote inside footnote +.. [#named] Fourth + +The section with a reference to [#]_ +===================================== + +.. [#] Footnote in section + +`URL in term <http://sphinx-doc.org/>`_ + Description Description Description ... + +Footnote in term [#]_ + Description Description Description ... + + `Term in deflist <http://sphinx-doc.org/>`_ + Description2 + +.. [#] Footnote in term + +.. figure:: rimg.png + + This is the figure caption with a footnote to [#]_. + +.. [#] Footnote in caption + +.. list-table:: footnote [#]_ in caption of normal table + :widths: 1 1 + :header-rows: 1 + + * - name + - desc + * - a + - b + * - a + - b + +.. [#] Foot note in table + +.. list-table:: footnote [#]_ in caption [#]_ of longtable + :widths: 1 1 + :header-rows: 1 + + * - name + - desc + * - This is a reference to the code-block in the footnote: + :ref:`codeblockinfootnote` + - This is one more footnote with some code in it [#]_. + * - This is a reference to the other code block: + :ref:`codeblockinanotherfootnote` + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + +.. [#] Foot note in longtable + +.. [#] Second footnote in caption of longtable + + .. code-block:: python + :caption: I am in a footnote + :name: codeblockinfootnote + + def foo(x,y): + return x+y + +.. [#] Third footnote in longtable + + .. code-block:: python + :caption: I am also in a footnote + :name: codeblockinanotherfootnote + + def bar(x,y): + return x+y + +The section with an object description +====================================== + +.. py:function:: dummy(N) + :no-index: + +Footnotes referred twice +======================== + +* Explicitly numbered footnote: [100]_ [100]_ +* Named footnote: [#twice]_ [#twice]_ + +.. [100] Numbered footnote +.. [#twice] Named footnote diff --git a/tests/roots/test-footnotes/rimg.png b/tests/roots/test-footnotes/rimg.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-footnotes/rimg.png diff --git a/tests/roots/test-gettext-template/_templates/template1.html b/tests/roots/test-gettext-template/_templates/template1.html new file mode 100644 index 0000000..f4b49f1 --- /dev/null +++ b/tests/roots/test-gettext-template/_templates/template1.html @@ -0,0 +1,5 @@ +{% extends "layout.html" %} +{% block body %} + <h1>{{ _('Template 1') }}</h1> + <p>{%trans%}This is Template 1.{%endtrans%}</p> +{% endblock %} diff --git a/tests/roots/test-gettext-template/_templates/template2.html b/tests/roots/test-gettext-template/_templates/template2.html new file mode 100644 index 0000000..2a21069 --- /dev/null +++ b/tests/roots/test-gettext-template/_templates/template2.html @@ -0,0 +1,5 @@ +{% extends "layout.html" %} +{% block body %} + <h1>{{ _('Template 2') }}</h1> + <p>{%trans%}This is Template 2.{%endtrans%}</p> +{% endblock %} diff --git a/tests/roots/test-gettext-template/conf.py b/tests/roots/test-gettext-template/conf.py new file mode 100644 index 0000000..3f793b7 --- /dev/null +++ b/tests/roots/test-gettext-template/conf.py @@ -0,0 +1 @@ +templates_path = ['_templates'] diff --git a/tests/roots/test-gettext-template/index.rst b/tests/roots/test-gettext-template/index.rst new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-gettext-template/index.rst diff --git a/tests/roots/test-glossary/conf.py b/tests/roots/test-glossary/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-glossary/conf.py diff --git a/tests/roots/test-glossary/index.rst b/tests/roots/test-glossary/index.rst new file mode 100644 index 0000000..1d84a02 --- /dev/null +++ b/tests/roots/test-glossary/index.rst @@ -0,0 +1,22 @@ +test-glossary +============= + +.. glossary:: + :sorted: + + boson + Particle with integer spin. + + *fermion* + Particle with half-integer spin. + + tauon + myon + electron + Examples for fermions. + + über + Gewisse + + ähnlich + Dinge diff --git a/tests/roots/test-highlight_options/conf.py b/tests/roots/test-highlight_options/conf.py new file mode 100644 index 0000000..90997d4 --- /dev/null +++ b/tests/roots/test-highlight_options/conf.py @@ -0,0 +1,4 @@ +highlight_options = { + 'default': {'default_option': True}, + 'python': {'python_option': True} +} diff --git a/tests/roots/test-highlight_options/index.rst b/tests/roots/test-highlight_options/index.rst new file mode 100644 index 0000000..389041a --- /dev/null +++ b/tests/roots/test-highlight_options/index.rst @@ -0,0 +1,14 @@ +test-highlight_options +====================== + +.. code-block:: + + blah blah blah + +.. code-block:: python + + blah blah blah + +.. code-block:: java + + blah blah blah diff --git a/tests/roots/test-html_assets/conf.py b/tests/roots/test-html_assets/conf.py new file mode 100644 index 0000000..7f94bbb --- /dev/null +++ b/tests/roots/test-html_assets/conf.py @@ -0,0 +1,12 @@ +project = 'Sphinx' +version = '1.4.4' + +html_static_path = ['static', 'subdir'] +html_extra_path = ['extra', 'subdir'] +html_css_files = ['css/style.css', + ('https://example.com/custom.css', + {'title': 'title', 'media': 'print', 'priority': 400})] +html_js_files = ['js/custom.js', + ('https://example.com/script.js', + {'async': 'async', 'priority': 400})] +exclude_patterns = ['**/_build', '**/.htpasswd'] diff --git a/tests/roots/test-html_assets/extra/.htaccess b/tests/roots/test-html_assets/extra/.htaccess new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/extra/.htaccess diff --git a/tests/roots/test-html_assets/extra/.htpasswd b/tests/roots/test-html_assets/extra/.htpasswd new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/extra/.htpasswd diff --git a/tests/roots/test-html_assets/extra/API.html_t b/tests/roots/test-html_assets/extra/API.html_t new file mode 100644 index 0000000..34ecd9d --- /dev/null +++ b/tests/roots/test-html_assets/extra/API.html_t @@ -0,0 +1 @@ +{{ project }}-{{ version }} diff --git a/tests/roots/test-html_assets/extra/css/style.css b/tests/roots/test-html_assets/extra/css/style.css new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/extra/css/style.css diff --git a/tests/roots/test-html_assets/extra/index.rst b/tests/roots/test-html_assets/extra/index.rst new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/extra/index.rst diff --git a/tests/roots/test-html_assets/extra/rimg.png b/tests/roots/test-html_assets/extra/rimg.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-html_assets/extra/rimg.png diff --git a/tests/roots/test-html_assets/extra/subdir/.htaccess b/tests/roots/test-html_assets/extra/subdir/.htaccess new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/extra/subdir/.htaccess diff --git a/tests/roots/test-html_assets/extra/subdir/.htpasswd b/tests/roots/test-html_assets/extra/subdir/.htpasswd new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/extra/subdir/.htpasswd diff --git a/tests/roots/test-html_assets/index.rst b/tests/roots/test-html_assets/index.rst new file mode 100644 index 0000000..6d56194 --- /dev/null +++ b/tests/roots/test-html_assets/index.rst @@ -0,0 +1,3 @@ +test-html_extra_path +===================== +this is dummy content diff --git a/tests/roots/test-html_assets/static/.htaccess b/tests/roots/test-html_assets/static/.htaccess new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/static/.htaccess diff --git a/tests/roots/test-html_assets/static/.htpasswd b/tests/roots/test-html_assets/static/.htpasswd new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/static/.htpasswd diff --git a/tests/roots/test-html_assets/static/API.html_t b/tests/roots/test-html_assets/static/API.html_t new file mode 100644 index 0000000..34ecd9d --- /dev/null +++ b/tests/roots/test-html_assets/static/API.html_t @@ -0,0 +1 @@ +{{ project }}-{{ version }} diff --git a/tests/roots/test-html_assets/static/css/style.css b/tests/roots/test-html_assets/static/css/style.css new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/static/css/style.css diff --git a/tests/roots/test-html_assets/static/index.rst b/tests/roots/test-html_assets/static/index.rst new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/static/index.rst diff --git a/tests/roots/test-html_assets/static/js/custom.js b/tests/roots/test-html_assets/static/js/custom.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/static/js/custom.js diff --git a/tests/roots/test-html_assets/static/rimg.png b/tests/roots/test-html_assets/static/rimg.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-html_assets/static/rimg.png diff --git a/tests/roots/test-html_assets/static/subdir/.htaccess b/tests/roots/test-html_assets/static/subdir/.htaccess new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/static/subdir/.htaccess diff --git a/tests/roots/test-html_assets/static/subdir/.htpasswd b/tests/roots/test-html_assets/static/subdir/.htpasswd new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/static/subdir/.htpasswd diff --git a/tests/roots/test-html_assets/subdir/_build/index.html b/tests/roots/test-html_assets/subdir/_build/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_assets/subdir/_build/index.html diff --git a/tests/roots/test-html_assets/subdir/background.png b/tests/roots/test-html_assets/subdir/background.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-html_assets/subdir/background.png diff --git a/tests/roots/test-html_entity/conf.py b/tests/roots/test-html_entity/conf.py new file mode 100644 index 0000000..46bb290 --- /dev/null +++ b/tests/roots/test-html_entity/conf.py @@ -0,0 +1,2 @@ +html_theme = 'classic' +exclude_patterns = ['_build'] diff --git a/tests/roots/test-html_entity/index.rst b/tests/roots/test-html_entity/index.rst new file mode 100644 index 0000000..11f4f4c --- /dev/null +++ b/tests/roots/test-html_entity/index.rst @@ -0,0 +1,31 @@ +.. _index: + +test-html_entity (#3450) +========================= + +Empty cell +---------- + +.. list-table:: + + - * un + * + * trois + +Return description in function signature +---------------------------------------- + +.. py:function:: test() -> string + + rarr + +Field list that has long name (over 14 characters) +-------------------------------------------------- + +:abcdefghijklmnopqrstuvwxyz: fieldlist + +Option list that has long name (over 14 characters) +--------------------------------------------------- + +-a all +-b long_long_file use file diff --git a/tests/roots/test-html_file_checksum/conf.py b/tests/roots/test-html_file_checksum/conf.py new file mode 100644 index 0000000..f918814 --- /dev/null +++ b/tests/roots/test-html_file_checksum/conf.py @@ -0,0 +1 @@ +html_static_path = ['static'] diff --git a/tests/roots/test-html_file_checksum/index.rst b/tests/roots/test-html_file_checksum/index.rst new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_file_checksum/index.rst diff --git a/tests/roots/test-html_file_checksum/static/empty.js b/tests/roots/test-html_file_checksum/static/empty.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_file_checksum/static/empty.js diff --git a/tests/roots/test-html_file_checksum/static/script.js b/tests/roots/test-html_file_checksum/static/script.js new file mode 100644 index 0000000..9a21456 --- /dev/null +++ b/tests/roots/test-html_file_checksum/static/script.js @@ -0,0 +1 @@ +/* Script */ diff --git a/tests/roots/test-html_file_checksum/static/stylesheet-a.css b/tests/roots/test-html_file_checksum/static/stylesheet-a.css new file mode 100644 index 0000000..3a5d802 --- /dev/null +++ b/tests/roots/test-html_file_checksum/static/stylesheet-a.css @@ -0,0 +1 @@ +/* Stylesheet A */ diff --git a/tests/roots/test-html_file_checksum/static/stylesheet-b.css b/tests/roots/test-html_file_checksum/static/stylesheet-b.css new file mode 100644 index 0000000..ad5ff28 --- /dev/null +++ b/tests/roots/test-html_file_checksum/static/stylesheet-b.css @@ -0,0 +1 @@ +/* Stylesheet B */ diff --git a/tests/roots/test-html_scaled_image_link/conf.py b/tests/roots/test-html_scaled_image_link/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_scaled_image_link/conf.py diff --git a/tests/roots/test-html_scaled_image_link/img.png b/tests/roots/test-html_scaled_image_link/img.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-html_scaled_image_link/img.png diff --git a/tests/roots/test-html_scaled_image_link/index.rst b/tests/roots/test-html_scaled_image_link/index.rst new file mode 100644 index 0000000..0e47940 --- /dev/null +++ b/tests/roots/test-html_scaled_image_link/index.rst @@ -0,0 +1,11 @@ +test-html_scaled_image_link +=========================== + +.. image:: img.png + +.. image:: img.png + :scale: 50% + +.. image:: img.png + :scale: 50% + :class: no-scaled-link diff --git a/tests/roots/test-html_signaturereturn_icon/conf.py b/tests/roots/test-html_signaturereturn_icon/conf.py new file mode 100644 index 0000000..a695d18 --- /dev/null +++ b/tests/roots/test-html_signaturereturn_icon/conf.py @@ -0,0 +1 @@ +extensions = ['sphinx.ext.autodoc'] diff --git a/tests/roots/test-html_signaturereturn_icon/index.rst b/tests/roots/test-html_signaturereturn_icon/index.rst new file mode 100644 index 0000000..4ff4eb6 --- /dev/null +++ b/tests/roots/test-html_signaturereturn_icon/index.rst @@ -0,0 +1,4 @@ +test-html_signaturereturn_icon +============================== + +.. py:function:: foo(a: bool, b: int) -> str diff --git a/tests/roots/test-html_style/_static/default.css b/tests/roots/test-html_style/_static/default.css new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-html_style/_static/default.css diff --git a/tests/roots/test-html_style/conf.py b/tests/roots/test-html_style/conf.py new file mode 100644 index 0000000..df1b310 --- /dev/null +++ b/tests/roots/test-html_style/conf.py @@ -0,0 +1,2 @@ +html_style = 'default.css' +html_static_path = ['_static'] diff --git a/tests/roots/test-html_style/index.rst b/tests/roots/test-html_style/index.rst new file mode 100644 index 0000000..d8aef48 --- /dev/null +++ b/tests/roots/test-html_style/index.rst @@ -0,0 +1,2 @@ +html_style +========== diff --git a/tests/roots/test-image-escape/conf.py b/tests/roots/test-image-escape/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-image-escape/conf.py diff --git a/tests/roots/test-image-escape/img_#1.png b/tests/roots/test-image-escape/img_#1.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-image-escape/img_#1.png diff --git a/tests/roots/test-image-escape/index.rst b/tests/roots/test-image-escape/index.rst new file mode 100644 index 0000000..723bf43 --- /dev/null +++ b/tests/roots/test-image-escape/index.rst @@ -0,0 +1,5 @@ +Sphinx image handling +===================== + +.. an image with a character that is valid in a local file path but not a URL +.. image:: img_#1.png diff --git a/tests/roots/test-image-in-parsed-literal/conf.py b/tests/roots/test-image-in-parsed-literal/conf.py new file mode 100644 index 0000000..5d06da6 --- /dev/null +++ b/tests/roots/test-image-in-parsed-literal/conf.py @@ -0,0 +1,9 @@ +exclude_patterns = ['_build'] + +rst_epilog = ''' +.. |picture| image:: pic.png + :height: 1cm + :scale: 200% + :align: middle + :alt: alternative_text +''' diff --git a/tests/roots/test-image-in-parsed-literal/index.rst b/tests/roots/test-image-in-parsed-literal/index.rst new file mode 100644 index 0000000..80e1008 --- /dev/null +++ b/tests/roots/test-image-in-parsed-literal/index.rst @@ -0,0 +1,9 @@ +test-image-in-parsed-literal +============================ + +Dummy text + +.. parsed-literal:: + + |picture|\ AFTER + diff --git a/tests/roots/test-image-in-parsed-literal/pic.png b/tests/roots/test-image-in-parsed-literal/pic.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-image-in-parsed-literal/pic.png diff --git a/tests/roots/test-image-in-section/conf.py b/tests/roots/test-image-in-section/conf.py new file mode 100644 index 0000000..9cb250c --- /dev/null +++ b/tests/roots/test-image-in-section/conf.py @@ -0,0 +1,8 @@ +exclude_patterns = ['_build'] + +rst_epilog = ''' +.. |picture| image:: pic.png + :width: 15pt + :height: 15pt + :alt: alternative_text +''' diff --git a/tests/roots/test-image-in-section/index.rst b/tests/roots/test-image-in-section/index.rst new file mode 100644 index 0000000..08416d6 --- /dev/null +++ b/tests/roots/test-image-in-section/index.rst @@ -0,0 +1,22 @@ +test-image-in-section +===================== +this is dummy content + + +|picture| Test section +---------------------- +blah blah blah + + +Another section +--------------- +another blah + + +Other [blah] |picture| section +------------------------------ +other blah + +|picture| +--------- +blah blah blah diff --git a/tests/roots/test-image-in-section/pic.png b/tests/roots/test-image-in-section/pic.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-image-in-section/pic.png diff --git a/tests/roots/test-images/conf.py b/tests/roots/test-images/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-images/conf.py diff --git a/tests/roots/test-images/img.gif b/tests/roots/test-images/img.gif Binary files differnew file mode 100644 index 0000000..8f02686 --- /dev/null +++ b/tests/roots/test-images/img.gif diff --git a/tests/roots/test-images/img.ja.png b/tests/roots/test-images/img.ja.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-images/img.ja.png diff --git a/tests/roots/test-images/img.pdf b/tests/roots/test-images/img.pdf Binary files differnew file mode 100644 index 0000000..cacbd85 --- /dev/null +++ b/tests/roots/test-images/img.pdf diff --git a/tests/roots/test-images/img.png b/tests/roots/test-images/img.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-images/img.png diff --git a/tests/roots/test-images/img.zh.png b/tests/roots/test-images/img.zh.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-images/img.zh.png diff --git a/tests/roots/test-images/index.rst b/tests/roots/test-images/index.rst new file mode 100644 index 0000000..14a2987 --- /dev/null +++ b/tests/roots/test-images/index.rst @@ -0,0 +1,29 @@ +test-image +========== + +.. image:: rimg.png + +.. figure:: rimg.png + + The caption of pic + +.. image:: img.* + +.. figure:: img.* + + The caption of img + +.. image:: testimäge.png + +.. image:: rimg.png + :target: https://www.sphinx-doc.org/ + +.. image:: rimg.png + :align: center + :target: https://www.python.org/ + +.. a remote image +.. image:: https://www.python.org/static/img/python-logo.png + +.. non-exist remote image +.. image:: https://www.google.com/NOT_EXIST.PNG diff --git a/tests/roots/test-images/rimg.png b/tests/roots/test-images/rimg.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-images/rimg.png diff --git a/tests/roots/test-images/rimg.png.xx b/tests/roots/test-images/rimg.png.xx Binary files differnew file mode 100644 index 0000000..1081dc1 --- /dev/null +++ b/tests/roots/test-images/rimg.png.xx diff --git a/tests/roots/test-images/rimg.xx.png b/tests/roots/test-images/rimg.xx.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-images/rimg.xx.png diff --git a/tests/roots/test-images/subdir/index.rst b/tests/roots/test-images/subdir/index.rst new file mode 100644 index 0000000..72e742c --- /dev/null +++ b/tests/roots/test-images/subdir/index.rst @@ -0,0 +1,10 @@ +test-images/subdir +================== + +.. image:: rimg.png + +.. image:: svgimg.* + +.. figure:: svgimg.* + + The caption of svgimg diff --git a/tests/roots/test-images/subdir/rimg.png b/tests/roots/test-images/subdir/rimg.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-images/subdir/rimg.png diff --git a/tests/roots/test-images/subdir/rimg.xx.png b/tests/roots/test-images/subdir/rimg.xx.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-images/subdir/rimg.xx.png diff --git a/tests/roots/test-images/subdir/svgimg.pdf b/tests/roots/test-images/subdir/svgimg.pdf Binary files differnew file mode 100644 index 0000000..cacbd85 --- /dev/null +++ b/tests/roots/test-images/subdir/svgimg.pdf diff --git a/tests/roots/test-images/subdir/svgimg.svg b/tests/roots/test-images/subdir/svgimg.svg new file mode 100644 index 0000000..2bae0b9 --- /dev/null +++ b/tests/roots/test-images/subdir/svgimg.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="60" width="60"> + <circle cx="40" cy="40" r="24" style="stroke:#000000; fill:#ffffff"/> +</svg> diff --git a/tests/roots/test-images/subdir/svgimg.xx.svg b/tests/roots/test-images/subdir/svgimg.xx.svg new file mode 100644 index 0000000..2bae0b9 --- /dev/null +++ b/tests/roots/test-images/subdir/svgimg.xx.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="60" width="60"> + <circle cx="40" cy="40" r="24" style="stroke:#000000; fill:#ffffff"/> +</svg> diff --git a/tests/roots/test-images/testimäge.png b/tests/roots/test-images/testimäge.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-images/testimäge.png diff --git a/tests/roots/test-index_on_title/conf.py b/tests/roots/test-index_on_title/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-index_on_title/conf.py diff --git a/tests/roots/test-index_on_title/contents.rst b/tests/roots/test-index_on_title/contents.rst new file mode 100644 index 0000000..8256c42 --- /dev/null +++ b/tests/roots/test-index_on_title/contents.rst @@ -0,0 +1,5 @@ +index_on_title +============== + +Test for :index:`index` in top level title +------------------------------------------ diff --git a/tests/roots/test-inheritance/basic_diagram.rst b/tests/roots/test-inheritance/basic_diagram.rst new file mode 100644 index 0000000..4c3838e --- /dev/null +++ b/tests/roots/test-inheritance/basic_diagram.rst @@ -0,0 +1,5 @@ +Basic Diagram +============== + +.. inheritance-diagram:: + dummy.test diff --git a/tests/roots/test-inheritance/conf.py b/tests/roots/test-inheritance/conf.py new file mode 100644 index 0000000..26cadca --- /dev/null +++ b/tests/roots/test-inheritance/conf.py @@ -0,0 +1,7 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.inheritance_diagram'] +source_suffix = '.rst' diff --git a/tests/roots/test-inheritance/diagram_module_w_2_top_classes.rst b/tests/roots/test-inheritance/diagram_module_w_2_top_classes.rst new file mode 100644 index 0000000..cc4365e --- /dev/null +++ b/tests/roots/test-inheritance/diagram_module_w_2_top_classes.rst @@ -0,0 +1,6 @@ +Diagram using module with 2 top classes +======================================= + +.. inheritance-diagram:: + dummy.test + :top-classes: dummy.test.B, dummy.test.C diff --git a/tests/roots/test-inheritance/diagram_w_1_top_class.rst b/tests/roots/test-inheritance/diagram_w_1_top_class.rst new file mode 100644 index 0000000..97da825 --- /dev/null +++ b/tests/roots/test-inheritance/diagram_w_1_top_class.rst @@ -0,0 +1,7 @@ +Diagram using 1 top class +========================= + +.. inheritance-diagram:: + dummy.test + :top-classes: dummy.test.B + diff --git a/tests/roots/test-inheritance/diagram_w_2_top_classes.rst b/tests/roots/test-inheritance/diagram_w_2_top_classes.rst new file mode 100644 index 0000000..8a6ae58 --- /dev/null +++ b/tests/roots/test-inheritance/diagram_w_2_top_classes.rst @@ -0,0 +1,9 @@ +Diagram using 2 top classes +=========================== + +.. inheritance-diagram:: + dummy.test.F + dummy.test.D + dummy.test.E + :top-classes: dummy.test.B, dummy.test.C + diff --git a/tests/roots/test-inheritance/diagram_w_nested_classes.rst b/tests/roots/test-inheritance/diagram_w_nested_classes.rst new file mode 100644 index 0000000..7fa0217 --- /dev/null +++ b/tests/roots/test-inheritance/diagram_w_nested_classes.rst @@ -0,0 +1,5 @@ +Diagram with Nested Classes +=========================== + +.. inheritance-diagram:: + dummy.test_nested diff --git a/tests/roots/test-inheritance/diagram_w_parts.rst b/tests/roots/test-inheritance/diagram_w_parts.rst new file mode 100644 index 0000000..65a8318 --- /dev/null +++ b/tests/roots/test-inheritance/diagram_w_parts.rst @@ -0,0 +1,7 @@ +Diagram using the parts option +============================== + +.. inheritance-diagram:: + dummy.test + :parts: 1 + diff --git a/tests/roots/test-inheritance/dummy/__init__.py b/tests/roots/test-inheritance/dummy/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-inheritance/dummy/__init__.py diff --git a/tests/roots/test-inheritance/dummy/test.py b/tests/roots/test-inheritance/dummy/test.py new file mode 100644 index 0000000..12fe8d9 --- /dev/null +++ b/tests/roots/test-inheritance/dummy/test.py @@ -0,0 +1,35 @@ +r""" + + Test with a class diagram like this:: + + A + / \ + B C + / \ / \ + E D F + +""" + + +class A: + pass + + +class B(A): + pass + + +class C(A): + pass + + +class D(B, C): + pass + + +class E(B): + pass + + +class F(C): + pass diff --git a/tests/roots/test-inheritance/dummy/test_nested.py b/tests/roots/test-inheritance/dummy/test_nested.py new file mode 100644 index 0000000..4b68018 --- /dev/null +++ b/tests/roots/test-inheritance/dummy/test_nested.py @@ -0,0 +1,11 @@ +"""Test with nested classes. +""" + + +class A: + class B: + pass + + +class C(A.B): + pass diff --git a/tests/roots/test-inheritance/index.rst b/tests/roots/test-inheritance/index.rst new file mode 100644 index 0000000..db4fbac --- /dev/null +++ b/tests/roots/test-inheritance/index.rst @@ -0,0 +1,4 @@ +.. toctree:: + :glob: + + * diff --git a/tests/roots/test-intl/_templates/contents.html b/tests/roots/test-intl/_templates/contents.html new file mode 100644 index 0000000..d730545 --- /dev/null +++ b/tests/roots/test-intl/_templates/contents.html @@ -0,0 +1,10 @@ +{% extends "layout.html" %} +{% block body %} + <h1>{{ _('Welcome') }}</h1> + <p>{%trans%}Sphinx {{ version }}{%endtrans%}</p> +{% endblock %} + +{% block comment %} +utf-8 encoded string: ニシã‚ヘビ +{% endblock %} + diff --git a/tests/roots/test-intl/admonitions.txt b/tests/roots/test-intl/admonitions.txt new file mode 100644 index 0000000..a539461 --- /dev/null +++ b/tests/roots/test-intl/admonitions.txt @@ -0,0 +1,50 @@ +:tocdepth: 2 + +Admonitions +================== +.. #1206 gettext did not translate admonition directive's title + +.. attention:: attention title + + attention body + +.. caution:: caution title + + caution body + +.. danger:: danger title + + danger body + +.. error:: error title + + error body + +.. hint:: hint title + + hint body + +.. important:: important title + + important body + +.. note:: note title + + note body + +.. tip:: tip title + + tip body + +.. warning:: warning title + + warning body + +.. admonition:: admonition title + + admonition body + +.. admonition:: 1. admonition title + + admonition body + diff --git a/tests/roots/test-intl/bom.txt b/tests/roots/test-intl/bom.txt new file mode 100644 index 0000000..3fea824 --- /dev/null +++ b/tests/roots/test-intl/bom.txt @@ -0,0 +1,5 @@ +File with UTF-8 BOM +=================== + +This file has a UTF-8 "BOM". + diff --git a/tests/roots/test-intl/conf.py b/tests/roots/test-intl/conf.py new file mode 100644 index 0000000..96ac664 --- /dev/null +++ b/tests/roots/test-intl/conf.py @@ -0,0 +1,8 @@ +project = 'Sphinx intl <Tests>' +source_suffix = '.txt' +keep_warnings = True +templates_path = ['_templates'] +html_additional_pages = {'contents': 'contents.html'} +release = version = '2013.120' +gettext_additional_targets = ['index'] +exclude_patterns = ['_build'] diff --git a/tests/roots/test-intl/definition_terms.txt b/tests/roots/test-intl/definition_terms.txt new file mode 100644 index 0000000..4c56288 --- /dev/null +++ b/tests/roots/test-intl/definition_terms.txt @@ -0,0 +1,16 @@ +:tocdepth: 2 + +i18n with definition terms +========================== + +Some term + The corresponding definition + +Some *term* `with link <http://sphinx-doc.org/>`__ + The corresponding definition #2 + +Some **term** with : classifier1 : classifier2 + The corresponding definition + +Some term with : classifier[] + The corresponding definition diff --git a/tests/roots/test-intl/docfields.txt b/tests/roots/test-intl/docfields.txt new file mode 100644 index 0000000..b1b3c89 --- /dev/null +++ b/tests/roots/test-intl/docfields.txt @@ -0,0 +1,46 @@ +:tocdepth: 2 + +i18n with docfields +=================== + +.. single TypedField + +.. class:: Cls1 + :no-index: + + :param param: description of parameter param + +.. grouped TypedFields + +.. class:: Cls2 + :no-index: + + :param foo: description of parameter foo + :param bar: description of parameter bar + + +.. single GroupedField + +.. class:: Cls3(values) + :no-index: + + :raises ValueError: if the values are out of range + +.. grouped GroupedFields + +.. class:: Cls4(values) + :no-index: + + :raises TypeError: if the values are not valid + :raises ValueError: if the values are out of range + + +.. single Field + +.. class:: Cls5 + :no-index: + + :returns: a new :class:`Cls3` instance + +.. Field is never grouped + diff --git a/tests/roots/test-intl/external_links.txt b/tests/roots/test-intl/external_links.txt new file mode 100644 index 0000000..1cecbee --- /dev/null +++ b/tests/roots/test-intl/external_links.txt @@ -0,0 +1,35 @@ +:tocdepth: 2 + +i18n with external links +======================== +.. #1044 external-links-dont-work-in-localized-html + +External link to Python_. + +Internal link to `i18n with external links`_. + +Inline link by `Sphinx Site <http://sphinx-doc.org>`_. + +Unnamed link__. + +.. _Python: http://python.org/index.html +.. __: http://google.com + + +link target swapped translation +================================ + +link to external1_ and external2_. + +link to `Sphinx Site <http://sphinx-doc.org>`_ and `Python Site <http://python.org>`_. + +.. _external1: https://www.google.com/external1 +.. _external2: https://www.google.com/external2 + + +Multiple references in the same line +===================================== + +Link to `Sphinx Site <http://sphinx-doc.org>`_, `Python Site <http://python.org>`_, Python_, Unnamed__ and `i18n with external links`_. + +.. __: http://google.com diff --git a/tests/roots/test-intl/figure.txt b/tests/roots/test-intl/figure.txt new file mode 100644 index 0000000..633e12e --- /dev/null +++ b/tests/roots/test-intl/figure.txt @@ -0,0 +1,53 @@ +:tocdepth: 2 + +i18n with figure caption +======================== + +.. figure:: i18n.png + + My caption of the figure + + My description paragraph1 of the figure. + + My description paragraph2 of the figure. + +figure in the block +--------------------- + +block + + .. figure:: i18n.png + + My caption of the figure + + My description paragraph1 of the figure. + + My description paragraph2 of the figure. + + +image url and alt +------------------- + +.. image:: i18n.png + :alt: i18n + +.. figure:: img.png + :alt: img + + +image on substitution +--------------------- + +.. |sub image| image:: i18n.png + +image under note +----------------- + +.. note:: + + .. image:: i18n.png + :alt: i18n under note + + .. figure:: img.png + :alt: img under note + diff --git a/tests/roots/test-intl/footnote.txt b/tests/roots/test-intl/footnote.txt new file mode 100644 index 0000000..0bbed91 --- /dev/null +++ b/tests/roots/test-intl/footnote.txt @@ -0,0 +1,14 @@ +:tocdepth: 2 + +i18n with Footnote +================== +.. #955 cant-build-html-with-footnotes-when-using + +[100]_ Contents [#]_ for `i18n with Footnote`_ [ref]_ [#named]_ [*]_. +second footnote_ref [100]_. + +.. [#] This is a auto numbered footnote. +.. [ref] This is a named footnote. +.. [100] This is a numbered footnote. +.. [#named] This is a auto numbered named footnote. +.. [*] This is a auto symbol footnote. diff --git a/tests/roots/test-intl/glossary_terms.txt b/tests/roots/test-intl/glossary_terms.txt new file mode 100644 index 0000000..473d857 --- /dev/null +++ b/tests/roots/test-intl/glossary_terms.txt @@ -0,0 +1,29 @@ +:tocdepth: 2 + +i18n with glossary terms +======================== + +.. glossary:: + + Some term + The corresponding glossary + + Some other term + The corresponding glossary #2 + +link to :term:`Some term`. + +Translated glossary should be sorted by translated terms: + +.. glossary:: + :sorted: + + AAA + Define AAA + + CCC + EEE + Define CCC + + BBB + Define BBB diff --git a/tests/roots/test-intl/glossary_terms_inconsistency.txt b/tests/roots/test-intl/glossary_terms_inconsistency.txt new file mode 100644 index 0000000..837411b --- /dev/null +++ b/tests/roots/test-intl/glossary_terms_inconsistency.txt @@ -0,0 +1,6 @@ +:tocdepth: 2 + +i18n with glossary terms inconsistency +====================================== + +1. link to :term:`Some term` and :term:`Some other term`. diff --git a/tests/roots/test-intl/i18n.png b/tests/roots/test-intl/i18n.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-intl/i18n.png diff --git a/tests/roots/test-intl/img.png b/tests/roots/test-intl/img.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-intl/img.png diff --git a/tests/roots/test-intl/index.txt b/tests/roots/test-intl/index.txt new file mode 100644 index 0000000..9de15d5 --- /dev/null +++ b/tests/roots/test-intl/index.txt @@ -0,0 +1,40 @@ +CONTENTS +======== + +.. meta:: + :description: testdata for i18n + :keywords: i18n, sphinx, markup + +.. toctree:: + :maxdepth: 2 + :numbered: + :caption: Table of Contents + + subdir/index + bom + warnings + footnote + external_links + refs_inconsistency + literalblock + seealso + definition_terms + figure + index_entries + role_xref + glossary_terms + glossary_terms_inconsistency + versionchange + docfields + raw + refs + section + translation_progress + topic + +.. toctree:: + :maxdepth: 2 + :caption: Hidden Toc + :hidden: + + only diff --git a/tests/roots/test-intl/index_entries.txt b/tests/roots/test-intl/index_entries.txt new file mode 100644 index 0000000..e9300d0 --- /dev/null +++ b/tests/roots/test-intl/index_entries.txt @@ -0,0 +1,24 @@ +:tocdepth: 2 + +i18n with index entries +======================= + +.. index:: + single: Mailing List + pair: Newsletter; Recipients List + +index target section +-------------------- + +this is :index:`Newsletter` target paragraph. + + +various index entries +--------------------- + +.. index:: + triple: First; Second; Third + see: Entry; Mailing List + seealso: See; Newsletter + +That's all. diff --git a/tests/roots/test-intl/label_target.txt b/tests/roots/test-intl/label_target.txt new file mode 100644 index 0000000..ac00084 --- /dev/null +++ b/tests/roots/test-intl/label_target.txt @@ -0,0 +1,67 @@ +:tocdepth: 2 + +.. _implicit-target: + +section and label +================== + +.. This section's label and section title are different. +.. This case, the section have 2 target id. + +:ref:`implicit-target` point to ``implicit-target`` and +`section and label`_ point to ``section-and-label``. + + +.. _explicit-target: + +explicit-target +================ + +.. This section's label equals to section title. +.. This case, a duplicated target id is generated by docutils. + +:ref:`explicit-target` point to ``explicit-target`` and +`explicit-target`_ point to duplicated id like ``id1``. + + +implicit section name +====================== + +.. This section have no label. +.. This case, the section have one id. + +`implicit section name`_ point to ``implicit-section-name``. + +duplicated sub section +------------------------ + +.. This section have no label, but name will be duplicated by next section. +.. This case, the section have one id. + +`duplicated sub section`_ is broken link. + +.. There is no way to link to this section's ``duplicated-sub-section``` by +.. using formal reStructuredText markup. + +duplicated sub section +------------------------ + +.. This section have no label, but the section was a duplicate name. +.. This case, a duplicated target id is generated by docutils. + +.. There is no way to link to this section's duplicated id like ``id2`` by +.. using formal reStructuredText markup. + + +.. _bridge label: `label bridged target section`_ +.. _bridge label2: `section and label`_ + +label bridged target section +============================= + +.. This section is targeted through label definition. + +`bridge label`_ is not translatable but linked to translated section title. + +`bridge label2`_ point to ``section and label`` and `bridge label`_ point to ``label bridged target section``. The second appeared `bridge label2`_ point to correct target. + diff --git a/tests/roots/test-intl/literalblock.txt b/tests/roots/test-intl/literalblock.txt new file mode 100644 index 0000000..583b5b6 --- /dev/null +++ b/tests/roots/test-intl/literalblock.txt @@ -0,0 +1,71 @@ +:tocdepth: 2 + +i18n with literal block +========================= + +Correct literal block:: + + this is + literal block + +Missing literal block:: + +That's all. + +.. literalinclude:: raw.txt + :caption: included raw.txt + +code blocks +============== + +.. highlight:: ruby + +:: + + def main + 'result' + end + +:: + + #include <stdlib.h> + int main(int argc, char** argv) + { + return 0; + } + +.. code-block:: c + :caption: example of C language + + #include <stdio.h> + int main(int argc, char** argv) + { + return 0; + } + + +* :: + + literal-block + in list + +.. highlight:: none + +:: + + test_code_for_noqa() + continued() + + +doctest blocks +============== + +.. highlight:: python + +>>> import sys # sys importing +>>> def main(): # define main function +... sys.stdout.write('hello') # call write method of stdout object +>>> +>>> if __name__ == '__main__': # if run this py file as python script +... main() # call main + diff --git a/tests/roots/test-intl/noqa.txt b/tests/roots/test-intl/noqa.txt new file mode 100644 index 0000000..004b301 --- /dev/null +++ b/tests/roots/test-intl/noqa.txt @@ -0,0 +1,16 @@ +First section +============= + +Some text with a reference, :ref:`next-section`. + +Another reference: :ref:`next-section`. + +This should allow to test escaping ``#noqa``. + +.. _next-section: + +Next section +============ + +Some text, again referring to the section: :ref:`next-section`. + diff --git a/tests/roots/test-intl/only.txt b/tests/roots/test-intl/only.txt new file mode 100644 index 0000000..2c8990e --- /dev/null +++ b/tests/roots/test-intl/only.txt @@ -0,0 +1,14 @@ +Only directive +-------------- + +.. only:: html + + In HTML. + +.. only:: latex + + In LaTeX. + +.. only:: html or latex + + In both. diff --git a/tests/roots/test-intl/raw.txt b/tests/roots/test-intl/raw.txt new file mode 100644 index 0000000..fe77f6c --- /dev/null +++ b/tests/roots/test-intl/raw.txt @@ -0,0 +1,8 @@ +=== +Raw +=== + +.. raw:: html + + <iframe src="http://sphinx-doc.org"></iframe> + diff --git a/tests/roots/test-intl/refs.txt b/tests/roots/test-intl/refs.txt new file mode 100644 index 0000000..4a094b2 --- /dev/null +++ b/tests/roots/test-intl/refs.txt @@ -0,0 +1,48 @@ +References +=========== + +Translation Tips +----------------- + +.. _download Sphinx: https://pypi.org/project/Sphinx/ +.. _Docutils site: https://docutils.sourceforge.io/ +.. _Sphinx site: http://sphinx-doc.org/ + + +A-1. Here's how you can `download Sphinx`_. + +A-2. Here's how you can `download Sphinx`_. + +A-3. Here's how you can `download Sphinx`_. + +B-1. `Docutils site`_ and `Sphinx site`_. + +B-2. `Docutils site`_ and `Sphinx site`_. + +B-3. `Docutils site`_ and `Sphinx site`_. + +B-4. `Docutils site`_ and `Sphinx site`_. + +C-1. Link to `Translation Tips`_ section. + +C-2. Link to `Translation Tips`_ section. + +C-3. Link to `Translation Tips`_ section. + +C-4. Link to `Translation Tips`_ section. + +C-5. Link to `Translation Tips`_ section. + +D-1. Link to `Translation Tips`_ and `Next Section`_ section. + +D-2. Link to `Translation Tips`_ and `Next Section`_ section. + +D-3. Link to `Translation Tips`_ and `Next Section`_ section. + +D-4. Link to `Translation Tips`_ and `Next Section`_ section. + +D-5. Link to `Translation Tips`_ and `Next Section`_ section. + +Next Section +------------- +Last updated |today|. diff --git a/tests/roots/test-intl/refs_inconsistency.txt b/tests/roots/test-intl/refs_inconsistency.txt new file mode 100644 index 0000000..b16623a --- /dev/null +++ b/tests/roots/test-intl/refs_inconsistency.txt @@ -0,0 +1,13 @@ +:tocdepth: 2 + +i18n with refs inconsistency +============================= + +* [100]_ for [#]_ citation [ref2]_. +* for reference_. +* normal text. + +.. [#] This is a auto numbered footnote. +.. [ref2] This is a citation. +.. [100] This is a numbered footnote. +.. _reference: http://www.example.com diff --git a/tests/roots/test-intl/refs_python_domain.txt b/tests/roots/test-intl/refs_python_domain.txt new file mode 100644 index 0000000..2b021f2 --- /dev/null +++ b/tests/roots/test-intl/refs_python_domain.txt @@ -0,0 +1,15 @@ +:tocdepth: 2 + +i18n with python domain refs +============================= + +.. currentmodule:: sensitive + +See this decorator: :func:`sensitive_variables`. + +.. function:: sensitive_variables(*variables) + + Some description + +.. currentmodule:: reporting + diff --git a/tests/roots/test-intl/role_xref.txt b/tests/roots/test-intl/role_xref.txt new file mode 100644 index 0000000..2919b5c --- /dev/null +++ b/tests/roots/test-intl/role_xref.txt @@ -0,0 +1,40 @@ +:tocdepth: 2 + +.. _i18n-role-xref: + +i18n role xref +============== + +link to :term:`Some term`, :ref:`i18n-role-xref`, :doc:`index`. + +.. _same-type-links: + +same type links +================= + +link to :term:`Some term` and :term:`Some other term`. + +link to :ref:`i18n-role-xref`, :ref:`same-type-links` and :ref:`label <same-type-links>`. + +link to :doc:`index` and :doc:`glossary_terms`. + +link to :option:`-m` and :option:`--module`. + +link to :envvar:`env1` and :envvar:`env2`. + +link to :token:`token1` and :token:`token2`. + +link to :keyword:`i18n-role-xref` and :keyword:`same-type-links`. + + +.. option:: -m <module> + +.. option:: --module <module> + +.. envvar:: env1 + +.. envvar:: env2 + +.. productionlist:: + token_stmt: `token1` ":" `token2` + diff --git a/tests/roots/test-intl/rubric.txt b/tests/roots/test-intl/rubric.txt new file mode 100644 index 0000000..f285d49 --- /dev/null +++ b/tests/roots/test-intl/rubric.txt @@ -0,0 +1,14 @@ +:tocdepth: 2 + +i18n with rubric +================ + +.. rubric:: rubric title + +rubric in the block +------------------- + +block + + .. rubric:: rubric title + diff --git a/tests/roots/test-intl/section.txt b/tests/roots/test-intl/section.txt new file mode 100644 index 0000000..ae0604c --- /dev/null +++ b/tests/roots/test-intl/section.txt @@ -0,0 +1,8 @@ +1. Section +========== + +.. contents:: 3. Contents Title + :local: + +2. Sub Section +-------------- diff --git a/tests/roots/test-intl/seealso.txt b/tests/roots/test-intl/seealso.txt new file mode 100644 index 0000000..ed88599 --- /dev/null +++ b/tests/roots/test-intl/seealso.txt @@ -0,0 +1,15 @@ +:tocdepth: 2 + +i18n with seealso +============================ +.. #960 directive-seelaso-ignored-in-the-gettext + +.. seealso:: short text 1 + +.. seealso:: + + long text 1 + +.. seealso:: short text 2 + + long text 2 diff --git a/tests/roots/test-intl/subdir/index.txt b/tests/roots/test-intl/subdir/index.txt new file mode 100644 index 0000000..7578ce3 --- /dev/null +++ b/tests/roots/test-intl/subdir/index.txt @@ -0,0 +1,2 @@ +subdir contents +=============== diff --git a/tests/roots/test-intl/table.txt b/tests/roots/test-intl/table.txt new file mode 100644 index 0000000..cf82438 --- /dev/null +++ b/tests/roots/test-intl/table.txt @@ -0,0 +1,20 @@ +:tocdepth: 2 + +i18n with table +=============== + +.. table:: table caption + + ======= ======= + header1 header2 + ------- ------- + text1 text2 + text3 text4 + text5 text6 + ======= ======= + +.. table:: 1. table caption + + +-----+ + |text1| + +-----+ diff --git a/tests/roots/test-intl/toctree.txt b/tests/roots/test-intl/toctree.txt new file mode 100644 index 0000000..35c956a --- /dev/null +++ b/tests/roots/test-intl/toctree.txt @@ -0,0 +1,10 @@ +i18n with toctree +================= + +.. toctree:: + :caption: caption + + figure <figure> + table + https://www.sphinx-doc.org/ + self diff --git a/tests/roots/test-intl/topic.txt b/tests/roots/test-intl/topic.txt new file mode 100644 index 0000000..255a334 --- /dev/null +++ b/tests/roots/test-intl/topic.txt @@ -0,0 +1,13 @@ +:tocdepth: 2 + +i18n with topic +================ + +.. topic:: Topic Title + + Topic Content + +.. topic:: 1. Topic Title + + Topic Content + diff --git a/tests/roots/test-intl/translation_progress.txt b/tests/roots/test-intl/translation_progress.txt new file mode 100644 index 0000000..f70ab7a --- /dev/null +++ b/tests/roots/test-intl/translation_progress.txt @@ -0,0 +1,40 @@ +Translation Progress +==================== + +When, in disgrace with fortune and men’s eyes, + +I all alone beweep my outcast state, + +And trouble deaf heaven with my bootless cries, + +And look upon myself, and curse my fate, + +Wishing me like to one more rich in hope, + +Featur’d like him, like him with friends possess’d, + +Desiring this man’s art and that man’s scope, + +With what I most enjoy contented least; + +.. idempotent translations (2 out of 14 lines): + +Yet in these thoughts myself almost despising, + +Haply I think on thee, and then my state, + +.. untranslated (2 out of 14 lines): + +Like to the lark at break of day arising + +From sullen earth, sings hymns at heaven’s gate; + +.. translation missing (2 out of 14 lines): + +For thy sweet love remember’d such wealth brings + +That then I scorn to change my state with kings. + +.. translation progress substitution + +|translation progress| diff --git a/tests/roots/test-intl/versionchange.txt b/tests/roots/test-intl/versionchange.txt new file mode 100644 index 0000000..4c57e14 --- /dev/null +++ b/tests/roots/test-intl/versionchange.txt @@ -0,0 +1,16 @@ +:tocdepth: 2 + +i18n with versionchange +============================ + +.. deprecated:: 1.0 + This is the *first* paragraph of deprecated. + + This is the *second* paragraph of deprecated. + +.. versionadded:: 1.0 + This is the *first* paragraph of versionadded. + +.. versionchanged:: 1.0 + + This is the *first* paragraph of versionchanged. diff --git a/tests/roots/test-intl/warnings.txt b/tests/roots/test-intl/warnings.txt new file mode 100644 index 0000000..a80fe18 --- /dev/null +++ b/tests/roots/test-intl/warnings.txt @@ -0,0 +1,5 @@ +i18n with reST warnings +======================== + +line of ``literal`` markup. + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/admonitions.po b/tests/roots/test-intl/xx/LC_MESSAGES/admonitions.po new file mode 100644 index 0000000..f114e33 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/admonitions.po @@ -0,0 +1,84 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2013, test_intl +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-07-03 12:00+0000\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" + +msgid "Admonitions" +msgstr "ADMONITIONS" + +msgid "attention title" +msgstr "ATTENTION TITLE" + +msgid "attention body" +msgstr "ATTENTION BODY" + +msgid "caution title" +msgstr "CAUTION TITLE" + +msgid "caution body" +msgstr "CAUTION BODY" + +msgid "danger title" +msgstr "DANGER TITLE" + +msgid "danger body" +msgstr "DANGER BODY" + +msgid "error title" +msgstr "ERROR TITLE" + +msgid "error body" +msgstr "ERROR BODY" + +msgid "hint title" +msgstr "HINT TITLE" + +msgid "hint body" +msgstr "HINT BODY" + +msgid "important title" +msgstr "IMPORTANT TITLE" + +msgid "important body" +msgstr "IMPORTANT BODY" + +msgid "note title" +msgstr "NOTE TITLE" + +msgid "note body" +msgstr "NOTE BODY" + +msgid "tip title" +msgstr "TIP TITLE" + +msgid "tip body" +msgstr "TIP BODY" + +msgid "warning title" +msgstr "WARNING TITLE" + +msgid "warning body" +msgstr "WARNING BODY" + +msgid "admonition title" +msgstr "ADMONITION TITLE" + +msgid "admonition body" +msgstr "ADMONITION BODY" + +msgid "1. admonition title" +msgstr "1. ADMONITION TITLE" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/bom.po b/tests/roots/test-intl/xx/LC_MESSAGES/bom.po new file mode 100644 index 0000000..c6025eb --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/bom.po @@ -0,0 +1,12 @@ +#, fuzzy +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "File with UTF-8 BOM" +msgstr "Datei mit UTF-8" + +msgid "This file has a UTF-8 \"BOM\"." +msgstr "This file has umlauts: äöü." diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/definition_terms.po b/tests/roots/test-intl/xx/LC_MESSAGES/definition_terms.po new file mode 100644 index 0000000..1752dd6 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/definition_terms.po @@ -0,0 +1,47 @@ +# SOME DESCRIPTIVE TITLE.
+# Copyright (C) 2012, foof
+# This file is distributed under the same license as the foo package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: sphinx 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-01-01 05:00+0000\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"
+
+msgid "i18n with definition terms"
+msgstr "I18N WITH DEFINITION TERMS"
+
+msgid "Some term"
+msgstr "SOME TERM"
+
+msgid "The corresponding definition"
+msgstr "THE CORRESPONDING DEFINITION"
+
+msgid "Some *term* `with link <http://sphinx-doc.org/>`__"
+msgstr "SOME *TERM* `WITH LINK <http://sphinx-doc.org/>`__"
+
+msgid "The corresponding definition #2"
+msgstr "THE CORRESPONDING DEFINITION #2"
+
+msgid "Some **term** with"
+msgstr "SOME **TERM** WITH"
+
+msgid "classifier1"
+msgstr "CLASSIFIER1"
+
+msgid "classifier2"
+msgstr "CLASSIFIER2"
+
+msgid "Some term with"
+msgstr "SOME TERM WITH"
+
+msgid "classifier[]"
+msgstr "CLASSIFIER[]"
diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/docfields.po b/tests/roots/test-intl/xx/LC_MESSAGES/docfields.po new file mode 100644 index 0000000..8c3b8f9 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/docfields.po @@ -0,0 +1,39 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx <Tests> package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx <Tests> 0.6\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-12-16 14:11+0000\n" +"PO-Revision-Date: 2012-12-18 06:14+0900\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 "i18n with docfields" +msgstr "I18N WITH DOCFIELDS" + +msgid "description of parameter param" +msgstr "DESCRIPTION OF PARAMETER param" + +msgid "description of parameter foo" +msgstr "DESCRIPTION OF PARAMETER foo" + +msgid "description of parameter bar" +msgstr "DESCRIPTION OF PARAMETER bar" + +msgid "if the values are not valid" +msgstr "IF THE VALUES ARE NOT VALID" + +msgid "if the values are out of range" +msgstr "IF THE VALUES ARE OUT OF RANGE" + +msgid "a new :class:`Cls3` instance" +msgstr "A NEW :class:`Cls3` INSTANCE" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/external_links.po b/tests/roots/test-intl/xx/LC_MESSAGES/external_links.po new file mode 100644 index 0000000..8c53abb --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/external_links.po @@ -0,0 +1,47 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-11-22 08:28+0000\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" + +msgid "i18n with external links" +msgstr "EXTERNAL LINKS" + +msgid "External link to Python_." +msgstr "EXTERNAL LINK TO Python_." + +msgid "Internal link to `i18n with external links`_." +msgstr "`EXTERNAL LINKS`_ IS INTERNAL LINK." + +msgid "Inline link by `Sphinx Site <http://sphinx-doc.org>`_." +msgstr "INLINE LINK BY `THE SPHINX SITE <http://sphinx-doc.org>`_." + +msgid "Unnamed link__." +msgstr "UNNAMED LINK__." + +msgid "link target swapped translation" +msgstr "LINK TARGET SWAPPED TRANSLATION" + +msgid "link to external1_ and external2_." +msgstr "LINK TO external2_ AND external1_." + +msgid "link to `Sphinx Site <http://sphinx-doc.org>`_ and `Python Site <http://python.org>`_." +msgstr "LINK TO `THE PYTHON SITE <http://python.org>`_ AND `THE SPHINX SITE <http://sphinx-doc.org>`_." + +msgid "Multiple references in the same line" +msgstr "MULTIPLE REFERENCES IN THE SAME LINE" + +msgid "Link to `Sphinx Site <http://sphinx-doc.org>`_, `Python Site <http://python.org>`_, Python_, Unnamed__ and `i18n with external links`_." +msgstr "LINK TO `EXTERNAL LINKS`_, Python_, `THE SPHINX SITE <http://sphinx-doc.org>`_, UNNAMED__ AND `THE PYTHON SITE <http://python.org>`_." diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/figure.po b/tests/roots/test-intl/xx/LC_MESSAGES/figure.po new file mode 100644 index 0000000..64bbdf7 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/figure.po @@ -0,0 +1,57 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-01-04 07:00+0000\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" + +msgid "i18n with figure caption" +msgstr "I18N WITH FIGURE CAPTION" + +msgid "My caption of the figure" +msgstr "MY CAPTION OF THE FIGURE" + +msgid "My description paragraph1 of the figure." +msgstr "MY DESCRIPTION PARAGRAPH1 OF THE FIGURE." + +msgid "My description paragraph2 of the figure." +msgstr "MY DESCRIPTION PARAGRAPH2 OF THE FIGURE." + +msgid "figure in the block" +msgstr "FIGURE IN THE BLOCK" + +msgid "block" +msgstr "BLOCK" + +msgid "image url and alt" +msgstr "IMAGE URL AND ALT" + +msgid "img" +msgstr "IMG -> I18N" + +msgid ".. image:: img.png" +msgstr ".. image:: i18n.png" + +msgid "i18n" +msgstr "I18N -> IMG" + +msgid ".. image:: i18n.png" +msgstr ".. image:: img.png" + +msgid "image on substitution" +msgstr "IMAGE ON SUBSTITUTION" + +msgid "image under note" +msgstr "IMAGE UNDER NOTE" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/footnote.po b/tests/roots/test-intl/xx/LC_MESSAGES/footnote.po new file mode 100644 index 0000000..869bf62 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/footnote.po @@ -0,0 +1,40 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-11-22 08:28+0000\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" + +msgid "i18n with Footnote" +msgstr "I18N WITH FOOTNOTE" + +msgid "[100]_ Contents [#]_ for `i18n with Footnote`_ [ref]_ [#named]_ [*]_. " +"second footnote_ref [100]_." +msgstr "`I18N WITH FOOTNOTE`_ INCLUDE THIS CONTENTS [#named]_ [ref]_ [#]_ [100]_ [*]_. " +"SECOND FOOTNOTE_REF [100]_." + +msgid "This is a auto numbered footnote." +msgstr "THIS IS A AUTO NUMBERED FOOTNOTE." + +msgid "This is a named footnote." +msgstr "THIS IS A NAMED FOOTNOTE." + +msgid "This is a numbered footnote." +msgstr "THIS IS A NUMBERED FOOTNOTE." + +msgid "This is a auto numbered named footnote." +msgstr "THIS IS A AUTO NUMBERED NAMED FOOTNOTE." + +msgid "This is a auto symbol footnote." +msgstr "THIS IS A AUTO SYMBOL FOOTNOTE." diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms.po b/tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms.po new file mode 100644 index 0000000..83542f1 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms.po @@ -0,0 +1,59 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-01-29 14:10+0000\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" + +msgid "i18n with glossary terms" +msgstr "I18N WITH GLOSSARY TERMS" + +msgid "Some term" +msgstr "SOME NEW TERM" + +msgid "The corresponding glossary" +msgstr "THE CORRESPONDING GLOSSARY" + +msgid "Some other term" +msgstr "SOME OTHER NEW TERM" + +msgid "The corresponding glossary #2" +msgstr "THE CORRESPONDING GLOSSARY #2" + +msgid "link to :term:`Some term`." +msgstr "LINK TO :term:`SOME NEW TERM`." + +msgid "Translated glossary should be sorted by translated terms:" +msgstr "TRANSLATED GLOSSARY SHOULD BE SORTED BY TRANSLATED TERMS:" + +msgid "BBB" +msgstr "TRANSLATED TERM XXX" + +msgid "Define BBB" +msgstr "DEFINE XXX" + +msgid "AAA" +msgstr "TRANSLATED TERM YYY" + +msgid "Define AAA" +msgstr "DEFINE YYY" + +msgid "CCC" +msgstr "TRANSLATED TERM ZZZ" + +msgid "EEE" +msgstr "VVV" + +msgid "Define CCC" +msgstr "DEFINE ZZZ" diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms_inconsistency.po b/tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms_inconsistency.po new file mode 100644 index 0000000..ef2bf30 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms_inconsistency.po @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE.
+# Copyright (C) 2012, foof
+# This file is distributed under the same license as the foo package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: sphinx 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-01-29 14:10+0000\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"
+
+msgid "i18n with glossary terms inconsistency"
+msgstr "I18N WITH GLOSSARY TERMS INCONSISTENCY"
+
+msgid "link to :term:`Some term` and :term:`Some other term`."
+msgstr "LINK TO :term:`SOME NEW TERM`."
diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/index.po b/tests/roots/test-intl/xx/LC_MESSAGES/index.po new file mode 100644 index 0000000..a4646f1 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/index.po @@ -0,0 +1,29 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx <Tests> package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx <Tests> 0.6\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-12-16 14:11+0000\n" +"PO-Revision-Date: 2012-12-18 06:14+0900\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 "Table of Contents" +msgstr "TABLE OF CONTENTS" + +msgid "Hidden Toc" +msgstr "HIDDEN TOC" + +msgid "testdata for i18n" +msgstr "TESTDATA FOR I18N" + +msgid "i18n, sphinx, markup" +msgstr "I18N, SPHINX, MARKUP" diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/index_entries.po b/tests/roots/test-intl/xx/LC_MESSAGES/index_entries.po new file mode 100644 index 0000000..83619b4 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/index_entries.po @@ -0,0 +1,77 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2013, foo +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: foo foo\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-01-05 18:10+0000\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" + +msgid "i18n with index entries" +msgstr "" + +msgid "index target section" +msgstr "" + +msgid "this is :index:`Newsletter` target paragraph." +msgstr "THIS IS :index:`NEWSLETTER` TARGET PARAGRAPH." + +msgid "various index entries" +msgstr "" + +msgid "That's all." +msgstr "" + +msgid "Mailing List" +msgstr "MAILING LIST" + +msgid "Newsletter" +msgstr "NEWSLETTER" + +msgid "Recipients List" +msgstr "RECIPIENTS LIST" + +msgid "First" +msgstr "FIRST" + +msgid "Second" +msgstr "SECOND" + +msgid "Third" +msgstr "THIRD" + +msgid "Entry" +msgstr "ENTRY" + +msgid "See" +msgstr "SEE" + +msgid "Module" +msgstr "MODULE" + +msgid "Keyword" +msgstr "KEYWORD" + +msgid "Operator" +msgstr "OPERATOR" + +msgid "Object" +msgstr "OBJECT" + +msgid "Exception" +msgstr "EXCEPTION" + +msgid "Statement" +msgstr "STATEMENT" + +msgid "Builtin" +msgstr "BUILTIN" diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/label_target.po b/tests/roots/test-intl/xx/LC_MESSAGES/label_target.po new file mode 100644 index 0000000..60d7c3e --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/label_target.po @@ -0,0 +1,66 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2013, sphinx +# This file is distributed under the same license as the sphinx package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: 1.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-06-19 00:33+0000\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" + +msgid "section and label" +msgstr "X SECTION AND LABEL" + +msgid "" +":ref:`implicit-target` point to ``implicit-target`` and " +"`section and label`_ point to ``section-and-label``." +msgstr "" +":ref:`implicit-target` POINT TO ``implicit-target`` AND " +"`X SECTION AND LABEL`_ POINT TO ``section-and-label``." + +msgid "explicit-target" +msgstr "X EXPLICIT-TARGET" + +msgid "" +":ref:`explicit-target` point to ``explicit-target`` and `explicit-target`_" +" point to duplicated id like ``id1``." +msgstr "" +":ref:`explicit-target` POINT TO ``explicit-target`` AND `X EXPLICIT-TARGET`_" +" POINT TO DUPLICATED ID LIKE ``id1``." + +msgid "implicit section name" +msgstr "X IMPLICIT SECTION NAME" + +msgid "`implicit section name`_ point to ``implicit-section-name``." +msgstr "`X IMPLICIT SECTION NAME`_ POINT TO ``implicit-section-name``." + +msgid "duplicated sub section" +msgstr "X DUPLICATED SUB SECTION" + +msgid "" +"`duplicated sub section`_ is broken link." +msgstr "" +"`X DUPLICATED SUB SECTION`_ IS BROKEN LINK." + +msgid "label bridged target section" +msgstr "X LABEL BRIDGED TARGET SECTION" + +msgid "`bridge label`_ is not translatable but linked to translated section title." +msgstr "X `bridge label`_ IS NOT TRANSLATABLE BUT LINKED TO TRANSLATED SECTION TITLE." + +msgid "" +"`bridge label2`_ point to ``section and label`` and `bridge label`_ point to " +"``label bridged target section``. The second appeared `bridge label2`_ point " +"to correct target." +msgstr "" +"X `bridge label`_ POINT TO ``LABEL BRIDGED TARGET SECTION`` AND " +"`bridge label2`_ POINT TO ``SECTION AND LABEL``. THE SECOND APPEARED " +"`bridge label2`_ POINT TO CORRECT TARGET." diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/literalblock.po b/tests/roots/test-intl/xx/LC_MESSAGES/literalblock.po new file mode 100644 index 0000000..8d3e5d8 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/literalblock.po @@ -0,0 +1,103 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-11-22 08:28+0000\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" + +msgid "i18n with literal block" +msgstr "I18N WITH LITERAL BLOCK" + +msgid "Correct literal block::" +msgstr "CORRECT LITERAL BLOCK::" + +msgid "Missing literal block::" +msgstr "MISSING LITERAL BLOCK::" + +msgid "That's all." +msgstr "THAT'S ALL." + +msgid "included raw.txt" +msgstr "INCLUDED RAW.TXT" + +msgid "code blocks" +msgstr "CODE-BLOCKS" + +msgid "" +"def main\n" +" 'result'\n" +"end" +msgstr "" +"def main\n" +" 'RESULT'\n" +"end" + +msgid "example of C language" +msgstr "EXAMPLE OF C LANGUAGE" + +msgid "" +"#include <stdlib.h>\n" +"int main(int argc, char** argv)\n" +"{\n" +" return 0;\n" +"}" +msgstr "" +"#include <STDLIB.H>\n" +"int main(int ARGC, char** ARGV)\n" +"{\n" +" return 0;\n" +"}" + +msgid "" +"#include <stdio.h>\n" +"int main(int argc, char** argv)\n" +"{\n" +" return 0;\n" +"}" +msgstr "" +"#include <STDIO.H>\n" +"int main(int ARGC, char** ARGV)\n" +"{\n" +" return 0;\n" +"}" + +msgid "literal-block\n" +"in list" +msgstr "LITERAL-BLOCK\n" +"IN LIST" + +msgid "test_code_for_noqa()\n" +"continued()" +msgstr "" +"# TRAILING noqa SHOULD NOT GET STRIPPED\n" +"# FROM THIS BLOCK. #noqa" + +msgid "doctest blocks" +msgstr "DOCTEST-BLOCKS" + +msgid "" +">>> import sys # sys importing\n" +">>> def main(): # define main function\n" +"... sys.stdout.write('hello') # call write method of stdout object\n" +">>>\n" +">>> if __name__ == '__main__': # if run this py file as python script\n" +"... main() # call main" +msgstr "" +">>> import sys # SYS IMPORTING\n" +">>> def main(): # DEFINE MAIN FUNCTION\n" +"... sys.stdout.write('hello') # CALL WRITE METHOD OF STDOUT OBJECT\n" +">>>\n" +">>> if __name__ == '__main__': # IF RUN THIS PY FILE AS PYTHON SCRIPT\n" +"... main() # CALL MAIN" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/noqa.po b/tests/roots/test-intl/xx/LC_MESSAGES/noqa.po new file mode 100644 index 0000000..1af66b4 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/noqa.po @@ -0,0 +1,46 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) +# This file is distributed under the same license as the Sphinx intl <Tests> package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-01-16 15:23+0100\n" +"PO-Revision-Date: 2022-01-16 15:23+0100\n" +"Last-Translator: Jean Abou Samra <jean@abou-samra.fr>\n" +"Language-Team: \n" +"Language: xx\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.0\n" + +#: ../tests/roots/test-intl/noqa.txt:2 +msgid "First section" +msgstr "FIRST SECTION" + +#: ../tests/roots/test-intl/noqa.txt:4 +msgid "Some text with a reference, :ref:`next-section`." +msgstr "TRANSLATED TEXT WITHOUT REFERENCE. #noqa" + +#: ../tests/roots/test-intl/noqa.txt:6 +msgid "Another reference: :ref:`next-section`." +msgstr "" +"TEST noqa WHITESPACE INSENSITIVITY.\n" +"# \n" +" noqa" + +#: ../tests/roots/test-intl/noqa.txt:8 +msgid "This should allow to test escaping ``#noqa``." +msgstr "``#noqa`` IS ESCAPED AT THE END OF THIS STRING. \\#noqa" + +#: ../tests/roots/test-intl/noqa.txt:13 +msgid "Next section" +msgstr "NEXT SECTION WITH PARAGRAPH TO TEST BARE noqa" + +# This edge case should not fail. +#: ../tests/roots/test-intl/noqa.txt:15 +msgid "Some text, again referring to the section: :ref:`next-section`." +msgstr "#noqa" diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/only.po b/tests/roots/test-intl/xx/LC_MESSAGES/only.po new file mode 100644 index 0000000..43eb7d6 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/only.po @@ -0,0 +1,29 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx <Tests> package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx <Tests> 0.6\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-04 13:06+0000\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" + +msgid "Only directive" +msgstr "ONLY DIRECTIVE" + +msgid "In HTML." +msgstr "IN HTML." + +msgid "In LaTeX." +msgstr "IN LATEX." + +msgid "In both." +msgstr "IN BOTH." diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/raw.po b/tests/roots/test-intl/xx/LC_MESSAGES/raw.po new file mode 100644 index 0000000..f2e8893 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/raw.po @@ -0,0 +1,21 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, dev +# This file is distributed under the same license as the 1235 package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: 1235 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-02-22 15:22+0900\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" + +msgid "<iframe src=\"http://sphinx-doc.org\"></iframe>" +msgstr "<iframe src=\"HTTP://SPHINX-DOC.ORG\"></iframe>" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/refs.po b/tests/roots/test-intl/xx/LC_MESSAGES/refs.po new file mode 100644 index 0000000..510a5a7 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/refs.po @@ -0,0 +1,85 @@ +# +msgid "" +msgstr "" +"Project-Id-Version: 1191 1.3\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-08-08 15:31+0900\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" + +msgid "Translation Tips" +msgstr "X TIPS" + +msgid "A-1. Here's how you can `download Sphinx`_." +msgstr "A-1. HERE'S HOW YOU CAN `download Sphinx`_." + +msgid "A-2. Here's how you can `download Sphinx`_." +msgstr "A-2. HERE'S HOW YOU CAN `A1 DOWNLOAD SPHINX`_." + +msgid "A-3. Here's how you can `download Sphinx`_." +msgstr "" +"A-3. HERE'S HOW YOU CAN `A3 DOWNLOAD SPHINX <download Sphinx_>`_ AND `A3 DOWNLOAD " +"SPHINX <download Sphinx_>`_." + +msgid "B-1. `Docutils site`_ and `Sphinx site`_." +msgstr "B-1. `Docutils site`_ and `Sphinx site`_." + +msgid "B-2. `Docutils site`_ and `Sphinx site`_." +msgstr "B-2. `B1 DOCUTILS SITE`_ AND `B1 SPHINX SITE`_." + +msgid "B-3. `Docutils site`_ and `Sphinx site`_." +msgstr "B-3. `B2 SPHINX SITE`_ AND `B2 DOCUTILS SITE`_." + +msgid "B-4. `Docutils site`_ and `Sphinx site`_." +msgstr "" +"B-4. `B4 SPHINX SITE <Sphinx site_>`_ AND `B4 DOCUTILS SITE <Docutils " +"site_>`_." + +msgid "B-5. `Docutils site`_ and `Sphinx site`_." +msgstr "" +"B-5. `B5 SPHINX SITE <Sphinx site_>`_ AND `B5 DOCUTILS SITE <Docutils " +"site_>`_\" AND `B5 SPHINX SITE <Sphinx site_>`_." + +msgid "C-1. Link to `Translation Tips`_ section." +msgstr "C-1. LINK TO `Translation Tips`_ SECTION." + +msgid "C-2. Link to `Translation Tips`_ section." +msgstr "C-2. LINK TO `X TIPS`_ SECTION." + +msgid "C-3. Link to `Translation Tips`_ section." +msgstr "C-3. LINK TO `X TIPS <Translation Tips_>`_ SECTION." + +msgid "C-4. Link to `Translation Tips`_ section." +msgstr "" +"C-4. LINK TO `X TIPS <Translation Tips_>`_ x `X TIPS <Translation Tips_>`_ " +"SECTION." + +msgid "C-5. Link to `Translation Tips`_ section." +msgstr "" +"C-5. LINK TO `TRANS <X TIPS_>`_ x `LATION <X TIPS_>`_ " + +msgid "D-1. Link to `Translation Tips`_ and `Next Section`_ section." +msgstr "D-1. LINK TO `Translation Tips`_ and `Next Section`_ SECTION." + +msgid "D-2. Link to `Translation Tips`_ and `Next Section`_ section." +msgstr "D-2. LINK TO `X TIPS`_ AND `N SECTION`_ SECTION." + +msgid "D-3. Link to `Translation Tips`_ and `Next Section`_ section." +msgstr "D-3. LINK TO `N SECTION`_ AND `X TIPS`_ SECTION." + +msgid "D-4. Link to `Translation Tips`_ and `Next Section`_ section." +msgstr "" +"D-4. LINK TO `N SECTION <Next Section_>`_ AND `X TIPS <Translation Tips_>`_ " +"SECTION." + +msgid "D-5. Link to `Translation Tips`_ and `Next Section`_ section." +msgstr "" +"D-5. LINK TO `Next <N SECTION_>`_ AND `Tips <X TIPS_>`_ " + +msgid "Next Section" +msgstr "N SECTION" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/refs_inconsistency.po b/tests/roots/test-intl/xx/LC_MESSAGES/refs_inconsistency.po new file mode 100644 index 0000000..9d8d13f --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/refs_inconsistency.po @@ -0,0 +1,39 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-12-05 08:28+0000\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" + +msgid "i18n with refs inconsistency" +msgstr "I18N WITH REFS INCONSISTENCY" + +msgid "[100]_ for [#]_ citation [ref2]_." +msgstr "FOR CITATION [ref3]_." + +msgid "for reference_." +msgstr "reference_ FOR reference_." + +msgid "normal text." +msgstr "ORPHAN REFERENCE: `I18N WITH REFS INCONSISTENCY`_." + +msgid "This is a auto numbered footnote." +msgstr "THIS IS A AUTO NUMBERED FOOTNOTE." + +msgid "This is a citation." +msgstr "THIS IS A CITATION." + +msgid "This is a numbered footnote." +msgstr "THIS IS A NUMBERED FOOTNOTE." + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/refs_python_domain.po b/tests/roots/test-intl/xx/LC_MESSAGES/refs_python_domain.po new file mode 100644 index 0000000..bed87c4 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/refs_python_domain.po @@ -0,0 +1,25 @@ +# +msgid "" +msgstr "" +"Project-Id-Version: issue1363 1363\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-03-16 19:34+0900\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.rst:4 +msgid "i18n with python domain refs" +msgstr "I18N WITH PYTHON DOMAIN REFS" + +#: ..\..\index.rst:8 +msgid "See this decorator: :func:`sensitive_variables`." +msgstr "SEE THIS DECORATOR: :func:`sensitive_variables`." + +#: ..\..\index.rst:12 +msgid "Some description" +msgstr "SOME DESCRIPTION" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/role_xref.po b/tests/roots/test-intl/xx/LC_MESSAGES/role_xref.po new file mode 100644 index 0000000..96d821f --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/role_xref.po @@ -0,0 +1,47 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-04 14:00+0000\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" + +msgid "i18n role xref" +msgstr "I18N ROCK'N ROLE XREF" + +msgid "link to :term:`Some term`, :ref:`i18n-role-xref`, :doc:`index`." +msgstr "LINK TO :ref:`i18n-role-xref`, :doc:`index`, :term:`SOME NEW TERM`." + +msgid "same type links" +msgstr "SAME TYPE LINKS" + +msgid "link to :term:`Some term` and :term:`Some other term`." +msgstr "LINK TO :term:`SOME OTHER NEW TERM` AND :term:`SOME NEW TERM`." + +msgid "link to :ref:`i18n-role-xref`, :ref:`same-type-links` and :ref:`label <same-type-links>`." +msgstr "LINK TO :ref:`LABEL <i18n-role-xref>` AND :ref:`same-type-links` AND :ref:`same-type-links`." + +msgid "link to :doc:`index` and :doc:`glossary_terms`." +msgstr "LINK TO :doc:`glossary_terms` AND :doc:`index`." + +msgid "link to :option:`-m` and :option:`--module`." +msgstr "LINK TO :option:`--module` AND :option:`-m`." + +msgid "link to :envvar:`env1` and :envvar:`env2`." +msgstr "LINK TO :envvar:`env2` AND :envvar:`env1`." + +msgid "link to :token:`token1` and :token:`token2`." +msgstr "LINK TO :token:`token2` AND :token:`token1`." + +msgid "link to :keyword:`i18n-role-xref` and :keyword:`same-type-links`." +msgstr "LINK TO :keyword:`same-type-links` AND :keyword:`i18n-role-xref`." diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/rubric.po b/tests/roots/test-intl/xx/LC_MESSAGES/rubric.po new file mode 100644 index 0000000..9137623 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/rubric.po @@ -0,0 +1,29 @@ +# SOME DESCRIPTIVE TITLE.
+# Copyright (C) 2012, foof
+# This file is distributed under the same license as the foo package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: sphinx 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-11-12 07:00+0000\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"
+
+msgid "i18n with rubric"
+msgstr "I18N WITH RUBRIC"
+
+msgid "rubric title"
+msgstr "RUBRIC TITLE"
+
+msgid "rubric in the block"
+msgstr "RUBRIC IN THE BLOCK"
+
+msgid "block"
+msgstr "BLOCK"
diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/section.po b/tests/roots/test-intl/xx/LC_MESSAGES/section.po new file mode 100644 index 0000000..4af349c --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/section.po @@ -0,0 +1,28 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2018, dev +# This file is distributed under the same license as the sphinx package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2018. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-05-06 16:44+0900\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" +"Generated-By: Babel 2.4.0\n" + +msgid "1. Section" +msgstr "1. SECTION" + +msgid "2. Sub Section" +msgstr "2. SUB SECTION" + +msgid "3. Contents Title" +msgstr "3. CONTENTS TITLE" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/seealso.po b/tests/roots/test-intl/xx/LC_MESSAGES/seealso.po new file mode 100644 index 0000000..86a1c73 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/seealso.po @@ -0,0 +1,33 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx <Tests> package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx <Tests> 0.6\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-12-16 06:06+0000\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" + +msgid "i18n with seealso" +msgstr "I18N WITH SEEALSO" + +msgid "short text 1" +msgstr "SHORT TEXT 1" + +msgid "long text 1" +msgstr "LONG TEXT 1" + +msgid "short text 2" +msgstr "SHORT TEXT 2" + +msgid "long text 2" +msgstr "LONG TEXT 2" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/sphinx.po b/tests/roots/test-intl/xx/LC_MESSAGES/sphinx.po new file mode 100644 index 0000000..a236f2f --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/sphinx.po @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-11-22 08:28+0000\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" + +msgid "Welcome" +msgstr "WELCOME" + +msgid "Sphinx %(version)s" +msgstr "SPHINX %(version)s" diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/table.po b/tests/roots/test-intl/xx/LC_MESSAGES/table.po new file mode 100644 index 0000000..d8ffd35 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/table.po @@ -0,0 +1,54 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx <Tests> package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx <Tests> 0.6\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-12-16 06:06+0000\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" + +msgid "i18n with table" +msgstr "I18N WITH TABLE" + +msgid "table caption" +msgstr "TABLE CAPTION" + +msgid "header1" +msgstr "HEADER1" + +msgid "header2" +msgstr "HEADER2" + +msgid "text1" +msgstr "TEXT1" + +msgid "text2" +msgstr "TEXT2" + +msgid "text3" +msgstr "TEXT3" + +msgid "text1" +msgstr "TEXT1" + +msgid "text4" +msgstr "TEXT4" + +msgid "text5" +msgstr "TEXT5" + +msgid "text6" +msgstr "TEXT6" + +msgid "1. table caption" +msgstr "1. TABLE CAPTION" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/toctree.po b/tests/roots/test-intl/xx/LC_MESSAGES/toctree.po new file mode 100644 index 0000000..62cccdf --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/toctree.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) +# This file is distributed under the same license as the Sphinx intl <Tests> package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx intl <Tests> 2013.120\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-11-01 10:24+0900\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" + +#: ../../toctree.txt:4 +msgid "figure" +msgstr "FIGURE" + +#: ../../toctree.txt:4 +#: ../../toctree.txt:4 +msgid "caption" +msgstr "CAPTION" + +#: ../../toctree.txt:2 +msgid "i18n with toctree" +msgstr "I18N WITH TOCTREE" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/topic.po b/tests/roots/test-intl/xx/LC_MESSAGES/topic.po new file mode 100644 index 0000000..53ecb0d --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/topic.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2018, dev +# This file is distributed under the same license as the sphinx package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2018. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-05-06 16:44+0900\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" +"Generated-By: Babel 2.4.0\n" + +msgid "i18n with topic" +msgstr "I18N WITH TOPIC" + +msgid "Topic Title" +msgstr "TOPIC TITLE" + +msgid "Topic Content" +msgstr "TOPIC CONTENT" + +msgid "1. Topic Title" +msgstr "1. TOPIC TITLE" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/translation_progress.po b/tests/roots/test-intl/xx/LC_MESSAGES/translation_progress.po new file mode 100644 index 0000000..94673d1 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/translation_progress.po @@ -0,0 +1,57 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2000-01-01 00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: \n" +"Language: xx\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Translation Progress" +msgstr "TRANSLATION PROGRESS" + +msgid "When, in disgrace with fortune and men’s eyes," +msgstr "WHEN, IN DISGRACE WITH FORTUNE AND MEN’S EYES," + +msgid "I all alone beweep my outcast state," +msgstr "I ALL ALONE BEWEEP MY OUTCAST STATE," + +msgid "And trouble deaf heaven with my bootless cries," +msgstr "AND TROUBLE DEAF HEAVEN WITH MY BOOTLESS CRIES," + +msgid "And look upon myself, and curse my fate," +msgstr "AND LOOK UPON MYSELF, AND CURSE MY FATE," + +msgid "Wishing me like to one more rich in hope," +msgstr "WISHING ME LIKE TO ONE MORE RICH IN HOPE," + +msgid "Featur’d like him, like him with friends possess’d," +msgstr "FEATUR’D LIKE HIM, LIKE HIM WITH FRIENDS POSSESS’D," + +msgid "Desiring this man’s art and that man’s scope," +msgstr "DESIRING THIS MAN’S ART AND THAT MAN’S SCOPE," + +msgid "With what I most enjoy contented least;" +msgstr "WITH WHAT I MOST ENJOY CONTENTED LEAST;" + +# idempotent translations (2 out of 14 lines): + +msgid "Yet in these thoughts myself almost despising," +msgstr "Yet in these thoughts myself almost despising," + +msgid "Haply I think on thee, and then my state," +msgstr "Haply I think on thee, and then my state," + +# untranslated (2 out of 14 lines): + +msgid "Like to the lark at break of day arising" +msgstr "" + +msgid "From sullen earth, sings hymns at heaven’s gate;" +msgstr "" + +# translation missing (2 out of 14 lines): diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/versionchange.po b/tests/roots/test-intl/xx/LC_MESSAGES/versionchange.po new file mode 100644 index 0000000..5a8df38 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/versionchange.po @@ -0,0 +1,33 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx <Tests> package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-12-15 03:17+0000\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" + +msgid "i18n with versionchange" +msgstr "I18N WITH VERSIONCHANGE" + +msgid "This is the *first* paragraph of deprecated." +msgstr "THIS IS THE *FIRST* PARAGRAPH OF DEPRECATED." + +msgid "This is the *second* paragraph of deprecated." +msgstr "THIS IS THE *SECOND* PARAGRAPH OF DEPRECATED." + +msgid "This is the *first* paragraph of versionadded." +msgstr "THIS IS THE *FIRST* PARAGRAPH OF VERSIONADDED." + +msgid "This is the *first* paragraph of versionchanged." +msgstr "THIS IS THE *FIRST* PARAGRAPH OF VERSIONCHANGED." + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/warnings.po b/tests/roots/test-intl/xx/LC_MESSAGES/warnings.po new file mode 100644 index 0000000..7963a0a --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/warnings.po @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx <Tests> package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx <Tests> 0.6\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-04 13:06+0000\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" + +msgid "i18n with reST warnings" +msgstr "I18N WITH REST WARNINGS" + +msgid "line of ``literal`` markup." +msgstr "LINE OF ``BROKEN LITERAL MARKUP." diff --git a/tests/roots/test-intl_substitution_definitions/conf.py b/tests/roots/test-intl_substitution_definitions/conf.py new file mode 100644 index 0000000..5e43033 --- /dev/null +++ b/tests/roots/test-intl_substitution_definitions/conf.py @@ -0,0 +1,13 @@ +exclude_patterns = ['_build'] + +rst_prolog = """\ +.. |subst_prolog_1| replace:: prologue substitute text + +.. |subst_prolog_2| image:: /img.png +""" + +rst_epilog = """\ +.. |subst_epilog_1| replace:: epilogue substitute text + +.. |subst_epilog_2| image:: /i18n.png +""" diff --git a/tests/roots/test-intl_substitution_definitions/i18n.png b/tests/roots/test-intl_substitution_definitions/i18n.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-intl_substitution_definitions/i18n.png diff --git a/tests/roots/test-intl_substitution_definitions/img.png b/tests/roots/test-intl_substitution_definitions/img.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-intl_substitution_definitions/img.png diff --git a/tests/roots/test-intl_substitution_definitions/index.rst b/tests/roots/test-intl_substitution_definitions/index.rst new file mode 100644 index 0000000..9b8c155 --- /dev/null +++ b/tests/roots/test-intl_substitution_definitions/index.rst @@ -0,0 +1,10 @@ +CONTENTS +======== + +.. toctree:: + :maxdepth: 2 + :numbered: + :caption: Table of Contents + + prolog_epilog_substitution + prolog_epilog_substitution_excluded diff --git a/tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution.rst b/tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution.rst new file mode 100644 index 0000000..4127ba4 --- /dev/null +++ b/tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution.rst @@ -0,0 +1,12 @@ +:tocdepth: 2 + +i18n with prologue and epilogue substitutions +============================================= + +This is content that contains |subst_prolog_1|. + +Substituted image |subst_prolog_2| here. + +This is content that contains |subst_epilog_1|. + +Substituted image |subst_epilog_2| here. diff --git a/tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution_excluded.rst b/tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution_excluded.rst new file mode 100644 index 0000000..0ddfc74 --- /dev/null +++ b/tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution_excluded.rst @@ -0,0 +1,6 @@ +:tocdepth: 2 + +i18n without prologue and epilogue substitutions +================================================ + +This is content that does not include prologue and epilogue substitutions. diff --git a/tests/roots/test-intl_substitution_definitions/xx/LC_MESSAGES/prolog_epilog_substitution.po b/tests/roots/test-intl_substitution_definitions/xx/LC_MESSAGES/prolog_epilog_substitution.po new file mode 100644 index 0000000..3ce51fe --- /dev/null +++ b/tests/roots/test-intl_substitution_definitions/xx/LC_MESSAGES/prolog_epilog_substitution.po @@ -0,0 +1,38 @@ +msgid "" +msgstr "" +"Project-Id-Version: sphinx tests\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-07-21 12:00+0800\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" + +msgid "i18n with prologue and epilogue substitutions" +msgstr "I18N WITH PROLOGUE AND EPILOGUE SUBSTITUTIONS" + +msgid "This is content that contains |subst_prolog_1|." +msgstr "THIS IS CONTENT THAT CONTAINS |subst_prolog_1|." + +msgid "Substituted image |subst_prolog_2| here." +msgstr "SUBSTITUTED IMAGE |subst_prolog_2| HERE." + +msgid "This is content that contains |subst_epilog_1|." +msgstr "THIS IS CONTENT THAT CONTAINS |subst_epilog_1|." + +msgid "Substituted image |subst_epilog_2| here." +msgstr "SUBSTITUTED IMAGE |subst_epilog_2| HERE." + +msgid "subst_prolog_2" +msgstr "SUBST_PROLOG_2 TRANSLATED" + +msgid ".. image:: /img.png" +msgstr ".. image:: /i18n.png" + +msgid "subst_epilog_2" +msgstr "SUBST_EPILOG_2 TRANSLATED" + +msgid ".. image:: /i18n.png" +msgstr ".. image:: /img.png" diff --git a/tests/roots/test-keep_warnings/conf.py b/tests/roots/test-keep_warnings/conf.py new file mode 100644 index 0000000..b7b3c31 --- /dev/null +++ b/tests/roots/test-keep_warnings/conf.py @@ -0,0 +1 @@ +keep_warnings = True diff --git a/tests/roots/test-keep_warnings/index.rst b/tests/roots/test-keep_warnings/index.rst new file mode 100644 index 0000000..1e2d597 --- /dev/null +++ b/tests/roots/test-keep_warnings/index.rst @@ -0,0 +1,2 @@ +keep_warnings +===== diff --git a/tests/roots/test-latex-babel/bar.rst b/tests/roots/test-latex-babel/bar.rst new file mode 100644 index 0000000..c1ddf30 --- /dev/null +++ b/tests/roots/test-latex-babel/bar.rst @@ -0,0 +1,4 @@ +=== +Bar +=== + diff --git a/tests/roots/test-latex-babel/conf.py b/tests/roots/test-latex-babel/conf.py new file mode 100644 index 0000000..175e3ff --- /dev/null +++ b/tests/roots/test-latex-babel/conf.py @@ -0,0 +1,5 @@ +numfig_format = { + 'figure': 'Fig. %s', + 'table': 'Table. %s', + 'code-block': 'List.', +} diff --git a/tests/roots/test-latex-babel/foo.rst b/tests/roots/test-latex-babel/foo.rst new file mode 100644 index 0000000..cecc672 --- /dev/null +++ b/tests/roots/test-latex-babel/foo.rst @@ -0,0 +1,4 @@ +=== +Foo +=== + diff --git a/tests/roots/test-latex-babel/index.rst b/tests/roots/test-latex-babel/index.rst new file mode 100644 index 0000000..7c19f9e --- /dev/null +++ b/tests/roots/test-latex-babel/index.rst @@ -0,0 +1,8 @@ +test-tocdepth +============= + +.. toctree:: + :caption: Table of content + + foo + bar diff --git a/tests/roots/test-latex-container/conf.py b/tests/roots/test-latex-container/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-latex-container/conf.py diff --git a/tests/roots/test-latex-container/index.rst b/tests/roots/test-latex-container/index.rst new file mode 100644 index 0000000..899788b --- /dev/null +++ b/tests/roots/test-latex-container/index.rst @@ -0,0 +1,4 @@ +.. container:: classname + + text +
\ No newline at end of file diff --git a/tests/roots/test-latex-equations/conf.py b/tests/roots/test-latex-equations/conf.py new file mode 100644 index 0000000..d851892 --- /dev/null +++ b/tests/roots/test-latex-equations/conf.py @@ -0,0 +1,2 @@ +root_doc = 'equations' +extensions = ['sphinx.ext.imgmath'] diff --git a/tests/roots/test-latex-equations/equations.rst b/tests/roots/test-latex-equations/equations.rst new file mode 100644 index 0000000..2eef2f2 --- /dev/null +++ b/tests/roots/test-latex-equations/equations.rst @@ -0,0 +1,21 @@ +test-latex-equation +=================== + +Equation without a label. + +.. math:: + + E = mc^2 + +Equation with label. + +.. math:: E = hv + :label: test + +Second equation without label. + +.. math:: + + c^2 = a^2 + b^2 + +Equation with label :eq:`test` is important. diff --git a/tests/roots/test-latex-equations/expects/latex-equations.tex b/tests/roots/test-latex-equations/expects/latex-equations.tex new file mode 100644 index 0000000..5374a67 --- /dev/null +++ b/tests/roots/test-latex-equations/expects/latex-equations.tex @@ -0,0 +1,18 @@ + +\sphinxAtStartPar +Equation without a label. +\begin{equation*} +\begin{split}E = mc^2\end{split} +\end{equation*} +\sphinxAtStartPar +Equation with label. +\begin{equation}\label{equation:equations:test} +\begin{split}E = hv\end{split} +\end{equation} +\sphinxAtStartPar +Second equation without label. +\begin{equation*} +\begin{split}c^2 = a^2 + b^2\end{split} +\end{equation*} +\sphinxAtStartPar +Equation with label \eqref{equation:equations:test} is important. diff --git a/tests/roots/test-latex-figure-in-admonition/conf.py b/tests/roots/test-latex-figure-in-admonition/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-latex-figure-in-admonition/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-latex-figure-in-admonition/img.png b/tests/roots/test-latex-figure-in-admonition/img.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-latex-figure-in-admonition/img.png diff --git a/tests/roots/test-latex-figure-in-admonition/index.rst b/tests/roots/test-latex-figure-in-admonition/index.rst new file mode 100644 index 0000000..e3d39d3 --- /dev/null +++ b/tests/roots/test-latex-figure-in-admonition/index.rst @@ -0,0 +1,9 @@ +Test Figure in Admonition +========================= + +.. caution:: + + This uses a figure in an admonition. + + .. figure:: img.png + diff --git a/tests/roots/test-latex-includegraphics/conf.py b/tests/roots/test-latex-includegraphics/conf.py new file mode 100644 index 0000000..65c19ab --- /dev/null +++ b/tests/roots/test-latex-includegraphics/conf.py @@ -0,0 +1,47 @@ +exclude_patterns = ['_build'] + +latex_elements = { + 'preamble': r''' +\makeatletter +\def\dividetwolengths#1#2{\the\dimexpr + \numexpr65536*\dimexpr#1\relax/\dimexpr#2\relax sp}% +\newwrite\out +\immediate\openout\out=\jobname-dimensions.txt +\def\toout{\immediate\write\out} +\def\getWfromoptions #1width=#2,#3\relax{\def\WidthFromOption{#2}}% +\def\getHfromoptions #1height=#2,#3\relax{\def\HeightFromOption{#2}}% +\def\tempincludegraphics[#1]#2{% + \sphinxsafeincludegraphics[#1]{#2}% + \edef\obtainedratio + {\dividetwolengths\spx@image@requiredheight\spx@image@requiredwidth}% + \getWfromoptions#1,width=,\relax + \getHfromoptions#1,height=,\relax + \def\ratiocheck{}% + \ifx\WidthFromOption\empty\else + \ifx\HeightFromOption\empty\else + \edef\askedforratio{\dividetwolengths\HeightFromOption\WidthFromOption}% + \edef\ratiocheck{\dividetwolengths\obtainedratio\askedforratio}% + \fi\fi + \toout{original options = #1^^J% + width = \the\dimexpr\spx@image@requiredwidth, + linewidth = \the\linewidth^^J% + height = \the\dimexpr\spx@image@requiredheight, + maxheight = \the\spx@image@maxheight^^J% + obtained H/W = \obtainedratio^^J% + \ifx\ratiocheck\empty + \else + asked for H/W = \askedforratio^^J% + ratio of ratios = \ratiocheck^^J% + \fi + }% + \ifx\ratiocheck\empty + \else + \ifpdfabsdim\dimexpr\ratiocheck-1pt\relax > 0.01pt + \ASPECTRATIOERROR + \fi + \fi +} +\def\sphinxincludegraphics#1#{\tempincludegraphics#1} +\makeatother +''', +} diff --git a/tests/roots/test-latex-includegraphics/img.png b/tests/roots/test-latex-includegraphics/img.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-latex-includegraphics/img.png diff --git a/tests/roots/test-latex-includegraphics/index.rst b/tests/roots/test-latex-includegraphics/index.rst new file mode 100644 index 0000000..920c749 --- /dev/null +++ b/tests/roots/test-latex-includegraphics/index.rst @@ -0,0 +1,37 @@ +==================== +Test image inclusion +==================== + +Tests with both width and height +-------------------------------- + +.. an image with big dimensions, ratio H/W = 1/5 +.. image:: img.png + :height: 200 + :width: 1000 + +.. topic:: Oversized images + + .. an image with big dimensions, ratio H/W = 5/1 + .. image:: img.png + :height: 1000 + :width: 200 + + .. height too big even if width reduced to linewidth, ratio H/W = 3/1 + .. image:: img.png + :width: 1000 + :height: 3000 + +Tests with only width or height +------------------------------- + +.. topic:: Oversized images + + .. tall image which does not fit in textheight even if width rescaled + .. image:: tall.png + :width: 1000 + +.. wide image which does not fit in linewidth even after height diminished +.. image:: sphinx.png + :height: 1000 + diff --git a/tests/roots/test-latex-includegraphics/sphinx.png b/tests/roots/test-latex-includegraphics/sphinx.png Binary files differnew file mode 100644 index 0000000..0a103cd --- /dev/null +++ b/tests/roots/test-latex-includegraphics/sphinx.png diff --git a/tests/roots/test-latex-includegraphics/tall.png b/tests/roots/test-latex-includegraphics/tall.png Binary files differnew file mode 100644 index 0000000..c98c058 --- /dev/null +++ b/tests/roots/test-latex-includegraphics/tall.png diff --git a/tests/roots/test-latex-index/conf.py b/tests/roots/test-latex-index/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-latex-index/conf.py diff --git a/tests/roots/test-latex-index/index.rst b/tests/roots/test-latex-index/index.rst new file mode 100644 index 0000000..5b61279 --- /dev/null +++ b/tests/roots/test-latex-index/index.rst @@ -0,0 +1,16 @@ +test-latex-index +================ + +A :index:`famous` :index:`equation`: + +.. math:: + + E = m c^2 + +.. index:: Einstein, relativity + +and some text. + +.. index:: main { + +An index entry containing non paired curly brace diff --git a/tests/roots/test-latex-labels-before-module/automodule1.py b/tests/roots/test-latex-labels-before-module/automodule1.py new file mode 100644 index 0000000..0545aa4 --- /dev/null +++ b/tests/roots/test-latex-labels-before-module/automodule1.py @@ -0,0 +1,2 @@ +"""docstring""" + diff --git a/tests/roots/test-latex-labels-before-module/automodule2a.py b/tests/roots/test-latex-labels-before-module/automodule2a.py new file mode 100644 index 0000000..0545aa4 --- /dev/null +++ b/tests/roots/test-latex-labels-before-module/automodule2a.py @@ -0,0 +1,2 @@ +"""docstring""" + diff --git a/tests/roots/test-latex-labels-before-module/automodule2b.py b/tests/roots/test-latex-labels-before-module/automodule2b.py new file mode 100644 index 0000000..0545aa4 --- /dev/null +++ b/tests/roots/test-latex-labels-before-module/automodule2b.py @@ -0,0 +1,2 @@ +"""docstring""" + diff --git a/tests/roots/test-latex-labels-before-module/automodule3.py b/tests/roots/test-latex-labels-before-module/automodule3.py new file mode 100644 index 0000000..0545aa4 --- /dev/null +++ b/tests/roots/test-latex-labels-before-module/automodule3.py @@ -0,0 +1,2 @@ +"""docstring""" + diff --git a/tests/roots/test-latex-labels-before-module/conf.py b/tests/roots/test-latex-labels-before-module/conf.py new file mode 100644 index 0000000..25193b0 --- /dev/null +++ b/tests/roots/test-latex-labels-before-module/conf.py @@ -0,0 +1,8 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autodoc'] + +nitpicky = True diff --git a/tests/roots/test-latex-labels-before-module/index.rst b/tests/roots/test-latex-labels-before-module/index.rst new file mode 100644 index 0000000..e6df749 --- /dev/null +++ b/tests/roots/test-latex-labels-before-module/index.rst @@ -0,0 +1,48 @@ +latex-labels-before-module +========================== + +.. _label_1a: +.. _label_1b: + +.. module:: module1 + + text + +.. _label_2: + +.. module:: module2a + + text + +.. module:: module2b + + text + +.. _label_3: + +.. module:: module3 + + text + +.. _label_auto_1a: +.. _label_auto_1b: + +.. automodule:: automodule1 + + text + +.. _label_auto_2: + +.. automodule:: automodule2a + + text + +.. automodule:: automodule2b + + text + +.. _label_auto_3: + +.. automodule:: automodule3 + + text diff --git a/tests/roots/test-latex-labels/conf.py b/tests/roots/test-latex-labels/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-latex-labels/conf.py diff --git a/tests/roots/test-latex-labels/index.rst b/tests/roots/test-latex-labels/index.rst new file mode 100644 index 0000000..f3c4217 --- /dev/null +++ b/tests/roots/test-latex-labels/index.rst @@ -0,0 +1,72 @@ +latex-labels +============ + +figures +------- + +.. _figure1: +.. _figure2: + +.. figure:: logo.jpg + + labeled figure + +.. figure:: logo.jpg + :name: figure3 + + labeled figure + + with a legend + +code-blocks +----------- + +.. _codeblock1: +.. _codeblock2: + +.. code-block:: none + + blah blah blah + +.. code-block:: none + :name: codeblock3 + + blah blah blah + +tables +------ + +.. _table1: +.. _table2: + +.. table:: table caption + + ==== ==== + head head + cell cell + ==== ==== + +.. table:: table caption + :name: table3 + + ==== ==== + head head + cell cell + ==== ==== + +.. _section1: +.. _section2: + +subsection +---------- + +.. _section3: + +subsubsection +~~~~~~~~~~~~~ + +.. toctree:: + + otherdoc + +* Embedded standalone hyperlink reference(refs: #5948): `subsection <section1_>`_. diff --git a/tests/roots/test-latex-labels/otherdoc.rst b/tests/roots/test-latex-labels/otherdoc.rst new file mode 100644 index 0000000..55c5ca0 --- /dev/null +++ b/tests/roots/test-latex-labels/otherdoc.rst @@ -0,0 +1,2 @@ +otherdoc +======== diff --git a/tests/roots/test-latex-numfig/conf.py b/tests/roots/test-latex-numfig/conf.py new file mode 100644 index 0000000..287bd1c --- /dev/null +++ b/tests/roots/test-latex-numfig/conf.py @@ -0,0 +1,8 @@ +extensions = ['sphinx.ext.imgmath'] # for math_numfig + +latex_documents = [ + ('indexmanual', 'SphinxManual.tex', 'Test numfig manual', + 'Sphinx', 'manual'), + ('indexhowto', 'SphinxHowTo.tex', 'Test numfig howto', + 'Sphinx', 'howto'), +] diff --git a/tests/roots/test-latex-numfig/index.rst b/tests/roots/test-latex-numfig/index.rst new file mode 100644 index 0000000..6b8b968 --- /dev/null +++ b/tests/roots/test-latex-numfig/index.rst @@ -0,0 +1,9 @@ +================= +test-latex-numfig +================= + +.. toctree:: + :numbered: + + indexmanual + indexhowto diff --git a/tests/roots/test-latex-numfig/indexhowto.rst b/tests/roots/test-latex-numfig/indexhowto.rst new file mode 100644 index 0000000..4749f1e --- /dev/null +++ b/tests/roots/test-latex-numfig/indexhowto.rst @@ -0,0 +1,10 @@ +======================= +test-latex-numfig-howto +======================= + +This is a part +============== + +This is a section +----------------- + diff --git a/tests/roots/test-latex-numfig/indexmanual.rst b/tests/roots/test-latex-numfig/indexmanual.rst new file mode 100644 index 0000000..8bab4fb --- /dev/null +++ b/tests/roots/test-latex-numfig/indexmanual.rst @@ -0,0 +1,13 @@ +======================== +test-latex-numfig-manual +======================== + +First part +========== + +This is chapter +--------------- + +This is section +~~~~~~~~~~~~~~~ + diff --git a/tests/roots/test-latex-table/_mytemplates/latex/longtable.tex_t b/tests/roots/test-latex-table/_mytemplates/latex/longtable.tex_t new file mode 100644 index 0000000..e2cb1db --- /dev/null +++ b/tests/roots/test-latex-table/_mytemplates/latex/longtable.tex_t @@ -0,0 +1 @@ +SALUT LES COPAINS diff --git a/tests/roots/test-latex-table/complex.rst b/tests/roots/test-latex-table/complex.rst new file mode 100644 index 0000000..d648ff1 --- /dev/null +++ b/tests/roots/test-latex-table/complex.rst @@ -0,0 +1,58 @@ +complex tables +============== + +grid table +---------- + +.. rst-class:: nocolorrows + ++---------+---------+---------+ +| header1 | header2 | header3 | ++=========+=========+=========+ +| cell1-1 | cell1-2 | cell1-3 | ++---------+ +---------+ +| cell2-1 | | cell2-3 | ++ +---------+---------+ +| | cell3-2-par1 | ++---------+ | +| cell4-1 | cell3-2-par2 | ++---------+---------+---------+ +| cell5-1 | ++---------+---------+---------+ + +grid table with tabularcolumns having no vline +---------------------------------------------- + +.. tabularcolumns:: TTT + ++---------+---------+---------+ +| header1 | header2 | header3 | ++=========+=========+=========+ +| cell1-1 | cell1-2 | cell1-3 | ++---------+ +---------+ +| cell2-1 | | cell2-3 | ++ +---------+---------+ +| | cell3-2-par1 | ++---------+ | +| cell4-1 | cell3-2-par2 | ++---------+---------+---------+ +| cell5-1 | ++---------+---------+---------+ + +complex spanning cell +--------------------- + +table having ... + +* consecutive multirow at top of row (1-1 and 1-2) +* consecutive multirow at end of row (1-4 and 1-5) + +.. rst-class:: standard + ++-----------+-----------+-----------+-----------+-----------+ +| | | cell1-3 | | | +| | +-----------+ | cell1-5 | +| cell1-1 | cell1-2 | | cell1-4 | | +| | | cell2-3 | +-----------+ +| | | | | cell3-5 | ++-----------+-----------+-----------+-----------+-----------+ diff --git a/tests/roots/test-latex-table/conf.py b/tests/roots/test-latex-table/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-latex-table/conf.py diff --git a/tests/roots/test-latex-table/expects/complex_spanning_cell.tex b/tests/roots/test-latex-table/expects/complex_spanning_cell.tex new file mode 100644 index 0000000..d2d6189 --- /dev/null +++ b/tests/roots/test-latex-table/expects/complex_spanning_cell.tex @@ -0,0 +1,69 @@ +\label{\detokenize{complex:complex-spanning-cell}} +\sphinxAtStartPar +table having … +\begin{itemize} +\item {} +\sphinxAtStartPar +consecutive multirow at top of row (1\sphinxhyphen{}1 and 1\sphinxhyphen{}2) + +\item {} +\sphinxAtStartPar +consecutive multirow at end of row (1\sphinxhyphen{}4 and 1\sphinxhyphen{}5) + +\end{itemize} + + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithstandardstyle +\centering +\begin{tabulary}{\linewidth}[t]{|T|T|T|T|T|} +\sphinxtoprule +\sphinxtableatstartofbodyhook\sphinxmultirow{3}{1}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{5}} +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +&\sphinxmultirow{3}{2}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{5}} +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +& +\sphinxAtStartPar +cell1\sphinxhyphen{}3 +&\sphinxmultirow{3}{4}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{5}} +\sphinxAtStartPar +cell1\sphinxhyphen{}4 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +&\sphinxmultirow{2}{5}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{5}} +\sphinxAtStartPar +cell1\sphinxhyphen{}5 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +\\ +\sphinxvlinecrossing{1}\sphinxcline{3-3}\sphinxvlinecrossing{4}\sphinxfixclines{5}\sphinxtablestrut{1}&\sphinxtablestrut{2}&\sphinxmultirow{2}{6}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{5}} +\sphinxAtStartPar +cell2\sphinxhyphen{}3 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +&\sphinxtablestrut{4}&\sphinxtablestrut{5}\\ +\sphinxvlinecrossing{1}\sphinxvlinecrossing{2}\sphinxvlinecrossing{3}\sphinxcline{5-5}\sphinxfixclines{5}\sphinxtablestrut{1}&\sphinxtablestrut{2}&\sphinxtablestrut{6}&\sphinxtablestrut{4}& +\sphinxAtStartPar +cell3\sphinxhyphen{}5 +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/gridtable.tex b/tests/roots/test-latex-table/expects/gridtable.tex new file mode 100644 index 0000000..407abe7 --- /dev/null +++ b/tests/roots/test-latex-table/expects/gridtable.tex @@ -0,0 +1,73 @@ +\label{\detokenize{complex:grid-table}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithnocolorrowsstyle +\centering +\begin{tabulary}{\linewidth}[t]{|T|T|T|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header3 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +&\sphinxmultirow{2}{5}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{3}} +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +& +\sphinxAtStartPar +cell1\sphinxhyphen{}3 +\\ +\sphinxcline{1-1}\sphinxcline{3-3}\sphinxfixclines{3}\sphinxmultirow{2}{7}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{3}} +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +&\sphinxtablestrut{5}& +\sphinxAtStartPar +cell2\sphinxhyphen{}3 +\\ +\sphinxcline{2-3}\sphinxfixclines{3}\sphinxtablestrut{7}&\sphinxstartmulticolumn{2}% +\sphinxmultirow{2}{9}{% +\begin{varwidth}[t]{\sphinxcolwidth{2}{3}} +\sphinxAtStartPar +cell3\sphinxhyphen{}2\sphinxhyphen{}par1 + +\sphinxAtStartPar +cell3\sphinxhyphen{}2\sphinxhyphen{}par2 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +\sphinxstopmulticolumn +\\ +\sphinxcline{1-1}\sphinxfixclines{3} +\sphinxAtStartPar +cell4\sphinxhyphen{}1 +&\multicolumn{2}{l|}{\sphinxtablestrut{9}}\\ +\sphinxhline\sphinxstartmulticolumn{3}% +\begin{varwidth}[t]{\sphinxcolwidth{3}{3}} +\sphinxAtStartPar +cell5\sphinxhyphen{}1 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +\sphinxstopmulticolumn +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/gridtable_with_tabularcolumn.tex b/tests/roots/test-latex-table/expects/gridtable_with_tabularcolumn.tex new file mode 100644 index 0000000..c77b990 --- /dev/null +++ b/tests/roots/test-latex-table/expects/gridtable_with_tabularcolumn.tex @@ -0,0 +1,73 @@ +\label{\detokenize{complex:grid-table-with-tabularcolumns-having-no-vline}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithnovlinesstyle +\centering +\begin{tabulary}{\linewidth}[t]{TTT} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header3 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +&\sphinxmultirow{2}{5}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{3}} +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +& +\sphinxAtStartPar +cell1\sphinxhyphen{}3 +\\ +\sphinxcline{1-1}\sphinxcline{3-3}\sphinxfixclines{3}\sphinxmultirow{2}{7}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{3}} +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +&\sphinxtablestrut{5}& +\sphinxAtStartPar +cell2\sphinxhyphen{}3 +\\ +\sphinxcline{2-3}\sphinxfixclines{3}\sphinxtablestrut{7}&\sphinxstartmulticolumn{2}% +\sphinxmultirow{2}{9}{% +\begin{varwidth}[t]{\sphinxcolwidth{2}{3}} +\sphinxAtStartPar +cell3\sphinxhyphen{}2\sphinxhyphen{}par1 + +\sphinxAtStartPar +cell3\sphinxhyphen{}2\sphinxhyphen{}par2 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +\sphinxstopmulticolumn +\\ +\sphinxcline{1-1}\sphinxfixclines{3} +\sphinxAtStartPar +cell4\sphinxhyphen{}1 +&\multicolumn{2}{l}{\sphinxtablestrut{9}}\\ +\sphinxhline\sphinxstartmulticolumn{3}% +\begin{varwidth}[t]{\sphinxcolwidth{3}{3}} +\sphinxAtStartPar +cell5\sphinxhyphen{}1 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +\sphinxstopmulticolumn +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable.tex b/tests/roots/test-latex-table/expects/longtable.tex new file mode 100644 index 0000000..1fe1022 --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable.tex @@ -0,0 +1,70 @@ +\label{\detokenize{longtable:longtable}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithborderlessstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{ll} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook + +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\sphinxatlongtableend +\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_having_align.tex b/tests/roots/test-latex-table/expects/longtable_having_align.tex new file mode 100644 index 0000000..4a4df18 --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_align.tex @@ -0,0 +1,69 @@ +\label{\detokenize{longtable:longtable-having-align-option}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax +\makeatother +\begin{longtable}{|l|l|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook + +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\sphinxatlongtableend +\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_having_caption.tex b/tests/roots/test-latex-table/expects/longtable_having_caption.tex new file mode 100644 index 0000000..a1aa65d --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_caption.tex @@ -0,0 +1,71 @@ +\label{\detokenize{longtable:longtable-having-caption}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|l|l|} +\sphinxthelongtablecaptionisattop +\caption{caption for longtable\strut}\label{\detokenize{longtable:id1}}\\*[\sphinxlongtablecapskipadjust] +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook + +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\sphinxatlongtableend +\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex new file mode 100644 index 0000000..240a760 --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex @@ -0,0 +1,76 @@ +\label{\detokenize{longtable:longtable-having-problematic-cell}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|*{2}{\X{1}{2}|}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook +\begin{itemize} +\item {} +\sphinxAtStartPar +item1 + +\item {} +\sphinxAtStartPar +item2 + +\end{itemize} +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\sphinxatlongtableend +\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex new file mode 100644 index 0000000..897830b --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex @@ -0,0 +1,81 @@ +\label{\detokenize{longtable:longtable-having-both-stub-columns-and-problematic-cell}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|*{3}{\X{1}{3}|}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header3 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{3}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header3 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{3}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook +\sphinxstyletheadfamily \begin{itemize} +\item {} +\sphinxAtStartPar +instub1\sphinxhyphen{}1a + +\item {} +\sphinxAtStartPar +instub1\sphinxhyphen{}1b + +\end{itemize} +&\sphinxstyletheadfamily +\sphinxAtStartPar +instub1\sphinxhyphen{}2 +& +\sphinxAtStartPar +notinstub1\sphinxhyphen{}3 +\\ +\sphinxhline\sphinxstyletheadfamily +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}3 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\sphinxatlongtableend +\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex b/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex new file mode 100644 index 0000000..b9f7512 --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex @@ -0,0 +1,70 @@ +\label{\detokenize{longtable:longtable-having-verbatim}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|*{2}{\X{1}{2}|}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook + +\begin{sphinxVerbatimintable}[commandchars=\\\{\}] +\PYG{n}{hello} \PYG{n}{world} +\end{sphinxVerbatimintable} +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\sphinxatlongtableend +\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_having_widths.tex b/tests/roots/test-latex-table/expects/longtable_having_widths.tex new file mode 100644 index 0000000..24dad79 --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_widths.tex @@ -0,0 +1,73 @@ +\label{\detokenize{longtable:longtable-having-widths-option}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|\X{30}{100}|\X{70}{100}|} +\noalign{\phantomsection\label{\detokenize{longtable:namedlongtable}}\label{\detokenize{longtable:mylongtable}}}% +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook + +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\sphinxatlongtableend +\end{savenotes} + +\sphinxAtStartPar +See {\hyperref[\detokenize{longtable:mylongtable}]{\sphinxcrossref{mylongtable}}}, same as {\hyperref[\detokenize{longtable:namedlongtable}]{\sphinxcrossref{\DUrole{std,std-ref}{this one}}}}. diff --git a/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex new file mode 100644 index 0000000..b4758ca --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex @@ -0,0 +1,76 @@ +\label{\detokenize{longtable:longtable-having-both-widths-and-problematic-cell}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|\X{30}{100}|\X{70}{100}|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook +\begin{itemize} +\item {} +\sphinxAtStartPar +item1 + +\item {} +\sphinxAtStartPar +item2 + +\end{itemize} +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\sphinxatlongtableend +\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex b/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex new file mode 100644 index 0000000..4c380fe --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex @@ -0,0 +1,70 @@ +\label{\detokenize{longtable:longtable-with-tabularcolumn}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithvlinesstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|c|c|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook + +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\sphinxatlongtableend +\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/simple_table.tex b/tests/roots/test-latex-table/expects/simple_table.tex new file mode 100644 index 0000000..7bd85c7 --- /dev/null +++ b/tests/roots/test-latex-table/expects/simple_table.tex @@ -0,0 +1,40 @@ +\label{\detokenize{tabular:simple-table}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\begin{tabulary}{\linewidth}[t]{|T|T|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/table_having_caption.tex b/tests/roots/test-latex-table/expects/table_having_caption.tex new file mode 100644 index 0000000..f2ce553 --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_caption.tex @@ -0,0 +1,44 @@ +\label{\detokenize{tabular:table-having-caption}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\sphinxcapstartof{table} +\sphinxthecaptionisattop +\sphinxcaption{caption for table}\label{\detokenize{tabular:id1}} +\sphinxaftertopcaption +\begin{tabulary}{\linewidth}[t]{|T|T|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/table_having_problematic_cell.tex b/tests/roots/test-latex-table/expects/table_having_problematic_cell.tex new file mode 100644 index 0000000..7d7ad4b --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_problematic_cell.tex @@ -0,0 +1,47 @@ +\label{\detokenize{tabular:table-having-problematic-cell}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\begin{tabular}[t]{|*{2}{\X{1}{2}|}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook\begin{itemize} +\item {} +\sphinxAtStartPar +item1 + +\item {} +\sphinxAtStartPar +item2 + +\end{itemize} +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabular} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/table_having_stub_columns_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/table_having_stub_columns_and_problematic_cell.tex new file mode 100644 index 0000000..fbd797a --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_stub_columns_and_problematic_cell.tex @@ -0,0 +1,49 @@ +\label{\detokenize{tabular:table-having-both-stub-columns-and-problematic-cell}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\begin{tabular}[t]{|*{3}{\X{1}{3}|}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header3 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook\sphinxstyletheadfamily \begin{itemize} +\item {} +\sphinxAtStartPar +instub1\sphinxhyphen{}1a + +\item {} +\sphinxAtStartPar +instub1\sphinxhyphen{}1b + +\end{itemize} +&\sphinxstyletheadfamily +\sphinxAtStartPar +instub1\sphinxhyphen{}2 +& +\sphinxAtStartPar +notinstub1\sphinxhyphen{}3 +\\ +\sphinxhline\sphinxstyletheadfamily +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}3 +\\ +\sphinxbottomrule +\end{tabular} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/table_having_threeparagraphs_cell_in_first_col.tex b/tests/roots/test-latex-table/expects/table_having_threeparagraphs_cell_in_first_col.tex new file mode 100644 index 0000000..9acd9a8 --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_threeparagraphs_cell_in_first_col.tex @@ -0,0 +1,26 @@ +\label{\detokenize{tabular:table-with-cell-in-first-column-having-three-paragraphs}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\begin{tabulary}{\linewidth}[t]{|T|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1\sphinxhyphen{}par1 + +\sphinxAtStartPar +cell1\sphinxhyphen{}1\sphinxhyphen{}par2 + +\sphinxAtStartPar +cell1\sphinxhyphen{}1\sphinxhyphen{}par3 +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/table_having_verbatim.tex b/tests/roots/test-latex-table/expects/table_having_verbatim.tex new file mode 100644 index 0000000..a002de5 --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_verbatim.tex @@ -0,0 +1,41 @@ +\label{\detokenize{tabular:table-having-verbatim}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\begin{tabular}[t]{|*{2}{\X{1}{2}|}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\begin{sphinxVerbatimintable}[commandchars=\\\{\}] +\PYG{n}{hello} \PYG{n}{world} +\end{sphinxVerbatimintable} +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabular} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/table_having_widths.tex b/tests/roots/test-latex-table/expects/table_having_widths.tex new file mode 100644 index 0000000..fe5f4c4 --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_widths.tex @@ -0,0 +1,46 @@ +\label{\detokenize{tabular:table-having-widths-option}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithbooktabsstyle +\sphinxthistablewithcolorrowsstyle +\centering +\phantomsection\label{\detokenize{tabular:namedtabular}}\label{\detokenize{tabular:mytabular}}\nobreak +\begin{tabular}[t]{\X{30}{100}\X{70}{100}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabular} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} + +\sphinxAtStartPar +See {\hyperref[\detokenize{tabular:mytabular}]{\sphinxcrossref{\DUrole{std,std-ref}{this}}}}, same as {\hyperref[\detokenize{tabular:namedtabular}]{\sphinxcrossref{namedtabular}}}. diff --git a/tests/roots/test-latex-table/expects/table_having_widths_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/table_having_widths_and_problematic_cell.tex new file mode 100644 index 0000000..1baf92c --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_widths_and_problematic_cell.tex @@ -0,0 +1,47 @@ +\label{\detokenize{tabular:table-having-both-widths-and-problematic-cell}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\begin{tabular}[t]{|\X{30}{100}|\X{70}{100}|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook\begin{itemize} +\item {} +\sphinxAtStartPar +item1 + +\item {} +\sphinxAtStartPar +item2 + +\end{itemize} +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabular} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/tabular_having_widths.tex b/tests/roots/test-latex-table/expects/tabular_having_widths.tex new file mode 100644 index 0000000..15321d6 --- /dev/null +++ b/tests/roots/test-latex-table/expects/tabular_having_widths.tex @@ -0,0 +1,40 @@ +\label{\detokenize{tabular:table-having-align-option-tabular}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\raggedright +\begin{tabular}[t]{|\X{30}{100}|\X{70}{100}|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabular} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/tabularcolumn.tex b/tests/roots/test-latex-table/expects/tabularcolumn.tex new file mode 100644 index 0000000..fcb01be --- /dev/null +++ b/tests/roots/test-latex-table/expects/tabularcolumn.tex @@ -0,0 +1,41 @@ +\label{\detokenize{tabular:table-with-tabularcolumn}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithnovlinesstyle +\centering +\begin{tabulary}{\linewidth}[t]{cc} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/tabulary_having_widths.tex b/tests/roots/test-latex-table/expects/tabulary_having_widths.tex new file mode 100644 index 0000000..2463416 --- /dev/null +++ b/tests/roots/test-latex-table/expects/tabulary_having_widths.tex @@ -0,0 +1,40 @@ +\label{\detokenize{tabular:table-having-align-option-tabulary}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\raggedleft +\begin{tabulary}{\linewidth}[t]{|T|T|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/index.rst b/tests/roots/test-latex-table/index.rst new file mode 100644 index 0000000..80dd110 --- /dev/null +++ b/tests/roots/test-latex-table/index.rst @@ -0,0 +1,8 @@ +test-latex-table +================ + +.. toctree:: + + tabular + longtable + complex diff --git a/tests/roots/test-latex-table/longtable.rst b/tests/roots/test-latex-table/longtable.rst new file mode 100644 index 0000000..da6fa5c --- /dev/null +++ b/tests/roots/test-latex-table/longtable.rst @@ -0,0 +1,156 @@ +longtables +========== + +longtable +--------- + +.. table:: + :class: longtable, borderless + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +longtable having :widths: option +-------------------------------- + +.. _mylongtable: + +.. table:: + :class: longtable + :widths: 30,70 + :name: namedlongtable + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +See mylongtable_, same as :ref:`this one <namedlongtable>`. + +longtable having :align: option +------------------------------- + +.. table:: + :align: right + :class: longtable + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +longtable with tabularcolumn +---------------------------- + +.. tabularcolumns:: |c|c| + +.. table:: + :class: longtable + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +longtable having caption +------------------------ + +.. list-table:: caption for longtable + :class: longtable + :header-rows: 1 + + * - header1 + - header2 + * - cell1-1 + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +longtable having verbatim +------------------------- + +.. list-table:: + :class: longtable + :header-rows: 1 + + * - header1 + - header2 + * - :: + + hello world + + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +longtable having both :widths: and problematic cell +--------------------------------------------------- + +.. list-table:: + :class: longtable + :header-rows: 1 + :widths: 30,70 + + * - header1 + - header2 + * - + item1 + + item2 + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +longtable having problematic cell +--------------------------------- + +.. list-table:: + :class: longtable + :header-rows: 1 + + * - header1 + - header2 + * - + item1 + + item2 + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +longtable having both stub columns and problematic cell +------------------------------------------------------- + +.. list-table:: + :class: longtable + :header-rows: 1 + :stub-columns: 2 + + * - header1 + - header2 + - header3 + * - + instub1-1a + + instub1-1b + - instub1-2 + - notinstub1-3 + * - cell2-1 + - cell2-2 + - cell2-3 diff --git a/tests/roots/test-latex-table/tabular.rst b/tests/roots/test-latex-table/tabular.rst new file mode 100644 index 0000000..15db823 --- /dev/null +++ b/tests/roots/test-latex-table/tabular.rst @@ -0,0 +1,173 @@ +tabular and tabulary +==================== + +simple table +------------ + +======= ======= +header1 header2 +======= ======= +cell1-1 cell1-2 +cell2-1 cell2-2 +cell3-1 cell3-2 +======= ======= + +table having :widths: option +---------------------------- + +.. _mytabular: + +.. table:: + :widths: 30,70 + :name: namedtabular + :class: booktabs, colorrows + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +See :ref:`this <mytabular>`, same as namedtabular_. + +table having :align: option (tabulary) +-------------------------------------- + +.. table:: + :align: right + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +table having :align: option (tabular) +------------------------------------- + +.. table:: + :align: left + :widths: 30,70 + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +table with tabularcolumn +------------------------ + +.. tabularcolumns:: cc + +======= ======= +header1 header2 +======= ======= +cell1-1 cell1-2 +cell2-1 cell2-2 +cell3-1 cell3-2 +======= ======= + +table with cell in first column having three paragraphs +------------------------------------------------------- + ++--------------+ +| header1 | ++==============+ +| cell1-1-par1 | +| | +| cell1-1-par2 | +| | +| cell1-1-par3 | ++--------------+ + + +table having caption +-------------------- + +.. list-table:: caption for table + :header-rows: 1 + + * - header1 + - header2 + * - cell1-1 + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +table having verbatim +--------------------- + +.. list-table:: + :header-rows: 1 + + * - header1 + - header2 + * - :: + + hello world + + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +table having both :widths: and problematic cell +----------------------------------------------- + +.. list-table:: + :header-rows: 1 + :widths: 30,70 + + * - header1 + - header2 + * - + item1 + + item2 + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +table having problematic cell +----------------------------- + +.. list-table:: + :header-rows: 1 + + * - header1 + - header2 + * - + item1 + + item2 + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +table having both stub columns and problematic cell +--------------------------------------------------- + +.. list-table:: + :header-rows: 1 + :stub-columns: 2 + + * - header1 + - header2 + - header3 + * - + instub1-1a + + instub1-1b + - instub1-2 + - notinstub1-3 + * - cell2-1 + - cell2-2 + - cell2-3 diff --git a/tests/roots/test-latex-theme/conf.py b/tests/roots/test-latex-theme/conf.py new file mode 100644 index 0000000..196307a --- /dev/null +++ b/tests/roots/test-latex-theme/conf.py @@ -0,0 +1,2 @@ +latex_theme = 'custom' +latex_theme_path = ['theme'] diff --git a/tests/roots/test-latex-theme/index.rst b/tests/roots/test-latex-theme/index.rst new file mode 100644 index 0000000..f5b1d53 --- /dev/null +++ b/tests/roots/test-latex-theme/index.rst @@ -0,0 +1,2 @@ +latex_theme +=========== diff --git a/tests/roots/test-latex-theme/theme/custom/theme.conf b/tests/roots/test-latex-theme/theme/custom/theme.conf new file mode 100644 index 0000000..ad8df26 --- /dev/null +++ b/tests/roots/test-latex-theme/theme/custom/theme.conf @@ -0,0 +1,6 @@ +[theme] +docclass = book +wrapperclass = sphinxbook +papersize = a4paper +pointsize = 12pt +toplevel_sectioning = chapter diff --git a/tests/roots/test-latex-title/conf.py b/tests/roots/test-latex-title/conf.py new file mode 100644 index 0000000..6443316 --- /dev/null +++ b/tests/roots/test-latex-title/conf.py @@ -0,0 +1,4 @@ +# set empty string to the third column to use the first section title to document title +latex_documents = [ + ('index', 'test.tex', '', 'Sphinx', 'report') +] diff --git a/tests/roots/test-latex-title/index.rst b/tests/roots/test-latex-title/index.rst new file mode 100644 index 0000000..411ad00 --- /dev/null +++ b/tests/roots/test-latex-title/index.rst @@ -0,0 +1,12 @@ +.. admonition:: Notice + + This generates nodes.title node before first section title. + +test-latex-title +================ + +.. toctree:: + :numbered: + + foo + bar diff --git a/tests/roots/test-latex-unicode/conf.py b/tests/roots/test-latex-unicode/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-latex-unicode/conf.py diff --git a/tests/roots/test-latex-unicode/index.rst b/tests/roots/test-latex-unicode/index.rst new file mode 100644 index 0000000..2abeca9 --- /dev/null +++ b/tests/roots/test-latex-unicode/index.rst @@ -0,0 +1,7 @@ +test-latex-unicode +================== + +* script small e: ℯ +* double struck italic small i: â…ˆ +* superscript: â°, ¹ +* subscript: â‚€, â‚ diff --git a/tests/roots/test-linkcheck-anchors-ignore-for-url/conf.py b/tests/roots/test-linkcheck-anchors-ignore-for-url/conf.py new file mode 100644 index 0000000..0005bfa --- /dev/null +++ b/tests/roots/test-linkcheck-anchors-ignore-for-url/conf.py @@ -0,0 +1,3 @@ +exclude_patterns = ['_build'] +linkcheck_anchors = True +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-anchors-ignore-for-url/index.rst b/tests/roots/test-linkcheck-anchors-ignore-for-url/index.rst new file mode 100644 index 0000000..df287b4 --- /dev/null +++ b/tests/roots/test-linkcheck-anchors-ignore-for-url/index.rst @@ -0,0 +1,7 @@ +* `Example valid url, no anchor <http://localhost:7777/valid>`_ +* `Example valid url, valid anchor <http://localhost:7777/valid#valid-anchor>`_ +* `Example valid url, invalid anchor <http://localhost:7777/valid#invalid-anchor>`_ +* `Example ignored url, no anchor <http://localhost:7777/ignored>`_ +* `Example ignored url, invalid anchor <http://localhost:7777/ignored#invalid-anchor>`_ +* `Example invalid url, no anchor <http://localhost:7777/invalid>`_ +* `Example invalid url, invalid anchor <http://localhost:7777/invalid#anchor>`_ diff --git a/tests/roots/test-linkcheck-anchors-ignore/conf.py b/tests/roots/test-linkcheck-anchors-ignore/conf.py new file mode 100644 index 0000000..0005bfa --- /dev/null +++ b/tests/roots/test-linkcheck-anchors-ignore/conf.py @@ -0,0 +1,3 @@ +exclude_patterns = ['_build'] +linkcheck_anchors = True +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-anchors-ignore/index.rst b/tests/roots/test-linkcheck-anchors-ignore/index.rst new file mode 100644 index 0000000..22a1379 --- /dev/null +++ b/tests/roots/test-linkcheck-anchors-ignore/index.rst @@ -0,0 +1,2 @@ +* `Example Bar invalid <http://localhost:7777/#!bar>`_ +* `Example Bar invalid <http://localhost:7777/#top>`_ diff --git a/tests/roots/test-linkcheck-documents_exclude/br0ken_link.rst b/tests/roots/test-linkcheck-documents_exclude/br0ken_link.rst new file mode 100644 index 0000000..bf421f0 --- /dev/null +++ b/tests/roots/test-linkcheck-documents_exclude/br0ken_link.rst @@ -0,0 +1,5 @@ +Broken link +=========== + +Some links are `broken <https://www.sphinx-doc.org/this-is-another-broken-link>`__ +but sometimes not worrying about some broken links is a valid strategy. diff --git a/tests/roots/test-linkcheck-documents_exclude/broken_link.rst b/tests/roots/test-linkcheck-documents_exclude/broken_link.rst new file mode 100644 index 0000000..86e3bb4 --- /dev/null +++ b/tests/roots/test-linkcheck-documents_exclude/broken_link.rst @@ -0,0 +1,5 @@ +Broken link +=========== + +Some links are `broken <https://www.sphinx-doc.org/this-is-a-broken-link>`__ +but sometimes not worrying about some broken links is a valid strategy. diff --git a/tests/roots/test-linkcheck-documents_exclude/conf.py b/tests/roots/test-linkcheck-documents_exclude/conf.py new file mode 100644 index 0000000..52388f9 --- /dev/null +++ b/tests/roots/test-linkcheck-documents_exclude/conf.py @@ -0,0 +1,6 @@ +exclude_patterns = ['_build'] +linkcheck_exclude_documents = [ + '^broken_link$', + 'br[0-9]ken_link', +] +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-documents_exclude/index.rst b/tests/roots/test-linkcheck-documents_exclude/index.rst new file mode 100644 index 0000000..57c39d8 --- /dev/null +++ b/tests/roots/test-linkcheck-documents_exclude/index.rst @@ -0,0 +1,3 @@ +.. toctree:: + broken_link + br0ken_link
\ No newline at end of file diff --git a/tests/roots/test-linkcheck-localserver-anchor/conf.py b/tests/roots/test-linkcheck-localserver-anchor/conf.py new file mode 100644 index 0000000..0005bfa --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-anchor/conf.py @@ -0,0 +1,3 @@ +exclude_patterns = ['_build'] +linkcheck_anchors = True +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-localserver-anchor/index.rst b/tests/roots/test-linkcheck-localserver-anchor/index.rst new file mode 100644 index 0000000..807fe96 --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-anchor/index.rst @@ -0,0 +1 @@ +`local server <http://localhost:7777/#anchor>`_ diff --git a/tests/roots/test-linkcheck-localserver-https/conf.py b/tests/roots/test-linkcheck-localserver-https/conf.py new file mode 100644 index 0000000..a2ce01e --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-https/conf.py @@ -0,0 +1,2 @@ +exclude_patterns = ['_build'] +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-localserver-https/index.rst b/tests/roots/test-linkcheck-localserver-https/index.rst new file mode 100644 index 0000000..fea5983 --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-https/index.rst @@ -0,0 +1 @@ +`HTTPS server <https://localhost:7777/>`_ diff --git a/tests/roots/test-linkcheck-localserver-warn-redirects/conf.py b/tests/roots/test-linkcheck-localserver-warn-redirects/conf.py new file mode 100644 index 0000000..a2ce01e --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-warn-redirects/conf.py @@ -0,0 +1,2 @@ +exclude_patterns = ['_build'] +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-localserver-warn-redirects/index.rst b/tests/roots/test-linkcheck-localserver-warn-redirects/index.rst new file mode 100644 index 0000000..7359bd5 --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-warn-redirects/index.rst @@ -0,0 +1,3 @@ +`local server1 <http://localhost:7777/path1>`_ + +`local server2 <http://localhost:7777/path2>`_ diff --git a/tests/roots/test-linkcheck-localserver/conf.py b/tests/roots/test-linkcheck-localserver/conf.py new file mode 100644 index 0000000..a2ce01e --- /dev/null +++ b/tests/roots/test-linkcheck-localserver/conf.py @@ -0,0 +1,2 @@ +exclude_patterns = ['_build'] +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-localserver/index.rst b/tests/roots/test-linkcheck-localserver/index.rst new file mode 100644 index 0000000..c617e94 --- /dev/null +++ b/tests/roots/test-linkcheck-localserver/index.rst @@ -0,0 +1 @@ +`local server <http://localhost:7777/>`_ diff --git a/tests/roots/test-linkcheck-raw-node/conf.py b/tests/roots/test-linkcheck-raw-node/conf.py new file mode 100644 index 0000000..a2ce01e --- /dev/null +++ b/tests/roots/test-linkcheck-raw-node/conf.py @@ -0,0 +1,2 @@ +exclude_patterns = ['_build'] +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-raw-node/index.rst b/tests/roots/test-linkcheck-raw-node/index.rst new file mode 100644 index 0000000..76e26b5 --- /dev/null +++ b/tests/roots/test-linkcheck-raw-node/index.rst @@ -0,0 +1,2 @@ +.. raw:: html + :url: http://localhost:7777/ diff --git a/tests/roots/test-linkcheck-too-many-retries/conf.py b/tests/roots/test-linkcheck-too-many-retries/conf.py new file mode 100644 index 0000000..0005bfa --- /dev/null +++ b/tests/roots/test-linkcheck-too-many-retries/conf.py @@ -0,0 +1,3 @@ +exclude_patterns = ['_build'] +linkcheck_anchors = True +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-too-many-retries/index.rst b/tests/roots/test-linkcheck-too-many-retries/index.rst new file mode 100644 index 0000000..29b1ae4 --- /dev/null +++ b/tests/roots/test-linkcheck-too-many-retries/index.rst @@ -0,0 +1 @@ +`Non-existing uri with localhost <https://localhost:7777/doesnotexist>`_ diff --git a/tests/roots/test-linkcheck/conf.py b/tests/roots/test-linkcheck/conf.py new file mode 100644 index 0000000..6ddb41a --- /dev/null +++ b/tests/roots/test-linkcheck/conf.py @@ -0,0 +1,4 @@ +root_doc = 'links' +exclude_patterns = ['_build'] +linkcheck_anchors = True +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck/links.rst b/tests/roots/test-linkcheck/links.rst new file mode 100644 index 0000000..88c757e --- /dev/null +++ b/tests/roots/test-linkcheck/links.rst @@ -0,0 +1,14 @@ +Some additional anchors to exercise ignore code + +* `Valid url <http://localhost:7777/>`_ +* `Bar anchor invalid (trailing slash) <http://localhost:7777/#!bar>`_ +* `Bar anchor invalid <http://localhost:7777#!bar>`_ tests that default ignore anchor of #! does not need to be prefixed with / +* `Top anchor invalid <http://localhost:7777/#top>`_ +* `'does-not-exist' anchor invalid <http://localhost:7777#does-not-exist>`_ +* `Valid local file <conf.py>`_ +* `Invalid local file <path/to/notfound>`_ + +.. image:: http://localhost:7777/image.png +.. figure:: http://localhost:7777/image2.png + +* `Valid anchored url <http://localhost:7777/anchor.html#found>`_ diff --git a/tests/roots/test-local-logo/conf.py b/tests/roots/test-local-logo/conf.py new file mode 100644 index 0000000..1a166c1 --- /dev/null +++ b/tests/roots/test-local-logo/conf.py @@ -0,0 +1,4 @@ +latex_documents = [ + ('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report') +] +html_logo = "images/img.png" diff --git a/tests/roots/test-local-logo/images/img.png b/tests/roots/test-local-logo/images/img.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-local-logo/images/img.png diff --git a/tests/roots/test-local-logo/index.rst b/tests/roots/test-local-logo/index.rst new file mode 100644 index 0000000..af12ed6 --- /dev/null +++ b/tests/roots/test-local-logo/index.rst @@ -0,0 +1,31 @@ +The basic Sphinx documentation for testing +========================================== + +Sphinx is a tool that makes it easy to create intelligent and beautiful +documentation for Python projects (or other documents consisting of multiple +reStructuredText sources), written by Georg Brandl. It was originally created +for the new Python documentation, and has excellent facilities for Python +project documentation, but C/C++ is supported as well, and more languages are +planned. + +Sphinx uses reStructuredText as its markup language, and many of its strengths +come from the power and straightforwardness of reStructuredText and its parsing +and translating suite, the Docutils. + +features +-------- + +Among its features are the following: + +* Output formats: HTML (including derivative formats such as HTML Help, Epub + and Qt Help), plain text, manual pages and LaTeX or direct PDF output + using rst2pdf +* Extensive cross-references: semantic markup and automatic links + for functions, classes, glossary terms and similar pieces of information +* Hierarchical structure: easy definition of a document tree, with automatic + links to siblings, parents and children +* Automatic indices: general index as well as a module index +* Code handling: automatic highlighting using the Pygments highlighter +* Flexible HTML output using the Jinja 2 templating engine +* Various extensions are available, e.g. for automatic testing of snippets + and inclusion of appropriately formatted docstrings diff --git a/tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.mo b/tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.mo Binary files differnew file mode 100644 index 0000000..6aa00f7 --- /dev/null +++ b/tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.mo diff --git a/tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.po b/tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.po new file mode 100644 index 0000000..ee1f6c2 --- /dev/null +++ b/tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.po @@ -0,0 +1,2 @@ +msgid "Hello world" +msgstr "HELLO WORLD" diff --git a/tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.mo b/tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.mo Binary files differnew file mode 100644 index 0000000..c99a368 --- /dev/null +++ b/tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.mo diff --git a/tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.po b/tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.po new file mode 100644 index 0000000..1ecf6e3 --- /dev/null +++ b/tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.po @@ -0,0 +1,2 @@ +msgid "Hello world" +msgstr "Tere maailm" diff --git a/tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.mo b/tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.mo Binary files differnew file mode 100644 index 0000000..14c34d0 --- /dev/null +++ b/tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.mo diff --git a/tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.po b/tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.po new file mode 100644 index 0000000..d376cf9 --- /dev/null +++ b/tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.po @@ -0,0 +1,2 @@ +msgid "Hello sphinx" +msgstr "HELLO SPHINX" diff --git a/tests/roots/test-manpage_url/conf.py b/tests/roots/test-manpage_url/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-manpage_url/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-manpage_url/index.rst b/tests/roots/test-manpage_url/index.rst new file mode 100644 index 0000000..50d3b04 --- /dev/null +++ b/tests/roots/test-manpage_url/index.rst @@ -0,0 +1,3 @@ + * :manpage:`man(1)` + * :manpage:`ls.1` + * :manpage:`sphinx` diff --git a/tests/roots/test-markup-citation/conf.py b/tests/roots/test-markup-citation/conf.py new file mode 100644 index 0000000..e274bde --- /dev/null +++ b/tests/roots/test-markup-citation/conf.py @@ -0,0 +1,3 @@ +latex_documents = [ + ('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report') +] diff --git a/tests/roots/test-markup-citation/index.rst b/tests/roots/test-markup-citation/index.rst new file mode 100644 index 0000000..238f093 --- /dev/null +++ b/tests/roots/test-markup-citation/index.rst @@ -0,0 +1,9 @@ +test-markup-citation +===================== + +This is a citation ref; [CITE1]_ and [CITE2]_. + +.. [CITE1] This is a citation + +.. [CITE2] This is + a multiline citation diff --git a/tests/roots/test-markup-rubric/conf.py b/tests/roots/test-markup-rubric/conf.py new file mode 100644 index 0000000..e274bde --- /dev/null +++ b/tests/roots/test-markup-rubric/conf.py @@ -0,0 +1,3 @@ +latex_documents = [ + ('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report') +] diff --git a/tests/roots/test-markup-rubric/index.rst b/tests/roots/test-markup-rubric/index.rst new file mode 100644 index 0000000..c2ae68a --- /dev/null +++ b/tests/roots/test-markup-rubric/index.rst @@ -0,0 +1,7 @@ +test-markup-rubric +=================== + +.. rubric:: This is a rubric + +.. rubric:: This is + a multiline rubric diff --git a/tests/roots/test-maxlistdepth/conf.py b/tests/roots/test-maxlistdepth/conf.py new file mode 100644 index 0000000..a3b12a2 --- /dev/null +++ b/tests/roots/test-maxlistdepth/conf.py @@ -0,0 +1,5 @@ +exclude_patterns = ['_build'] + +latex_elements = { + 'maxlistdepth': '10', +} diff --git a/tests/roots/test-maxlistdepth/index.rst b/tests/roots/test-maxlistdepth/index.rst new file mode 100644 index 0000000..5d9bc21 --- /dev/null +++ b/tests/roots/test-maxlistdepth/index.rst @@ -0,0 +1,57 @@ +test-maxlistdepth +================= + + +1. 1 + + 1. 2 + + 1. 3 + + 1. 4 + + 1. 5 + + 1. 6 + + 1. 7 + + 1. 8 + + 1. 9 + + 10a + + - 10b + + .. code-block:: python + + def foo(): + + +- 1 + + - 2 + + - 3 + + - 4 + + - 5 + + - 6 + + - 7 + + - 8 + + 1. 9 + + 10a + + 1. 10b + + .. code-block:: python + + def foo(): + diff --git a/tests/roots/test-metadata/conf.py b/tests/roots/test-metadata/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-metadata/conf.py diff --git a/tests/roots/test-metadata/index.rst b/tests/roots/test-metadata/index.rst new file mode 100644 index 0000000..42af665 --- /dev/null +++ b/tests/roots/test-metadata/index.rst @@ -0,0 +1,46 @@ +:Author: David Goodger +:Address: 123 Example Street + Example, EX Canada + A1B 2C3 +:Contact: goodger@python.org +:Authors: Me; Myself; I +:organization: humankind +:date: $Date: 2006-05-21 22:44:42 +0200 (Son, 21 Mai 2006) $ +:status: This is a "work in progress" +:revision: $Revision: 4564 $ +:version: 1 +:copyright: This document has been placed in the public domain. You + may do with it as you wish. You may copy, modify, + redistribute, reattribute, sell, buy, rent, lease, + destroy, or improve it, quote it at length, excerpt, + incorporate, collate, fold, staple, or mutilate it, or do + anything else to it that your or anyone else's heart + desires. +:field name: This is a generic bibliographic field. +:field name 2: + Generic bibliographic fields may contain multiple body elements. + + Like this. + +:Dedication: + + For Docutils users & co-developers. + +:abstract: + + This document is a demonstration of the reStructuredText markup + language, containing examples of all basic reStructuredText + constructs and many advanced constructs. + +:nocomments: +:orphan: +:tocdepth: 1 + +.. meta:: + :keywords: reStructuredText, demonstration, demo, parser + :description lang=en: A demonstration of the reStructuredText + markup language, containing examples of all basic + constructs and many advanced constructs. + +test-metadata +============== diff --git a/tests/roots/test-need-escaped/bar.rst b/tests/roots/test-need-escaped/bar.rst new file mode 100644 index 0000000..1cccd3c --- /dev/null +++ b/tests/roots/test-need-escaped/bar.rst @@ -0,0 +1,2 @@ +bar +=== diff --git a/tests/roots/test-need-escaped/baz.rst b/tests/roots/test-need-escaped/baz.rst new file mode 100644 index 0000000..52e2e72 --- /dev/null +++ b/tests/roots/test-need-escaped/baz.rst @@ -0,0 +1,2 @@ +baz +=== diff --git a/tests/roots/test-need-escaped/conf.py b/tests/roots/test-need-escaped/conf.py new file mode 100644 index 0000000..0461ea3 --- /dev/null +++ b/tests/roots/test-need-escaped/conf.py @@ -0,0 +1,2 @@ +project = 'need <b>"escaped"</b> project' +smartquotes = False diff --git a/tests/roots/test-need-escaped/foo.rst b/tests/roots/test-need-escaped/foo.rst new file mode 100644 index 0000000..70859b3 --- /dev/null +++ b/tests/roots/test-need-escaped/foo.rst @@ -0,0 +1,15 @@ +<foo> +===== + +.. toctree:: + + quux + +foo "1" +------- + +foo.1-1 +^^^^^^^ + +foo.2 +----- diff --git a/tests/roots/test-need-escaped/index.rst b/tests/roots/test-need-escaped/index.rst new file mode 100644 index 0000000..9ef74e0 --- /dev/null +++ b/tests/roots/test-need-escaped/index.rst @@ -0,0 +1,30 @@ +.. Sphinx Tests documentation master file, created by sphinx-quickstart on Wed Jun 4 23:49:58 2008. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Sphinx Tests's documentation! +======================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + :numbered: + :caption: Table of Contents + :name: mastertoc + + foo + bar + http://sphinx-doc.org/ + baz + qux + +.. index:: + pair: "subsection"; <subsection> + +---------- +subsection +---------- + +subsubsection +------------- diff --git a/tests/roots/test-need-escaped/quux.rst b/tests/roots/test-need-escaped/quux.rst new file mode 100644 index 0000000..07dd0a0 --- /dev/null +++ b/tests/roots/test-need-escaped/quux.rst @@ -0,0 +1,2 @@ +quux +==== diff --git a/tests/roots/test-need-escaped/qux.rst b/tests/roots/test-need-escaped/qux.rst new file mode 100644 index 0000000..26176b9 --- /dev/null +++ b/tests/roots/test-need-escaped/qux.rst @@ -0,0 +1 @@ +qux.rst has no section title diff --git a/tests/roots/test-nested-enumerated-list/conf.py b/tests/roots/test-nested-enumerated-list/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-nested-enumerated-list/conf.py diff --git a/tests/roots/test-nested-enumerated-list/index.rst b/tests/roots/test-nested-enumerated-list/index.rst new file mode 100644 index 0000000..28ad72f --- /dev/null +++ b/tests/roots/test-nested-enumerated-list/index.rst @@ -0,0 +1,21 @@ +nested-enumerated-list +====================== + +5. Sphinx + + d. Documentation builder + e. Egypt + + 10) Pyramid + 11) Nile River + + (x) Atbara + (y) Blue Nile + (#) Sobat + (#) Semliki + (#) Kagera + +6. Markup + + iii. reStructuredText + iv. Markdown diff --git a/tests/roots/test-nested-tables/conf.py b/tests/roots/test-nested-tables/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-nested-tables/conf.py diff --git a/tests/roots/test-nested-tables/index.rst b/tests/roots/test-nested-tables/index.rst new file mode 100644 index 0000000..79110ae --- /dev/null +++ b/tests/roots/test-nested-tables/index.rst @@ -0,0 +1,16 @@ +nested-tables +============= + +.. list-table:: + :header-rows: 1 + + * - heading + - heading + * - content + - .. list-table:: + :header-rows: 1 + + * - heading + - heading + * - content + - content diff --git a/tests/roots/test-nitpicky-warnings/conf.py b/tests/roots/test-nitpicky-warnings/conf.py new file mode 100644 index 0000000..2db221c --- /dev/null +++ b/tests/roots/test-nitpicky-warnings/conf.py @@ -0,0 +1 @@ +nitpicky = True diff --git a/tests/roots/test-nitpicky-warnings/index.rst b/tests/roots/test-nitpicky-warnings/index.rst new file mode 100644 index 0000000..e73840d --- /dev/null +++ b/tests/roots/test-nitpicky-warnings/index.rst @@ -0,0 +1,7 @@ +test-nitpicky-warnings +====================== + +:py:const:`prefix.anything.postfix` +:py:class:`prefix.anything` +:py:class:`anything.postfix` +:js:class:`prefix.anything.postfix` diff --git a/tests/roots/test-numbered-circular/conf.py b/tests/roots/test-numbered-circular/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-numbered-circular/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-numbered-circular/index.rst b/tests/roots/test-numbered-circular/index.rst new file mode 100644 index 0000000..c3129cd --- /dev/null +++ b/tests/roots/test-numbered-circular/index.rst @@ -0,0 +1,5 @@ +.. toctree:: + :numbered: + + sub + diff --git a/tests/roots/test-numbered-circular/sub.rst b/tests/roots/test-numbered-circular/sub.rst new file mode 100644 index 0000000..cebfd65 --- /dev/null +++ b/tests/roots/test-numbered-circular/sub.rst @@ -0,0 +1,3 @@ +.. toctree:: + + index diff --git a/tests/roots/test-numfig/bar.rst b/tests/roots/test-numfig/bar.rst new file mode 100644 index 0000000..c4367c5 --- /dev/null +++ b/tests/roots/test-numfig/bar.rst @@ -0,0 +1,66 @@ +.. _bar: + +=== +Bar +=== + +.. _bar_a: + +Bar A +===== + +.. figure:: rimg.png + + should be Fig.2.1 + +.. csv-table:: should be Table 2.1 + :header-rows: 0 + + hello,world + +.. code-block:: python + :caption: should be List 2.1 + + print('hello world') + +.. toctree:: + + baz + +.. figure:: rimg.png + + should be Fig.2.3 + +.. csv-table:: should be Table 2.3 + :header-rows: 0 + + hello,world + +.. code-block:: python + :caption: should be List 2.3 + + print('hello world') + +.. _bar_b: + +Bar B +===== + +.. _bar_b1: + +Bar B1 +------ + +.. figure:: rimg.png + + should be Fig.2.4 + +.. csv-table:: should be Table 2.4 + :header-rows: 0 + + hello,world + +.. code-block:: python + :caption: should be List 2.4 + + print('hello world') diff --git a/tests/roots/test-numfig/baz.rst b/tests/roots/test-numfig/baz.rst new file mode 100644 index 0000000..3ac684b --- /dev/null +++ b/tests/roots/test-numfig/baz.rst @@ -0,0 +1,24 @@ +.. _baz_a: + +Baz A +----- + +.. _fig22: + +.. figure:: rimg.png + + should be Fig.2.2 + +.. _table22: + +.. csv-table:: should be Table 2.2 + :header-rows: 0 + + hello,world + +.. _CODE22: + +.. code-block:: python + :caption: should be List 2.2 + + print('hello world') diff --git a/tests/roots/test-numfig/conf.py b/tests/roots/test-numfig/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-numfig/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-numfig/foo.rst b/tests/roots/test-numfig/foo.rst new file mode 100644 index 0000000..6b6a865 --- /dev/null +++ b/tests/roots/test-numfig/foo.rst @@ -0,0 +1,81 @@ +.. _foo: + +=== +Foo +=== + +.. figure:: rimg.png + + should be Fig.1.1 + +.. csv-table:: should be Table 1.1 + :header-rows: 0 + + hello,world + +.. code-block:: python + :caption: should be List 1.1 + + print('hello world') + +.. _foo_a: + +Foo A +===== + +.. figure:: rimg.png + + should be Fig.1.2 + +.. figure:: rimg.png + + should be Fig.1.3 + +.. csv-table:: should be Table 1.2 + :header-rows: 0 + + hello,world + +.. csv-table:: should be Table 1.3 + :header-rows: 0 + + hello,world + +.. code-block:: python + :caption: should be List 1.2 + + print('hello world') + +.. code-block:: python + :caption: should be List 1.3 + + print('hello world') + +.. _foo_a1: + +Foo A1 +------ + +.. _foo_b: + +Foo B +===== + +.. _foo_b1: + +Foo B1 +------ + +.. figure:: rimg.png + + should be Fig.1.4 + +.. csv-table:: should be Table 1.4 + :header-rows: 0 + + hello,world + +.. code-block:: python + :caption: should be List 1.4 + + print('hello world') diff --git a/tests/roots/test-numfig/index.rst b/tests/roots/test-numfig/index.rst new file mode 100644 index 0000000..9399038 --- /dev/null +++ b/tests/roots/test-numfig/index.rst @@ -0,0 +1,59 @@ +.. _index: + +test-tocdepth +============= + +.. toctree:: + :numbered: + + foo + bar + +.. _fig1: + +.. figure:: rimg.png + + should be Fig.1 + +.. figure:: rimg.png + + should be Fig.2 + +.. _table-1: + +.. csv-table:: should be Table 1 + :header-rows: 0 + + hello,world + +.. csv-table:: should be Table 2 + :header-rows: 0 + + hello,world + +.. _CODE_1: + +.. code-block:: python + :caption: should be List 1 + + print('hello world') + +.. code-block:: python + :caption: should be List 2 + + print('hello world') + + +* Fig.1 is :numref:`fig1` +* Fig.2.2 is :numref:`Figure%s <fig22>` +* Table.1 is :numref:`table-1` +* Table.2.2 is :numref:`Table:%s <table22>` +* List.1 is :numref:`CODE_1` +* List.2.2 is :numref:`Code-%s <CODE22>` +* Section.1 is :numref:`foo` +* Section.2.1 is :numref:`bar_a` +* Unnumbered section is :numref:`index` +* Invalid numfig_format 01: :numref:`invalid <fig1>` +* Invalid numfig_format 02: :numref:`Fig %s %s <fig1>` +* Fig.1 is :numref:`Fig.{number} {name} <fig1>` +* Section.1 is :numref:`Sect.{number} {name} <foo>` diff --git a/tests/roots/test-numfig/rimg.png b/tests/roots/test-numfig/rimg.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-numfig/rimg.png diff --git a/tests/roots/test-object-description-sections/conf.py b/tests/roots/test-object-description-sections/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-object-description-sections/conf.py diff --git a/tests/roots/test-object-description-sections/index.rst b/tests/roots/test-object-description-sections/index.rst new file mode 100644 index 0000000..1892f94 --- /dev/null +++ b/tests/roots/test-object-description-sections/index.rst @@ -0,0 +1,6 @@ +.. py:function:: func() + + Overview + -------- + + Lorem ipsum dolar sit amet diff --git a/tests/roots/test-productionlist/Bare.rst b/tests/roots/test-productionlist/Bare.rst new file mode 100644 index 0000000..8ea9213 --- /dev/null +++ b/tests/roots/test-productionlist/Bare.rst @@ -0,0 +1,6 @@ +Bare +==== + +.. productionlist:: + A: `A` | somethingA + B: `B` | somethingB diff --git a/tests/roots/test-productionlist/Dup1.rst b/tests/roots/test-productionlist/Dup1.rst new file mode 100644 index 0000000..5cd09cb --- /dev/null +++ b/tests/roots/test-productionlist/Dup1.rst @@ -0,0 +1,5 @@ +Dup1 +==== + +.. productionlist:: + Dup: `Dup` | somethingDup diff --git a/tests/roots/test-productionlist/Dup2.rst b/tests/roots/test-productionlist/Dup2.rst new file mode 100644 index 0000000..1d66375 --- /dev/null +++ b/tests/roots/test-productionlist/Dup2.rst @@ -0,0 +1,5 @@ +Dup2 +==== + +.. productionlist:: + Dup: `Dup` | somethingDup diff --git a/tests/roots/test-productionlist/LineContinuation.rst b/tests/roots/test-productionlist/LineContinuation.rst new file mode 100644 index 0000000..4943e8b --- /dev/null +++ b/tests/roots/test-productionlist/LineContinuation.rst @@ -0,0 +1,6 @@ +LineContinuation +================ + +.. productionlist:: lineContinuation + A: B C D \ + E F G diff --git a/tests/roots/test-productionlist/P1.rst b/tests/roots/test-productionlist/P1.rst new file mode 100644 index 0000000..6f9a863 --- /dev/null +++ b/tests/roots/test-productionlist/P1.rst @@ -0,0 +1,6 @@ +P1 +== + +.. productionlist:: P1 + A: `A` | somethingA + B: `B` | somethingB diff --git a/tests/roots/test-productionlist/P2.rst b/tests/roots/test-productionlist/P2.rst new file mode 100644 index 0000000..e6c3bc1 --- /dev/null +++ b/tests/roots/test-productionlist/P2.rst @@ -0,0 +1,6 @@ +P2 +== + +.. productionlist:: P2 + A: `A` | somethingA + B: `B` | somethingB diff --git a/tests/roots/test-productionlist/conf.py b/tests/roots/test-productionlist/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-productionlist/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-productionlist/firstLineRule.rst b/tests/roots/test-productionlist/firstLineRule.rst new file mode 100644 index 0000000..30ea6e0 --- /dev/null +++ b/tests/roots/test-productionlist/firstLineRule.rst @@ -0,0 +1,5 @@ +FirstLineRule +============= + +.. productionlist:: FirstLine: something + SecondLine: somethingElse diff --git a/tests/roots/test-productionlist/index.rst b/tests/roots/test-productionlist/index.rst new file mode 100644 index 0000000..4a0b978 --- /dev/null +++ b/tests/roots/test-productionlist/index.rst @@ -0,0 +1,27 @@ +.. toctree:: + + P1 + P2 + Bare + Dup1 + Dup2 + firstLineRule + LineContinuation + +- A: :token:`A` +- B: :token:`B` +- P1:A: :token:`P1:A` +- P1:B: :token:`P1:B` +- P2:A: :token:`P1:A` +- P2:B: :token:`P2:B` +- Explicit title A, plain: :token:`MyTitle <A>` +- Explicit title A, colon: :token:`My:Title <A>` +- Explicit title P1:A, plain: :token:`MyTitle <P1:A>` +- Explicit title P1:A, colon: :token:`My:Title <P1:A>` +- Tilde A: :token:`~A`. +- Tilde P1:A: :token:`~P1:A`. +- Tilde explicit title P1:A: :token:`~MyTitle <P1:A>` +- Tilde, explicit title P1:A: :token:`MyTitle <~P1:A>` +- Dup: :token:`Dup` +- FirstLine: :token:`FirstLine` +- SecondLine: :token:`SecondLine` diff --git a/tests/roots/test-prolog/conf.py b/tests/roots/test-prolog/conf.py new file mode 100644 index 0000000..f6be09c --- /dev/null +++ b/tests/roots/test-prolog/conf.py @@ -0,0 +1,10 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + + +extensions = ['prolog_markdown_parser'] + +rst_prolog = '*Hello world*.\n\n' +rst_epilog = '\n\n*Good-bye world*.' diff --git a/tests/roots/test-prolog/index.rst b/tests/roots/test-prolog/index.rst new file mode 100644 index 0000000..2178d73 --- /dev/null +++ b/tests/roots/test-prolog/index.rst @@ -0,0 +1,7 @@ +prolog and epilog +================= + +.. toctree:: + + restructuredtext + markdown diff --git a/tests/roots/test-prolog/markdown.md b/tests/roots/test-prolog/markdown.md new file mode 100644 index 0000000..e400720 --- /dev/null +++ b/tests/roots/test-prolog/markdown.md @@ -0,0 +1,3 @@ +# sample document + +This is a sample document in markdown diff --git a/tests/roots/test-prolog/prolog_markdown_parser.py b/tests/roots/test-prolog/prolog_markdown_parser.py new file mode 100644 index 0000000..f8d787c --- /dev/null +++ b/tests/roots/test-prolog/prolog_markdown_parser.py @@ -0,0 +1,13 @@ +from docutils.parsers import Parser + + +class DummyMarkdownParser(Parser): + supported = ('markdown',) + + def parse(self, inputstring, document): + document.rawsource = inputstring + + +def setup(app): + app.add_source_suffix('.md', 'markdown') + app.add_source_parser(DummyMarkdownParser) diff --git a/tests/roots/test-prolog/restructuredtext.rst b/tests/roots/test-prolog/restructuredtext.rst new file mode 100644 index 0000000..f1fafb6 --- /dev/null +++ b/tests/roots/test-prolog/restructuredtext.rst @@ -0,0 +1,4 @@ +sample document +=============== + +This is a sample document in reST diff --git a/tests/roots/test-pycode/cp_1251_coded.py b/tests/roots/test-pycode/cp_1251_coded.py new file mode 100644 index 0000000..43d98f3 --- /dev/null +++ b/tests/roots/test-pycode/cp_1251_coded.py @@ -0,0 +1,4 @@ +#!python
+# -*- coding: windows-1251 -*-
+
+X="Õ" #:It MUST look like X="Õ"
\ No newline at end of file diff --git a/tests/roots/test-reST-code-block/conf.py b/tests/roots/test-reST-code-block/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-reST-code-block/conf.py diff --git a/tests/roots/test-reST-code-block/index.rst b/tests/roots/test-reST-code-block/index.rst new file mode 100644 index 0000000..a7c7df0 --- /dev/null +++ b/tests/roots/test-reST-code-block/index.rst @@ -0,0 +1,7 @@ +.. code-block:: + :linenos: + + def hello(name) + print("hello", name) + + hello("Sphinx") diff --git a/tests/roots/test-reST-code-role/conf.py b/tests/roots/test-reST-code-role/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-reST-code-role/conf.py diff --git a/tests/roots/test-reST-code-role/index.rst b/tests/roots/test-reST-code-role/index.rst new file mode 100644 index 0000000..5be6bfc --- /dev/null +++ b/tests/roots/test-reST-code-role/index.rst @@ -0,0 +1,9 @@ +.. role:: python(code) + :language: python + :class: highlight + +Inline :python:`def foo(1 + 2 + None + "abc"): pass` code block + +.. code-block:: python + + def foo(1 + 2 + None + "abc"): pass diff --git a/tests/roots/test-refonly_bullet_list/conf.py b/tests/roots/test-refonly_bullet_list/conf.py new file mode 100644 index 0000000..bdccf9c --- /dev/null +++ b/tests/roots/test-refonly_bullet_list/conf.py @@ -0,0 +1 @@ +html_compact_lists = False diff --git a/tests/roots/test-refonly_bullet_list/index.rst b/tests/roots/test-refonly_bullet_list/index.rst new file mode 100644 index 0000000..9d8539d --- /dev/null +++ b/tests/roots/test-refonly_bullet_list/index.rst @@ -0,0 +1,14 @@ +test-refonly_bullet_list +======================== + +List A: + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + +List B: + +* Hello +* Sphinx +* World diff --git a/tests/roots/test-remote-logo/conf.py b/tests/roots/test-remote-logo/conf.py new file mode 100644 index 0000000..07949ba --- /dev/null +++ b/tests/roots/test-remote-logo/conf.py @@ -0,0 +1,5 @@ +latex_documents = [ + ('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report') +] +html_logo = "https://www.python.org/static/img/python-logo.png" +html_favicon = "https://www.python.org/static/favicon.ico" diff --git a/tests/roots/test-remote-logo/index.rst b/tests/roots/test-remote-logo/index.rst new file mode 100644 index 0000000..af12ed6 --- /dev/null +++ b/tests/roots/test-remote-logo/index.rst @@ -0,0 +1,31 @@ +The basic Sphinx documentation for testing +========================================== + +Sphinx is a tool that makes it easy to create intelligent and beautiful +documentation for Python projects (or other documents consisting of multiple +reStructuredText sources), written by Georg Brandl. It was originally created +for the new Python documentation, and has excellent facilities for Python +project documentation, but C/C++ is supported as well, and more languages are +planned. + +Sphinx uses reStructuredText as its markup language, and many of its strengths +come from the power and straightforwardness of reStructuredText and its parsing +and translating suite, the Docutils. + +features +-------- + +Among its features are the following: + +* Output formats: HTML (including derivative formats such as HTML Help, Epub + and Qt Help), plain text, manual pages and LaTeX or direct PDF output + using rst2pdf +* Extensive cross-references: semantic markup and automatic links + for functions, classes, glossary terms and similar pieces of information +* Hierarchical structure: easy definition of a document tree, with automatic + links to siblings, parents and children +* Automatic indices: general index as well as a module index +* Code handling: automatic highlighting using the Pygments highlighter +* Flexible HTML output using the Jinja 2 templating engine +* Various extensions are available, e.g. for automatic testing of snippets + and inclusion of appropriately formatted docstrings diff --git a/tests/roots/test-roles-download/another/dummy.dat b/tests/roots/test-roles-download/another/dummy.dat new file mode 100644 index 0000000..f6d9fed --- /dev/null +++ b/tests/roots/test-roles-download/another/dummy.dat @@ -0,0 +1 @@ +this one will have some content diff --git a/tests/roots/test-roles-download/conf.py b/tests/roots/test-roles-download/conf.py new file mode 100644 index 0000000..e274bde --- /dev/null +++ b/tests/roots/test-roles-download/conf.py @@ -0,0 +1,3 @@ +latex_documents = [ + ('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report') +] diff --git a/tests/roots/test-roles-download/dummy.dat b/tests/roots/test-roles-download/dummy.dat new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-roles-download/dummy.dat diff --git a/tests/roots/test-roles-download/index.rst b/tests/roots/test-roles-download/index.rst new file mode 100644 index 0000000..cdb075e --- /dev/null +++ b/tests/roots/test-roles-download/index.rst @@ -0,0 +1,7 @@ +test-roles-download +=================== + +* :download:`dummy.dat` +* :download:`another/dummy.dat` +* :download:`not_found.dat` +* :download:`Sphinx logo <http://www.sphinx-doc.org/en/master/_static/sphinxheader.png>` diff --git a/tests/roots/test-root/Makefile b/tests/roots/test-root/Makefile new file mode 100644 index 0000000..85a93bc --- /dev/null +++ b/tests/roots/test-root/Makefile @@ -0,0 +1,67 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build + +# Internal variables. +ALLSPHINXOPTS = -d _build/doctrees $(SPHINXOPTS) . + +.PHONY: help clean html web pickle htmlhelp latex changes linkcheck + +help: + @echo "Please use \`make <target>' where <target> is one of" + @echo " html to make standalone HTML files" + @echo " pickle to make pickle files (usable by e.g. sphinx-web)" + @echo " htmlhelp to make HTML files and an HTML help project" + @echo " latex to make LaTeX files" + @echo " changes to make an overview over all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + +clean: + rm -rf _build/* + +html: + mkdir -p _build/html _build/doctrees + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html + @echo + @echo "Build finished. The HTML pages are in _build/html." + +pickle: + mkdir -p _build/pickle _build/doctrees + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle + @echo + @echo "Build finished; now you can process the pickle files or run" + @echo " sphinx-web _build/pickle" + @echo "to start the sphinx-web server." + +web: pickle + +htmlhelp: + mkdir -p _build/htmlhelp _build/doctrees + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in _build/htmlhelp." + +latex: + mkdir -p _build/latex _build/doctrees + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex + @echo + @echo "Build finished; the LaTeX files are in _build/latex." + @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ + "run these through (pdf)latex." + +changes: + mkdir -p _build/changes _build/doctrees + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes + @echo + @echo "The overview file is in _build/changes." + +linkcheck: + mkdir -p _build/linkcheck _build/doctrees + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in _build/linkcheck/output.txt." diff --git a/tests/roots/test-root/_templates/contentssb.html b/tests/roots/test-root/_templates/contentssb.html new file mode 100644 index 0000000..d0c276a --- /dev/null +++ b/tests/roots/test-root/_templates/contentssb.html @@ -0,0 +1,2 @@ +{# sidebar only for contents document #} +<h4>Contents sidebar</h4> diff --git a/tests/roots/test-root/_templates/customsb.html b/tests/roots/test-root/_templates/customsb.html new file mode 100644 index 0000000..0cd6735 --- /dev/null +++ b/tests/roots/test-root/_templates/customsb.html @@ -0,0 +1,4 @@ +{# custom sidebar template #} +<h4>Custom sidebar</h4> + +{{ toctree(titles_only=True, maxdepth=1) }} diff --git a/tests/roots/test-root/_templates/layout.html b/tests/roots/test-root/_templates/layout.html new file mode 100644 index 0000000..db685b0 --- /dev/null +++ b/tests/roots/test-root/_templates/layout.html @@ -0,0 +1,15 @@ +{% extends "!layout.html" %} + +{% block extrahead %} +{# html_context variable from conf.py #} +<meta name="hc" content="{{ hckey }}" /> +{# html_context variable from confoverrides (as if given on cmdline) #} +<meta name="hc_co" content="{{ hckey_co }}" /> +{{ super() }} +{% endblock %} + +{% block sidebartoc %} +{# display global TOC in addition to local TOC #} +{{ super() }} +{{ toctree(collapse=False, maxdepth=-1) }} +{% endblock %} diff --git a/tests/roots/test-root/autodoc.txt b/tests/roots/test-root/autodoc.txt new file mode 100644 index 0000000..959ab2d --- /dev/null +++ b/tests/roots/test-root/autodoc.txt @@ -0,0 +1,39 @@ +Autodoc tests +============= + +Just testing a few autodoc possibilities... + +.. automodule:: autodoc_target + :members: + +.. autofunction:: function + +.. autoclass:: Class + :inherited-members: + + Additional content. + +.. autoclass:: Outer + :members: Inner + +.. autoattribute:: Class.docattr + +.. autoexception:: CustomEx + :members: f + +.. autoclass:: CustomDict + :show-inheritance: + :members: + + +.. currentmodule:: autodoc_target + +.. autoclass:: InstAttCls + :members: + + All members (5 total) + +.. autoclass:: InstAttCls + :members: ca1, ia1 + + Specific members (2 total) diff --git a/tests/roots/test-root/autodoc_target.py b/tests/roots/test-root/autodoc_target.py new file mode 100644 index 0000000..59f6c74 --- /dev/null +++ b/tests/roots/test-root/autodoc_target.py @@ -0,0 +1,221 @@ +import enum +from io import StringIO + +__all__ = ['Class'] + +#: documentation for the integer +integer = 1 + + +def raises(exc, func, *args, **kwds): + """Raise AssertionError if ``func(*args, **kwds)`` does not raise *exc*.""" + pass + + +class CustomEx(Exception): + """My custom exception.""" + + def f(self): + """Exception method.""" + + +class CustomDataDescriptor: + """Descriptor class docstring.""" + + def __init__(self, doc): + self.__doc__ = doc + + def __get__(self, obj, type=None): + if obj is None: + return self + return 42 + + def meth(self): + """Function.""" + return "The Answer" + + +class CustomDataDescriptorMeta(type): + """Descriptor metaclass docstring.""" + + +class CustomDataDescriptor2(CustomDataDescriptor): + """Descriptor class with custom metaclass docstring.""" + __metaclass__ = CustomDataDescriptorMeta + + +def _funky_classmethod(name, b, c, d, docstring=None): + """Generates a classmethod for a class from a template by filling out + some arguments.""" + def template(cls, a, b, c, d=4, e=5, f=6): + return a, b, c, d, e, f + from functools import partial + function = partial(template, b=b, c=c, d=d) + function.__name__ = name + function.__doc__ = docstring + return classmethod(function) + + +class Base: + def inheritedmeth(self): + """Inherited function.""" + + +class Derived(Base): + def inheritedmeth(self): + # no docstring here + pass + + +class Class(Base): + """Class to document.""" + + descr = CustomDataDescriptor("Descriptor instance docstring.") + + def meth(self): + """Function.""" + + def undocmeth(self): + pass + + def skipmeth(self): + """Method that should be skipped.""" + + def excludemeth(self): + """Method that should be excluded.""" + + # should not be documented + skipattr = 'foo' + + #: should be documented -- süß + attr = 'bar' + + @property + def prop(self): + """Property.""" + + docattr = 'baz' + """should likewise be documented -- süß""" + + udocattr = 'quux' + """should be documented as well - süß""" + + # initialized to any class imported from another module + mdocattr = StringIO() + """should be documented as well - süß""" + + roger = _funky_classmethod("roger", 2, 3, 4) + + moore = _funky_classmethod("moore", 9, 8, 7, + docstring="moore(a, e, f) -> happiness") + + def __init__(self, arg): + self.inst_attr_inline = None #: an inline documented instance attr + #: a documented instance attribute + self.inst_attr_comment = None + self.inst_attr_string = None + """a documented instance attribute""" + self._private_inst_attr = None #: a private instance attribute + + def __special1__(self): + """documented special method""" + + def __special2__(self): + # undocumented special method + pass + + +class CustomDict(dict): + """Docstring.""" + + +def function(foo, *args, **kwds): + """ + Return spam. + """ + pass + + +class Outer: + """Foo""" + + class Inner: + """Foo""" + + def meth(self): + """Foo""" + + # should be documented as an alias + factory = dict + + +class DocstringSig: + def meth(self): + """meth(FOO, BAR=1) -> BAZ +First line of docstring + + rest of docstring + """ + + def meth2(self): + """First line, no signature + Second line followed by indentation:: + + indented line + """ + + @property + def prop1(self): + """DocstringSig.prop1(self) + First line of docstring + """ + return 123 + + @property + def prop2(self): + """First line of docstring + Second line of docstring + """ + return 456 + + +class StrRepr(str): + def __repr__(self): + return self + + +class AttCls: + a1 = StrRepr('hello\nworld') + a2 = None + + +class InstAttCls: + """Class with documented class and instance attributes.""" + + #: Doc comment for class attribute InstAttCls.ca1. + #: It can have multiple lines. + ca1 = 'a' + + ca2 = 'b' #: Doc comment for InstAttCls.ca2. One line only. + + ca3 = 'c' + """Docstring for class attribute InstAttCls.ca3.""" + + def __init__(self): + #: Doc comment for instance attribute InstAttCls.ia1 + self.ia1 = 'd' + + self.ia2 = 'e' + """Docstring for instance attribute InstAttCls.ia2.""" + + +class EnumCls(enum.Enum): + """ + this is enum class + """ + + #: doc for val1 + val1 = 12 + val2 = 23 #: doc for val2 + val3 = 34 + """doc for val3""" diff --git a/tests/roots/test-root/bom.txt b/tests/roots/test-root/bom.txt new file mode 100644 index 0000000..3fea824 --- /dev/null +++ b/tests/roots/test-root/bom.txt @@ -0,0 +1,5 @@ +File with UTF-8 BOM +=================== + +This file has a UTF-8 "BOM". + diff --git a/tests/roots/test-root/conf.py b/tests/roots/test-root/conf.py new file mode 100644 index 0000000..154d4d1 --- /dev/null +++ b/tests/roots/test-root/conf.py @@ -0,0 +1,148 @@ +import os +import sys + +from docutils import nodes +from docutils.parsers.rst import Directive + +from sphinx import addnodes + +sys.path.append(os.path.abspath('.')) + +extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.extlinks'] + +jsmath_path = 'dummy.js' + +templates_path = ['_templates'] + +source_suffix = ['.txt', '.add', '.foo'] + +project = 'Sphinx <Tests>' +copyright = '1234-6789, copyright text credits' +# If this is changed, remember to update the versionchanges! +version = '0.6' +release = '0.6alpha1' +today_fmt = '%B %d, %Y' +exclude_patterns = ['_build', '**/excluded.*'] +keep_warnings = True +pygments_style = 'sphinx' +show_authors = True +numfig = True + +html_sidebars = {'**': ['localtoc.html', 'relations.html', 'sourcelink.html', + 'customsb.html', 'searchbox.html'], + 'index': ['contentssb.html', 'localtoc.html', 'globaltoc.html']} +html_last_updated_fmt = '%b %d, %Y' +html_context = {'hckey': 'hcval', 'hckey_co': 'wrong_hcval_co'} + +latex_additional_files = ['svgimg.svg'] +# some random pdf layout parameters to check they don't break build +latex_elements = { + 'sphinxsetup': """ + verbatimwithframe, + verbatimwrapslines, + verbatimforcewraps, + verbatimmaxoverfull=1, + verbatimmaxunderfull=5, + verbatimhintsturnover=true, + verbatimcontinuesalign=l, + VerbatimColor={RGB}{242,242,242}, + VerbatimBorderColor={RGB}{32,32,32}, + VerbatimHighlightColor={RGB}{200,200,200}, + pre_box-decoration-break=slice, + pre_border-top-left-radius=20pt, + pre_border-top-right-radius=0pt, + pre_border-bottom-right-radius=20pt, + pre_border-bottom-left-radius=0pt, + verbatimsep=1pt, + pre_padding=5pt,% alias to verbatimsep + pre_border-top-width=5pt, + pre_border-right-width=10pt, + pre_border-bottom-width=15pt, + pre_border-left-width=20pt, + pre_border-width=3pt,% overrides all previous four + verbatimborder=2pt,% alias to pre_border-width +% + shadowrule=1pt, + shadowsep=10pt, + shadowsize=10pt, + div.topic_border-width=2pt,% alias to shadowrule + div.topic_padding=6pt,% alias to shadowsep + div.topic_box-shadow=5pt,% overrides/alias shadowsize +% + noteBorderColor={RGB}{204,204,204}, + hintBorderColor={RGB}{204,204,204}, + importantBorderColor={RGB}{204,204,204}, + tipBorderColor={RGB}{204,204,204}, +% + noteborder=5pt, + hintborder=5pt, + importantborder=5pt, + tipborder=5pt, +% + warningborder=3pt, + cautionborder=3pt, + attentionborder=3pt, + errorborder=3pt, +% + dangerborder=3pt, + div.danger_border-width=10pt, + div.danger_background-TeXcolor={rgb}{0,1,0}, + div.danger_border-TeXcolor={rgb}{0,0,1}, + div.danger_box-shadow=20pt -20pt, + div.danger_box-shadow-TeXcolor={rgb}{0.5,0.5,0.5}, +% + warningBorderColor={RGB}{255,119,119}, + cautionBorderColor={RGB}{255,119,119}, + attentionBorderColor={RGB}{255,119,119}, + dangerBorderColor={RGB}{255,119,119}, + errorBorderColor={RGB}{255,119,119}, + warningBgColor={RGB}{255,238,238}, + cautionBgColor={RGB}{255,238,238}, + attentionBgColor={RGB}{255,238,238}, + dangerBgColor={RGB}{255,238,238}, + errorBgColor={RGB}{255,238,238}, +% + TableRowColorHeader={rgb}{0,1,0}, + TableRowColorOdd={rgb}{0.5,0,0}, + TableRowColorEven={rgb}{0.1,0.1,0.1}, +""", +} + +coverage_c_path = ['special/*.h'] +coverage_c_regexes = {'function': r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'} + +extlinks = {'issue': ('http://bugs.python.org/issue%s', 'issue %s'), + 'pyurl': ('http://python.org/%s', None)} + +# modify tags from conf.py +tags.add('confpytag') + + +# -- extension API +def userdesc_parse(env, sig, signode): + x, y = sig.split(':') + signode += addnodes.desc_name(x, x) + signode += addnodes.desc_parameterlist() + signode[-1] += addnodes.desc_parameter(y, y) + return x + + +class ClassDirective(Directive): + option_spec = {'opt': lambda x: x} + + def run(self): + return [nodes.strong(text='from class: %s' % self.options['opt'])] + + +def setup(app): + import parsermod + + app.add_directive('clsdir', ClassDirective) + app.add_object_type('userdesc', 'userdescrole', '%s (userdesc)', + userdesc_parse, objname='user desc') + app.add_js_file('file://moo.js') + app.add_source_suffix('.foo', 'foo') + app.add_source_parser(parsermod.Parser) diff --git a/tests/roots/test-root/extapi.txt b/tests/roots/test-root/extapi.txt new file mode 100644 index 0000000..56be6d8 --- /dev/null +++ b/tests/roots/test-root/extapi.txt @@ -0,0 +1,7 @@ +Extension API tests +=================== + +Testing directives: + +.. clsdir:: + :opt: Bar diff --git a/tests/roots/test-root/extensions.txt b/tests/roots/test-root/extensions.txt new file mode 100644 index 0000000..96b1f8e --- /dev/null +++ b/tests/roots/test-root/extensions.txt @@ -0,0 +1,28 @@ +Test for diverse extensions +=========================== + +extlinks +-------- + +Test diverse links: :issue:`1000` and :pyurl:`dev/`, also with +:issue:`explicit caption <1042>`. + + +todo +---- + +.. todo:: + + Test the todo extension. + +.. todo:: + + Test with |sub| (see #286). + +.. |sub| replace:: substitution references + + +list of all todos +^^^^^^^^^^^^^^^^^ + +.. todolist:: diff --git a/tests/roots/test-root/file_with_special_#_chars.xyz b/tests/roots/test-root/file_with_special_#_chars.xyz new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-root/file_with_special_#_chars.xyz diff --git a/tests/roots/test-root/footnote.txt b/tests/roots/test-root/footnote.txt new file mode 100644 index 0000000..49cceee --- /dev/null +++ b/tests/roots/test-root/footnote.txt @@ -0,0 +1,60 @@ +:tocdepth: 2 + +Testing footnote and citation +================================ +.. #1058 footnote-backlinks-do-not-work + +numbered footnote +-------------------- + +[1]_ + +auto-numbered footnote +------------------------------ + +[#]_ + +named footnote +-------------------- + +[#foo]_ + +citation +-------------------- + +[bar]_ +[baz_qux]_ + +footnotes in table +-------------------- + +.. list-table:: Table caption [#]_ + :header-rows: 1 + + * - name [#]_ + - description + * - VIDIOC_CROPCAP + - Information about VIDIOC_CROPCAP [#]_ + +footenotes +-------------------- + +.. rubric:: Footnotes + +.. [1] numbered + +.. [#] auto numbered + +.. [#foo] named + +.. rubric:: Citations + +.. [bar] cite + +.. [baz_qux] citation including underscore + +.. [#] footnote in table caption + +.. [#] footnote in table header + +.. [#] footnote in table not in header diff --git a/tests/roots/test-root/images.txt b/tests/roots/test-root/images.txt new file mode 100644 index 0000000..1dc591a --- /dev/null +++ b/tests/roots/test-root/images.txt @@ -0,0 +1,25 @@ +Sphinx image handling +===================== + +.. first, a simple test with direct filename +.. image:: img.png + +.. an image with path name (relative to this directory!) +.. image:: subdir/img.png + :height: 100 + :width: 200 + +.. an image with unspecified extension +.. image:: img.* + +.. a non-local image URI +.. image:: https://www.python.org/static/img/python-logo.png + +.. an image with subdir and unspecified extension +.. image:: subdir/simg.* + +.. an SVG image (for HTML at least) +.. image:: svgimg.* + +.. an image with more than 1 dot in its file name +.. image:: img.foo.png diff --git a/tests/roots/test-root/img.foo.png b/tests/roots/test-root/img.foo.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-root/img.foo.png diff --git a/tests/roots/test-root/img.gif b/tests/roots/test-root/img.gif Binary files differnew file mode 100644 index 0000000..8f02686 --- /dev/null +++ b/tests/roots/test-root/img.gif diff --git a/tests/roots/test-root/img.pdf b/tests/roots/test-root/img.pdf Binary files differnew file mode 100644 index 0000000..cacbd85 --- /dev/null +++ b/tests/roots/test-root/img.pdf diff --git a/tests/roots/test-root/img.png b/tests/roots/test-root/img.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-root/img.png diff --git a/tests/roots/test-root/includes.txt b/tests/roots/test-root/includes.txt new file mode 100644 index 0000000..19b98ae --- /dev/null +++ b/tests/roots/test-root/includes.txt @@ -0,0 +1,102 @@ +Testing downloadable files +========================== + +Download :download:`img.png` here. +Download :download:`this <subdir/img.png>` there. +Download :download:`file with special characters <file_with_special_#_chars.xyz>`. + +Test file and literal inclusion +=============================== + +.. include:: subdir/include.inc + +.. include:: /subdir/include.inc + +.. literalinclude:: literal.inc + :language: python + +.. should succeed +.. literalinclude:: wrongenc.inc + :encoding: latin-1 + :language: none +.. include:: wrongenc.inc + :encoding: latin-1 + +Literalinclude options +====================== + +.. highlight:: text + +.. cssclass:: inc-pyobj1 +.. literalinclude:: literal.inc + :pyobject: Foo + +.. cssclass:: inc-pyobj2 +.. literalinclude:: literal.inc + :pyobject: Bar.baz + +.. cssclass:: inc-lines +.. literalinclude:: literal.inc + :lines: 6-7,9 + :lineno-start: 6 + +.. cssclass:: inc-startend +.. literalinclude:: literal.inc + :start-after: coding: utf-8 + :end-before: class Foo + +.. cssclass:: inc-preappend +.. literalinclude:: literal.inc + :prepend: START CODE + :append: END CODE + +.. literalinclude:: literal.inc + :start-after: utf-8 + +.. literalinclude:: literal.inc + :end-before: class Foo + +.. literalinclude:: literal.inc + :diff: literal_orig.inc + +.. cssclass:: inc-tab3 +.. literalinclude:: tabs.inc + :tab-width: 3 + :language: text + +.. cssclass:: inc-tab8 +.. literalinclude:: tabs.inc + :tab-width: 8 + :language: python + +.. cssclass:: inc-pyobj-lines-match +.. literalinclude:: literal.inc + :pyobject: Foo + :lineno-match: + +.. cssclass:: inc-lines-match +.. literalinclude:: literal.inc + :lines: 6-7,8 + :lineno-match: + +.. cssclass:: inc-startend-match +.. literalinclude:: literal.inc + :start-after: coding: utf-8 + :end-before: class Foo + :lineno-match: + +Test if dedenting before parsing works. + +.. highlight:: python + +.. cssclass:: inc-pyobj-dedent +.. literalinclude:: literal.inc + :pyobject: Bar.baz + +Docutils include with "literal" +=============================== + +While not recommended, it should work (and leave quotes alone). + +.. include:: quotes.inc + :literal: diff --git a/tests/roots/test-root/index.txt b/tests/roots/test-root/index.txt new file mode 100644 index 0000000..e39c958 --- /dev/null +++ b/tests/roots/test-root/index.txt @@ -0,0 +1,65 @@ +.. Sphinx Tests documentation master file, created by sphinx-quickstart on Wed Jun 4 23:49:58 2008. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Sphinx Tests's documentation! +======================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + :numbered: + :caption: Table of Contents + :name: mastertoc + + extapi + images + subdir/images + subdir/includes + includes + markup + objects + bom + math + autodoc + extensions + footnote + lists + otherext + + http://sphinx-doc.org/ + Latest reference <http://sphinx-doc.org/latest/> + Python <http://python.org/> + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` + +References +========== + +.. [Ref1] Reference target. +.. [Ref_1] Reference target 2. + +Test for issue #1157 +==================== + +This used to crash: + +.. toctree:: + +.. toctree:: + :hidden: + +Test for issue #1700 +==================== + +:ref:`mastertoc` + +Test for indirect hyperlink targets +=================================== + +:ref:`indirect hyperref <other-label>` diff --git a/tests/roots/test-root/lists.txt b/tests/roots/test-root/lists.txt new file mode 100644 index 0000000..0b54454 --- /dev/null +++ b/tests/roots/test-root/lists.txt @@ -0,0 +1,70 @@ +Various kinds of lists +====================== + + +nested enumerated lists +----------------------- + +#. one + +#. two + + #. two.1 + #. two.2 + +#. three + + +enumerated lists with non-default start values +---------------------------------------------- + +0. zero +#. one + +---------------------------------------- + +1. one +#. two + +---------------------------------------- + +2. two +#. three + + +enumerated lists using letters +------------------------------ + +a. a + +b. b + +#. c + +#. d + +---------------------------------------- + +x. x + +y. y + +#. z + +#. { + +definition lists +----------------- + +term1 + description + +term2 (**stronged partially**) + description + +Samp tests +---------- + +:samp:`{variable_only}` +:samp:`{variable} and text` +:samp:`Show {variable} in the middle` diff --git a/tests/roots/test-root/literal.inc b/tests/roots/test-root/literal.inc new file mode 100644 index 0000000..694f15e --- /dev/null +++ b/tests/roots/test-root/literal.inc @@ -0,0 +1,13 @@ +# Literally included file using Python highlighting +# -*- coding: utf-8 -*- + +foo = "Including Unicode characters: üöä" + +class Foo: + pass + +class Bar: + def baz(): + pass + +def bar(): pass diff --git a/tests/roots/test-root/literal_orig.inc b/tests/roots/test-root/literal_orig.inc new file mode 100644 index 0000000..cfb5dd1 --- /dev/null +++ b/tests/roots/test-root/literal_orig.inc @@ -0,0 +1,12 @@ +# Literally included file using Python highlighting + +foo = "Including Unicode characters: üöä" # This will be changed + +class FooOrig: + pass + +class BarOrig: + def baz(): + pass + +def bar(): pass diff --git a/tests/roots/test-root/markup.txt b/tests/roots/test-root/markup.txt new file mode 100644 index 0000000..b59a652 --- /dev/null +++ b/tests/roots/test-root/markup.txt @@ -0,0 +1,455 @@ +:tocdepth: 2 + +.. title:: set by title directive +.. _1024: + +Testing various markup +====================== + +Meta markup +----------- + +.. sectionauthor:: Georg Brandl +.. moduleauthor:: Georg Brandl + +.. contents:: TOC + +.. meta:: + :author: Me + :keywords: docs, sphinx + + +Generic reST +------------ + +A |subst|! + +.. |subst| replace:: global substitution + +.. highlight:: none + +.. _label: + +:: + + some code + +Option list: + +-h help +--help also help + +Line block: + +| line1 +| line2 +| line3 +| line4 +| line5 +| line6 +| line7 + + +Body directives +^^^^^^^^^^^^^^^ + +.. topic:: Title + + Topic body. + +.. sidebar:: Sidebar + :subtitle: Sidebar subtitle + + Sidebar body. + +.. rubric:: Test rubric + +.. epigraph:: Epigraph title + + Epigraph body. + + -- Author + +.. highlights:: Highlights + + Highlights body. + +.. pull-quote:: Pull-quote + + Pull quote body. + +.. compound:: + + a + + b + +.. parsed-literal:: + + with some *markup* inside + + +.. _admonition-section: + +Admonitions +^^^^^^^^^^^ + +.. admonition:: My Admonition + + Admonition text. + +.. note:: + Note text. + +.. warning:: + + Warning text. + +.. _some-label: + +.. tip:: + Tip text. + +Indirect hyperlink targets + +.. _other-label: some-label_ + +Inline markup +------------- + +*Generic inline markup* + +Adding \n to test unescaping. + +* :command:`command\\n` +* :dfn:`dfn\\n` +* :guilabel:`guilabel with &accelerator and \\n` +* :kbd:`kbd\\n` +* :mailheader:`mailheader\\n` +* :makevar:`makevar\\n` +* :manpage:`manpage\\n` +* :mimetype:`mimetype\\n` +* :newsgroup:`newsgroup\\n` +* :program:`program\\n` +* :regexp:`regexp\\n` +* :menuselection:`File --> Close\\n` +* :menuselection:`&File --> &Print` +* :file:`a/{varpart}/b\\n` +* :samp:`print {i}\\n` + +*Linking inline markup* + +* :pep:`8` +* :pep:`Python Enhancement Proposal #8 <8>` +* :rfc:`1` +* :rfc:`Request for Comments #1 <1>` +* :envvar:`HOME` +* :keyword:`with` +* :token:`try statement <try_stmt>` +* :ref:`admonition-section` +* :ref:`here <some-label>` +* :ref:`there <other-label>` +* :ref:`my-figure` +* :ref:`my-figure-name` +* :ref:`my-table` +* :ref:`my-table-name` +* :ref:`my-code-block` +* :ref:`my-code-block-name` +* :ref:`1024` +* :numref:`my-figure` +* :numref:`my-figure-name` +* :numref:`my-table` +* :numref:`my-table-name` +* :numref:`my-code-block` +* :numref:`my-code-block-name` +* :doc:`subdir/includes` +* ``:download:`` is tested in includes.txt +* :option:`Python -c option <python -c>` + +Test :abbr:`abbr (abbreviation)` and another :abbr:`abbr (abbreviation)`. + +Testing the :index:`index` role, also available with +:index:`explicit <pair: title; explicit>` title. + +.. _with: + +With +---- + +(Empty section.) + + +Tables +------ + +.. tabularcolumns:: |L|p{5cm}|R| + +.. _my-table: + +.. table:: my table + :name: my-table-name + + +----+----------------+----+ + | 1 | * Block elems | x | + | | * In table | | + +----+----------------+----+ + | 2 | Empty cells: | | + +----+----------------+----+ + +.. table:: empty cell in table header + + ===== ====== + \ + ===== ====== + 1 2 + 3 4 + ===== ====== + +Tables with multirow and multicol: + +.. only:: latex + + +----+----------------+---------+ + | 1 | test! | c | + +----+---------+------+ | + | 2 | col | col | | + | y +---------+------+----+----+ + | x | multi-column cell | x | + +----+---------------------+----+ + + +----+ + | 1 | + + + + | | + +----+ + +.. list-table:: + :header-rows: 0 + + * - .. figure:: img.png + + figure in table + + +Figures +------- + +.. _my-figure: + +.. figure:: img.png + :name: my-figure-name + + My caption of the figure + + My description paragraph of the figure. + + Description paragraph is wrapped with legend node. + +.. figure:: rimg.png + :align: right + + figure with align option + +.. figure:: rimg.png + :align: right + :figwidth: 50% + + figure with align & figwidth option + +.. figure:: rimg.png + :align: right + :width: 3cm + + figure with align & width option + +Version markup +-------------- + +.. versionadded:: 0.6 + Some funny **stuff**. + +.. versionchanged:: 0.6 + Even more funny stuff. + +.. deprecated:: 0.6 + Boring stuff. + +.. versionadded:: 1.2 + + First paragraph of versionadded. + +.. versionchanged:: 1.2 + First paragraph of versionchanged. + + Second paragraph of versionchanged. + + +Code blocks +----------- + +.. _my-code-block: + +.. code-block:: ruby + :linenos: + :caption: my ruby code + :name: my-code-block-name + + def ruby? + false + end + +Misc stuff +---------- + +Stuff [#]_ + +Reference lookup: [Ref1]_ (defined in another file). +Reference lookup underscore: [Ref_1]_ + +.. seealso:: something, something else, something more + + `Google <http://www.google.com>`_ + For everything. + +.. hlist:: + :columns: 4 + + * This + * is + * a horizontal + * list + * with several + * items + +.. rubric:: Side note + +This is a side note. + +This tests :CLASS:`role names in uppercase`. + +.. centered:: LICENSE AGREEMENT + +.. acks:: + + * Terry Pratchett + * J. R. R. Tolkien + * Monty Python + +.. glossary:: + :sorted: + + boson + Particle with integer spin. + + *fermion* + Particle with half-integer spin. + + tauon + myon + electron + Examples for fermions. + + über + Gewisse + + ähnlich + Dinge + +.. productionlist:: + try_stmt: `try1_stmt` | `try2_stmt` + try1_stmt: "try" ":" `suite` + : ("except" [`expression` ["," `target`]] ":" `suite`)+ + : ["else" ":" `suite`] + : ["finally" ":" `suite`] + try2_stmt: "try" ":" `suite` + : "finally" ":" `suite` + + +Index markup +------------ + +.. index:: + single: entry + pair: entry; pair + double: entry; double + triple: index; entry; triple + see: from; to + seealso: fromalso; toalso + +.. index:: + !Main, !Other + !single: entry; pair + +:index:`!Main` + +.. _ölabel: + +Ö... Some strange characters +---------------------------- + +Testing öäü... + + +Only directive +-------------- + +.. only:: html + + In HTML. + +.. only:: latex + + In LaTeX. + +.. only:: html or latex + + In both. + +.. only:: confpytag and (testtag or nonexisting_tag) + + Always present, because set through conf.py/command line. + + +Any role +-------- + +.. default-role:: any + +Test referencing to `headings <with>` and `objects <func_without_body>`. +Also `modules <mod>` and `classes <Time>`. + +More domains: + +* `JS <bar.baz>` +* `C <SphinxType>` +* `myobj` (user markup) +* `n::Array` +* `perl -c` + +.. default-role:: + + +Smart quotes +------------ + +* Smart "quotes" in English 'text'. +* Smart --- long and -- short dashes. +* Ellipsis... +* No smartypants in literal blocks: ``foo--"bar"...``. + +.. only:: html + + .. LaTeX does not like Cyrillic letters in this test, so it is HTML only. + + .. rst-class:: language-ru + + Ðтот "абзац" должен иÑпользовать 'руÑÑкие' кавычки. + + .. rst-class:: language-fr + + Il dit : "C'est 'super' !" + +.. rubric:: Footnotes + +.. [#] Like footnotes. + diff --git a/tests/roots/test-root/math.txt b/tests/roots/test-root/math.txt new file mode 100644 index 0000000..5a209be --- /dev/null +++ b/tests/roots/test-root/math.txt @@ -0,0 +1,31 @@ +Test math extensions :math:`E = m c^2` +====================================== + +This is inline math: :math:`a^2 + b^2 = c^2`. + +.. math:: a^2 + b^2 = c^2 + +.. math:: + + a + 1 < b + +.. math:: + :label: foo + + e^{i\pi} = 1 + +.. math:: + :label: + + e^{ix} = \cos x + i\sin x + +.. math:: + + n \in \mathbb N + +.. math:: + :nowrap: + + a + 1 < b + +Referencing equation :eq:`foo`. diff --git a/tests/roots/test-root/objects.txt b/tests/roots/test-root/objects.txt new file mode 100644 index 0000000..ed5f2c2 --- /dev/null +++ b/tests/roots/test-root/objects.txt @@ -0,0 +1,262 @@ +Testing object descriptions +=========================== + +.. function:: func_without_module(a, b, *c[, d]) + + Does something. + +.. function:: func_without_body() + +.. function:: func_with_unknown_field() + + : : + + : empty field name: + + :field_name: + + :field_name all lower: + + :FIELD_NAME: + + :FIELD_NAME ALL CAPS: + + :Field_Name: + + :Field_Name All Word Caps: + + :Field_name: + + :Field_name First word cap: + + :FIELd_name: + + :FIELd_name PARTial caps: + +.. function:: func_noindex + :no-index: + +.. function:: func_with_module + :module: foolib + +Referring to :func:`func with no index <func_noindex>`. +Referring to :func:`nothing <>`. + +.. module:: mod + :synopsis: Module synopsis. + :platform: UNIX + +.. function:: func_in_module + +.. class:: Cls + + .. method:: meth1 + + .. staticmethod:: meths + + .. attribute:: attr + +.. explicit class given +.. method:: Cls.meth2 + +.. explicit module given +.. exception:: Error(arg1, arg2) + :module: errmod + +.. data:: var + + +.. currentmodule:: None + +.. function:: func_without_module2() -> annotation + +.. object:: long(parameter, \ + list) + another one + +.. class:: TimeInt + + Has only one parameter (triggers special behavior...) + + :param moo: |test| + :type moo: |test| + +.. |test| replace:: Moo + +.. class:: Time(hour, minute, isdst) + + :param year: The year. + :type year: TimeInt + :param TimeInt minute: The minute. + :param isdst: whether it's DST + :type isdst: * some complex + * expression + :returns: a new :class:`Time` instance + :rtype: Time + :raises Error: if the values are out of range + :ivar int hour: like *hour* + :ivar minute: like *minute* + :vartype minute: int + :param hour: Some parameter + :type hour: DuplicateType + :param hour: Duplicate param. Should not lead to crashes. + :type hour: DuplicateType + :param .Cls extcls: A class from another module. + +.. raw:: latex + + \begingroup + \let\oldhref\href + \def\href{\ifnum\catcode`\-=\active\errorwithsphinxhref\fi\oldhref} + +.. class:: MyClass + + .. attribute:: config + :type: sphinx.config.Config + + A configuration object. + +.. raw:: latex + + \endgroup + +C items +======= + +.. c:function:: void Sphinx_DoSomething() + +.. c:member:: int SphinxStruct.member + +.. c:macro:: SPHINX_USE_PYTHON + +.. c:type:: SphinxType + +.. c:var:: int sphinx_global + +.. c:function:: PyObject* Py_SphinxFoo(void) + + +Javascript items +================ + +.. js:function:: foo() + +.. js:data:: bar + +.. documenting the method of any object +.. js:function:: bar.baz(href, callback[, errback]) + + :param string href: The location of the resource. + :param callback: Gets called with the data returned by the resource. + :throws InvalidHref: If the `href` is invalid. + :returns: `undefined` + +.. js:attribute:: bar.spam + +References +========== + +Referencing :class:`mod.Cls` or :Class:`mod.Cls` should be the same. + +With target: :c:func:`Sphinx_DoSomething()` (parentheses are handled), +:c:member:`SphinxStruct.member`, :c:macro:`SPHINX_USE_PYTHON`, +:c:type:`SphinxType *` (pointer is handled), :c:data:`sphinx_global`. + +Without target: :c:func:`CFunction`. :c:func:`!malloc`. + +:js:func:`foo()` +:js:func:`foo` + +:js:data:`bar` +:js:func:`bar.baz()` +:js:func:`bar.baz` +:js:func:`~bar.baz()` + +:js:attr:`bar.baz` + + +Others +====== + +.. envvar:: HOME + +.. program:: python + +.. cmdoption:: -c command + +.. program:: perl + +.. cmdoption:: -c + +.. option:: +p + +.. option:: --ObjC++ + +.. option:: --plugin.option + +.. option:: create-auth-token + +.. option:: arg + +.. option:: -j[=N] + +Link to :option:`perl +p`, :option:`--ObjC++`, :option:`--plugin.option`, :option:`create-auth-token`, :option:`arg` and :option:`-j` + +.. program:: hg + +.. option:: commit + +.. program:: git commit + +.. option:: -p + +Link to :option:`hg commit` and :option:`git commit -p`. + +.. option:: --abi={TYPE} + +.. option:: --test={WHERE}-{COUNT} + +.. option:: --wrap=\{\{value\}\} + +.. option:: -allowable_client {client_name} + +Foo bar. + +Test repeated option directive. + +.. option:: -mapi + + My API. + +.. option:: -mapi=secret + + My secret API. + +Reference the first option :option:`-mapi=secret`, :option:`-mapi[=xxx]` +or :option:`-mapi with_space`. + + +User markup +=========== + +.. userdesc:: myobj:parameter + + Description of userdesc. + + +Referencing :userdescrole:`myobj`. + + +CPP domain +========== + +.. cpp:class:: n::Array + + .. cpp:function:: T& operator[]( unsigned j ) + const T& operator[]( unsigned j ) const + +.. cpp:function:: template<typename T1, typename T2> \ + requires A<T1, T2> \ + void f() + +- :cpp:expr:`a + b` diff --git a/tests/roots/test-root/otherext.foo b/tests/roots/test-root/otherext.foo new file mode 100644 index 0000000..531ea29 --- /dev/null +++ b/tests/roots/test-root/otherext.foo @@ -0,0 +1,2 @@ +The contents of this file are ignored. +The file is "parsed" using Parser in the tests/root/parsermod.py file. diff --git a/tests/roots/test-root/parsermod.py b/tests/roots/test-root/parsermod.py new file mode 100644 index 0000000..de0849c --- /dev/null +++ b/tests/roots/test-root/parsermod.py @@ -0,0 +1,14 @@ +from docutils import nodes +from docutils.parsers import Parser + + +class Parser(Parser): + supported = ('foo',) + + def parse(self, input, document): + section = nodes.section(ids=['id1']) + section += nodes.title('Generated section', 'Generated section') + document += section + + def get_transforms(self): + return [] diff --git a/tests/roots/test-root/quotes.inc b/tests/roots/test-root/quotes.inc new file mode 100644 index 0000000..276cc56 --- /dev/null +++ b/tests/roots/test-root/quotes.inc @@ -0,0 +1 @@ +Testing "quotes" in literal 'included' text. diff --git a/tests/roots/test-root/rimg.png b/tests/roots/test-root/rimg.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-root/rimg.png diff --git a/tests/roots/test-root/special/api.h b/tests/roots/test-root/special/api.h new file mode 100644 index 0000000..2bf2382 --- /dev/null +++ b/tests/roots/test-root/special/api.h @@ -0,0 +1,2 @@ +PyAPI_FUNC(PyObject *) Py_SphinxTest(void); +PyAPI_FUNC(PyObject *) Py_SphinxFoo(void); diff --git a/tests/roots/test-root/special/code.py b/tests/roots/test-root/special/code.py new file mode 100644 index 0000000..b7934b2 --- /dev/null +++ b/tests/roots/test-root/special/code.py @@ -0,0 +1,2 @@ +print("line 1") +print("line 2") diff --git a/tests/roots/test-root/subdir/excluded.txt b/tests/roots/test-root/subdir/excluded.txt new file mode 100644 index 0000000..5df3139 --- /dev/null +++ b/tests/roots/test-root/subdir/excluded.txt @@ -0,0 +1,2 @@ +Excluded file -- should *not* be read as source +----------------------------------------------- diff --git a/tests/roots/test-root/subdir/images.txt b/tests/roots/test-root/subdir/images.txt new file mode 100644 index 0000000..f2adf88 --- /dev/null +++ b/tests/roots/test-root/subdir/images.txt @@ -0,0 +1,6 @@ +Image including source in subdir +================================ + +.. image:: img.* + +.. image:: /rimg.png diff --git a/tests/roots/test-root/subdir/img.png b/tests/roots/test-root/subdir/img.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-root/subdir/img.png diff --git a/tests/roots/test-root/subdir/include.inc b/tests/roots/test-root/subdir/include.inc new file mode 100644 index 0000000..d89275d --- /dev/null +++ b/tests/roots/test-root/subdir/include.inc @@ -0,0 +1,5 @@ +.. This file is included by contents.txt. + +.. Paths in included files are relative to the file that + includes them +.. image:: subdir/img.png diff --git a/tests/roots/test-root/subdir/includes.txt b/tests/roots/test-root/subdir/includes.txt new file mode 100644 index 0000000..627dcfb --- /dev/null +++ b/tests/roots/test-root/subdir/includes.txt @@ -0,0 +1,18 @@ +Including in subdir +=================== + +.. absolute filename +.. literalinclude:: /special/code.py + :lines: 1 + +.. relative filename +.. literalinclude:: ../special/code.py + :lines: 2 + +Absolute :download:`/img.png` download. + +.. absolute image filename +.. image:: /img.png + +.. absolute include filename +.. include:: /test.inc diff --git a/tests/roots/test-root/subdir/simg.png b/tests/roots/test-root/subdir/simg.png Binary files differnew file mode 100644 index 0000000..a97e86d --- /dev/null +++ b/tests/roots/test-root/subdir/simg.png diff --git a/tests/roots/test-root/svgimg.pdf b/tests/roots/test-root/svgimg.pdf Binary files differnew file mode 100644 index 0000000..cacbd85 --- /dev/null +++ b/tests/roots/test-root/svgimg.pdf diff --git a/tests/roots/test-root/svgimg.svg b/tests/roots/test-root/svgimg.svg new file mode 100644 index 0000000..2bae0b9 --- /dev/null +++ b/tests/roots/test-root/svgimg.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="60" width="60"> + <circle cx="40" cy="40" r="24" style="stroke:#000000; fill:#ffffff"/> +</svg> diff --git a/tests/roots/test-root/tabs.inc b/tests/roots/test-root/tabs.inc new file mode 100644 index 0000000..20b5182 --- /dev/null +++ b/tests/roots/test-root/tabs.inc @@ -0,0 +1,5 @@ +Tabs include file test +---------------------- + +The next line has a tab: +-| |- diff --git a/tests/roots/test-root/test.inc b/tests/roots/test-root/test.inc new file mode 100644 index 0000000..4773390 --- /dev/null +++ b/tests/roots/test-root/test.inc @@ -0,0 +1,3 @@ +.. This file is included from subdir/includes.txt. + +This is an include file. diff --git a/tests/roots/test-root/wrongenc.inc b/tests/roots/test-root/wrongenc.inc new file mode 100644 index 0000000..700f613 --- /dev/null +++ b/tests/roots/test-root/wrongenc.inc @@ -0,0 +1,3 @@ +This file is encoded in latin-1 but at first read as utf-8. + +Max Strauß aß in München eine Leberkässemmel. diff --git a/tests/roots/test-search/conf.py b/tests/roots/test-search/conf.py new file mode 100644 index 0000000..8613f5f --- /dev/null +++ b/tests/roots/test-search/conf.py @@ -0,0 +1,2 @@ +exclude_patterns = ['_build'] +html_search_language = 'en' diff --git a/tests/roots/test-search/index.rst b/tests/roots/test-search/index.rst new file mode 100644 index 0000000..fc2298b --- /dev/null +++ b/tests/roots/test-search/index.rst @@ -0,0 +1,30 @@ +meta keywords +============= + +.. meta:: + :keywords lang=en: findthiskey, thistoo, notgerman + :keywords: thisonetoo + :keywords lang=de: onlygerman, onlytoogerman + :description: thisnoteither + +Stemmer +======= + +bat +findthisstemmedkey + +textinheading + +International + +.. toctree:: + + tocitem + +.. raw:: html + + <span class="raw">rawword"</span> + +.. raw:: latex + + latex_keyword diff --git a/tests/roots/test-search/nosearch.rst b/tests/roots/test-search/nosearch.rst new file mode 100644 index 0000000..4f79575 --- /dev/null +++ b/tests/roots/test-search/nosearch.rst @@ -0,0 +1,7 @@ +:nosearch: + +nosearch +======== + +bat +latex diff --git a/tests/roots/test-search/tocitem.rst b/tests/roots/test-search/tocitem.rst new file mode 100644 index 0000000..98a1dc7 --- /dev/null +++ b/tests/roots/test-search/tocitem.rst @@ -0,0 +1,17 @@ +heading 1 +========= + +lorem ipsum + +bat + +textinheading +============= + +lorem ipsum + +å¯ä»¥æŸ¥çœ‹ FAQ 模å—ä¸ Chinesetest 部分 + +模å—ä¸ CAS service部分 + +å¯ä»¥Chinesetesttwo查看 diff --git a/tests/roots/test-smartquotes/conf.py b/tests/roots/test-smartquotes/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-smartquotes/conf.py diff --git a/tests/roots/test-smartquotes/index.rst b/tests/roots/test-smartquotes/index.rst new file mode 100644 index 0000000..7dfd01a --- /dev/null +++ b/tests/roots/test-smartquotes/index.rst @@ -0,0 +1,8 @@ +test-smartquotes +================ + +-- "Sphinx" is a tool that makes it easy ... + +.. toctree:: + + literals diff --git a/tests/roots/test-smartquotes/literals.rst b/tests/roots/test-smartquotes/literals.rst new file mode 100644 index 0000000..ed77c80 --- /dev/null +++ b/tests/roots/test-smartquotes/literals.rst @@ -0,0 +1,12 @@ +literals +======== + +.. role:: python(code) + :language: python +.. default-role:: python + +Standard :code:`code role with 'quotes'` + +This is a Python :python:`{'code': 'role', 'with': 'quotes'}`. + +This is a ``literal with 'quotes'`` diff --git a/tests/roots/test-stylesheets/_templates/layout.html b/tests/roots/test-stylesheets/_templates/layout.html new file mode 100644 index 0000000..d048fe4 --- /dev/null +++ b/tests/roots/test-stylesheets/_templates/layout.html @@ -0,0 +1,8 @@ +{% extends "!layout.html" %} +{%- block css %} + {{ super() }} + <link rel="stylesheet" href="_static/more_persistent.css" type="text/css" /> + <link rel="stylesheet" href="_static/more_default.css" type="text/css" title="Default" /> + <link rel="alternate stylesheet" href="_static/more_alternate1.css" type="text/css" title="Alternate" /> + <link rel="alternate stylesheet" href="_static/more_alternate2.css" type="text/css" /> +{%- endblock %} diff --git a/tests/roots/test-stylesheets/conf.py b/tests/roots/test-stylesheets/conf.py new file mode 100644 index 0000000..fa37130 --- /dev/null +++ b/tests/roots/test-stylesheets/conf.py @@ -0,0 +1,9 @@ +html_theme = 'classic' +templates_path = ['_templates'] + + +def setup(app): + app.add_css_file('persistent.css') + app.add_css_file('default.css', title="Default") + app.add_css_file('alternate1.css', title="Alternate", rel="alternate stylesheet") + app.add_css_file('alternate2.css', rel="alternate stylesheet") diff --git a/tests/roots/test-stylesheets/index.rst b/tests/roots/test-stylesheets/index.rst new file mode 100644 index 0000000..c5c5766 --- /dev/null +++ b/tests/roots/test-stylesheets/index.rst @@ -0,0 +1,4 @@ +test-stylesheets +================ + +Lorem ipsum dolor diff --git a/tests/roots/test-templating/_templates/autosummary/class.rst b/tests/roots/test-templating/_templates/autosummary/class.rst new file mode 100644 index 0000000..6f50564 --- /dev/null +++ b/tests/roots/test-templating/_templates/autosummary/class.rst @@ -0,0 +1,9 @@ +{% extends "!autosummary/class.rst" %} + +{% block methods %} + + .. note:: autosummary/class.rst method block overloading + {{ sentence }} + + {{ super() }} +{% endblock %} diff --git a/tests/roots/test-templating/_templates/layout.html b/tests/roots/test-templating/_templates/layout.html new file mode 100644 index 0000000..f836c77 --- /dev/null +++ b/tests/roots/test-templating/_templates/layout.html @@ -0,0 +1,6 @@ +{% extends "!layout.html" %} + +{% block extrahead %} +<!-- layout overloading --> +{{ super() }} +{% endblock %} diff --git a/tests/roots/test-templating/autosummary_templating.txt b/tests/roots/test-templating/autosummary_templating.txt new file mode 100644 index 0000000..6b396a3 --- /dev/null +++ b/tests/roots/test-templating/autosummary_templating.txt @@ -0,0 +1,7 @@ +Autosummary templating test +=========================== + +.. autosummary:: + :toctree: generated + + sphinx.application.TemplateBridge diff --git a/tests/roots/test-templating/conf.py b/tests/roots/test-templating/conf.py new file mode 100644 index 0000000..e03eaf1 --- /dev/null +++ b/tests/roots/test-templating/conf.py @@ -0,0 +1,9 @@ +project = 'Sphinx templating <Tests>' +source_suffix = '.txt' +keep_warnings = True +templates_path = ['_templates'] +release = version = '2013.120' +exclude_patterns = ['_build'] + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = ['autosummary_templating'] diff --git a/tests/roots/test-templating/index.txt b/tests/roots/test-templating/index.txt new file mode 100644 index 0000000..04a40e2 --- /dev/null +++ b/tests/roots/test-templating/index.txt @@ -0,0 +1,7 @@ +Welcome to Sphinx Tests's documentation! +======================================== + +.. toctree:: + + autosummary_templating + diff --git a/tests/roots/test-theming/child.zip b/tests/roots/test-theming/child.zip Binary files differnew file mode 100644 index 0000000..b4a6a56 --- /dev/null +++ b/tests/roots/test-theming/child.zip diff --git a/tests/roots/test-theming/conf.py b/tests/roots/test-theming/conf.py new file mode 100644 index 0000000..0db7cf0 --- /dev/null +++ b/tests/roots/test-theming/conf.py @@ -0,0 +1,3 @@ +html_theme = 'test-theme' +html_theme_path = ['.', 'test_theme'] +exclude_patterns = ['_build'] diff --git a/tests/roots/test-theming/index.rst b/tests/roots/test-theming/index.rst new file mode 100644 index 0000000..214dcd7 --- /dev/null +++ b/tests/roots/test-theming/index.rst @@ -0,0 +1,5 @@ +======= +Theming +======= + + diff --git a/tests/roots/test-theming/parent.zip b/tests/roots/test-theming/parent.zip Binary files differnew file mode 100644 index 0000000..8a246ed --- /dev/null +++ b/tests/roots/test-theming/parent.zip diff --git a/tests/roots/test-theming/test_theme/__init__.py b/tests/roots/test-theming/test_theme/__init__.py new file mode 100644 index 0000000..13bdc4b --- /dev/null +++ b/tests/roots/test-theming/test_theme/__init__.py @@ -0,0 +1,5 @@ +import os + + +def get_path(): + return os.path.dirname(os.path.abspath(__file__)) diff --git a/tests/roots/test-theming/test_theme/staticfiles/layout.html b/tests/roots/test-theming/test_theme/staticfiles/layout.html new file mode 100644 index 0000000..81372be --- /dev/null +++ b/tests/roots/test-theming/test_theme/staticfiles/layout.html @@ -0,0 +1,5 @@ +{% extends "basic/layout.html" %} +{% block extrahead %} +<meta name="testopt" content="{{ theme_testopt }}" /> +{{ super() }} +{% endblock %} diff --git a/tests/roots/test-theming/test_theme/staticfiles/static/staticimg.png b/tests/roots/test-theming/test_theme/staticfiles/static/staticimg.png Binary files differnew file mode 100644 index 0000000..fda6cd2 --- /dev/null +++ b/tests/roots/test-theming/test_theme/staticfiles/static/staticimg.png diff --git a/tests/roots/test-theming/test_theme/staticfiles/static/statictmpl.html_t b/tests/roots/test-theming/test_theme/staticfiles/static/statictmpl.html_t new file mode 100644 index 0000000..4ab292b --- /dev/null +++ b/tests/roots/test-theming/test_theme/staticfiles/static/statictmpl.html_t @@ -0,0 +1,2 @@ +<!-- testing static templates --> +<html><project>{{ project|e }}</project></html> diff --git a/tests/roots/test-theming/test_theme/staticfiles/theme.conf b/tests/roots/test-theming/test_theme/staticfiles/theme.conf new file mode 100644 index 0000000..a877673 --- /dev/null +++ b/tests/roots/test-theming/test_theme/staticfiles/theme.conf @@ -0,0 +1,7 @@ +[theme] +inherit = basic +stylesheet = default.css +pygments_style = emacs + +[options] +testopt = optdefault diff --git a/tests/roots/test-theming/test_theme/test-theme/theme.conf b/tests/roots/test-theming/test_theme/test-theme/theme.conf new file mode 100644 index 0000000..2ad2c33 --- /dev/null +++ b/tests/roots/test-theming/test_theme/test-theme/theme.conf @@ -0,0 +1,4 @@ +[theme] +inherit = classic +sidebars = globaltoc.html, searchbox.html +pygments_dark_style = monokai diff --git a/tests/roots/test-theming/ziptheme.zip b/tests/roots/test-theming/ziptheme.zip Binary files differnew file mode 100644 index 0000000..8a246ed --- /dev/null +++ b/tests/roots/test-theming/ziptheme.zip diff --git a/tests/roots/test-tocdepth/bar.rst b/tests/roots/test-tocdepth/bar.rst new file mode 100644 index 0000000..d70dec9 --- /dev/null +++ b/tests/roots/test-tocdepth/bar.rst @@ -0,0 +1,27 @@ +:tocdepth: 2 + +=== +Bar +=== + +should be 2 + +Bar A +===== + +should be 2.1 + +.. toctree:: + + baz + +Bar B +===== + +should be 2.2 + +Bar B1 +------ + +should be 2.2.1 + diff --git a/tests/roots/test-tocdepth/baz.rst b/tests/roots/test-tocdepth/baz.rst new file mode 100644 index 0000000..b07fa05 --- /dev/null +++ b/tests/roots/test-tocdepth/baz.rst @@ -0,0 +1,5 @@ +Baz A +----- + +should be 2.1.1 + diff --git a/tests/roots/test-tocdepth/conf.py b/tests/roots/test-tocdepth/conf.py new file mode 100644 index 0000000..46bb290 --- /dev/null +++ b/tests/roots/test-tocdepth/conf.py @@ -0,0 +1,2 @@ +html_theme = 'classic' +exclude_patterns = ['_build'] diff --git a/tests/roots/test-tocdepth/foo.rst b/tests/roots/test-tocdepth/foo.rst new file mode 100644 index 0000000..61fd539 --- /dev/null +++ b/tests/roots/test-tocdepth/foo.rst @@ -0,0 +1,26 @@ +=== +Foo +=== + +should be 1 + +Foo A +===== + +should be 1.1 + +Foo A1 +------ + +should be 1.1.1 + +Foo B +===== + +should be 1.2 + +Foo B1 +------ + +should be 1.2.1 + diff --git a/tests/roots/test-tocdepth/index.rst b/tests/roots/test-tocdepth/index.rst new file mode 100644 index 0000000..0b651d4 --- /dev/null +++ b/tests/roots/test-tocdepth/index.rst @@ -0,0 +1,8 @@ +test-tocdepth +============= + +.. toctree:: + :numbered: + + foo + bar diff --git a/tests/roots/test-toctree-domain-objects/conf.py b/tests/roots/test-toctree-domain-objects/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-toctree-domain-objects/conf.py diff --git a/tests/roots/test-toctree-domain-objects/domains.rst b/tests/roots/test-toctree-domain-objects/domains.rst new file mode 100644 index 0000000..61467cf --- /dev/null +++ b/tests/roots/test-toctree-domain-objects/domains.rst @@ -0,0 +1,39 @@ +test-domain-objects +=================== + +.. py:module:: hello + +.. py:function:: world() -> str + + Prints "Hello, World!" to stdout + +.. py:class:: HelloWorldPrinter + + Controls printing of hello world + + .. py:method:: set_language() + + Sets the language of the HelloWorldPrinter instance + + .. py:attribute:: output_count + + Count of outputs of "Hello, World!" + + .. py:method:: print_normal() + :async: + :classmethod: + + Prints the normal form of "Hello, World!" + + .. py:method:: print() + + Prints "Hello, World!", including in the chosen language + +.. py:function:: exit() + :module: sys + + Quits the interpreter + +.. js:function:: fetch(resource) + + Fetches the given resource, returns a Promise
\ No newline at end of file diff --git a/tests/roots/test-toctree-domain-objects/index.rst b/tests/roots/test-toctree-domain-objects/index.rst new file mode 100644 index 0000000..77ee010 --- /dev/null +++ b/tests/roots/test-toctree-domain-objects/index.rst @@ -0,0 +1,6 @@ +.. toctree:: + :numbered: + :caption: Table of Contents + :name: mastertoc + + domains diff --git a/tests/roots/test-toctree-duplicated/conf.py b/tests/roots/test-toctree-duplicated/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-toctree-duplicated/conf.py diff --git a/tests/roots/test-toctree-duplicated/foo.rst b/tests/roots/test-toctree-duplicated/foo.rst new file mode 100644 index 0000000..f23d4ce --- /dev/null +++ b/tests/roots/test-toctree-duplicated/foo.rst @@ -0,0 +1,2 @@ +foo +=== diff --git a/tests/roots/test-toctree-duplicated/index.rst b/tests/roots/test-toctree-duplicated/index.rst new file mode 100644 index 0000000..38a8c44 --- /dev/null +++ b/tests/roots/test-toctree-duplicated/index.rst @@ -0,0 +1,7 @@ +test-toctree-duplicated +======================= + +.. toctree:: + + foo + foo diff --git a/tests/roots/test-toctree-empty/_templates/localtoc.html b/tests/roots/test-toctree-empty/_templates/localtoc.html new file mode 100644 index 0000000..0fd9139 --- /dev/null +++ b/tests/roots/test-toctree-empty/_templates/localtoc.html @@ -0,0 +1,2 @@ +{# This will call toctree unconditionally, whether there is a local or global toc #} +{{ toctree() }} diff --git a/tests/roots/test-toctree-empty/conf.py b/tests/roots/test-toctree-empty/conf.py new file mode 100644 index 0000000..bda61da --- /dev/null +++ b/tests/roots/test-toctree-empty/conf.py @@ -0,0 +1,2 @@ +exclude_patterns = ['_build'] +templates_path = ['_templates'] diff --git a/tests/roots/test-toctree-empty/index.rst b/tests/roots/test-toctree-empty/index.rst new file mode 100644 index 0000000..0b97a60 --- /dev/null +++ b/tests/roots/test-toctree-empty/index.rst @@ -0,0 +1,4 @@ +test-toctree-empty +================== + +.. toctree:: diff --git a/tests/roots/test-toctree-glob/bar/bar_1.rst b/tests/roots/test-toctree-glob/bar/bar_1.rst new file mode 100644 index 0000000..6229a15 --- /dev/null +++ b/tests/roots/test-toctree-glob/bar/bar_1.rst @@ -0,0 +1,4 @@ +Bar-1 +===== + +bar diff --git a/tests/roots/test-toctree-glob/bar/bar_2.rst b/tests/roots/test-toctree-glob/bar/bar_2.rst new file mode 100644 index 0000000..ed78621 --- /dev/null +++ b/tests/roots/test-toctree-glob/bar/bar_2.rst @@ -0,0 +1,4 @@ +Bar-2 +===== + +bar diff --git a/tests/roots/test-toctree-glob/bar/bar_3.rst b/tests/roots/test-toctree-glob/bar/bar_3.rst new file mode 100644 index 0000000..93c58d4 --- /dev/null +++ b/tests/roots/test-toctree-glob/bar/bar_3.rst @@ -0,0 +1,4 @@ +Bar-3 +===== + +bar diff --git a/tests/roots/test-toctree-glob/bar/bar_4/index.rst b/tests/roots/test-toctree-glob/bar/bar_4/index.rst new file mode 100644 index 0000000..4fae623 --- /dev/null +++ b/tests/roots/test-toctree-glob/bar/bar_4/index.rst @@ -0,0 +1,4 @@ +Bar-4 +===== + +bar diff --git a/tests/roots/test-toctree-glob/bar/index.rst b/tests/roots/test-toctree-glob/bar/index.rst new file mode 100644 index 0000000..74a9ba9 --- /dev/null +++ b/tests/roots/test-toctree-glob/bar/index.rst @@ -0,0 +1,8 @@ +Bar +=== + +.. toctree:: + :glob: + + * + bar_4/index diff --git a/tests/roots/test-toctree-glob/baz.rst b/tests/roots/test-toctree-glob/baz.rst new file mode 100644 index 0000000..2c1bbbc --- /dev/null +++ b/tests/roots/test-toctree-glob/baz.rst @@ -0,0 +1,4 @@ +Baz +=== + +baz diff --git a/tests/roots/test-toctree-glob/conf.py b/tests/roots/test-toctree-glob/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-toctree-glob/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-toctree-glob/foo.rst b/tests/roots/test-toctree-glob/foo.rst new file mode 100644 index 0000000..83f9522 --- /dev/null +++ b/tests/roots/test-toctree-glob/foo.rst @@ -0,0 +1,4 @@ +Foo +=== + +foo diff --git a/tests/roots/test-toctree-glob/index.rst b/tests/roots/test-toctree-glob/index.rst new file mode 100644 index 0000000..4ed6bb4 --- /dev/null +++ b/tests/roots/test-toctree-glob/index.rst @@ -0,0 +1,28 @@ +test-toctree-glob +================= + +normal order +------------ + +.. toctree:: + :glob: + + foo + bar/index + bar/* + baz + qux/index + hyperref <https://sphinx-doc.org/?q=sphinx> + +reversed order +-------------- + +.. toctree:: + :glob: + :reversed: + + foo + bar/index + bar/* + baz + qux/index diff --git a/tests/roots/test-toctree-glob/quux.rst b/tests/roots/test-toctree-glob/quux.rst new file mode 100644 index 0000000..340389d --- /dev/null +++ b/tests/roots/test-toctree-glob/quux.rst @@ -0,0 +1,4 @@ +Quux +==== + +quux diff --git a/tests/roots/test-toctree-glob/qux/index.rst b/tests/roots/test-toctree-glob/qux/index.rst new file mode 100644 index 0000000..ad0bee5 --- /dev/null +++ b/tests/roots/test-toctree-glob/qux/index.rst @@ -0,0 +1,8 @@ +Qux +=== + +.. toctree:: + :glob: + :hidden: + + * diff --git a/tests/roots/test-toctree-glob/qux/qux_1.rst b/tests/roots/test-toctree-glob/qux/qux_1.rst new file mode 100644 index 0000000..bac227b --- /dev/null +++ b/tests/roots/test-toctree-glob/qux/qux_1.rst @@ -0,0 +1,4 @@ +Qux-1 +===== + +qux diff --git a/tests/roots/test-toctree-glob/qux/qux_2.rst b/tests/roots/test-toctree-glob/qux/qux_2.rst new file mode 100644 index 0000000..bac227b --- /dev/null +++ b/tests/roots/test-toctree-glob/qux/qux_2.rst @@ -0,0 +1,4 @@ +Qux-1 +===== + +qux diff --git a/tests/roots/test-toctree-index/conf.py b/tests/roots/test-toctree-index/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-toctree-index/conf.py diff --git a/tests/roots/test-toctree-index/foo.rst b/tests/roots/test-toctree-index/foo.rst new file mode 100644 index 0000000..fc2c716 --- /dev/null +++ b/tests/roots/test-toctree-index/foo.rst @@ -0,0 +1,8 @@ +foo +=== + +:index:`word` + +.. py:module:: pymodule + +.. py:function:: Timer.repeat(repeat=3, number=1000000) diff --git a/tests/roots/test-toctree-index/index.rst b/tests/roots/test-toctree-index/index.rst new file mode 100644 index 0000000..eb211c5 --- /dev/null +++ b/tests/roots/test-toctree-index/index.rst @@ -0,0 +1,15 @@ +test-toctree-index +================== + +.. toctree:: + + foo + + +.. toctree:: + :caption: Indices + + genindex + modindex + search + diff --git a/tests/roots/test-toctree-maxdepth/bar.rst b/tests/roots/test-toctree-maxdepth/bar.rst new file mode 100644 index 0000000..d70dec9 --- /dev/null +++ b/tests/roots/test-toctree-maxdepth/bar.rst @@ -0,0 +1,27 @@ +:tocdepth: 2 + +=== +Bar +=== + +should be 2 + +Bar A +===== + +should be 2.1 + +.. toctree:: + + baz + +Bar B +===== + +should be 2.2 + +Bar B1 +------ + +should be 2.2.1 + diff --git a/tests/roots/test-toctree-maxdepth/baz.rst b/tests/roots/test-toctree-maxdepth/baz.rst new file mode 100644 index 0000000..b07fa05 --- /dev/null +++ b/tests/roots/test-toctree-maxdepth/baz.rst @@ -0,0 +1,5 @@ +Baz A +----- + +should be 2.1.1 + diff --git a/tests/roots/test-toctree-maxdepth/conf.py b/tests/roots/test-toctree-maxdepth/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-toctree-maxdepth/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-toctree-maxdepth/foo.rst b/tests/roots/test-toctree-maxdepth/foo.rst new file mode 100644 index 0000000..61fd539 --- /dev/null +++ b/tests/roots/test-toctree-maxdepth/foo.rst @@ -0,0 +1,26 @@ +=== +Foo +=== + +should be 1 + +Foo A +===== + +should be 1.1 + +Foo A1 +------ + +should be 1.1.1 + +Foo B +===== + +should be 1.2 + +Foo B1 +------ + +should be 1.2.1 + diff --git a/tests/roots/test-toctree-maxdepth/index.rst b/tests/roots/test-toctree-maxdepth/index.rst new file mode 100644 index 0000000..30dc61c --- /dev/null +++ b/tests/roots/test-toctree-maxdepth/index.rst @@ -0,0 +1,9 @@ +test-toctree-max-depth +====================== + +.. toctree:: + :numbered: + :maxdepth: 2 + + foo + bar diff --git a/tests/roots/test-toctree-maxdepth/qux.rst b/tests/roots/test-toctree-maxdepth/qux.rst new file mode 100644 index 0000000..35e9ac1 --- /dev/null +++ b/tests/roots/test-toctree-maxdepth/qux.rst @@ -0,0 +1,9 @@ +test-toctree-max-depth +====================== + +.. toctree:: + :numbered: + :maxdepth: 4 + + foo + bar diff --git a/tests/roots/test-toctree/bar.rst b/tests/roots/test-toctree/bar.rst new file mode 100644 index 0000000..1cccd3c --- /dev/null +++ b/tests/roots/test-toctree/bar.rst @@ -0,0 +1,2 @@ +bar +=== diff --git a/tests/roots/test-toctree/baz.rst b/tests/roots/test-toctree/baz.rst new file mode 100644 index 0000000..52e2e72 --- /dev/null +++ b/tests/roots/test-toctree/baz.rst @@ -0,0 +1,2 @@ +baz +=== diff --git a/tests/roots/test-toctree/conf.py b/tests/roots/test-toctree/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-toctree/conf.py diff --git a/tests/roots/test-toctree/foo.rst b/tests/roots/test-toctree/foo.rst new file mode 100644 index 0000000..49f4d4b --- /dev/null +++ b/tests/roots/test-toctree/foo.rst @@ -0,0 +1,15 @@ +foo +=== + +.. toctree:: + + quux + +foo.1 +----- + +foo.1-1 +^^^^^^^ + +foo.2 +----- diff --git a/tests/roots/test-toctree/index.rst b/tests/roots/test-toctree/index.rst new file mode 100644 index 0000000..adf1b84 --- /dev/null +++ b/tests/roots/test-toctree/index.rst @@ -0,0 +1,55 @@ +.. Sphinx Tests documentation master file, created by sphinx-quickstart on Wed Jun 4 23:49:58 2008. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Sphinx Tests's documentation! +======================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + :numbered: + :caption: Table of Contents + :name: mastertoc + + foo + bar + http://sphinx-doc.org/ + self + +.. only:: html + + Section for HTML + ---------------- + + .. toctree:: + + baz + +---------- +subsection +---------- + +subsubsection +------------- + +Test for issue #1157 +==================== + +This used to crash: + +.. toctree:: + +.. toctree:: + :hidden: + + Latest reference <http://sphinx-doc.org/latest/> + Python <http://python.org/> + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/tests/roots/test-toctree/quux.rst b/tests/roots/test-toctree/quux.rst new file mode 100644 index 0000000..07dd0a0 --- /dev/null +++ b/tests/roots/test-toctree/quux.rst @@ -0,0 +1,2 @@ +quux +==== diff --git a/tests/roots/test-toctree/qux.rst b/tests/roots/test-toctree/qux.rst new file mode 100644 index 0000000..26176b9 --- /dev/null +++ b/tests/roots/test-toctree/qux.rst @@ -0,0 +1 @@ +qux.rst has no section title diff --git a/tests/roots/test-toctree/tocdepth.rst b/tests/roots/test-toctree/tocdepth.rst new file mode 100644 index 0000000..1069b4c --- /dev/null +++ b/tests/roots/test-toctree/tocdepth.rst @@ -0,0 +1,15 @@ +:tocdepth: 2 + +======= +level 1 +======= + +level 2 +======= + +------- +level 3 +------- + +level 4 +------- diff --git a/tests/roots/test-transforms-post_transforms-keyboard/conf.py b/tests/roots/test-transforms-post_transforms-keyboard/conf.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/roots/test-transforms-post_transforms-keyboard/conf.py diff --git a/tests/roots/test-transforms-post_transforms-keyboard/index.rst b/tests/roots/test-transforms-post_transforms-keyboard/index.rst new file mode 100644 index 0000000..2177578 --- /dev/null +++ b/tests/roots/test-transforms-post_transforms-keyboard/index.rst @@ -0,0 +1,4 @@ +Regression test for issue 10495 +=============================== + +:kbd:`spanish - inquisition` diff --git a/tests/roots/test-transforms-post_transforms-missing-reference/conf.py b/tests/roots/test-transforms-post_transforms-missing-reference/conf.py new file mode 100644 index 0000000..2db221c --- /dev/null +++ b/tests/roots/test-transforms-post_transforms-missing-reference/conf.py @@ -0,0 +1 @@ +nitpicky = True diff --git a/tests/roots/test-transforms-post_transforms-missing-reference/index.rst b/tests/roots/test-transforms-post_transforms-missing-reference/index.rst new file mode 100644 index 0000000..7180978 --- /dev/null +++ b/tests/roots/test-transforms-post_transforms-missing-reference/index.rst @@ -0,0 +1,5 @@ +transforms-post_transforms-missing-reference +============================================ + +:class:`io.StringIO` + diff --git a/tests/roots/test-trim_doctest_flags/conf.py b/tests/roots/test-trim_doctest_flags/conf.py new file mode 100644 index 0000000..77c7255 --- /dev/null +++ b/tests/roots/test-trim_doctest_flags/conf.py @@ -0,0 +1 @@ +extensions = ['sphinx.ext.doctest'] diff --git a/tests/roots/test-trim_doctest_flags/index.rst b/tests/roots/test-trim_doctest_flags/index.rst new file mode 100644 index 0000000..d63251a --- /dev/null +++ b/tests/roots/test-trim_doctest_flags/index.rst @@ -0,0 +1,40 @@ +test-trim_doctest_flags +======================= + +.. code-block:: pycon + + >>> datetime.date.now() # doctest: +FOO + datetime.date(2008, 1, 1) + +.. code-block:: none + + >>> datetime.date.now() # doctest: +BAR + datetime.date(2008, 1, 1) + +.. code-block:: guess + + # vim: set filetype=pycon + >>> datetime.date.now() # doctest: +BAZ + datetime.date(2008, 1, 1) + +.. testcode:: + + >>> datetime.date.now() # doctest: +QUX + datetime.date(2008, 1, 1) + +.. doctest:: + + >>> datetime.date.now() # doctest: +QUUX + datetime.date(2008, 1, 1) + +.. doctest:: + :trim-doctest-flags: + + >>> datetime.date.now() # doctest: +CORGE + datetime.date(2008, 1, 1) + +.. doctest:: + :no-trim-doctest-flags: + + >>> datetime.date.now() # doctest: +GRAULT + datetime.date(2008, 1, 1) diff --git a/tests/roots/test-versioning/added.txt b/tests/roots/test-versioning/added.txt new file mode 100644 index 0000000..22a7073 --- /dev/null +++ b/tests/roots/test-versioning/added.txt @@ -0,0 +1,20 @@ +Versioning test text +==================== + +So the thing is I need some kind of text - not the lorem ipsum stuff, that +doesn't work out that well - to test :mod:`sphinx.versioning`. I couldn't find +a good text for that under public domain so I thought the easiest solution is +to write one by myself. It's not really interesting, in fact it is *really* +boring. + +Anyway I need more than one paragraph, at least three for the original +document, I think, and another one for two different ones. + +So the previous paragraph was a bit short because I don't want to test this +only on long paragraphs, I hope it was short enough to cover most stuff. +Anyway I see this lacks ``some markup`` so I have to add a **little** bit. + +Woho another paragraph, if this test fails we really have a problem because +this means the algorithm itself fails and not the diffing algorithm which is +pretty much doomed anyway as it probably fails for some kind of language +respecting certain nodes anyway but we can't work around that anyway. diff --git a/tests/roots/test-versioning/conf.py b/tests/roots/test-versioning/conf.py new file mode 100644 index 0000000..6344cb0 --- /dev/null +++ b/tests/roots/test-versioning/conf.py @@ -0,0 +1,3 @@ +project = 'versioning test root' +source_suffix = '.txt' +exclude_patterns = ['_build'] diff --git a/tests/roots/test-versioning/deleted.txt b/tests/roots/test-versioning/deleted.txt new file mode 100644 index 0000000..a1a9c4c --- /dev/null +++ b/tests/roots/test-versioning/deleted.txt @@ -0,0 +1,12 @@ +Versioning test text +==================== + +So the thing is I need some kind of text - not the lorem ipsum stuff, that +doesn't work out that well - to test :mod:`sphinx.versioning`. I couldn't find +a good text for that under public domain so I thought the easiest solution is +to write one by myself. It's not really interesting, in fact it is *really* +boring. + +So the previous paragraph was a bit short because I don't want to test this +only on long paragraphs, I hope it was short enough to cover most stuff. +Anyway I see this lacks ``some markup`` so I have to add a **little** bit. diff --git a/tests/roots/test-versioning/deleted_end.txt b/tests/roots/test-versioning/deleted_end.txt new file mode 100644 index 0000000..f30e630 --- /dev/null +++ b/tests/roots/test-versioning/deleted_end.txt @@ -0,0 +1,11 @@ +Versioning test text +==================== + +So the thing is I need some kind of text - not the lorem ipsum stuff, that +doesn't work out that well - to test :mod:`sphinx.versioning`. I couldn't find +a good text for that under public domain so I thought the easiest solution is +to write one by myself. It's not really interesting, in fact it is *really* +boring. + +Anyway I need more than one paragraph, at least three for the original +document, I think, and another one for two different ones. diff --git a/tests/roots/test-versioning/index.txt b/tests/roots/test-versioning/index.txt new file mode 100644 index 0000000..9d098f7 --- /dev/null +++ b/tests/roots/test-versioning/index.txt @@ -0,0 +1,13 @@ +Versioning Stuff +================ + +.. toctree:: + + original + added + insert + deleted + deleted_end + modified + insert_beginning + insert_similar diff --git a/tests/roots/test-versioning/insert.txt b/tests/roots/test-versioning/insert.txt new file mode 100644 index 0000000..1c157cc --- /dev/null +++ b/tests/roots/test-versioning/insert.txt @@ -0,0 +1,18 @@ +Versioning test text +==================== + +So the thing is I need some kind of text - not the lorem ipsum stuff, that +doesn't work out that well - to test :mod:`sphinx.versioning`. I couldn't find +a good text for that under public domain so I thought the easiest solution is +to write one by myself. It's not really interesting, in fact it is *really* +boring. + +So this paragraph is just something I inserted in this document to test if our +algorithm notices that this paragraph is not just a changed version. + +Anyway I need more than one paragraph, at least three for the original +document, I think, and another one for two different ones. + +So the previous paragraph was a bit short because I don't want to test this +only on long paragraphs, I hope it was short enough to cover most stuff. +Anyway I see this lacks ``some markup`` so I have to add a **little** bit. diff --git a/tests/roots/test-versioning/insert_beginning.txt b/tests/roots/test-versioning/insert_beginning.txt new file mode 100644 index 0000000..57102a7 --- /dev/null +++ b/tests/roots/test-versioning/insert_beginning.txt @@ -0,0 +1,18 @@ +Versioning test text +==================== + +Apperantly inserting a paragraph at the beginning of a document caused +problems earlier so this document should be used to test that. + +So the thing is I need some kind of text - not the lorem ipsum stuff, that +doesn't work out that well - to test :mod:`sphinx.versioning`. I couldn't find +a good text for that under public domain so I thought the easiest solution is +to write one by myself. It's not really interesting, in fact it is *really* +boring. + +Anyway I need more than one paragraph, at least three for the original +document, I think, and another one for two different ones. + +So the previous paragraph was a bit short because I don't want to test this +only on long paragraphs, I hope it was short enough to cover most stuff. +Anyway I see this lacks ``some markup`` so I have to add a **little** bit. diff --git a/tests/roots/test-versioning/insert_similar.txt b/tests/roots/test-versioning/insert_similar.txt new file mode 100644 index 0000000..ee9b530 --- /dev/null +++ b/tests/roots/test-versioning/insert_similar.txt @@ -0,0 +1,17 @@ +Versioning test text +==================== + +So the thing is I need some kind of text - not the lorem ipsum stuff, that +doesn't work out that well - to test :mod:`sphinx.versioning`. I couldn't find +a good text for that under public domain so I thought the easiest solution is +to write one by myself. It's not really interesting, in fact it is *really* +boring. + +Anyway I need more + +Anyway I need more than one paragraph, at least three for the original +document, I think, and another one for two different ones. + +So the previous paragraph was a bit short because I don't want to test this +only on long paragraphs, I hope it was short enough to cover most stuff. +Anyway I see this lacks ``some markup`` so I have to add a **little** bit. diff --git a/tests/roots/test-versioning/modified.txt b/tests/roots/test-versioning/modified.txt new file mode 100644 index 0000000..49cdad9 --- /dev/null +++ b/tests/roots/test-versioning/modified.txt @@ -0,0 +1,17 @@ +Versioning test text +==================== + +So the thing is I need some kind of text - not the lorem ipsum stuff, that +doesn't work out that well - to test :mod:`sphinx.versioning`. I couldn't find +a good text for that under public domain so I thought the easiest solution is +to write one by myself. Inserting something silly as a modification, btw. have +you seen the typo below?. It's not really interesting, in fact it is *really* +boring. + +Anyway I need more than one paragraph, at least three for the original +document, I think, and another one for two different ones. So this is a small +modification by adding something to this paragraph. + +So the previous paragraph was a bit short because I don't want to test this +only on long paragraphs, I hoep it was short enough to cover most stuff. +Anyway I see this lacks ``some markup`` so I have to add a **little** bit. diff --git a/tests/roots/test-versioning/original.txt b/tests/roots/test-versioning/original.txt new file mode 100644 index 0000000..b3fe060 --- /dev/null +++ b/tests/roots/test-versioning/original.txt @@ -0,0 +1,15 @@ +Versioning test text +==================== + +So the thing is I need some kind of text - not the lorem ipsum stuff, that +doesn't work out that well - to test :mod:`sphinx.versioning`. I couldn't find +a good text for that under public domain so I thought the easiest solution is +to write one by myself. It's not really interesting, in fact it is *really* +boring. + +Anyway I need more than one paragraph, at least three for the original +document, I think, and another one for two different ones. + +So the previous paragraph was a bit short because I don't want to test this +only on long paragraphs, I hope it was short enough to cover most stuff. +Anyway I see this lacks ``some markup`` so I have to add a **little** bit. diff --git a/tests/roots/test-warnings/autodoc_fodder.py b/tests/roots/test-warnings/autodoc_fodder.py new file mode 100644 index 0000000..59e4e21 --- /dev/null +++ b/tests/roots/test-warnings/autodoc_fodder.py @@ -0,0 +1,6 @@ +class MarkupError: + """ + .. note:: This is a docstring with a + small markup error which should have + correct location information. + """ diff --git a/tests/roots/test-warnings/conf.py b/tests/roots/test-warnings/conf.py new file mode 100644 index 0000000..25b8aba --- /dev/null +++ b/tests/roots/test-warnings/conf.py @@ -0,0 +1,6 @@ +import os +import sys + +sys.path.append(os.path.abspath('.')) + +extensions = ['sphinx.ext.autodoc'] diff --git a/tests/roots/test-warnings/index.rst b/tests/roots/test-warnings/index.rst new file mode 100644 index 0000000..ac52d90 --- /dev/null +++ b/tests/roots/test-warnings/index.rst @@ -0,0 +1,45 @@ +test-warnings +============= + +.. automodule:: autodoc_fodder + :no-index: + + .. autoclass:: MarkupError + +.. a non-existing image with direct filename +.. image:: foo.png + +.. a non-existing image with .* +.. image:: foo.* + +.. an SVG image (for HTML at least) +.. image:: svgimg.* + +.. should give a warning +.. literalinclude:: wrongenc.inc + :language: none + +.. a non-existing download + +Don't download :download:`this <nonexisting.png>`. + +.. Invalid index markup +.. index:: + single: + pair: + seealso: + +.. Invalid code-block +.. code-block:: c + + import sys + + sys.stdout.write('hello world!\n') + +.. unknown option + +This used to crash: :option:`&option` + +.. missing citation + +[missing]_ citation diff --git a/tests/roots/test-warnings/svgimg.pdf b/tests/roots/test-warnings/svgimg.pdf Binary files differnew file mode 100644 index 0000000..cacbd85 --- /dev/null +++ b/tests/roots/test-warnings/svgimg.pdf diff --git a/tests/roots/test-warnings/svgimg.svg b/tests/roots/test-warnings/svgimg.svg new file mode 100644 index 0000000..2bae0b9 --- /dev/null +++ b/tests/roots/test-warnings/svgimg.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="60" width="60"> + <circle cx="40" cy="40" r="24" style="stroke:#000000; fill:#ffffff"/> +</svg> diff --git a/tests/roots/test-warnings/undecodable.rst b/tests/roots/test-warnings/undecodable.rst new file mode 100644 index 0000000..a4cf5c3 --- /dev/null +++ b/tests/roots/test-warnings/undecodable.rst @@ -0,0 +1,3 @@ +:orphan: + +here: » diff --git a/tests/roots/test-warnings/wrongenc.inc b/tests/roots/test-warnings/wrongenc.inc new file mode 100644 index 0000000..700f613 --- /dev/null +++ b/tests/roots/test-warnings/wrongenc.inc @@ -0,0 +1,3 @@ +This file is encoded in latin-1 but at first read as utf-8. + +Max Strauß aß in München eine Leberkässemmel. |