diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-10-28 02:13:49 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-28 02:13:49 +0900 |
commit | 871f43f77837d7e668fcaac8d22cdeaff3d7b8e0 (patch) | |
tree | 594c76c23df106099a8738373e2a0a195913d23b /sphinx | |
parent | cc97a076407d20a495f95c1b2dfa996d629d5452 (diff) | |
parent | 2c2335bbb8af99fa132e1573bbf45dc91584d5a2 (diff) | |
download | sphinx-git-871f43f77837d7e668fcaac8d22cdeaff3d7b8e0.tar.gz |
Merge branch '3.x' into 7785_autodoc_typehints_none_for_overloads
Diffstat (limited to 'sphinx')
-rw-r--r-- | sphinx/builders/linkcheck.py | 2 | ||||
-rw-r--r-- | sphinx/cmd/quickstart.py | 4 | ||||
-rw-r--r-- | sphinx/ext/autodoc/importer.py | 5 | ||||
-rw-r--r-- | sphinx/testing/fixtures.py | 15 | ||||
-rw-r--r-- | sphinx/texinputs/sphinx.sty | 15 | ||||
-rw-r--r-- | sphinx/themes/basic/layout.html | 2 | ||||
-rw-r--r-- | sphinx/themes/basic/static/basic.css_t | 1 | ||||
-rw-r--r-- | sphinx/themes/basic/static/doctools.js | 5 | ||||
-rw-r--r-- | sphinx/themes/basic/static/searchtools.js | 8 |
9 files changed, 41 insertions, 16 deletions
diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index d6631dd2c..7652761b5 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -212,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 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.')) 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 diff --git a/sphinx/testing/fixtures.py b/sphinx/testing/fixtures.py index 9197014bf..f457e3745 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 +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."); |