From add70354f1a49a5a6d4f8c1d0dd1fdf21fcd24cc Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Wed, 16 Sep 2020 14:29:27 +0100 Subject: [PATCH 01/28] Fix 'oneside' latex output Sphinx.sty had an FIXME bug where documents with the 'oneside' option would output lots of the following warnings when building the document: Package Fancyhdr Warning: \fancyfoot's `E' option without twoside option is useless on input line 309. Fix the problem by using \if@twoside around the offending tex code that tries to set format for the even pages. 'Even' pages don't exist on oneside builds, which causes the warning to be emitted. Fixes: #8215 --- CHANGES | 1 + sphinx/texinputs/sphinx.sty | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 37719297f..583975c8e 100644 --- a/CHANGES +++ b/CHANGES @@ -28,6 +28,7 @@ Bugs fixed * #8192: napoleon: description is disappeared when it contains inline literals * #8093: The highlight warning has wrong location in some builders (LaTeX, singlehtml and so on) +* #8215: Eliminate Fancyhdr build warnings for oneside documents Testing -------- diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index a3e91ad34..e52ed5975 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} } From 3eecf133d8a8af2f22f6f122d3245a1e2db940eb Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Mon, 5 Oct 2020 09:29:16 +0100 Subject: [PATCH 02/28] Fix #8289: Allow to suppress "duplicated ToC entry found" warnings from epub builder --- CHANGES | 2 ++ doc/usage/configuration.rst | 6 ++++++ sphinx/builders/_epub_base.py | 7 ++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 600efc466..e9a6220bf 100644 --- a/CHANGES +++ b/CHANGES @@ -26,6 +26,8 @@ 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: Allow to suppress "duplicated ToC entry found" warnings from epub builder + using :confval:`suppress_warnings`. Bugs fixed ---------- diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst index 270fcbf33..1cda6a055 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,11 @@ 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/sphinx/builders/_epub_base.py b/sphinx/builders/_epub_base.py index 95f9ab8ed..b126182e9 100644 --- a/sphinx/builders/_epub_base.py +++ b/sphinx/builders/_epub_base.py @@ -208,7 +208,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']) From 4f19f400bfb22f0549c69718f193371c6d9208fa Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Tue, 6 Oct 2020 01:53:28 +0900 Subject: [PATCH 03/28] refactor: Remove rst_epilog from test-root/conf.py I found test-root defines rst_epilog in its conf.py. It causes side-effects to many test cases in Sphinx's testing because test-root is widely used. This removes the configuration from test-root not to cause side-effects to our testings. Note: We already have test cases for rst_epilog in test_util_rst. --- tests/roots/test-root/conf.py | 2 -- tests/roots/test-root/markup.txt | 4 +++- tests/test_build_html.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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 8cd541481..1f9f8eac7 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'), From 3f26564c283d4800b7fea7402622f9cfd5efbf61 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Mon, 5 Oct 2020 22:10:25 +0100 Subject: [PATCH 04/28] Apply suggestions from code review --- CHANGES | 2 +- doc/usage/configuration.rst | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index e9a6220bf..2dd313092 100644 --- a/CHANGES +++ b/CHANGES @@ -26,7 +26,7 @@ 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: Allow to suppress "duplicated ToC entry found" warnings from epub builder +* #8289: epub: Allow to suppress "duplicated ToC entry found" warnings from epub builder using :confval:`suppress_warnings`. Bugs fixed diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst index 1cda6a055..4881b8629 100644 --- a/doc/usage/configuration.rst +++ b/doc/usage/configuration.rst @@ -341,7 +341,6 @@ General configuration Added ``autosectionlabel.*`` - .. versionchanged:: 3.3.0 Added ``epub.duplicated_toc_entry`` From 529d19ff81976a75275082bc34156dd38f97da98 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Mon, 5 Oct 2020 22:12:34 +0100 Subject: [PATCH 05/28] wrap CHANGES at 85 cols --- CHANGES | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 2dd313092..5f3a17520 100644 --- a/CHANGES +++ b/CHANGES @@ -26,8 +26,8 @@ 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`. +* #8289: epub: Allow to suppress "duplicated ToC entry found" warnings from epub + builder using :confval:`suppress_warnings`. Bugs fixed ---------- From 55f79195317e0fc4f9b98062cbb4fa875024a996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Freitag?= Date: Sun, 11 Oct 2020 11:41:42 +0200 Subject: [PATCH 06/28] Linkcheck: Use Thread daemon argument Instead of using a separate call. --- sphinx/builders/linkcheck.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index a9e6b05b0..d6631dd2c 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) From 9115aa8db0040b68ea851e2bc9ea2641100fad2a Mon Sep 17 00:00:00 2001 From: David Foster <31405412+foster999@users.noreply.github.com> Date: Wed, 14 Oct 2020 18:00:29 +0100 Subject: [PATCH 07/28] Prevent arrow key changing page on buttons --- sphinx/themes/basic/static/doctools.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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'); From 3171a44032f216a1775d86302d939e271e3ab2e9 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 24 Oct 2020 20:11:23 +0900 Subject: [PATCH 08/28] Fix #8321: linkcheck: ``tel:`` schema hyperlinks are detected as errors --- CHANGES | 1 + sphinx/builders/linkcheck.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 0405e1d93..8dbbd5290 100644 --- a/CHANGES +++ b/CHANGES @@ -57,6 +57,7 @@ Bugs fixed * #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 * #6914: figure numbers are unexpectedly assigned to uncaptioned items Testing diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index a9e6b05b0..85d5c5d86 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -213,7 +213,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): From 5a866d5e7c57883d647d1d5bfa08c80cec923c73 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Mon, 19 Oct 2020 14:31:25 +0200 Subject: [PATCH 09/28] basic CSS: disable "user-select" on span.linenos --- sphinx/themes/basic/static/basic.css_t | 1 + 1 file changed, 1 insertion(+) 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; } From 38a6838119744e3ce147d244c46ccd7eadec4403 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sat, 24 Oct 2020 15:12:58 +0200 Subject: [PATCH 10/28] Add CHANGES for #8320 --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 4031d2bcc..718579663 100644 --- a/CHANGES +++ b/CHANGES @@ -60,6 +60,7 @@ Bugs fixed * #8268: linkcheck: Report HTTP errors when ``linkcheck_anchors`` is ``True`` * #8245: linkcheck: take source directory into account for local files * #6914: figure numbers are unexpectedly assigned to uncaptioned items +* #8320: make "inline" line numbers un-selectable Testing -------- From 91f5448b2596f30b26e413edbafa4917ece578e3 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sat, 24 Oct 2020 15:21:31 +0200 Subject: [PATCH 11/28] Override Pygments CSS with theme CSS --- sphinx/themes/basic/layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() %} - + {%- for css in css_files %} {%- if css|attr("filename") %} {{ css_tag(css) }} From 84c6d693f43dc7f7b1e627b7cce91d2a9e49e5da Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sat, 24 Oct 2020 17:20:24 +0200 Subject: [PATCH 12/28] DOC: Add favicon --- doc/_static/favicon.svg | 8 ++++++++ doc/conf.py | 1 + 2 files changed, 9 insertions(+) create mode 100644 doc/_static/favicon.svg 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 @@ + + + + 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' From 554bb5e9b988f794c58faaaca1680045f34a1743 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 24 Oct 2020 09:32:52 -0700 Subject: [PATCH 13/28] =?UTF-8?q?Fix=20docs=20type:=20"the=20builder=20bui?= =?UTF-8?q?lders"=20=E2=86=92=20"builders"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/glossary.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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. From da4f091c211ccf30a8a7591c4881027fe1d74c35 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sat, 24 Oct 2020 20:55:06 +0200 Subject: [PATCH 14/28] autodoc: check whether __slots__ is a str Closes #8294. --- sphinx/ext/autodoc/importer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sphinx/ext/autodoc/importer.py b/sphinx/ext/autodoc/importer.py index 133ce1439..52b07639a 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 From 82c83ed478618c9b97f1cbf7a24214ee433fa891 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sun, 25 Oct 2020 10:27:43 +0100 Subject: [PATCH 15/28] autodoc: Add test for single-string __slots__ --- tests/roots/test-ext-autodoc/target/slots.py | 4 ++++ tests/test_ext_autodoc.py | 8 ++++++++ 2 files changed, 12 insertions(+) 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/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', + '', ] From 746842f4fc298c08a3dc864da069c38668fed44d Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 25 Oct 2020 18:52:45 +0900 Subject: [PATCH 16/28] Update CHANGES for PR #8323 --- CHANGES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index 8cf598cca..976e8f1fe 100644 --- a/CHANGES +++ b/CHANGES @@ -60,6 +60,8 @@ Bugs fixed * #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 From ad7c09ef10038c6147f373f1edf8db2c5e2160d1 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 25 Oct 2020 18:59:33 +0900 Subject: [PATCH 17/28] Update CHANGES for PR #8338 --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 976e8f1fe..8e87f5538 100644 --- a/CHANGES +++ b/CHANGES @@ -45,6 +45,7 @@ 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 From 35725f02d9fc42d711d8a377fd97e07aa8015958 Mon Sep 17 00:00:00 2001 From: "oleg.hoefling" Date: Thu, 8 Oct 2020 17:08:18 +0200 Subject: [PATCH 18/28] move registration of public markers to sphinx.testing.fixtures Signed-off-by: oleg.hoefling --- setup.cfg | 2 -- sphinx/testing/fixtures.py | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 37e42df84..abda98124 100644 --- a/setup.cfg +++ b/setup.cfg @@ -57,10 +57,8 @@ filterwarnings = ignore::DeprecationWarning:pyximport.pyximport ignore::PendingDeprecationWarning:sphinx.util.pycompat markers = - sphinx apidoc setup_command - test_params testpaths = tests [coverage:run] diff --git a/sphinx/testing/fixtures.py b/sphinx/testing/fixtures.py index 9197014bf..cacbb04bf 100644 --- a/sphinx/testing/fixtures.py +++ b/sphinx/testing/fixtures.py @@ -22,6 +22,21 @@ from sphinx.testing import util from sphinx.testing.util import SphinxTestApp, SphinxTestAppWrapperForSkipBuilding +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 markers: + config.addinivalue_line('markers', marker) + + @pytest.fixture(scope='session') def rootdir() -> str: return None From 3c3216fa40a8d30b5dd9bc97be7273c99394483b Mon Sep 17 00:00:00 2001 From: "oleg.hoefling" Date: Sun, 25 Oct 2020 11:36:40 +0100 Subject: [PATCH 19/28] more meaningful name for the public markers list Signed-off-by: oleg.hoefling --- sphinx/testing/fixtures.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx/testing/fixtures.py b/sphinx/testing/fixtures.py index cacbb04bf..cd296e71c 100644 --- a/sphinx/testing/fixtures.py +++ b/sphinx/testing/fixtures.py @@ -22,7 +22,7 @@ from sphinx.testing import util from sphinx.testing.util import SphinxTestApp, SphinxTestAppWrapperForSkipBuilding -markers = [ +PUBLIC_MARKERS = [ ( 'sphinx(builder, testroot=None, freshenv=False, confoverrides=None, tags=None,' ' docutilsconf=None, parallel=0): arguments to initialize the sphinx test application.' @@ -33,7 +33,7 @@ markers = [ def pytest_configure(config): # register custom markers - for marker in markers: + for marker in PUBLIC_MARKERS: config.addinivalue_line('markers', marker) From 30f3ac6fe7ec426eef07811c445aae217ee4d725 Mon Sep 17 00:00:00 2001 From: "oleg.hoefling" Date: Sun, 25 Oct 2020 11:44:39 +0100 Subject: [PATCH 20/28] rename public markers to default markers Signed-off-by: oleg.hoefling --- sphinx/testing/fixtures.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx/testing/fixtures.py b/sphinx/testing/fixtures.py index cd296e71c..5e72ed530 100644 --- a/sphinx/testing/fixtures.py +++ b/sphinx/testing/fixtures.py @@ -22,7 +22,7 @@ from sphinx.testing import util from sphinx.testing.util import SphinxTestApp, SphinxTestAppWrapperForSkipBuilding -PUBLIC_MARKERS = [ +DEFAULT_MARKERS = [ ( 'sphinx(builder, testroot=None, freshenv=False, confoverrides=None, tags=None,' ' docutilsconf=None, parallel=0): arguments to initialize the sphinx test application.' @@ -33,7 +33,7 @@ PUBLIC_MARKERS = [ def pytest_configure(config): # register custom markers - for marker in PUBLIC_MARKERS: + for marker in DEFAULT_MARKERS: config.addinivalue_line('markers', marker) From f2a31185a65b31883846e5d127bf9a7dfe968db0 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 26 Oct 2020 00:59:25 +0900 Subject: [PATCH 21/28] Update CHANGES for PR #8216 --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 76275d246..77cd6705d 100644 --- a/CHANGES +++ b/CHANGES @@ -49,6 +49,7 @@ Bugs fixed * #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 From b453be75c9656bb311aa88d50b367a5ccb414e37 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 26 Oct 2020 01:12:36 +0900 Subject: [PATCH 22/28] Fix #8298: sphinx-quickstart: Add :option:`sphinx-quickstart --no-sep` option --- CHANGES | 1 + doc/man/sphinx-quickstart.rst | 4 ++++ sphinx/cmd/quickstart.py | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 77cd6705d..e33bf3d54 100644 --- a/CHANGES +++ b/CHANGES @@ -28,6 +28,7 @@ Features added 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 Bugs fixed ---------- 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/sphinx/cmd/quickstart.py b/sphinx/cmd/quickstart.py index cad3c65e5..2363f9fe4 100644 --- a/sphinx/cmd/quickstart.py +++ b/sphinx/cmd/quickstart.py @@ -489,8 +489,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.')) From 72397f6dcefb10f95650190991320aeb8d781cba Mon Sep 17 00:00:00 2001 From: "oleg.hoefling" Date: Sun, 25 Oct 2020 18:34:47 +0100 Subject: [PATCH 23/28] change markers list name to DEFAULT_ENABLED_MARKERS Signed-off-by: oleg.hoefling --- sphinx/testing/fixtures.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx/testing/fixtures.py b/sphinx/testing/fixtures.py index 5e72ed530..f457e3745 100644 --- a/sphinx/testing/fixtures.py +++ b/sphinx/testing/fixtures.py @@ -22,7 +22,7 @@ from sphinx.testing import util from sphinx.testing.util import SphinxTestApp, SphinxTestAppWrapperForSkipBuilding -DEFAULT_MARKERS = [ +DEFAULT_ENABLED_MARKERS = [ ( 'sphinx(builder, testroot=None, freshenv=False, confoverrides=None, tags=None,' ' docutilsconf=None, parallel=0): arguments to initialize the sphinx test application.' @@ -33,7 +33,7 @@ DEFAULT_MARKERS = [ def pytest_configure(config): # register custom markers - for marker in DEFAULT_MARKERS: + for marker in DEFAULT_ENABLED_MARKERS: config.addinivalue_line('markers', marker) From 46638bc01b4a52cd314c7d06ac110361d95b852e Mon Sep 17 00:00:00 2001 From: Jan Vojt Date: Tue, 27 Oct 2020 10:37:45 +0100 Subject: [PATCH 24/28] Fix unnecessary load of images when parsing the document text for search function. The issue was, that when searching, new element with all the HTML content was created. This caused loading of all images in the background. However, in the end, these images are stripped from search result anyway, so there is no point in loading them. In cases where images were included in HTML files in a different directory from search.html, this behaviour was even causing 404 errors because of wrong relative URLs. This commit fixes the issue by creating virtual document and using that as the owner document of temporary meta-element used for searching and parsing purposes. The virtual owner document causes browser to not load the images. --- sphinx/themes/basic/static/searchtools.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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."); From d17563987a80007e2310102cfde673c651823a39 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Tue, 27 Oct 2020 23:55:12 +0900 Subject: [PATCH 25/28] Update CHANGES for PR #8343 --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 77cd6705d..a801f054a 100644 --- a/CHANGES +++ b/CHANGES @@ -56,6 +56,7 @@ Bugs fixed * #7973: imgconverter: Check availability of imagemagick many times * #8255: py domain: number in default argument value is changed from hexadecimal to decimal +* #8343: html search: Fix unnecessary load of images when parsing the document * #8093: The highlight warning has wrong location in some builders (LaTeX, singlehtml and so on) * #8215: Eliminate Fancyhdr build warnings for oneside documents From 0ddfb16666a2412e4029bb91b88497f734f17e34 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Tue, 27 Oct 2020 23:59:02 +0900 Subject: [PATCH 26/28] Update CHANGES for PR #8333 --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 53973822a..b9a690272 100644 --- a/CHANGES +++ b/CHANGES @@ -58,6 +58,7 @@ Bugs fixed * #8255: py domain: number in default argument value is changed from hexadecimal to decimal * #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 From 9fc5c37817c58aaf0ad319307ba4df3586efb6f1 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 28 Oct 2020 00:02:14 +0900 Subject: [PATCH 27/28] Update CHANGES for PR #8316 --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index b9a690272..d55972c8e 100644 --- a/CHANGES +++ b/CHANGES @@ -57,6 +57,7 @@ Bugs fixed * #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, From 2c2335bbb8af99fa132e1573bbf45dc91584d5a2 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 28 Oct 2020 00:04:10 +0900 Subject: [PATCH 28/28] Update CHANGES for PR #8304 --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index d55972c8e..d86bd2eb6 100644 --- a/CHANGES +++ b/CHANGES @@ -29,6 +29,7 @@ Features added * #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 ----------