summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES14
-rw-r--r--doc/_static/favicon.svg8
-rw-r--r--doc/conf.py1
-rw-r--r--doc/glossary.rst4
-rw-r--r--doc/man/sphinx-quickstart.rst4
-rw-r--r--doc/usage/configuration.rst5
-rw-r--r--setup.cfg2
-rw-r--r--sphinx/builders/_epub_base.py7
-rw-r--r--sphinx/builders/linkcheck.py5
-rw-r--r--sphinx/cmd/quickstart.py4
-rw-r--r--sphinx/ext/autodoc/importer.py5
-rw-r--r--sphinx/testing/fixtures.py15
-rw-r--r--sphinx/texinputs/sphinx.sty15
-rw-r--r--sphinx/themes/basic/layout.html2
-rw-r--r--sphinx/themes/basic/static/basic.css_t1
-rw-r--r--sphinx/themes/basic/static/doctools.js5
-rw-r--r--sphinx/themes/basic/static/searchtools.js8
-rw-r--r--tests/roots/test-ext-autodoc/target/slots.py4
-rw-r--r--tests/roots/test-root/conf.py2
-rw-r--r--tests/roots/test-root/markup.txt4
-rw-r--r--tests/test_build_html.py2
-rw-r--r--tests/test_ext_autodoc.py8
22 files changed, 98 insertions, 27 deletions
diff --git a/CHANGES b/CHANGES
index 76468a8d7..ab610b01c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -74,6 +74,10 @@ Features added
just before writing .tex file
* #7996: manpage: Add :confval:`man_make_section_directory` to make a section
directory on build man page
+* #8289: epub: Allow to suppress "duplicated ToC entry found" warnings from epub
+ builder using :confval:`suppress_warnings`.
+* #8298: sphinx-quickstart: Add :option:`sphinx-quickstart --no-sep` option
+* #8304: sphinx.testing: Register public markers in sphinx.testing.fixtures
Bugs fixed
----------
@@ -91,21 +95,31 @@ Bugs fixed
* #7964: autodoc: Tuple in default value is wrongly rendered
* #8200: autodoc: type aliases break type formatting of autoattribute
* #7786: autodoc: can't detect overloaded methods defined in other file
+* #8294: autodoc: single-string __slots__ is not handled correctly
* #8192: napoleon: description is disappeared when it contains inline literals
* #8142: napoleon: Potential of regex denial of service in google style docs
* #8169: LaTeX: pxjahyper loaded even when latex_engine is not platex
+* #8215: LaTeX: 'oneside' classoption causes build warning
* #8175: intersphinx: Potential of regex denial of service by broken inventory
* #8277: sphinx-build: missing and redundant spacing (and etc) for console
output on building
* #7973: imgconverter: Check availability of imagemagick many times
* #8255: py domain: number in default argument value is changed from hexadecimal
to decimal
+* #8316: html: Prevent arrow keys changing page when button elements are focused
+* #8343: html search: Fix unnecessary load of images when parsing the document
+* #8254: html theme: Line numbers misalign with code lines
* #8093: The highlight warning has wrong location in some builders (LaTeX,
singlehtml and so on)
+* #8215: Eliminate Fancyhdr build warnings for oneside documents
* #8239: Failed to refer a token in productionlist if it is indented
* #8268: linkcheck: Report HTTP errors when ``linkcheck_anchors`` is ``True``
* #8245: linkcheck: take source directory into account for local files
+* #8321: linkcheck: ``tel:`` schema hyperlinks are detected as errors
+* #8323: linkcheck: An exit status is incorrect when links having unsupported
+ schema found
* #6914: figure numbers are unexpectedly assigned to uncaptioned items
+* #8320: make "inline" line numbers un-selectable
Testing
--------
diff --git a/doc/_static/favicon.svg b/doc/_static/favicon.svg
new file mode 100644
index 000000000..c3e1acd35
--- /dev/null
+++ b/doc/_static/favicon.svg
@@ -0,0 +1,8 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
+ <style>
+ @media (prefers-color-scheme: dark) {
+ svg { fill: white; }
+ }
+ </style>
+ <path d="m 67.780707,71.526216 c 0,-2.720856 0.735772,-7.633735 1.635035,-10.917507 2.076574,-7.582764 3.222746,-16.97568 2.071477,-16.97568 -0.485619,0 -3.994408,3.173002 -7.797313,7.051115 -14.448869,14.734603 -29.952812,23.068339 -42.915946,23.068339 -7.400211,0 -12.4298817,-1.871115 -17.2867007,-6.430912 -2.94436186,-2.764297 -3.47532146,-4.129685 -3.47532146,-8.936928 0,-4.94488 0.4862322,-6.108589 3.78321146,-9.054437 2.987989,-2.669773 4.875111,-3.380296 8.9779137,-3.380296 3.163221,0.711278 5.032659,0.664017 6.063532,1.917191 1.045041,1.231842 1.406892,5.262673 0.143323,7.623675 -0.674746,1.260763 -2.435471,2.043539 -4.5966,2.043539 -2.040303,0 -3.203991,-0.483702 -2.786976,-1.15844 1.31395,-2.126021 -0.560952,-3.566616 -2.9664067,-2.279256 -2.907025,1.555792 -2.957418,7.069066 -0.08839,9.665535 4.0345357,3.651203 15.1912207,5.023925 21.9019857,2.694828 7.250749,-2.516503 16.739014,-8.578986 24.30831,-15.531674 l 6.657407,-6.115083 -8.688303,-0.05007 C 43.622519,44.707714 37.702703,43.621524 18.54695,38.489741 12.175528,36.782852 6.0502733,35.306342 4.9352743,35.208608 3.6710803,35.097791 2.841723,34.067882 2.9080043,32.476074 3.0199286,29.788108 4.4800823,27.78768 6.2067673,27.033038 7.2437505,26.579828 14.43583,25.894406 22.0605,23.866486 c 29.699148,-7.899023 31.502043,-6.781254 51.28707,-1.772167 6.461504,1.635896 13.942408,3.414988 17.256961,3.474566 5.106245,0.09178 6.211825,0.514653 7.240255,2.76932 0.66758,1.46355 1.21378,2.858905 1.21378,3.10079 0,0.241884 -2.89333,1.764397 -6.429613,3.383363 -12.984983,5.944723 -17.083271,9.093943 -12.855172,15.130399 1.753219,2.503069 1.718037,2.768923 -0.57922,4.37799 -1.345193,0.942203 -2.457238,2.856456 -2.471232,4.253898 -0.03777,3.776976 -2.424786,11.884847 -5.893734,15.080164 l -3.048923,2.808424 z m 6.632814,-34.658372 c 5.169656,-1.440693 8.302047,-3.07045 14.72913,-6.500861 -5.292267,-1.548658 -18.570782,-3.724097 -18.570782,-3.724097 -9.796513,-1.964547 -8.76916,-1.865132 -9.21348,0.29669 -0.176673,0.859598 -0.702644,2.763948 -1.872329,4.596663 -2.251474,3.527711 -10.489307,4.271075 -15.214327,2.009703 -1.482367,-0.709454 -2.971272,-3.416276 -2.950606,-5.336922 0.02911,-2.705486 -1.505386,-3.336055 -2.486689,-2.975309 -0.796428,0.292781 -3.384665,0.330004 -9.071284,1.864262 -18.784765,5.068157 -21.3552119,4.487473 -9.110967,6.223299 1.472409,0.208739 9.252992,2.381926 13.052028,3.39412 9.318588,2.482796 11.064717,2.665087 23.125496,2.414247 8.385835,-0.174409 11.891174,-0.675356 17.58381,-2.261795 z M 3.0589449,14.916483 C 3.2921927,12.514245 3.424378,11.992797 10.100599,10.647894 13.924923,9.8774962 23.355266,7.3808108 31.056903,5.0997052 c 17.703937,-5.2436279 22.73392,-5.2565016 41.092202,-0.105175 7.923233,2.2232606 16.798382,4.047803 19.72254,4.054541 4.567242,0.01054 6.941892,2.0284768 6.941892,2.0284768 2.101843,4.825342 1.718463,5.158474 -6.484103,5.158474 -5.714193,0 -10.641875,-0.963081 -18.245438,-3.565943 C 68.300078,10.69012 60.060462,8.8316882 55.557963,8.4915615 47.342337,7.8709375 47.353713,7.8687835 21.963188,14.855617 17.503192,16.082896 11.34213,17.454164 8.2719268,17.902883 l -5.5821654,0.81585 z" />
+</svg>
diff --git a/doc/conf.py b/doc/conf.py
index 74e5a8b80..8b242dc7e 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -28,6 +28,7 @@ html_sidebars = {'index': ['indexsidebar.html', 'searchbox.html']}
html_additional_pages = {'index': 'index.html'}
html_use_opensearch = 'https://www.sphinx-doc.org/en/master'
html_baseurl = 'https://www.sphinx-doc.org/en/master/'
+html_favicon = '_static/favicon.svg'
htmlhelp_basename = 'Sphinxdoc'
diff --git a/doc/glossary.rst b/doc/glossary.rst
index d3367e5df..87b7014b6 100644
--- a/doc/glossary.rst
+++ b/doc/glossary.rst
@@ -9,8 +9,8 @@ Glossary
A class (inheriting from :class:`~sphinx.builders.Builder`) that takes
parsed documents and performs an action on them. Normally, builders
translate the documents to an output format, but it is also possible to
- use the builder builders that e.g. check for broken links in the
- documentation, or build coverage information.
+ use builders that e.g. check for broken links in the documentation, or
+ build coverage information.
See :doc:`/usage/builders/index` for an overview over Sphinx's built-in
builders.
diff --git a/doc/man/sphinx-quickstart.rst b/doc/man/sphinx-quickstart.rst
index 2407e3be7..520a420ce 100644
--- a/doc/man/sphinx-quickstart.rst
+++ b/doc/man/sphinx-quickstart.rst
@@ -33,6 +33,10 @@ Options
If specified, separate source and build directories.
+.. option:: --no-sep
+
+ If specified, create build directroy under source directroy.
+
.. option:: --dot=DOT
Inside the root directory, two more directories will be created;
diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst
index 075dbfe8e..13dd6623c 100644
--- a/doc/usage/configuration.rst
+++ b/doc/usage/configuration.rst
@@ -316,6 +316,7 @@ General configuration
* ``toc.circular``
* ``toc.secnum``
* ``epub.unknown_project_files``
+ * ``epub.duplicated_toc_entry``
* ``autosectionlabel.*``
You can choose from these types.
@@ -340,6 +341,10 @@ General configuration
Added ``autosectionlabel.*``
+ .. versionchanged:: 3.3.0
+
+ Added ``epub.duplicated_toc_entry``
+
.. confval:: needs_sphinx
If set to a ``major.minor`` version string like ``'1.1'``, Sphinx will
diff --git a/setup.cfg b/setup.cfg
index 3e0a292b0..2730c6610 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -56,10 +56,8 @@ filterwarnings =
ignore::DeprecationWarning:docutils.io
ignore::DeprecationWarning:pyximport.pyximport
markers =
- sphinx
apidoc
setup_command
- test_params
testpaths = tests
[coverage:run]
diff --git a/sphinx/builders/_epub_base.py b/sphinx/builders/_epub_base.py
index 7a2c10207..6a2b312d9 100644
--- a/sphinx/builders/_epub_base.py
+++ b/sphinx/builders/_epub_base.py
@@ -213,7 +213,12 @@ class EpubBuilder(StandaloneHTMLBuilder):
appeared = set() # type: Set[str]
for node in nodes:
if node['refuri'] in appeared:
- logger.warning(__('duplicated ToC entry found: %s'), node['refuri'])
+ logger.warning(
+ __('duplicated ToC entry found: %s'),
+ node['refuri'],
+ type="epub",
+ subtype="duplicated_toc_entry",
+ )
else:
appeared.add(node['refuri'])
diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py
index a9e6b05b0..7652761b5 100644
--- a/sphinx/builders/linkcheck.py
+++ b/sphinx/builders/linkcheck.py
@@ -106,8 +106,7 @@ class CheckExternalLinksBuilder(Builder):
self.rqueue = queue.Queue() # type: queue.Queue
self.workers = [] # type: List[threading.Thread]
for i in range(self.app.config.linkcheck_workers):
- thread = threading.Thread(target=self.check_thread)
- thread.setDaemon(True)
+ thread = threading.Thread(target=self.check_thread, daemon=True)
thread.start()
self.workers.append(thread)
@@ -213,7 +212,7 @@ class CheckExternalLinksBuilder(Builder):
def check(docname: str) -> Tuple[str, str, int]:
# check for various conditions without bothering the network
- if len(uri) == 0 or uri.startswith(('#', 'mailto:')):
+ if len(uri) == 0 or uri.startswith(('#', 'mailto:', 'tel:')):
return 'unchecked', '', 0
elif not uri.startswith(('http:', 'https:')):
if uri_re.match(uri):
diff --git a/sphinx/cmd/quickstart.py b/sphinx/cmd/quickstart.py
index 68f8b2a18..dc587600c 100644
--- a/sphinx/cmd/quickstart.py
+++ b/sphinx/cmd/quickstart.py
@@ -451,8 +451,10 @@ def get_parser() -> argparse.ArgumentParser:
help=__('project root'))
group = parser.add_argument_group(__('Structure options'))
- group.add_argument('--sep', action='store_true', default=None,
+ group.add_argument('--sep', action='store_true', dest='sep', default=None,
help=__('if specified, separate source and build dirs'))
+ group.add_argument('--no-sep', action='store_false', dest='sep',
+ help=__('if specified, create build dir under source dir'))
group.add_argument('--dot', metavar='DOT', default='_',
help=__('replacement for dot in _templates etc.'))
diff --git a/sphinx/ext/autodoc/importer.py b/sphinx/ext/autodoc/importer.py
index 132eb81ba..df5614f99 100644
--- a/sphinx/ext/autodoc/importer.py
+++ b/sphinx/ext/autodoc/importer.py
@@ -206,7 +206,10 @@ def get_object_members(subject: Any, objpath: List[str], attrgetter: Callable,
if isclass(subject) and getattr(subject, '__slots__', None) is not None:
from sphinx.ext.autodoc import SLOTSATTR
- for name in subject.__slots__:
+ slots = subject.__slots__
+ if isinstance(slots, str):
+ slots = [slots]
+ for name in slots:
members[name] = Attribute(name, True, SLOTSATTR)
# other members
diff --git a/sphinx/testing/fixtures.py b/sphinx/testing/fixtures.py
index 9e6021f12..55e639df6 100644
--- a/sphinx/testing/fixtures.py
+++ b/sphinx/testing/fixtures.py
@@ -21,6 +21,21 @@ from sphinx.testing import util
from sphinx.testing.util import SphinxTestApp, SphinxTestAppWrapperForSkipBuilding
+DEFAULT_ENABLED_MARKERS = [
+ (
+ 'sphinx(builder, testroot=None, freshenv=False, confoverrides=None, tags=None,'
+ ' docutilsconf=None, parallel=0): arguments to initialize the sphinx test application.'
+ ),
+ 'test_params(shared_result=...): test parameters.',
+]
+
+
+def pytest_configure(config):
+ # register custom markers
+ for marker in DEFAULT_ENABLED_MARKERS:
+ config.addinivalue_line('markers', marker)
+
+
@pytest.fixture(scope='session')
def rootdir() -> str:
return None
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index 2b83ab85b..4b637a9ec 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -588,12 +588,14 @@
{% classes with \chapter command
\fancypagestyle{normal}{
\fancyhf{}
- % FIXME: this presupposes "twoside".
- % If "oneside" class option, there are warnings in LaTeX log.
- \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
+ \fancyfoot[RO]{{\py@HeaderFamily\thepage}}
\fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
- \fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
- \fancyhead[LE,RO]{{\py@HeaderFamily \@title\sphinxheadercomma\py@release}}
+ \fancyhead[RO]{{\py@HeaderFamily \@title\sphinxheadercomma\py@release}}
+ \if@twoside
+ \fancyfoot[LE]{{\py@HeaderFamily\thepage}}
+ \fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
+ \fancyhead[LE]{{\py@HeaderFamily \@title\sphinxheadercomma\py@release}}
+ \fi
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
% define chaptermark with \@chappos when \@chappos is available for Japanese
@@ -605,7 +607,8 @@
% page of a chapter `clean.'
\fancypagestyle{plain}{
\fancyhf{}
- \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
+ \fancyfoot[RO]{{\py@HeaderFamily\thepage}}
+ \if@twoside\fancyfoot[LE]{{\py@HeaderFamily\thepage}}\fi
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}
}
diff --git a/sphinx/themes/basic/layout.html b/sphinx/themes/basic/layout.html
index 9163a18a2..131d2c533 100644
--- a/sphinx/themes/basic/layout.html
+++ b/sphinx/themes/basic/layout.html
@@ -95,8 +95,8 @@
{%- endmacro %}
{%- macro css() %}
- <link rel="stylesheet" href="{{ pathto('_static/' + style, 1)|e }}" type="text/css" />
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
+ <link rel="stylesheet" href="{{ pathto('_static/' + style, 1)|e }}" type="text/css" />
{%- for css in css_files %}
{%- if css|attr("filename") %}
{{ css_tag(css) }}
diff --git a/sphinx/themes/basic/static/basic.css_t b/sphinx/themes/basic/static/basic.css_t
index 0a71a7a91..38b9fb553 100644
--- a/sphinx/themes/basic/static/basic.css_t
+++ b/sphinx/themes/basic/static/basic.css_t
@@ -764,6 +764,7 @@ div.code-block-caption code {
}
table.highlighttable td.linenos,
+span.linenos,
div.doctest > div.highlight span.gp { /* gp: Generic.Prompt */
user-select: none;
}
diff --git a/sphinx/themes/basic/static/doctools.js b/sphinx/themes/basic/static/doctools.js
index daccd209d..7d88f807d 100644
--- a/sphinx/themes/basic/static/doctools.js
+++ b/sphinx/themes/basic/static/doctools.js
@@ -285,9 +285,10 @@ var Documentation = {
initOnKeyListeners: function() {
$(document).keydown(function(event) {
var activeElementType = document.activeElement.tagName;
- // don't navigate when in search box or textarea
+ // don't navigate when in search box, textarea, dropdown or button
if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT'
- && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) {
+ && activeElementType !== 'BUTTON' && !event.altKey && !event.ctrlKey && !event.metaKey
+ && !event.shiftKey) {
switch (event.keyCode) {
case 37: // left
var prevHref = $('link[rel="prev"]').prop('href');
diff --git a/sphinx/themes/basic/static/searchtools.js b/sphinx/themes/basic/static/searchtools.js
index 970d0d975..261ecaa92 100644
--- a/sphinx/themes/basic/static/searchtools.js
+++ b/sphinx/themes/basic/static/searchtools.js
@@ -59,10 +59,10 @@ var Search = {
_pulse_status : -1,
htmlToText : function(htmlString) {
- var htmlElement = document.createElement('span');
- htmlElement.innerHTML = htmlString;
- $(htmlElement).find('.headerlink').remove();
- docContent = $(htmlElement).find('[role=main]')[0];
+ var virtualDocument = document.implementation.createHTMLDocument('virtual');
+ var htmlElement = $(htmlString, virtualDocument);
+ htmlElement.find('.headerlink').remove();
+ docContent = htmlElement.find('[role=main]')[0];
if(docContent === undefined) {
console.warn("Content block not found. Sphinx search tries to obtain it " +
"via '[role=main]'. Could you check your theme or template.");
diff --git a/tests/roots/test-ext-autodoc/target/slots.py b/tests/roots/test-ext-autodoc/target/slots.py
index 44e750320..17e469cac 100644
--- a/tests/roots/test-ext-autodoc/target/slots.py
+++ b/tests/roots/test-ext-autodoc/target/slots.py
@@ -2,6 +2,10 @@ class Foo:
__slots__ = ['attr']
+class FooSingleString:
+ __slots__ = 'attr'
+
+
class Bar:
__slots__ = {'attr1': 'docstring of attr1',
'attr2': 'docstring of attr2',
diff --git a/tests/roots/test-root/conf.py b/tests/roots/test-root/conf.py
index b3cc12ae0..c3a890045 100644
--- a/tests/roots/test-root/conf.py
+++ b/tests/roots/test-root/conf.py
@@ -32,8 +32,6 @@ pygments_style = 'sphinx'
show_authors = True
numfig = True
-rst_epilog = '.. |subst| replace:: global substitution'
-
html_sidebars = {'**': ['localtoc.html', 'relations.html', 'sourcelink.html',
'customsb.html', 'searchbox.html'],
'index': ['contentssb.html', 'localtoc.html', 'globaltoc.html']}
diff --git a/tests/roots/test-root/markup.txt b/tests/roots/test-root/markup.txt
index e6adef55e..7cd3e95ea 100644
--- a/tests/roots/test-root/markup.txt
+++ b/tests/roots/test-root/markup.txt
@@ -22,7 +22,9 @@ Meta markup
Generic reST
------------
-A |subst| (the definition is in rst_epilog).
+A |subst|!
+
+.. |subst| replace:: global substitution
.. highlight:: none
diff --git a/tests/test_build_html.py b/tests/test_build_html.py
index e75cc0393..22b60dc74 100644
--- a/tests/test_build_html.py
+++ b/tests/test_build_html.py
@@ -258,7 +258,7 @@ def test_html4_output(app, status, warning):
(".//pre/strong", 'try_stmt'),
(".//pre/a[@href='#grammar-token-try1_stmt']/code/span", 'try1_stmt'),
# tests for ``only`` directive
- (".//p", 'A global substitution.'),
+ (".//p", 'A global substitution!'),
(".//p", 'In HTML.'),
(".//p", 'In both.'),
(".//p", 'Always present'),
diff --git a/tests/test_ext_autodoc.py b/tests/test_ext_autodoc.py
index 9cb54de5b..c0676f23f 100644
--- a/tests/test_ext_autodoc.py
+++ b/tests/test_ext_autodoc.py
@@ -1205,6 +1205,14 @@ def test_slots(app):
' .. py:attribute:: Foo.attr',
' :module: target.slots',
'',
+ '',
+ '.. py:class:: FooSingleString()',
+ ' :module: target.slots',
+ '',
+ '',
+ ' .. py:attribute:: FooSingleString.attr',
+ ' :module: target.slots',
+ '',
]