diff -Nru python-pallets-sphinx-themes-1.1.4/CHANGES.rst python-pallets-sphinx-themes-1.2.2/CHANGES.rst --- python-pallets-sphinx-themes-1.1.4/CHANGES.rst 2019-01-28 18:31:15.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/CHANGES.rst 2019-08-05 03:35:24.000000000 +0000 @@ -1,66 +1,84 @@ +Version 1.2.2 +------------- + +Released 2019-07-04 + +- Make the version warning sticky so that it appears when linking to + the middle of a document. :issue:`5` +- Remove CSS for old ads. + + +Version 1.2.1 +------------- + +Released 2019-07-29 + +- Sort versions taken from Read the Docs so that 2.10.x is considered + newer than 2.9.x. :issue:`24` + + +Version 1.2.0 +------------- + +Released 2019-07-26 + +- Use HTTPS for font URLs in CSS. :pr:`22` +- Don't require ``sphinx.ext.autodoc`` to be enabled. +- Implement the Jinja directives ``jinja:filters::``, + ``jinja:tests::``, and ``jinja:nodes::``. +- Generate a table of contents for Jinja filters and tests. +- Update the ``babel`` and ``platter`` themes. + + Version 1.1.4 -============= +------------- Released 2019-01-28 - Store a page's canonical URL in ``html_context["page_canonical_url"]`` rather than overwriting - ``canonical_url``, for compatibility with Read the Docs. (`#21`_) - -.. _#21: https://github.com/pallets/pallets-sphinx-themes/pull/21 + ``canonical_url``, for compatibility with Read the Docs. :pr:`21` Version 1.1.3 -============= +------------- Released 2019-01-28 - Move the Read the Docs search flag to the ``footer`` block to ensure - it executes after Read the Docs injects its data. (`#20`_) - -.. _#20: https://github.com/pallets/pallets-sphinx-themes/pull/20 + it executes after Read the Docs injects its data. :pr:`20` Version 1.1.2 -============= +------------- Released 2018-09-24 - Strip ".x" placeholder when parsing versions for sidebar. - (`#7`_, `#17`_) - -.. _#7: https://github.com/pallets/pallets-sphinx-themes/issues/7 -.. _#17: https://github.com/pallets/pallets-sphinx-themes/pull/17 + :issue:`7`, :pr:`17` Version 1.1.1 -============= +------------- Released 2018-09-16 - Add configurable ".x" placholder to versions, producing strings like - "1.2.x". (`#6`_, `#12`_) + "1.2.x". :issue:`6`, :pr:`12` - Add dependency on "packaging" to support older Sphinx versions. - (`#9`_, `#11`_) -- Backport ``shlex.quote`` for Python 2. (`#13`_, `#14`_) - -.. _#6: https://github.com/pallets/pallets-sphinx-themes/issues/6 -.. _#9: https://github.com/pallets/pallets-sphinx-themes/issues/9 -.. _#11: https://github.com/pallets/pallets-sphinx-themes/pull/11 -.. _#12: https://github.com/pallets/pallets-sphinx-themes/pull/12 -.. _#13: https://github.com/pallets/pallets-sphinx-themes/issues/13 -.. _#14: https://github.com/pallets/pallets-sphinx-themes/pull/14 + :issue:`9`, :pr:`11` +- Backport ``shlex.quote`` for Python 2. :issue:`13`, :pr:`14` Version 1.1.0 -============= +------------- Released 2018-08-28 - Modernize ``click`` theme. The ``.. click:example::`` and ``.. click:run::`` directives used by Click are available and ported to Python 3. -- Modernize ``werkzeug`` theme. (`#4`_) +- Modernize ``werkzeug`` theme. :pr:`4` - Modernize ``jinja`` theme. Local extensions used by Jinja are not available yet. - Remove theme entry points to make late configuration consistent. The @@ -85,22 +103,18 @@ - Disable the sidebar logo on the index page with ``html_theme_options["index_sidebar_logo"] = False``. -.. _#4: https://github.com/pallets/pallets-sphinx-themes/pull/4 - Version 1.0.1 -============= +------------- Released 2018-04-29 - Work around an issues with search when using the ``dirhtml`` - builder. (`#3`_) - -.. _#3: https://github.com/pallets/pallets-sphinx-themes/pull/3 + builder. :pr:`3` Version 1.0.0 -============= +------------- Released 2018-04-18 diff -Nru python-pallets-sphinx-themes-1.1.4/debian/changelog python-pallets-sphinx-themes-1.2.2/debian/changelog --- python-pallets-sphinx-themes-1.1.4/debian/changelog 2019-07-10 11:29:24.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/debian/changelog 2019-08-10 08:31:21.000000000 +0000 @@ -1,3 +1,10 @@ +python-pallets-sphinx-themes (1.2.2-1) unstable; urgency=medium + + * New upstream release. + * Rebase patches. + + -- Ondřej Nový Sat, 10 Aug 2019 10:31:21 +0200 + python-pallets-sphinx-themes (1.1.4-1) unstable; urgency=medium * New upstream release diff -Nru python-pallets-sphinx-themes-1.1.4/debian/control python-pallets-sphinx-themes-1.2.2/debian/control --- python-pallets-sphinx-themes-1.1.4/debian/control 2019-07-10 11:28:48.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/debian/control 2019-08-10 08:28:36.000000000 +0000 @@ -7,6 +7,7 @@ dh-python, python3-all, python3-setuptools, + python3-importlib-metadata, python3-jinja2, python3-packaging, python3-pygments, diff -Nru python-pallets-sphinx-themes-1.1.4/debian/patches/0001-Prevent-privacy-breach.patch python-pallets-sphinx-themes-1.2.2/debian/patches/0001-Prevent-privacy-breach.patch --- python-pallets-sphinx-themes-1.1.4/debian/patches/0001-Prevent-privacy-breach.patch 2019-07-10 11:20:50.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/debian/patches/0001-Prevent-privacy-breach.patch 2019-08-09 21:33:06.000000000 +0000 @@ -9,30 +9,23 @@ src/pallets_sphinx_themes/themes/platter/static/platter.css | 1 - 4 files changed, 6 deletions(-) -diff --git a/src/pallets_sphinx_themes/themes/babel/static/babel.css b/src/pallets_sphinx_themes/themes/babel/static/babel.css -index 6841512..5bbeed3 100644 --- a/src/pallets_sphinx_themes/themes/babel/static/babel.css +++ b/src/pallets_sphinx_themes/themes/babel/static/babel.css -@@ -1,6 +1,4 @@ +@@ -1,5 +1,4 @@ @import url(pocoo.css); --@import url(http://fonts.googleapis.com/css?family=Ubuntu+Mono:400,400italic,700,700italic); --@import url(http://fonts.googleapis.com/css?family=Open+Sans:300,400); +-@import url(http://fonts.googleapis.com/css?family=Bree+Serif); - /* fonts */ - body { font-family: 'Ubuntu Mono', 'Consolas', 'Menlo', -diff --git a/src/pallets_sphinx_themes/themes/click/static/click.css b/src/pallets_sphinx_themes/themes/click/static/click.css -index adff8b6..1378e53 100644 + body { + font-family: "Verdana", "Garamond", "Georgia", serif; --- a/src/pallets_sphinx_themes/themes/click/static/click.css +++ b/src/pallets_sphinx_themes/themes/click/static/click.css @@ -1,6 +1,4 @@ @import url("pocoo.css"); --@import url("http://fonts.googleapis.com/css?family=Ubuntu+Mono"); --@import url("http://fonts.googleapis.com/css?family=Open+Sans"); +-@import url("https://fonts.googleapis.com/css?family=Ubuntu+Mono"); +-@import url("https://fonts.googleapis.com/css?family=Open+Sans"); body, pre, code { font-family: "Ubuntu Mono", "Consolas", "Menlo", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace; -diff --git a/src/pallets_sphinx_themes/themes/jinja/static/jinja.css b/src/pallets_sphinx_themes/themes/jinja/static/jinja.css -index 83de6a1..f6d65a0 100644 --- a/src/pallets_sphinx_themes/themes/jinja/static/jinja.css +++ b/src/pallets_sphinx_themes/themes/jinja/static/jinja.css @@ -1,5 +1,4 @@ @@ -41,13 +34,11 @@ h1, h2, h3, h4, h5, h6, p.admonition-title, div.sphinxsidebar input { font-family: "Crimson Text", "Garamond", "Georgia", serif; -diff --git a/src/pallets_sphinx_themes/themes/platter/static/platter.css b/src/pallets_sphinx_themes/themes/platter/static/platter.css -index 270cc08..36bd6c0 100644 --- a/src/pallets_sphinx_themes/themes/platter/static/platter.css +++ b/src/pallets_sphinx_themes/themes/platter/static/platter.css @@ -1,5 +1,4 @@ @import url(pocoo.css); --@import url(http://fonts.googleapis.com/css?family=Fira+Mono:400,700|Bitter:400,400italic,700); +-@import url(https://fonts.googleapis.com/css?family=Fira+Mono:400,700|Bitter:400,400italic,700); - /* fonts */ - body { font-family: 'Bitter', serif; font-size: 16px; } + body { + font-family: "Bitter", "Garamond", "Georgia", serif; diff -Nru python-pallets-sphinx-themes-1.1.4/MANIFEST.in python-pallets-sphinx-themes-1.2.2/MANIFEST.in --- python-pallets-sphinx-themes-1.1.4/MANIFEST.in 2019-01-28 16:42:00.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/MANIFEST.in 2019-07-27 19:21:49.000000000 +0000 @@ -1,4 +1,4 @@ include CHANGES.rst -include LICENSE.rst graft src/pallets_sphinx_themes -global-exclude *.py[co] +graft docs +prune docs/_build diff -Nru python-pallets-sphinx-themes-1.1.4/PKG-INFO python-pallets-sphinx-themes-1.2.2/PKG-INFO --- python-pallets-sphinx-themes-1.1.4/PKG-INFO 2019-01-28 18:33:24.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/PKG-INFO 2019-08-05 03:37:28.000000000 +0000 @@ -1,11 +1,14 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: Pallets-Sphinx-Themes -Version: 1.1.4 +Version: 1.2.2 Summary: Sphinx themes for Pallets and related projects. -Home-page: https://github.com/pallets/pallets-sphinx-themes/ +Home-page: https://sphinx-themes.palletsprojects.com/ Author: Pallets Author-email: contact@palletsprojects.com License: BSD-3-Clause +Project-URL: Documentation, https://sphinx-themes.palletsprojects.com/ +Project-URL: Code, https://github.com/pallets/pallets-sphinx-themes +Project-URL: Issue tracker, https://github.com/pallets/pallets-sphinx-themes/issues Description: Pallets Sphinx Themes ===================== @@ -47,10 +50,11 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Topic :: Documentation Classifier: Topic :: Documentation :: Sphinx Classifier: Topic :: Software Development :: Documentation +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* +Description-Content-Type: text/x-rst diff -Nru python-pallets-sphinx-themes-1.1.4/setup.cfg python-pallets-sphinx-themes-1.2.2/setup.cfg --- python-pallets-sphinx-themes-1.1.4/setup.cfg 2019-01-28 18:33:24.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/setup.cfg 2019-08-05 03:37:28.000000000 +0000 @@ -1,12 +1,65 @@ [metadata] +name = Pallets-Sphinx-Themes +version = 1.2.2 +url = https://sphinx-themes.palletsprojects.com/ +project_urls = + Documentation = https://sphinx-themes.palletsprojects.com/ + Code = https://github.com/pallets/pallets-sphinx-themes + Issue tracker = https://github.com/pallets/pallets-sphinx-themes/issues +license = BSD-3-Clause license_file = LICENSE.rst +author = Pallets +author_email = contact@palletsprojects.com +description = Sphinx themes for Pallets and related projects. +long_description = file:README.rst +long_description_content_type = text/x-rst +classifiers = + Development Status :: 5 - Production/Stable + Framework :: Sphinx + Framework :: Sphinx :: Theme + Intended Audience :: Developers + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Topic :: Documentation + Topic :: Documentation :: Sphinx + Topic :: Software Development :: Documentation + +[options] +packages = find: +package_dir = + = src +include_package_data = true +python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* +install_requires = + importlib-metadata + packaging + Sphinx + +[options.packages.find] +where = src + +[options.entry_points] +pygments.styles = + pocoo = pallets_sphinx_themes.themes.pocoo:PocooStyle + jinja = pallets_sphinx_themes.themes.jinja:JinjaStyle [bdist_wheel] -universal = True +universal = true [flake8] select = B, E, F, W, B9 -ignore = E203, E501, E722, W503 +ignore = + E203 + E501 + E722 + W503 max-line-length = 80 [egg_info] diff -Nru python-pallets-sphinx-themes-1.1.4/setup.py python-pallets-sphinx-themes-1.2.2/setup.py --- python-pallets-sphinx-themes-1.1.4/setup.py 2019-01-28 18:32:02.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/setup.py 2019-07-27 19:21:49.000000000 +0000 @@ -1,48 +1,3 @@ -import io - -from setuptools import find_packages from setuptools import setup -with io.open("README.rst", "rt", encoding="utf8") as f: - readme = f.read() - -setup( - name="Pallets-Sphinx-Themes", - version="1.1.4", - url="https://github.com/pallets/pallets-sphinx-themes/", - license="BSD-3-Clause", - author="Pallets", - author_email="contact@palletsprojects.com", - description="Sphinx themes for Pallets and related projects.", - long_description=readme, - packages=find_packages("src"), - package_dir={"": "src"}, - include_package_data=True, - zip_safe=False, - install_requires=["Sphinx", "packaging"], - entry_points={ - "pygments.styles": [ - "pocoo = pallets_sphinx_themes.themes.pocoo:PocooStyle", - "jinja = pallets_sphinx_themes.themes.jinja:JinjaStyle", - ] - }, - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Framework :: Sphinx", - "Framework :: Sphinx :: Theme", - "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Topic :: Documentation", - "Topic :: Documentation :: Sphinx", - "Topic :: Software Development :: Documentation", - ], -) +setup() diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/__init__.py python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/__init__.py --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/__init__.py 2019-01-28 18:25:34.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/__init__.py 2019-07-27 19:21:49.000000000 +0000 @@ -5,15 +5,20 @@ import textwrap from collections import namedtuple -import pkg_resources +import importlib_metadata from sphinx.builders._epub_base import EpubBuilder -from sphinx.builders.html import SingleFileHTMLBuilder from sphinx.errors import ExtensionError from .theme_check import only_pallets_theme from .theme_check import set_is_pallets_theme from .versions import load_versions +try: + from sphinx.builders.singlehtml import SingleFileHTMLBuilder +except ImportError: + # Sphinx 1 compatibility + from sphinx.builders.html import SingleFileHTMLBuilder + def setup(app): base = os.path.join(os.path.dirname(__file__), "themes") @@ -30,8 +35,12 @@ app.connect("builder-inited", load_versions) app.connect("html-collect-pages", add_404_page) app.connect("html-page-context", canonical_url) - app.connect("autodoc-skip-member", skip_internal) - app.connect("autodoc-process-docstring", cut_module_meta) + + try: + app.connect("autodoc-skip-member", skip_internal) + app.connect("autodoc-process-docstring", cut_module_meta) + except ExtensionError: + pass try: app.add_config_value("singlehtml_sidebars", None, "html") @@ -41,8 +50,10 @@ app.connect("builder-inited", singlehtml_sidebars) from .themes import click as click_ext + from .themes import jinja as jinja_ext click_ext.setup(app) + jinja_ext.setup(app) own_release, _ = get_version(__name__) return {"version": own_release, "parallel_read_safe": True} @@ -132,7 +143,7 @@ :return: ``(release, version)`` tuple. """ try: - release = pkg_resources.get_distribution(name).version + release = importlib_metadata.version(name) except ImportError: print( textwrap.fill( diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/babel/sidebarintro.html python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/babel/sidebarintro.html --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/babel/sidebarintro.html 2018-07-23 15:56:11.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/babel/sidebarintro.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -

About Babel

-

- Babel is an internationalization library for Python. -

-

Useful Links

- diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/babel/sidebarlogo.html python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/babel/sidebarlogo.html --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/babel/sidebarlogo.html 2018-07-23 15:56:11.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/babel/sidebarlogo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ - diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/babel/static/babel.css python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/babel/static/babel.css --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/babel/static/babel.css 2019-01-28 16:43:50.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/babel/static/babel.css 2019-07-27 19:21:49.000000000 +0000 @@ -1,40 +1,24 @@ @import url(pocoo.css); -@import url(http://fonts.googleapis.com/css?family=Ubuntu+Mono:400,400italic,700,700italic); -@import url(http://fonts.googleapis.com/css?family=Open+Sans:300,400); +@import url(http://fonts.googleapis.com/css?family=Bree+Serif); -/* fonts */ -body { font-family: 'Ubuntu Mono', 'Consolas', 'Menlo', - 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono'; - font-size: 15px; } -div.admonition p.admonition-title, div.sphinxsidebar h3, div.sphinxsidebar h4, - div.sphinxsidebar input, div.body h1, div.body h2, div.body h3, div.body h4, - div.body h5, div.body h6 { font-family: 'Open Sans', 'Helvetica', 'Arial', - sans-serif; font-weight: 400; } -div.body h1, div.body h2, div.body h3, div.body h4, - div.body h5, div.body h6 { color: black; } -pre, code { font-family: 'Ubuntu Mono', 'Consolas', 'Menlo', - 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono'; - font-size: 15px; background: transparent; } -pre, * pre { padding: 7px 0 7px 30px!important; - margin: 15px 0!important; - line-height: 1.3; } +body { + font-family: "Verdana", "Garamond", "Georgia", serif; +} + +h1, h2, h3, h4, h5, h6, p.admonition-title, div.sphinxsidebar input { + font-family: "Bree Serif", "Garamond", "Georgia", serif; +} -/* colors */ -div.body { color: #3E4349; } -a { color: #5D2CD1; } -a:hover { color: #7546E3; } -p.version-warning { background-color: #7546E3; } -a.reference { border-bottom: 1px dotted #5D2CD1; } -a.reference:hover { border-bottom: 1px solid #7546E3; } -a.footnote-reference { border-bottom: 1px dotted #5D2CD1; } -a.footnote-reference:hover { border-bottom: 1px solid #7546E3; } -a:hover code { background-color: #eeeeee; } -code.xref, a code { background-color: #E8EFF0; - border-bottom: 1px solid white; } +a { + color: #b00; + border-color: #b00; +} + +a:hover { + color: #fc5e1e; + border-color: #fc5e1e; +} -/* special elements */ -div.indexwrapper h1 { - text-indent: -999999px; - background: url(babel.png) no-repeat center center; - height: 200px; +p.version-warning { + background-color: #d40; } diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/click/static/click.css python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/click/static/click.css --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/click/static/click.css 2018-08-15 17:50:12.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/click/static/click.css 2019-05-02 19:25:51.000000000 +0000 @@ -1,6 +1,6 @@ @import url("pocoo.css"); -@import url("http://fonts.googleapis.com/css?family=Ubuntu+Mono"); -@import url("http://fonts.googleapis.com/css?family=Open+Sans"); +@import url("https://fonts.googleapis.com/css?family=Ubuntu+Mono"); +@import url("https://fonts.googleapis.com/css?family=Open+Sans"); body, pre, code { font-family: "Ubuntu Mono", "Consolas", "Menlo", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace; diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/jinja/domain.py python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/jinja/domain.py --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/jinja/domain.py 1970-01-01 00:00:00.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/jinja/domain.py 2019-07-26 02:42:18.000000000 +0000 @@ -0,0 +1,268 @@ +import csv +import inspect +import re +from io import StringIO + +from docutils import nodes +from docutils.statemachine import StringList +from sphinx.domains import Domain +from sphinx.util import import_object +from sphinx.util.docutils import SphinxDirective + + +def build_function_directive(name, aliases, func): + """Build a function directive, with name, signature, docs, and + aliases. + + .. code-block:: rst + + .. function:: name(signature) + + doc + doc + + :aliases: ``name2``, ``name3`` + + :param name: The name mapped to the function, which may not match + the real name of the function. + :param aliases: Other names mapped to the function. + :param func: The function. + :return: A list of lines of reStructuredText to be rendered. + + If the function is a Jinja environment, context, or eval context + filter, the first argument is omitted from the signature since it's + not seen by template developers. + + If the filter is a Jinja async variant, it is unwrapped to its sync + variant to get the docs and signature. + """ + if getattr(func, "asyncfiltervariant", False): + # unwrap async filters to their normal variant + func = inspect.unwrap(func) + + doc = inspect.getdoc(func).splitlines() + + try: + sig = inspect.signature(func, follow_wrapped=False) + except ValueError: + # some c function that doesn't report its signature (ex. MarkupSafe.escape) + # try the first line of the docs, fall back to generic value + sig = "(value)" + m = re.match(r"[a-zA-Z_]\w*(\(.*?\))", doc[0]) + + if m is not None: + doc = doc[1:] + sig = m.group(1) + else: + if any( + getattr(func, attr, False) + for attr in ("environmentfilter", "contextfilter", "evalcontextfilter") + ): + # remove the internal-only first argument from context filters + params = list(sig.parameters.values()) + + if params[0].kind != inspect.Parameter.VAR_POSITIONAL: + # only remove it if it's not "*args" + del params[0] + + sig = sig.replace(parameters=params) + + result = ["", ".. function:: {}{}".format(name, sig), ""] + result.extend([" {}".format(x) for x in doc]) + + if aliases: + result.append("") + alias_str = ", ".join(["``{}``".format(x) for x in sorted(aliases)]) + result.append(" :aliases: {}".format(alias_str)) + + return result + + +class MappedFunctionsDirective(SphinxDirective): + """Take a dict of names to functions and produce rendered docs. + Requires one argument, the import name of the dict to process. + + Used for the ``jinja:filters::` and `jinja:tests::` directives. + + Multiple names can point to the same function. In this case the + shortest name is used as the primary name, and other names are + displayed as aliases. Comparison operators are special cased to + prefer their two letter names, like "eq". + + The docs are sorted by primary name. A table is rendered above the + docs as a compact table of contents linking to each function. + """ + + required_arguments = 1 + + def _build_functions(self): + """Imports the dict and builds the output for the functions. + This is what determines aliases and performs sorting. + + Calls :func:`build_function_directive` for each function, then + renders the list of reStructuredText to nodes. + + The list of sorted names is stored for use by + :meth:`_build_table`. + + :return: A list of rendered nodes. + """ + map_name = self.arguments[0] + mapping = import_object(map_name) + grouped = {} + + # reverse the mapping to get a list of aliases for each function + for key, value in mapping.items(): + grouped.setdefault(value, []).append(key) + + # store the function names for use by _build_table + self.funcs = funcs = [] + compare_ops = {"eq", "ge", "gt", "le", "lt", "ne"} + + for func, names in grouped.items(): + # use the longest alias as the canonical name + names.sort(key=len) + # adjust for special cases + names.sort(key=lambda x: x in compare_ops) + name = names.pop() + funcs.append((name, names, func)) + + funcs.sort() + result = StringList() + + # generate and collect markup + for name, aliases, func in funcs: + for item in build_function_directive(name, aliases, func): + result.append(item, "") + + # parse the generated markup into nodes + node = nodes.Element() + self.state.nested_parse(result, self.content_offset, node) + return node.children + + def _build_table(self): + """Takes the sorted list of names produced by + :meth:`_build_functions` and builds the nodes for the table of + contents. + + The table is hard coded to be 5 columns wide. Names are rendered + in alphabetical order in columns. + + :return: A list of rendered nodes. + """ + # the reference markup to link to each name + names = [":func:`{}`".format(name) for name, _, _ in self.funcs] + # total number of rows, the number of names divided by the + # number of columns, plus one in case of overflow + row_size = (len(names) // 5) + bool(len(names) % 5) + # pivot to rows so that names remain alphabetical in columns + rows = [names[i::row_size] for i in range(row_size)] + + # render the names to CSV for the csv-table directive + out = StringIO() + writer = csv.writer(out) + writer.writerows(rows) + + # generate the markup for the csv-table directive + result = ["", ".. csv-table::", " :align: left", ""] + result.extend([" {}".format(line) for line in out.getvalue().splitlines()]) + + # parse the generated markup into nodes + result = StringList(result, "") + node = nodes.Element() + self.state.nested_parse(result, self.content_offset, node) + return node.children + + def run(self): + """Render the table and function docs. + + Build the functions first to calculate the names and order, then + build the table. Return the table above the functions. + + :return: A list of rendered nodes. + """ + functions = self._build_functions() + table = self._build_table() + return table + functions + + +class NodesDirective(SphinxDirective): + """Take a base Jinja ``Node`` class and render docs for it and all + subclasses, recursively, depth first. Requires one argument, the + import name of the base class. + + Used for the ``jinja:nodes::` directive. + + Each descendant renders a link back to its parent. + """ + + required_arguments = 1 + + def run(self): + def walk(cls): + """Render the given class, then recursively render its + descendants depth first. + + Appends to the outer ``lines`` variable. + + :param cls: The Jinja ``Node`` class to render. + """ + lines.append( + ".. autoclass:: {}({})".format(cls.__name__, ", ".join(cls.fields)) + ) + + # render member methods for nodes marked abstract + if cls.abstract: + members = [] + + for key, value in cls.__dict__.items(): + if ( + not key.startswith("_") + and not hasattr(cls.__base__, key) + and callable(value) + ): + members.append(key) + + if members: + members.sort() + lines.append(" :members: " + ", ".join(members)) + + # reference the parent node, except for the base node + if cls.__base__ is not object: + lines.append("") + lines.append( + " :Node type: :class:`{}`".format(cls.__base__.__name__) + ) + + lines.append("") + children = cls.__subclasses__() + children.sort(key=lambda x: x.__name__.lower()) + + # render each child + for child in children: + walk(child) + + # generate the markup starting at the base class + lines = [] + target = import_object(self.arguments[0]) + walk(target) + + # parse the generated markup into nodes + doc = StringList(lines, "") + node = nodes.Element() + self.state.nested_parse(doc, self.content_offset, node) + return node.children + + +class JinjaDomain(Domain): + name = "jinja" + label = "Jinja" + directives = { + "filters": MappedFunctionsDirective, + "tests": MappedFunctionsDirective, + "nodes": NodesDirective, + } + + +def setup(app): + app.add_domain(JinjaDomain) diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/jinja/__init__.py python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/jinja/__init__.py --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/jinja/__init__.py 2018-08-07 15:00:24.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/jinja/__init__.py 2019-07-26 02:42:18.000000000 +0000 @@ -41,3 +41,13 @@ Generic.Traceback: "#aa0000", Error: "#f00 bg:#faa", } + + +def setup(app): + """Load the Jinja extension if Jinja is installed.""" + try: + from . import domain + except ImportError: + return + + domain.setup(app) diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/platter/sidebarintro.html python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/platter/sidebarintro.html --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/platter/sidebarintro.html 2018-07-23 15:56:11.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/platter/sidebarintro.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -

About Platter

-

- Platter is a deployment helper for Python. -

-

Useful Links

- diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/platter/sidebarlogo.html python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/platter/sidebarlogo.html --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/platter/sidebarlogo.html 2018-07-23 15:56:11.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/platter/sidebarlogo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ - diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/platter/static/platter.css python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/platter/static/platter.css --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/platter/static/platter.css 2018-07-23 15:56:11.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/platter/static/platter.css 2019-07-27 19:21:49.000000000 +0000 @@ -1,48 +1,26 @@ @import url(pocoo.css); -@import url(http://fonts.googleapis.com/css?family=Fira+Mono:400,700|Bitter:400,400italic,700); +@import url(https://fonts.googleapis.com/css?family=Fira+Mono:400,700|Bitter:400,400italic,700); -/* fonts */ -body { font-family: 'Bitter', serif; font-size: 16px; } -div.admonition p.admonition-title, div.sphinxsidebar h3, div.sphinxsidebar h4, - div.sphinxsidebar input, div.body h1, div.body h2, div.body h3, div.body h4, - div.body h5, div.body h6 { font-family: 'Bitter', sans-serif; font-weight: normal; } -div.body h1, div.body h2, div.body h3, div.body h4, - div.body h5, div.body h6 { color: black; } -pre, code { font-family: 'Fiora Mono', monospace; - font-size: 16px; background: transparent; } -pre, * pre { padding: 7px 0 7px 30px!important; - margin: 15px 0!important; - line-height: 1.3; } - -/* colors */ -div.body { color: #163228; margin-top: 20px; } -a { color: #bca612; } -a:hover { color: #95840e; } -p.version-warning { background-color: #e39046; } -a.reference { border-bottom: 1px dotted #d1952c; } -a.reference:hover { border-bottom: 1px solid #ab7311; } -a.footnote-reference { border-bottom: 1px dotted #d1952c; } -a.footnote-reference:hover { border-bottom: 1px solid #ab7311; } -a:hover code { background-color: #eeeeee; } -code.xref, a code { background-color: #E8EFF0; - border-bottom: 1px solid white; } - -/* special elements */ -div.indexwrapper h1:after { - content: ""; - display: block; - background: url(platter.png) no-repeat center center; - background-size: cover; - width: 200px; - height: 200px; - padding-left: 10px; - padding-bottom: 10px; - margin-left: 20px; - float: right; -} - -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - div.indexwrapper h1:after { - background-image: url(platter@2x.png); - } +body { + font-family: "Bitter", "Garamond", "Georgia", serif; +} + +pre, code { + font-family: "Fira Mono", "Consolas", "Menlo", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace; +} + +div.body { + color: #163228; +} + +a { + color: #bca612; +} + +a:hover { + color: #95840e; +} + +p.version-warning { + background-color: #e39046; } diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/pocoo/layout.html python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/pocoo/layout.html --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/pocoo/layout.html 2019-01-28 18:25:34.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/pocoo/layout.html 2019-08-05 03:17:32.000000000 +0000 @@ -47,4 +47,5 @@ } {%- endif %} + {{ js_tag("_static/version_warning_offset.js") }} {% endblock %} diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/pocoo/static/pocoo.css python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/pocoo/static/pocoo.css --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/pocoo/static/pocoo.css 2018-08-27 20:23:22.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/pocoo/static/pocoo.css 2019-08-05 03:19:42.000000000 +0000 @@ -135,33 +135,12 @@ color: #999; } -/* -- carbon ads ---------------------------------------------------- */ - -div.carbon_ads { - text-align: center; - overflow: hidden; - margin: 15px 0; - border: 1px solid #ccc; - background: #eee; - padding: 10px 7px; -} - -div.carbon_ads a.carbon-img { - display: block; - margin-bottom: 7px; - border: none; -} - -div.carbon_ads a.carbon-poweredby { - margin-top: 7px; - margin-left: 15px; - float: right; - font-size: 11px; -} - /* -- version warning ----------------------------------------------- */ p.version-warning { + top: 10px; + position: sticky; + margin: 10px 0; padding: 5px 10px; border-radius: 4px; diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/pocoo/static/version_warning_offset.js python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/pocoo/static/version_warning_offset.js --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/themes/pocoo/static/version_warning_offset.js 1970-01-01 00:00:00.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/themes/pocoo/static/version_warning_offset.js 2019-08-05 03:17:32.000000000 +0000 @@ -0,0 +1,40 @@ +/* +When showing the sticky version warning, the warning will cover the +scroll target when navigating to #id hash locations. Take over scrolling +to adjust the position to account for the height of the warning. +*/ +$(() => { + const versionWarning = $('.version-warning') + + // Skip if there is no version warning, regular browser behavior is + // fine in that case. + if (versionWarning.length) { + const height = versionWarning.outerHeight(true) + const target = $(':target') + + // Adjust position when the initial link has a hash. + if (target.length) { + // Use absolute scrollTo instead of relative scrollBy to avoid + // scrolling when the viewport is already at the bottom of the + // document and has space. + const y = target.offset().top - height + // Delayed because the initial browser scroll doesn't seem to + // happen until after the document ready event, so scrolling + // immediately will be overridden. + setTimeout(() => scrollTo(0, y), 100) + } + + // Listen to clicks on hash anchors. + $('a[href^="#"]').on('click', e => { + // Stop default scroll. Also stops the automatic URL hash update. + e.preventDefault() + // Get the id to scroll to and set the URL hash manually. + const id = $(e.currentTarget).attr('href').substring(1) + location.hash = id + // Use getElementById since the hash may have dots in it. + const target = $(document.getElementById(id)) + // Scroll to top of target with space for the version warning. + scrollTo(0, target.offset().top - height) + }) + } +}) diff -Nru python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/versions.py python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/versions.py --- python-pallets-sphinx-themes-1.1.4/src/pallets_sphinx_themes/versions.py 2018-09-24 19:36:36.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/pallets_sphinx_themes/versions.py 2019-08-05 03:27:44.000000000 +0000 @@ -64,43 +64,35 @@ def readthedocs_versions(app): config_versions = app.config.html_context["versions"] current_slug = app.config.html_context["current_version"] - latest_slug = None - versions = [] for slug, _ in config_versions: dev = slug in {"master", "default", "latest"} - is_version = _is_version(slug) - latest = False if dev: name = "Development" - elif slug in {"stable", "latest"}: + elif not _is_version(slug): name = slug.title() else: name = slug - if latest_slug is None and is_version: - latest_slug = slug - latest = True - versions.append( - DocVersion( - name=name, - slug=slug, - latest=latest, - dev=dev, - current=slug == current_slug, - ) + DocVersion(name=name, slug=slug, dev=dev, current=slug == current_slug) ) - if latest_slug is None: + versions.sort(key=lambda x: x.version, reverse=True) + versions.sort(key=lambda x: not x.dev) + + for i, version in enumerate(versions): + if _is_version(version.slug): + versions[i] = version._replace(latest=True) + break + else: for i, version in enumerate(versions): if version.slug == "stable": versions[i] = version._replace(latest=True) break - versions.sort(key=lambda x: not x.dev) return versions @@ -116,17 +108,20 @@ class DocVersion( - namedtuple("DocVersion", ("name", "slug", "latest", "dev", "current")) + namedtuple("DocVersion", ("name", "slug", "version", "latest", "dev", "current")) ): __slots__ = () def __new__(cls, name, slug=None, latest=False, dev=False, current=False): slug = slug or name + version = pv.parse(slug) - if _is_version(name): + if _is_version(slug): name = "Version " + name - return super(DocVersion, cls).__new__(cls, name, slug, latest, dev, current) + return super(DocVersion, cls).__new__( + cls, name, slug, version, latest, dev, current + ) @contextfunction def href(self, context): diff -Nru python-pallets-sphinx-themes-1.1.4/src/Pallets_Sphinx_Themes.egg-info/not-zip-safe python-pallets-sphinx-themes-1.2.2/src/Pallets_Sphinx_Themes.egg-info/not-zip-safe --- python-pallets-sphinx-themes-1.1.4/src/Pallets_Sphinx_Themes.egg-info/not-zip-safe 2019-01-28 18:33:18.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/Pallets_Sphinx_Themes.egg-info/not-zip-safe 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ - diff -Nru python-pallets-sphinx-themes-1.1.4/src/Pallets_Sphinx_Themes.egg-info/PKG-INFO python-pallets-sphinx-themes-1.2.2/src/Pallets_Sphinx_Themes.egg-info/PKG-INFO --- python-pallets-sphinx-themes-1.1.4/src/Pallets_Sphinx_Themes.egg-info/PKG-INFO 2019-01-28 18:33:24.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/Pallets_Sphinx_Themes.egg-info/PKG-INFO 2019-08-05 03:37:28.000000000 +0000 @@ -1,11 +1,14 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: Pallets-Sphinx-Themes -Version: 1.1.4 +Version: 1.2.2 Summary: Sphinx themes for Pallets and related projects. -Home-page: https://github.com/pallets/pallets-sphinx-themes/ +Home-page: https://sphinx-themes.palletsprojects.com/ Author: Pallets Author-email: contact@palletsprojects.com License: BSD-3-Clause +Project-URL: Documentation, https://sphinx-themes.palletsprojects.com/ +Project-URL: Code, https://github.com/pallets/pallets-sphinx-themes +Project-URL: Issue tracker, https://github.com/pallets/pallets-sphinx-themes/issues Description: Pallets Sphinx Themes ===================== @@ -47,10 +50,11 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Topic :: Documentation Classifier: Topic :: Documentation :: Sphinx Classifier: Topic :: Software Development :: Documentation +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* +Description-Content-Type: text/x-rst diff -Nru python-pallets-sphinx-themes-1.1.4/src/Pallets_Sphinx_Themes.egg-info/requires.txt python-pallets-sphinx-themes-1.2.2/src/Pallets_Sphinx_Themes.egg-info/requires.txt --- python-pallets-sphinx-themes-1.1.4/src/Pallets_Sphinx_Themes.egg-info/requires.txt 2019-01-28 18:33:24.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/Pallets_Sphinx_Themes.egg-info/requires.txt 2019-08-05 03:37:28.000000000 +0000 @@ -1,2 +1,3 @@ -Sphinx +importlib-metadata packaging +Sphinx diff -Nru python-pallets-sphinx-themes-1.1.4/src/Pallets_Sphinx_Themes.egg-info/SOURCES.txt python-pallets-sphinx-themes-1.2.2/src/Pallets_Sphinx_Themes.egg-info/SOURCES.txt --- python-pallets-sphinx-themes-1.1.4/src/Pallets_Sphinx_Themes.egg-info/SOURCES.txt 2019-01-28 18:33:24.000000000 +0000 +++ python-pallets-sphinx-themes-1.2.2/src/Pallets_Sphinx_Themes.egg-info/SOURCES.txt 2019-08-05 03:37:28.000000000 +0000 @@ -8,15 +8,12 @@ src/Pallets_Sphinx_Themes.egg-info/SOURCES.txt src/Pallets_Sphinx_Themes.egg-info/dependency_links.txt src/Pallets_Sphinx_Themes.egg-info/entry_points.txt -src/Pallets_Sphinx_Themes.egg-info/not-zip-safe src/Pallets_Sphinx_Themes.egg-info/requires.txt src/Pallets_Sphinx_Themes.egg-info/top_level.txt src/pallets_sphinx_themes/__init__.py src/pallets_sphinx_themes/theme_check.py src/pallets_sphinx_themes/versions.py src/pallets_sphinx_themes/themes/__init__.py -src/pallets_sphinx_themes/themes/babel/sidebarintro.html -src/pallets_sphinx_themes/themes/babel/sidebarlogo.html src/pallets_sphinx_themes/themes/babel/theme.conf src/pallets_sphinx_themes/themes/babel/static/babel.css src/pallets_sphinx_themes/themes/click/__init__.py @@ -26,10 +23,9 @@ src/pallets_sphinx_themes/themes/flask/theme.conf src/pallets_sphinx_themes/themes/flask/static/flask.css src/pallets_sphinx_themes/themes/jinja/__init__.py +src/pallets_sphinx_themes/themes/jinja/domain.py src/pallets_sphinx_themes/themes/jinja/theme.conf src/pallets_sphinx_themes/themes/jinja/static/jinja.css -src/pallets_sphinx_themes/themes/platter/sidebarintro.html -src/pallets_sphinx_themes/themes/platter/sidebarlogo.html src/pallets_sphinx_themes/themes/platter/theme.conf src/pallets_sphinx_themes/themes/platter/static/platter.css src/pallets_sphinx_themes/themes/pocoo/404.html @@ -41,5 +37,6 @@ src/pallets_sphinx_themes/themes/pocoo/theme.conf src/pallets_sphinx_themes/themes/pocoo/versions.html src/pallets_sphinx_themes/themes/pocoo/static/pocoo.css +src/pallets_sphinx_themes/themes/pocoo/static/version_warning_offset.js src/pallets_sphinx_themes/themes/werkzeug/theme.conf src/pallets_sphinx_themes/themes/werkzeug/static/werkzeug.css \ No newline at end of file