Rewrite `usage/configuration.rst` (#12537)

- Remove now-removed configuration values
- Use obvious 'unset' defaults for ``project`` and ``author``
- Prefer 'e.g.' to 'ex.'
- Allow non-list sequence types in various configuration values
- Add types and defaults to every confval directive
This commit is contained in:
Adam Turner 2024-07-10 21:43:14 +01:00 committed by GitHub
parent a4de250b5a
commit 82edc3d385
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
42 changed files with 3040 additions and 2375 deletions

View File

@ -60,6 +60,14 @@ Features added
Patch by Tim Hoffmann.
* #12536: Add the :rst:dir:`confval` directive.
Patch by Adam Turner.
* #12537: :confval:`c_id_attributes`, :confval:`c_paren_attributes`,
:confval:`cpp_id_attributes`, and :confval:`cpp_paren_attributes`
can now be a tuple of strings.
:confval:`c_extra_keywords`, :confval:`gettext_additional_targets`,
:confval:`html_domain_indices`, :confval:`latex_domain_indices`,
and :confval:`texinfo_domain_indices`,
can now be a set of strings.
Patch by Adam Turner.
Bugs fixed
----------
@ -78,9 +86,8 @@ Bugs fixed
* #12380: LaTeX: Footnote mark sometimes indicates ``Page N`` where ``N`` is
the current page number and the footnote does appear on that same page.
Patch by Jean-François B.
* #12416: :confval:`root_doc` is synchronized with :confval:`master_doc`
so that if either of the two values is modified, the other reflects that
modification. It is still recommended to use :confval:`root_doc`.
* #12416: Ensure that configuration setting aliases are always synchronised
when one value or the other is modified.
Patch by Bénédikt Tran.
* #12220: Fix loading custom template translations for ``en`` locale.
Patch by Nicolas Peugnet.
@ -3828,7 +3835,7 @@ Deprecated
* The arguments of ``Epub3Builder.build_navigation_doc()``
* The config variables
- :confval:`html_experimental_html5_writer`
- :confval:`!html_experimental_html5_writer`
* The ``encoding`` argument of ``autodoc.Documenter.get_doc()``,
``autodoc.DocstringSignatureMixin.get_doc()``,
@ -3944,7 +3951,7 @@ Features added
* #4611: epub: Show warning for duplicated ToC entries
* #1851: Allow to omit an argument for :rst:dir:`code-block` directive. If
omitted, it follows :rst:dir:`highlight` or :confval:`highlight_language`
* #4587: html: Add :confval:`html4_writer` to use old HTML4 writer
* #4587: html: Add :confval:`!html4_writer` to use old HTML4 writer
* #6016: HTML search: A placeholder for the search summary prevents search
result links from changing their position when the search terminates. This
makes navigating search results easier.
@ -4264,7 +4271,7 @@ Deprecated
1.8.0b1
* :confval:`source_parsers` is deprecated
* :confval:`!source_parsers` is deprecated
* :confval:`autodoc_default_flags` is deprecated
* quickstart: ``--epub`` option becomes default, so it is deprecated
* Drop function based directive support. For now, Sphinx only supports class
@ -6404,7 +6411,7 @@ Features added
--------------
* #1873, #1876, #2278: Add ``page_source_suffix`` html context variable. This
should be introduced with :confval:`source_parsers` feature. Thanks for Eric
should be introduced with :confval:`!source_parsers` feature. Thanks for Eric
Holscher.
@ -6471,7 +6478,7 @@ Bugs fixed
* #2186: Fix LaTeX output of \mathbb in math
* #1480, #2188: LaTeX: Support math in section titles
* #2071: Fix same footnote in more than two section titles => LaTeX/PDF Bug
* #2040: Fix UnicodeDecodeError in sphinx-apidoc when author contains non-ascii
* #2040: Fix UnicodeDecodeError in sphinx-apidoc when author contains non-ASCII
characters
* #2193: Fix shutil.SameFileError if source directory and destination directory
are same
@ -6646,7 +6653,7 @@ Features added
* The :confval:`source_suffix` config value can now be a list of multiple
suffixes.
* Add the ability to specify source parsers by source suffix with the
:confval:`source_parsers` config value.
:confval:`!source_parsers` config value.
* #1675: A new builder, AppleHelpBuilder, has been added that builds Apple
Help Books.

View File

@ -1,346 +0,0 @@
# test documentation build configuration file, created by
# sphinx-quickstart on Sun Jun 26 00:00:43 2016.
#
# This file is executed through importlib.import_module with
# the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#
# source_encoding = 'utf-8-sig'
# The master toctree document.
root_doc = 'index'
# General information about the project.
project = 'test'
copyright = '2016, test'
author = 'test'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = 'test'
# The full version, including alpha/beta/rc tags.
release = 'test'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#
# today = ''
#
# Else, today_fmt is used as the format for a strftime call.
#
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# These patterns also affect html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = 'test vtest'
# A shorter title for the navigation bar. Default is the same as html_title.
#
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#
# html_logo = None
# The name of an image file (relative to this directory) to use as a favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#
# html_extra_path = []
# If not None, a 'Last updated on:' timestamp is inserted at every page
# bottom, using the given strftime format.
# The empty string is equivalent to '%b %d, %Y'.
#
# html_last_updated_fmt = None
# Custom sidebar templates, maps document names to template names.
#
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#
# html_additional_pages = {}
# If false, no module index is generated.
#
# html_domain_indices = True
# If false, no index is generated.
#
# html_use_index = True
# If true, the index is split into individual pages for each letter.
#
# html_split_index = False
# If true, links to the reST sources are added to the pages.
#
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
#
# html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value.
# 'zh' user can custom change `jieba` dictionary path.
#
# html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#
# html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'testdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(root_doc, 'test.tex', 'test Documentation',
'test', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#
# latex_logo = None
# If true, show page references after internal links.
#
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
#
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
#
# latex_appendices = []
# If false, no module index is generated.
#
# latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(root_doc, 'test', 'test Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#
# man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(root_doc, 'test', 'test Documentation',
author, 'test', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#
# texinfo_appendices = []
# If false, no module index is generated.
#
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#
# texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#
# texinfo_no_detailmenu = False
# If false, do not generate in manual @ref nodes.
#
# texinfo_cross_references = False
# -- A random example -----------------------------------------------------
import sys, os
sys.path.insert(0, os.path.abspath('.'))
exclude_patterns = ['zzz']
numfig = True
#language = 'ja'
extensions.append('sphinx.ext.todo')
extensions.append('sphinx.ext.autodoc')
#extensions.append('sphinx.ext.autosummary')
extensions.append('sphinx.ext.intersphinx')
extensions.append('sphinx.ext.mathjax')
extensions.append('sphinx.ext.viewcode')
extensions.append('sphinx.ext.graphviz')
autosummary_generate = True
html_theme = 'default'
#source_suffix = ['.rst', '.txt']

View File

@ -5,7 +5,7 @@ import os
import re
import time
import sphinx
from sphinx import __display_version__
os.environ['SPHINX_AUTODOC_RELOAD_MODULES'] = '1'
@ -27,8 +27,7 @@ exclude_patterns = ['_build']
project = 'Sphinx'
copyright = f'2007-{time.strftime("%Y")}, the Sphinx developers'
version = sphinx.__display_version__
release = version
release = version = __display_version__
show_authors = True
nitpicky = True
show_warning_types = True
@ -156,7 +155,7 @@ texinfo_documents = [
'Sphinx',
'The Sphinx documentation builder.',
'Documentation tools',
1,
True,
),
]
@ -241,12 +240,12 @@ nitpick_ignore = {
from sphinx import addnodes # NoQA: E402
from sphinx.application import Sphinx # NoQA: E402, TCH001
event_sig_re = re.compile(r'([a-zA-Z-]+)\s*\((.*)\)')
_event_sig_re = re.compile(r'([a-zA-Z-]+)\s*\((.*)\)')
def parse_event(env, sig, signode):
m = event_sig_re.match(sig)
if not m:
m = _event_sig_re.match(sig)
if m is None:
signode += addnodes.desc_name(sig, sig)
return sig
name, args = m.groups()
@ -330,5 +329,9 @@ def setup(app: Sphinx) -> None:
app.connect('build-finished', build_redirects)
fdesc = GroupedField('parameter', label='Parameters', names=['param'], can_collapse=True)
app.add_object_type(
'event', 'event', 'pair: %s; event', parse_event, doc_field_types=[fdesc]
'event',
'event',
'pair: %s; event',
parse_event,
doc_field_types=[fdesc],
)

View File

@ -1769,7 +1769,7 @@ The following is a list of deprecated interfaces.
- 3.0
- ``warning()``
* - :confval:`source_parsers`
* - :confval:`!source_parsers`
- 1.8
- 3.0
- :meth:`~sphinx.application.Sphinx.add_source_parser()`

View File

@ -26,9 +26,9 @@ Glossary
Sphinx and custom extensions can add their own. The basic directive
syntax looks like this:
.. sourcecode:: rst
.. code-block:: rst
.. directivename:: argument ...
.. directive-name:: argument ...
:option: value
Content of the directive.

View File

@ -758,7 +758,7 @@ Do not use quotes to enclose values, whether numerical or strings.
wrapped.
If ``true``, line breaks may happen at spaces (the last space before the
line break will be rendered using a special symbol), and at ascii
line break will be rendered using a special symbol), and at ASCII
punctuation characters (i.e. not at letters or digits). Whenever a long
string has no break points, it is moved to next line. If its length is
longer than the line width it will overflow.
@ -1828,7 +1828,7 @@ Miscellany
\newenvironment{sphinxclassred}{\color{red}}{}
Currently the class names must contain only ascii characters and avoid
Currently the class names must contain only ASCII characters and avoid
characters special to LaTeX such as ``\``.
.. versionadded:: 4.1.0

View File

@ -102,8 +102,10 @@ Options
.. option:: -t tag, --tag tag
Define the tag *tag*. This is relevant for :rst:dir:`only` directives that
only include their content if this tag is set.
Define the tag *tag*.
This is relevant for :rst:dir:`only` directives that
include their content only if certain tags are set.
See :ref:`including content based on tags <tags>` for further detail.
.. versionadded:: 0.6

View File

@ -21,7 +21,7 @@ things are in a document. To do this you will need to create an instance of the
support.build()
This will read reStructuredText sources from ``srcdir`` and place the necessary
data in ``builddir``. The ``builddir`` will contain two sub-directories: one
data in ``builddir``. The ``builddir`` will contain two subdirectories: one
named "data" that contains all the data needed to display documents, search
through documents, and add comments to documents. The other directory will be
called "static" and contains static files that should be served from "/static".

File diff suppressed because it is too large Load Diff

View File

@ -745,7 +745,7 @@ There are also config values that you can set:
* ``'fully-qualified'`` -- Show the module name and its name of typehints
* ``'short'`` -- Suppress the leading module names of the typehints
(ex. ``io.StringIO`` -> ``StringIO``) (default)
(e.g. ``io.StringIO`` -> ``StringIO``) (default)
.. versionadded:: 4.4

View File

@ -66,7 +66,7 @@ It adds these directives:
.. rst:directive:option:: layout: layout type of the graph
:type: text
The layout of the graph (ex. ``dot``, ``neato`` and so on). A path to the
The layout of the graph (e.g. ``dot``, ``neato`` and so on). A path to the
graphviz commands are also allowed. By default, :confval:`graphviz_dot`
is used.

View File

@ -49,8 +49,8 @@ tables of contents. The ``toctree`` directive is the central element.
indicate the depth of the tree; by default, all levels are included. [#]_
The representation of "TOC tree" is changed in each output format. The
builders that output multiple files (ex. HTML) treat it as a collection of
hyperlinks. On the other hand, the builders that output a single file (ex.
builders that output multiple files (e.g. HTML) treat it as a collection of
hyperlinks. On the other hand, the builders that output a single file (e.g.
LaTeX, man page, etc.) replace it with the content of the documents on the
TOC tree.
@ -1060,10 +1060,11 @@ Including content based on tags
.. only:: html and draft
Undefined tags are false, defined tags (via the ``-t`` command-line option or
within :file:`conf.py`, see :ref:`here <conf-tags>`) are true. Boolean
expressions, also using parentheses (like ``(latex or html) and draft``) are
supported.
Undefined tags are false, defined tags are true
(tags can be defined via the :option:`--tag <sphinx-build --tag>`
command-line option or within :file:`conf.py`, see :ref:`here <conf-tags>`).
Boolean expressions (like ``(latex or html) and draft``) are supported
and may use parentheses.
The *format* and the *name* of the current builder (``html``, ``latex`` or
``text``) are always set as a tag [#]_. To make the distinction between

View File

@ -311,7 +311,7 @@ def setup(app: Sphinx) -> ExtensionMetadata:
app.add_config_value('gettext_location', True, 'gettext')
app.add_config_value('gettext_uuid', False, 'gettext')
app.add_config_value('gettext_auto_build', True, 'env')
app.add_config_value('gettext_additional_targets', [], 'env')
app.add_config_value('gettext_additional_targets', [], 'env', types={set, list})
app.add_config_value('gettext_last_translator', 'FULL NAME <EMAIL@ADDRESS>', 'gettext')
app.add_config_value('gettext_language_team', 'LANGUAGE <LL@li.org>', 'gettext')
app.connect('config-inited', _gettext_compact_validator, priority=800)

View File

@ -465,19 +465,22 @@ class StandaloneHTMLBuilder(Builder):
# determine the additional indices to include
self.domain_indices = []
# html_domain_indices can be False/True or a list of index names
indices_config = self.config.html_domain_indices
if indices_config:
if indices_config := self.config.html_domain_indices:
if not isinstance(indices_config, bool):
check_names = True
indices_config = frozenset(indices_config)
else:
check_names = False
for domain_name in sorted(self.env.domains):
domain: Domain = self.env.domains[domain_name]
for indexcls in domain.indices:
indexname = f'{domain.name}-{indexcls.name}'
if isinstance(indices_config, list):
if indexname not in indices_config:
continue
content, collapse = indexcls(domain).generate()
for index_cls in domain.indices:
index_name = f'{domain.name}-{index_cls.name}'
if check_names and index_name not in indices_config:
continue
content, collapse = index_cls(domain).generate()
if content:
self.domain_indices.append(
(indexname, indexcls, content, collapse))
(index_name, index_cls, content, collapse))
# format the "last updated on" string, only once is enough since it
# typically doesn't include the time of day
@ -1314,7 +1317,7 @@ def setup(app: Sphinx) -> ExtensionMetadata:
app.add_config_value('html_last_updated_fmt', None, 'html', str)
app.add_config_value('html_sidebars', {}, 'html')
app.add_config_value('html_additional_pages', {}, 'html')
app.add_config_value('html_domain_indices', True, 'html', list)
app.add_config_value('html_domain_indices', True, 'html', types={set, list})
app.add_config_value('html_permalinks', True, 'html')
app.add_config_value('html_permalinks_icon', '', 'html')
app.add_config_value('html_use_index', True, 'html')

View File

@ -539,7 +539,7 @@ def setup(app: Sphinx) -> ExtensionMetadata:
app.add_config_value('latex_use_xindy', default_latex_use_xindy, '', bool)
app.add_config_value('latex_toplevel_sectioning', None, '',
ENUM(None, 'part', 'chapter', 'section'))
app.add_config_value('latex_domain_indices', True, '', list)
app.add_config_value('latex_domain_indices', True, '', types={set, list})
app.add_config_value('latex_show_urls', 'no', '')
app.add_config_value('latex_show_pagerefs', False, '')
app.add_config_value('latex_elements', {}, '')

View File

@ -221,7 +221,7 @@ def setup(app: Sphinx) -> ExtensionMetadata:
app.add_config_value('texinfo_documents', default_texinfo_documents, '')
app.add_config_value('texinfo_appendices', [], '')
app.add_config_value('texinfo_elements', {}, '')
app.add_config_value('texinfo_domain_indices', True, '', list)
app.add_config_value('texinfo_domain_indices', True, '', types={set, list})
app.add_config_value('texinfo_show_urls', 'footnote', '')
app.add_config_value('texinfo_no_detailmenu', False, '')
app.add_config_value('texinfo_cross_references', True, '')

View File

@ -196,11 +196,11 @@ class Config:
config_values: dict[str, _Opt] = {
# general options
'project': _Opt('Python', 'env', ()),
'author': _Opt('unknown', 'env', ()),
'project': _Opt('Project name not set', 'env', ()),
'author': _Opt('Author name not set', 'env', ()),
'project_copyright': _Opt('', 'html', frozenset((str, tuple, list))),
'copyright': _Opt(
lambda c: c.project_copyright, 'html', frozenset((str, tuple, list))),
lambda config: config.project_copyright, 'html', frozenset((str, tuple, list))),
'version': _Opt('', 'env', ()),
'release': _Opt('', 'env', ()),
'today': _Opt('', 'env', ()),
@ -326,34 +326,33 @@ class Config:
valid_types = opt.valid_types
if valid_types == Any:
return value
elif (type(default) is bool
or (not isinstance(valid_types, ENUM)
and len(valid_types) == 1 and bool in valid_types)):
if (type(default) is bool
or (not isinstance(valid_types, ENUM)
and len(valid_types) == 1 and bool in valid_types)):
if isinstance(valid_types, ENUM) or len(valid_types) > 1:
# if valid_types are given, and non-bool valid types exist,
# return the value without coercing to a Boolean.
return value
# given falsy string from a command line option
return value not in {'0', ''}
elif isinstance(default, dict):
if isinstance(default, dict):
raise ValueError(__('cannot override dictionary config setting %r, '
'ignoring (use %r to set individual elements)') %
(name, f'{name}.key=value'))
elif isinstance(default, list):
if isinstance(default, list):
return value.split(',')
elif isinstance(default, int):
if isinstance(default, int):
try:
return int(value)
except ValueError as exc:
raise ValueError(__('invalid number %r for config value %r, ignoring') %
(value, name)) from exc
elif callable(default):
if callable(default):
return value
elif default is not None and not isinstance(default, str):
raise ValueError(__('cannot override config setting %r with unsupported '
'type, ignoring') % name)
else:
if isinstance(default, str) or default is None:
return value
raise ValueError(__('cannot override config setting %r with unsupported '
'type, ignoring') % name)
@staticmethod
def pre_init_values() -> None:
@ -385,13 +384,16 @@ class Config:
values.append(f"{opt_name}={opt_value!r}")
return self.__class__.__qualname__ + '(' + ', '.join(values) + ')'
def __setattr__(self, key: str, value: Any) -> None:
# if someone is still using 'master_doc', we need to update 'root_doc'
if key in ('master_doc', 'root_doc'):
def __setattr__(self, key: str, value: object) -> None:
# Ensure aliases update their counterpart.
if key == 'master_doc':
super().__setattr__('root_doc', value)
elif key == 'root_doc':
super().__setattr__('master_doc', value)
return
elif key == 'copyright':
super().__setattr__('project_copyright', value)
elif key == 'project_copyright':
super().__setattr__('copyright', value)
super().__setattr__(key, value)
def __getattr__(self, name: str) -> Any:
@ -570,10 +572,10 @@ def convert_source_suffix(app: Sphinx, config: Config) -> None:
#
# The default filetype is determined on later step.
# By default, it is considered as restructuredtext.
config.source_suffix = {source_suffix: None}
config.source_suffix = {source_suffix: 'restructuredtext'}
elif isinstance(source_suffix, (list, tuple)):
# if list, considers as all of them are default filetype
config.source_suffix = dict.fromkeys(source_suffix, None)
config.source_suffix = dict.fromkeys(source_suffix, 'restructuredtext')
elif not isinstance(source_suffix, dict):
logger.warning(__("The config value `source_suffix' expects "
"a string, list of strings, or dictionary. "

View File

@ -835,9 +835,9 @@ class CDomain(Domain):
def setup(app: Sphinx) -> ExtensionMetadata:
app.add_domain(CDomain)
app.add_config_value("c_id_attributes", [], 'env')
app.add_config_value("c_paren_attributes", [], 'env')
app.add_config_value("c_extra_keywords", _macroKeywords, 'env')
app.add_config_value("c_id_attributes", [], 'env', types={list, tuple})
app.add_config_value("c_paren_attributes", [], 'env', types={list, tuple})
app.add_config_value("c_extra_keywords", _macroKeywords, 'env', types={set, list})
app.add_config_value("c_maximum_signature_line_length", None, 'env', types={int, None})
app.add_post_transform(AliasTransform)

View File

@ -1157,8 +1157,8 @@ class CPPDomain(Domain):
def setup(app: Sphinx) -> ExtensionMetadata:
app.add_domain(CPPDomain)
app.add_config_value("cpp_index_common_prefix", [], 'env')
app.add_config_value("cpp_id_attributes", [], 'env')
app.add_config_value("cpp_paren_attributes", [], 'env')
app.add_config_value("cpp_id_attributes", [], 'env', types={list, tuple})
app.add_config_value("cpp_paren_attributes", [], 'env', types={list, tuple})
app.add_config_value("cpp_maximum_signature_line_length", None, 'env', types={int, None})
app.add_post_transform(AliasTransform)

View File

@ -497,20 +497,23 @@ class LaTeXTranslator(SphinxTranslator):
ret = []
# latex_domain_indices can be False/True or a list of index names
indices_config = self.config.latex_domain_indices
if indices_config:
for domain in self.builder.env.domains.values():
for indexcls in domain.indices:
indexname = f'{domain.name}-{indexcls.name}'
if isinstance(indices_config, list):
if indexname not in indices_config:
continue
content, collapsed = indexcls(domain).generate(
self.builder.docnames)
if not content:
if indices_config := self.config.latex_domain_indices:
if not isinstance(indices_config, bool):
check_names = True
indices_config = frozenset(indices_config)
else:
check_names = False
for domain_name in sorted(self.builder.env.domains):
domain = self.builder.env.domains[domain_name]
for index_cls in domain.indices:
index_name = f'{domain.name}-{index_cls.name}'
if check_names and index_name not in indices_config:
continue
ret.append(r'\renewcommand{\indexname}{%s}' % indexcls.localname + CR)
generate(content, collapsed)
content, collapsed = index_cls(domain).generate(
self.builder.docnames)
if content:
ret.append(r'\renewcommand{\indexname}{%s}' % index_cls.localname + CR)
generate(content, collapsed)
return ''.join(ret)

View File

@ -476,20 +476,25 @@ class TexinfoTranslator(SphinxTranslator):
ret.append('@end menu\n')
return ''.join(ret)
indices_config = self.config.texinfo_domain_indices
if indices_config:
for domain in self.builder.env.domains.values():
for indexcls in domain.indices:
indexname = f'{domain.name}-{indexcls.name}'
if isinstance(indices_config, list):
if indexname not in indices_config:
continue
content, collapsed = indexcls(domain).generate(
self.builder.docnames)
if not content:
if indices_config := self.config.texinfo_domain_indices:
if not isinstance(indices_config, bool):
check_names = True
indices_config = frozenset(indices_config)
else:
check_names = False
for domain_name in sorted(self.builder.env.domains):
domain = self.builder.env.domains[domain_name]
for index_cls in domain.indices:
index_name = f'{domain.name}-{index_cls.name}'
if check_names and index_name not in indices_config:
continue
self.indices.append((indexcls.localname,
generate(content, collapsed)))
content, collapsed = index_cls(domain).generate(
self.builder.docnames)
if content:
self.indices.append((
index_cls.localname,
generate(content, collapsed),
))
# only add the main Index if it's not empty
domain = cast(IndexDomain, self.builder.env.get_domain('index'))
for docname in self.builder.docnames:

View File

@ -17,7 +17,10 @@ jsmath_path = 'dummy.js'
templates_path = ['_templates']
source_suffix = ['.txt', '.add', '.foo']
source_suffix = {
'.txt': 'restructuredtext',
'.foo': 'foo',
}
project = 'Sphinx <Tests>'
copyright = '1234-6789, copyright text credits'
@ -68,7 +71,7 @@ latex_elements = {
shadowrule=1pt,
shadowsep=10pt,
shadowsize=10pt,
div.topic_border-width=2pt,% alias to shadowrule
div.topic_border-width=2pt,% alias to shadowrule
div.topic_padding=6pt,% alias to shadowsep
div.topic_box-shadow=5pt,% overrides/alias shadowsize
%

View File

@ -96,7 +96,7 @@ def test_add_source_parser(app, status, warning):
# .rst; only in :confval:`source_suffix`
assert '.rst' not in app.registry.get_source_parsers()
assert app.registry.source_suffix['.rst'] is None
assert app.registry.source_suffix['.rst'] == 'restructuredtext'
# .test; configured by API
assert app.registry.source_suffix['.test'] == 'test'

View File

@ -28,13 +28,13 @@ def test_dirhtml(app, status, warning):
invdata = InventoryFile.load(f, 'path/to', posixpath.join)
assert 'index' in invdata.get('std:doc')
assert invdata['std:doc']['index'] == ('Python', '', 'path/to/', '-')
assert invdata['std:doc']['index'] == ('Project name not set', '', 'path/to/', '-')
assert 'foo/index' in invdata.get('std:doc')
assert invdata['std:doc']['foo/index'] == ('Python', '', 'path/to/foo/', '-')
assert invdata['std:doc']['foo/index'] == ('Project name not set', '', 'path/to/foo/', '-')
assert 'index' in invdata.get('std:label')
assert invdata['std:label']['index'] == ('Python', '', 'path/to/#index', '-')
assert invdata['std:label']['index'] == ('Project name not set', '', 'path/to/#index', '-')
assert 'foo' in invdata.get('std:label')
assert invdata['std:label']['foo'] == ('Python', '', 'path/to/foo/#foo', 'foo/index')
assert invdata['std:label']['foo'] == ('Project name not set', '', 'path/to/foo/#foo', 'foo/index')

View File

@ -67,7 +67,7 @@ def test_build_epub(app):
# toc.ncx
toc = EPUBElementTree.fromstring((app.outdir / 'toc.ncx').read_text(encoding='utf8'))
assert toc.find("./ncx:docTitle/ncx:text").text == 'Python'
assert toc.find("./ncx:docTitle/ncx:text").text == 'Project name not set'
# toc.ncx / head
meta = list(toc.find("./ncx:head"))
@ -91,11 +91,11 @@ def test_build_epub(app):
# content.opf / metadata
metadata = opf.find("./idpf:metadata")
assert metadata.find("./dc:language").text == 'en'
assert metadata.find("./dc:title").text == 'Python'
assert metadata.find("./dc:title").text == 'Project name not set'
assert metadata.find("./dc:description").text == 'unknown'
assert metadata.find("./dc:creator").text == 'unknown'
assert metadata.find("./dc:creator").text == 'Author name not set'
assert metadata.find("./dc:contributor").text == 'unknown'
assert metadata.find("./dc:publisher").text == 'unknown'
assert metadata.find("./dc:publisher").text == 'Author name not set'
assert metadata.find("./dc:rights").text is None
assert metadata.find("./idpf:meta[@property='ibooks:version']").text is None
assert metadata.find("./idpf:meta[@property='ibooks:specified-fonts']").text == 'true'
@ -171,7 +171,7 @@ def test_nested_toc(app):
# toc.ncx
toc = EPUBElementTree.fromstring((app.outdir / 'toc.ncx').read_bytes())
assert toc.find("./ncx:docTitle/ncx:text").text == 'Python'
assert toc.find("./ncx:docTitle/ncx:text").text == 'Project name not set'
# toc.ncx / navPoint
def navinfo(elem):

View File

@ -131,24 +131,24 @@ def test_html_inventory(app):
'py-modindex',
'genindex',
'search'}
assert invdata['std:label']['modindex'] == ('Python',
assert invdata['std:label']['modindex'] == ('Project name not set',
'',
'https://www.google.com/py-modindex.html',
'Module Index')
assert invdata['std:label']['py-modindex'] == ('Python',
assert invdata['std:label']['py-modindex'] == ('Project name not set',
'',
'https://www.google.com/py-modindex.html',
'Python Module Index')
assert invdata['std:label']['genindex'] == ('Python',
assert invdata['std:label']['genindex'] == ('Project name not set',
'',
'https://www.google.com/genindex.html',
'Index')
assert invdata['std:label']['search'] == ('Python',
assert invdata['std:label']['search'] == ('Project name not set',
'',
'https://www.google.com/search.html',
'Search Page')
assert set(invdata['std:doc'].keys()) == {'index'}
assert invdata['std:doc']['index'] == ('Python',
assert invdata['std:doc']['index'] == ('Project name not set',
'',
'https://www.google.com/index.html',
'The basic Sphinx documentation for testing')
@ -223,7 +223,7 @@ def test_html_sidebar(app, status, warning):
result = (app.outdir / 'index.html').read_text(encoding='utf8')
assert ('<div class="sphinxsidebar" role="navigation" '
'aria-label="Main">' in result)
assert '<h1 class="logo"><a href="#">Python</a></h1>' in result
assert '<h1 class="logo"><a href="#">Project name not set</a></h1>' in result
assert '<h3>Navigation</h3>' in result
assert '<h3>Related Topics</h3>' in result
assert '<h3 id="searchlabel">Quick search</h3>' in result

View File

@ -29,7 +29,7 @@ def test_html_remote_logo(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'index.html').read_text(encoding='utf8')
assert ('<img class="logo" src="https://www.python.org/static/img/python-logo.png" alt="Logo of Python"/>' in result)
assert ('<img class="logo" src="https://www.python.org/static/img/python-logo.png" alt="Logo of Project name not set"/>' in result)
assert ('<link rel="icon" href="https://www.python.org/static/favicon.ico"/>' in result)
assert not (app.outdir / 'python-logo.png').exists()
@ -39,7 +39,7 @@ def test_html_local_logo(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'index.html').read_text(encoding='utf8')
assert ('<img class="logo" src="_static/img.png" alt="Logo of Python"/>' in result)
assert ('<img class="logo" src="_static/img.png" alt="Logo of Project name not set"/>' in result)
assert (app.outdir / '_static/img.png').exists()

View File

@ -41,7 +41,7 @@ def kpsetest(*filenames):
# compile latex document with app.config.latex_engine
def compile_latex_document(app, filename='python.tex', docclass='manual'):
def compile_latex_document(app, filename='projectnamenotset.tex', docclass='manual'):
# now, try to run latex over it
try:
with chdir(app.outdir):
@ -255,7 +255,7 @@ def test_latex_basic_howto_ja(app, status, warning):
@pytest.mark.sphinx('latex', testroot='latex-theme')
def test_latex_theme(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
assert r'\def\sphinxdocclass{book}' in result
assert r'\documentclass[a4paper,12pt,english]{sphinxbook}' in result
@ -266,7 +266,7 @@ def test_latex_theme(app, status, warning):
'pointsize': '9pt'}})
def test_latex_theme_papersize(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
assert r'\def\sphinxdocclass{book}' in result
assert r'\documentclass[b5paper,9pt,english]{sphinxbook}' in result
@ -277,7 +277,7 @@ def test_latex_theme_papersize(app, status, warning):
'pointsize': '9pt'}})
def test_latex_theme_options(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
assert r'\def\sphinxdocclass{book}' in result
assert r'\documentclass[b5paper,9pt,english]{sphinxbook}' in result
@ -330,7 +330,7 @@ def test_latex_release(app, status, warning):
confoverrides={'numfig': True})
def test_numref(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -372,7 +372,7 @@ def test_numref(app, status, warning):
'section': 'SECTION-%s'}})
def test_numref_with_prefix1(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -420,7 +420,7 @@ def test_numref_with_prefix1(app, status, warning):
'section': 'SECTION_%s_'}})
def test_numref_with_prefix2(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -460,7 +460,7 @@ def test_numref_with_prefix2(app, status, warning):
confoverrides={'numfig': True, 'language': 'ja'})
def test_numref_with_language_ja(app, status, warning):
app.build()
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -556,7 +556,7 @@ def test_latex_add_latex_package(app, status, warning):
@pytest.mark.sphinx('latex', testroot='latex-babel')
def test_babel_with_no_language_settings(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -581,7 +581,7 @@ def test_babel_with_no_language_settings(app, status, warning):
confoverrides={'language': 'de'})
def test_babel_with_language_de(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -606,7 +606,7 @@ def test_babel_with_language_de(app, status, warning):
confoverrides={'language': 'ru'})
def test_babel_with_language_ru(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -631,7 +631,7 @@ def test_babel_with_language_ru(app, status, warning):
confoverrides={'language': 'tr'})
def test_babel_with_language_tr(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -656,7 +656,7 @@ def test_babel_with_language_tr(app, status, warning):
confoverrides={'language': 'ja'})
def test_babel_with_language_ja(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -680,7 +680,7 @@ def test_babel_with_language_ja(app, status, warning):
confoverrides={'language': 'unknown'})
def test_babel_with_unknown_language(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -707,7 +707,7 @@ def test_babel_with_unknown_language(app, status, warning):
confoverrides={'language': 'de', 'latex_engine': 'lualatex'})
def test_polyglossia_with_language_de(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -733,7 +733,7 @@ def test_polyglossia_with_language_de(app, status, warning):
confoverrides={'language': 'de-1901', 'latex_engine': 'lualatex'})
def test_polyglossia_with_language_de_1901(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -786,7 +786,7 @@ def test_footnote(app, status, warning):
@pytest.mark.sphinx('latex', testroot='footnotes')
def test_reference_in_caption_and_codeblock_in_footnote(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -826,7 +826,7 @@ def test_reference_in_caption_and_codeblock_in_footnote(app, status, warning):
@pytest.mark.sphinx('latex', testroot='footnotes')
def test_footnote_referred_multiple_times(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -848,7 +848,7 @@ def test_footnote_referred_multiple_times(app, status, warning):
confoverrides={'latex_show_urls': 'inline'})
def test_latex_show_urls_is_inline(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -905,7 +905,7 @@ def test_latex_show_urls_is_inline(app, status, warning):
confoverrides={'latex_show_urls': 'footnote'})
def test_latex_show_urls_is_footnote(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -967,7 +967,7 @@ def test_latex_show_urls_is_footnote(app, status, warning):
confoverrides={'latex_show_urls': 'no'})
def test_latex_show_urls_is_no(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -1022,7 +1022,7 @@ def test_latex_show_urls_footnote_and_substitutions(app, status, warning):
@pytest.mark.sphinx('latex', testroot='image-in-section')
def test_image_in_section(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -1045,7 +1045,7 @@ def test_latex_logo_if_not_found(app, status, warning):
@pytest.mark.sphinx('latex', testroot='toctree-maxdepth')
def test_toctree_maxdepth_manual(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -1057,12 +1057,12 @@ def test_toctree_maxdepth_manual(app, status, warning):
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'latex_documents': [
('index', 'python.tex', 'Sphinx Tests Documentation',
('index', 'projectnamenotset.tex', 'Sphinx Tests Documentation',
'Georg Brandl', 'howto'),
]})
def test_toctree_maxdepth_howto(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -1076,7 +1076,7 @@ def test_toctree_maxdepth_howto(app, status, warning):
confoverrides={'root_doc': 'foo'})
def test_toctree_not_found(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -1090,7 +1090,7 @@ def test_toctree_not_found(app, status, warning):
confoverrides={'root_doc': 'bar'})
def test_toctree_without_maxdepth(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -1103,7 +1103,7 @@ def test_toctree_without_maxdepth(app, status, warning):
confoverrides={'root_doc': 'qux'})
def test_toctree_with_deeper_maxdepth(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -1116,7 +1116,7 @@ def test_toctree_with_deeper_maxdepth(app, status, warning):
confoverrides={'latex_toplevel_sectioning': None})
def test_latex_toplevel_sectioning_is_None(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -1128,7 +1128,7 @@ def test_latex_toplevel_sectioning_is_None(app, status, warning):
confoverrides={'latex_toplevel_sectioning': 'part'})
def test_latex_toplevel_sectioning_is_part(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -1141,12 +1141,12 @@ def test_latex_toplevel_sectioning_is_part(app, status, warning):
'latex', testroot='toctree-maxdepth',
confoverrides={'latex_toplevel_sectioning': 'part',
'latex_documents': [
('index', 'python.tex', 'Sphinx Tests Documentation',
('index', 'projectnamenotset.tex', 'Sphinx Tests Documentation',
'Georg Brandl', 'howto'),
]})
def test_latex_toplevel_sectioning_is_part_with_howto(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -1160,7 +1160,7 @@ def test_latex_toplevel_sectioning_is_part_with_howto(app, status, warning):
confoverrides={'latex_toplevel_sectioning': 'chapter'})
def test_latex_toplevel_sectioning_is_chapter(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -1171,12 +1171,12 @@ def test_latex_toplevel_sectioning_is_chapter(app, status, warning):
'latex', testroot='toctree-maxdepth',
confoverrides={'latex_toplevel_sectioning': 'chapter',
'latex_documents': [
('index', 'python.tex', 'Sphinx Tests Documentation',
('index', 'projectnamenotset.tex', 'Sphinx Tests Documentation',
'Georg Brandl', 'howto'),
]})
def test_latex_toplevel_sectioning_is_chapter_with_howto(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -1188,7 +1188,7 @@ def test_latex_toplevel_sectioning_is_chapter_with_howto(app, status, warning):
confoverrides={'latex_toplevel_sectioning': 'section'})
def test_latex_toplevel_sectioning_is_section(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@ -1199,11 +1199,11 @@ def test_latex_toplevel_sectioning_is_section(app, status, warning):
@pytest.mark.sphinx('latex', testroot='maxlistdepth')
def test_maxlistdepth_at_ten(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
compile_latex_document(app, 'python.tex')
compile_latex_document(app, 'projectnamenotset.tex')
@pytest.mark.sphinx('latex', testroot='latex-table',
@ -1211,7 +1211,7 @@ def test_maxlistdepth_at_ten(app, status, warning):
@pytest.mark.test_params(shared_result='latex-table')
def test_latex_table_tabulars(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
tables = {}
for chap in re.split(r'\\(?:section|chapter){', result)[1:]:
sectname, content = chap.split('}', 1)
@ -1282,7 +1282,7 @@ def test_latex_table_tabulars(app, status, warning):
@pytest.mark.test_params(shared_result='latex-table')
def test_latex_table_longtable(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
tables = {}
for chap in re.split(r'\\(?:section|chapter){', result)[1:]:
sectname, content = chap.split('}', 1)
@ -1343,7 +1343,7 @@ def test_latex_table_longtable(app, status, warning):
@pytest.mark.test_params(shared_result='latex-table')
def test_latex_table_complex_tables(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
tables = {}
for chap in re.split(r'\\(?:section|renewcommand){', result)[1:]:
sectname, content = chap.split('}', 1)
@ -1373,7 +1373,7 @@ def test_latex_table_complex_tables(app, status, warning):
@pytest.mark.sphinx('latex', testroot='latex-table')
def test_latex_table_with_booktabs_and_colorrows(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert r'\PassOptionsToPackage{booktabs}{sphinx}' in result
assert r'\PassOptionsToPackage{colorrows}{sphinx}' in result
# tabularcolumns
@ -1389,7 +1389,7 @@ def test_latex_table_with_booktabs_and_colorrows(app, status, warning):
confoverrides={'templates_path': ['_mytemplates/latex']})
def test_latex_table_custom_template_caseA(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert 'SALUT LES COPAINS' in result
assert 'AU REVOIR, KANIGGETS' in result
@ -1398,7 +1398,7 @@ def test_latex_table_custom_template_caseA(app, status, warning):
confoverrides={'templates_path': ['_mytemplates']})
def test_latex_table_custom_template_caseB(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert 'SALUT LES COPAINS' not in result
@ -1406,14 +1406,14 @@ def test_latex_table_custom_template_caseB(app, status, warning):
@pytest.mark.test_params(shared_result='latex-table')
def test_latex_table_custom_template_caseC(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert 'SALUT LES COPAINS' not in result
@pytest.mark.sphinx('latex', testroot='directives-raw')
def test_latex_raw_directive(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
# standard case
assert 'standalone raw directive (HTML)' not in result
@ -1430,7 +1430,7 @@ def test_latex_images(app, status, warning):
with http_server(RemoteImageHandler, port=7777):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
# images are copied
assert '\\sphinxincludegraphics{{sphinx}.png}' in result
@ -1454,7 +1454,7 @@ def test_latex_images(app, status, warning):
def test_latex_index(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert ('A \\index{famous@\\spxentry{famous}}famous '
'\\index{equation@\\spxentry{equation}}equation:\n' in result)
assert ('\n\\index{Einstein@\\spxentry{Einstein}}'
@ -1468,7 +1468,7 @@ def test_latex_index(app, status, warning):
def test_latex_equations(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
expected = (app.srcdir / 'expects' / 'latex-equations.tex').read_text(encoding='utf8').strip()
assert expected in result
@ -1478,7 +1478,7 @@ def test_latex_equations(app, status, warning):
def test_latex_image_in_parsed_literal(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert ('{\\sphinxunactivateextrasandspace \\raisebox{-0.5\\height}'
'{\\sphinxincludegraphics[height=2.00000cm]{{pic}.png}}'
'}AFTER') in result
@ -1488,7 +1488,7 @@ def test_latex_image_in_parsed_literal(app, status, warning):
def test_latex_nested_enumerated_list(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert ('\\sphinxsetlistlabels{\\arabic}{enumi}{enumii}{}{.}%\n'
'\\setcounter{enumi}{4}\n' in result)
assert ('\\sphinxsetlistlabels{\\alph}{enumii}{enumiii}{}{.}%\n'
@ -1505,7 +1505,7 @@ def test_latex_nested_enumerated_list(app, status, warning):
def test_latex_thebibliography(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
assert ('\\begin{sphinxthebibliography}{AuthorYe}\n'
'\\bibitem[AuthorYear]{index:authoryear}\n\\sphinxAtStartPar\n'
@ -1518,7 +1518,7 @@ def test_latex_thebibliography(app, status, warning):
def test_latex_glossary(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert (r'\sphinxlineitem{ähnlich\index{ähnlich@\spxentry{ähnlich}|spxpagem}'
r'\phantomsection'
r'\label{\detokenize{index:term-ahnlich}}}' in result)
@ -1542,7 +1542,7 @@ def test_latex_glossary(app, status, warning):
def test_latex_labels(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
# figures
assert (r'\caption{labeled figure}'
@ -1590,7 +1590,7 @@ def test_latex_labels(app, status, warning):
@pytest.mark.sphinx('latex', testroot='latex-figure-in-admonition')
def test_latex_figure_in_admonition(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert r'\begin{figure}[H]' in result
@ -1620,7 +1620,7 @@ def test_includegraphics_oversized(app, status, warning):
@pytest.mark.sphinx('latex', testroot='index_on_title')
def test_index_on_title(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert ('\\chapter{Test for index in top level title}\n'
'\\label{\\detokenize{contents:test-for-index-in-top-level-title}}'
'\\index{index@\\spxentry{index}}\n'
@ -1631,7 +1631,7 @@ def test_index_on_title(app, status, warning):
confoverrides={'latex_engine': 'pdflatex'})
def test_texescape_for_non_unicode_supported_engine(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
assert 'script small e: e' in result
assert 'double struck italic small i: i' in result
@ -1643,7 +1643,7 @@ def test_texescape_for_non_unicode_supported_engine(app, status, warning):
confoverrides={'latex_engine': 'xelatex'})
def test_texescape_for_unicode_supported_engine(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
assert 'script small e: e' in result
assert 'double struck italic small i: i' in result
@ -1668,7 +1668,7 @@ def test_latex_nested_tables(app, status, warning):
@pytest.mark.sphinx('latex', testroot='latex-container')
def test_latex_container(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert r'\begin{sphinxuseclass}{classname}' in result
assert r'\end{sphinxuseclass}' in result
@ -1676,7 +1676,7 @@ def test_latex_container(app, status, warning):
@pytest.mark.sphinx('latex', testroot='reST-code-role')
def test_latex_code_role(app):
app.build()
content = (app.outdir / 'python.tex').read_text(encoding='utf8')
content = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
common_content = (
r'\PYG{k}{def} '
@ -1721,7 +1721,7 @@ def test_copy_images(app, status, warning):
@pytest.mark.sphinx('latex', testroot='latex-labels-before-module')
def test_duplicated_labels_before_module(app, status, warning):
app.build()
content: str = (app.outdir / 'python.tex').read_text(encoding='utf8')
content: str = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
def count_label(name):
text = r'\phantomsection\label{\detokenize{%s}}' % name
@ -1752,7 +1752,7 @@ def test_duplicated_labels_before_module(app, status, warning):
confoverrides={'python_maximum_signature_line_length': 23})
def test_one_parameter_per_line(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
# TODO: should these asserts check presence or absence of a final \sphinxparamcomma?
# signature of 23 characters is too short to trigger one-param-per-line mark-up

View File

@ -44,13 +44,13 @@ def test_man_pages_empty_description(app, status, warning):
confoverrides={'man_make_section_directory': True})
def test_man_make_section_directory(app, status, warning):
app.build()
assert (app.outdir / 'man1' / 'python.1').exists()
assert (app.outdir / 'man1' / 'projectnamenotset.1').exists()
@pytest.mark.sphinx('man', testroot='directive-code')
def test_captioned_code_block(app, status, warning):
app.build(force_all=True)
content = (app.outdir / 'python.1').read_text(encoding='utf8')
content = (app.outdir / 'projectnamenotset.1').read_text(encoding='utf8')
if docutils.__version_info__[:2] < (0, 21):
expected = """\
@ -100,5 +100,5 @@ def test_default_man_pages():
@pytest.mark.sphinx('man', testroot='markup-rubric')
def test_rubric(app, status, warning):
app.build()
content = (app.outdir / 'python.1').read_text(encoding='utf8')
content = (app.outdir / 'projectnamenotset.1').read_text(encoding='utf8')
assert 'This is a rubric\n' in content

View File

@ -40,7 +40,7 @@ def test_texinfo(app, status, warning):
def test_texinfo_rubric(app, status, warning):
app.build()
output = (app.outdir / 'python.texi').read_text(encoding='utf8')
output = (app.outdir / 'projectnamenotset.texi').read_text(encoding='utf8')
assert '@heading This is a rubric' in output
assert '@heading This is a multiline rubric' in output
@ -49,7 +49,7 @@ def test_texinfo_rubric(app, status, warning):
def test_texinfo_citation(app, status, warning):
app.build(force_all=True)
output = (app.outdir / 'python.texi').read_text(encoding='utf8')
output = (app.outdir / 'projectnamenotset.texi').read_text(encoding='utf8')
assert 'This is a citation ref; @ref{1,,[CITE1]} and @ref{2,,[CITE2]}.' in output
assert ('@anchor{index cite1}@anchor{1}@w{(CITE1)} \n'
'This is a citation\n') in output
@ -87,7 +87,7 @@ def test_texinfo_escape_id(app, status, warning):
def test_texinfo_footnote(app, status, warning):
app.build(force_all=True)
output = (app.outdir / 'python.texi').read_text(encoding='utf8')
output = (app.outdir / 'projectnamenotset.texi').read_text(encoding='utf8')
assert 'First footnote: @footnote{\nFirst\n}' in output
@ -120,7 +120,7 @@ def test_texinfo_samp_with_variable(app, status, warning):
def test_copy_images(app, status, warning):
app.build()
images_dir = Path(app.outdir) / 'python-figures'
images_dir = Path(app.outdir) / 'projectnamenotset-figures'
images = {image.name for image in images_dir.rglob('*')}
images.discard('python-logo.png')
assert images == {

View File

@ -330,7 +330,7 @@ def test_code_block_caption_html(app, status, warning):
@pytest.mark.sphinx('latex', testroot='directive-code')
def test_code_block_caption_latex(app, status, warning):
app.build(force_all=True)
latex = (app.outdir / 'python.tex').read_text(encoding='utf8')
latex = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
caption = '\\sphinxSetupCaptionForVerbatim{caption \\sphinxstyleemphasis{test} rb}'
label = '\\def\\sphinxLiteralBlockLabel{\\label{\\detokenize{caption:id1}}}'
link = '\\hyperref[\\detokenize{caption:name-test-rb}]' \
@ -343,7 +343,7 @@ def test_code_block_caption_latex(app, status, warning):
@pytest.mark.sphinx('latex', testroot='directive-code')
def test_code_block_namedlink_latex(app, status, warning):
app.build(force_all=True)
latex = (app.outdir / 'python.tex').read_text(encoding='utf8')
latex = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
label1 = '\\def\\sphinxLiteralBlockLabel{\\label{\\detokenize{caption:name-test-rb}}}'
link1 = '\\hyperref[\\detokenize{caption:name-test-rb}]'\
'{\\sphinxcrossref{\\DUrole{std,std-ref}{Ruby}}'
@ -360,7 +360,7 @@ def test_code_block_namedlink_latex(app, status, warning):
@pytest.mark.sphinx('latex', testroot='directive-code')
def test_code_block_emphasize_latex(app, status, warning):
app.build(filenames=[app.srcdir / 'emphasize.rst'])
latex = (app.outdir / 'python.tex').read_text(encoding='utf8').replace('\r\n', '\n')
latex = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8').replace('\r\n', '\n')
includes = '\\fvset{hllines={, 5, 6, 13, 14, 15, 24, 25, 26,}}%\n'
assert includes in latex
includes = '\\end{sphinxVerbatim}\n\\sphinxresetverbatimhllines\n'
@ -424,7 +424,7 @@ def test_literal_include_linenos(app, status, warning):
@pytest.mark.sphinx('latex', testroot='directive-code')
def test_literalinclude_file_whole_of_emptyline(app, status, warning):
app.build(force_all=True)
latex = (app.outdir / 'python.tex').read_text(encoding='utf8').replace('\r\n', '\n')
latex = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8').replace('\r\n', '\n')
includes = (
'\\begin{sphinxVerbatim}'
'[commandchars=\\\\\\{\\},numbers=left,firstnumber=1,stepnumber=1]\n'
@ -450,7 +450,7 @@ def test_literalinclude_caption_html(app, status, warning):
@pytest.mark.sphinx('latex', testroot='directive-code')
def test_literalinclude_caption_latex(app, status, warning):
app.build(filenames='index')
latex = (app.outdir / 'python.tex').read_text(encoding='utf8')
latex = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
caption = '\\sphinxSetupCaptionForVerbatim{caption \\sphinxstylestrong{test} py}'
label = '\\def\\sphinxLiteralBlockLabel{\\label{\\detokenize{caption:id2}}}'
link = '\\hyperref[\\detokenize{caption:name-test-py}]' \
@ -463,7 +463,7 @@ def test_literalinclude_caption_latex(app, status, warning):
@pytest.mark.sphinx('latex', testroot='directive-code')
def test_literalinclude_namedlink_latex(app, status, warning):
app.build(filenames='index')
latex = (app.outdir / 'python.tex').read_text(encoding='utf8')
latex = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
label1 = '\\def\\sphinxLiteralBlockLabel{\\label{\\detokenize{caption:name-test-py}}}'
link1 = '\\hyperref[\\detokenize{caption:name-test-py}]'\
'{\\sphinxcrossref{\\DUrole{std,std-ref}{Python}}'

View File

@ -545,7 +545,7 @@ def test_autosummary_filename_map(app, status, warning):
@pytest.mark.sphinx('latex', **default_kw)
def test_autosummary_latex_table_colspec(app, status, warning):
app.build(force_all=True)
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(status.getvalue())
print(warning.getvalue())
assert r'\begin{longtable}{\X{1}{2}\X{1}{2}}' in result

View File

@ -105,7 +105,7 @@ def test_graphviz_svg_html(app, status, warning):
def test_graphviz_latex(app, status, warning):
app.build(force_all=True)
content = (app.outdir / 'python.tex').read_text(encoding='utf8')
content = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
macro = ('\\\\begin{figure}\\[htbp\\]\n\\\\centering\n\\\\capstart\n\n'
'\\\\sphinxincludegraphics\\[\\]{graphviz-\\w+.pdf}\n'
'\\\\caption{caption of graph}\\\\label{.*}\\\\end{figure}')

View File

@ -24,7 +24,7 @@ def _if_converter_found(app):
def test_ext_imgconverter(app, status, warning):
app.build(force_all=True)
content = (app.outdir / 'python.tex').read_text(encoding='utf8')
content = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
# supported image (not converted)
assert '\\sphinxincludegraphics{{img}.pdf}' in content

View File

@ -7,7 +7,7 @@ import pytest
def test_ext_imgmockconverter(app, status, warning):
app.build(force_all=True)
content = (app.outdir / 'python.tex').read_text(encoding='utf8')
content = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
# check identical basenames give distinct files
assert '\\sphinxincludegraphics{{svgimg}.pdf}' in content

View File

@ -251,7 +251,7 @@ def test_inheritance_diagram_svg_html(tmp_path, app):
def test_inheritance_diagram_latex(app, status, warning):
app.build(force_all=True)
content = (app.outdir / 'python.tex').read_text(encoding='utf8')
content = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
pattern = ('\\\\begin{figure}\\[htbp]\n\\\\centering\n\\\\capstart\n\n'
'\\\\sphinxincludegraphics\\[\\]{inheritance-\\w+.pdf}\n'

View File

@ -127,7 +127,7 @@ def test_math_number_all_mathjax(app, status, warning):
def test_math_number_all_latex(app, status, warning):
app.build()
content = (app.outdir / 'python.tex').read_text(encoding='utf8')
content = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
macro = (r'\\begin{equation\*}\s*'
r'\\begin{split}a\^2\+b\^2=c\^2\\end{split}\s*'
r'\\end{equation\*}')
@ -170,7 +170,7 @@ def test_math_eqref_format_html(app, status, warning):
def test_math_eqref_format_latex(app, status, warning):
app.build(force_all=True)
content = (app.outdir / 'python.tex').read_text(encoding='utf8')
content = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
macro = (r'Referencing equation Eq.\\ref{equation:math:foo} and '
r'Eq.\\ref{equation:math:foo}.')
assert re.search(macro, content, re.DOTALL)

View File

@ -89,7 +89,7 @@ def test_todo_valid_link(app, status, warning):
# Ensure the LaTeX output is built.
app.build(force_all=True)
content = (app.outdir / 'python.tex').read_text(encoding='utf8')
content = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
# Look for the link to foo. Note that there are two of them because the
# source document uses todolist twice. We could equally well look for links

View File

@ -41,7 +41,7 @@ def test_text_builder(app, status, warning):
def test_man_builder(app, status, warning):
app.build()
content = (app.outdir / 'python.1').read_text(encoding='utf8')
content = (app.outdir / 'projectnamenotset.1').read_text(encoding='utf8')
assert r'\-\- \(dqSphinx\(dq is a tool that makes it easy ...' in content
@ -49,7 +49,7 @@ def test_man_builder(app, status, warning):
def test_latex_builder(app, status, warning):
app.build()
content = (app.outdir / 'python.tex').read_text(encoding='utf8')
content = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert '\\textendash{} “Sphinx” is a tool that makes it easy …' in content
@ -94,5 +94,5 @@ def test_smartquotes_excludes_language(app, status, warning):
def test_smartquotes_excludes_builders(app, status, warning):
app.build()
content = (app.outdir / 'python.1').read_text(encoding='utf8')
content = (app.outdir / 'projectnamenotset.1').read_text(encoding='utf8')
assert ' “Sphinx” is a tool that makes it easy …' in content

View File

@ -112,12 +112,12 @@ def test_staticfiles(app, status, warning):
assert (app.outdir / '_static' / 'legacytmpl.html').exists()
assert (app.outdir / '_static' / 'legacytmpl.html').read_text(encoding='utf8') == (
'<!-- testing legacy _t static templates -->\n'
'<html><project>python</project></html>'
'<html><project>project name not set</project></html>'
)
assert (app.outdir / '_static' / 'staticimg.png').exists()
assert (app.outdir / '_static' / 'statictmpl.html').exists()
assert (app.outdir / '_static' / 'statictmpl.html').read_text(encoding='utf8') == (
'<!-- testing static templates -->\n<html><project>Python</project></html>'
'<!-- testing static templates -->\n<html><project>Project name not set</project></html>'
)
result = (app.outdir / 'index.html').read_text(encoding='utf8')

View File

@ -34,7 +34,7 @@ def test_trim_doctest_flags_disabled(app, status, warning):
def test_trim_doctest_flags_latex(app, status, warning):
app.build()
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert 'FOO' not in result
assert 'BAR' in result
assert 'BAZ' not in result

View File

@ -49,12 +49,12 @@ Bump to next development version
for stable and major releases
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ``python utils/bump_version.py --in-develop X.Y.Z+1b0`` (ex. 1.5.3b0)
* ``python utils/bump_version.py --in-develop X.Y.Z+1b0`` (e.g. 1.5.3b0)
for beta releases
~~~~~~~~~~~~~~~~~
* ``python utils/bump_version.py --in-develop X.Y.0bN+1`` (ex. 1.6.0b2)
* ``python utils/bump_version.py --in-develop X.Y.0bN+1`` (e.g. 1.6.0b2)
Commit version bump
-------------------