Update upstream source from tag 'upstream/2.0.2'
Update to upstream version '2.0.2'
with Debian dir 0fe45c31ae552f14d6f194f4fcb10243a3816cfe
Piotr Ożarowski
1 year, 7 months ago
0 | Version 2.0.2 | |
1 | ------------- | |
2 | ||
3 | Released 2021-11-10 | |
4 | ||
5 | - Detect if Sphinx dirhtml builder is generating canonical URLs with | |
6 | ".html" and replace with the correct dir URL. :issue:`47` | |
7 | - ``canonical_url`` config is deprecated. Use Sphinx's built-in | |
8 | ``html_baseurl`` config instead. :pr:`53` | |
9 | - Address deprecations in Jinja 2.0. :pr:`54` | |
10 | ||
11 | ||
0 | 12 | Version 2.0.1 |
1 | 13 | ------------- |
2 | 14 |
0 | 0 | Metadata-Version: 2.1 |
1 | 1 | Name: Pallets-Sphinx-Themes |
2 | Version: 2.0.1 | |
2 | Version: 2.0.2 | |
3 | 3 | Summary: Sphinx themes for Pallets and related projects. |
4 | 4 | Home-page: https://github.com/pallets/pallets-sphinx-themes/ |
5 | 5 | Author: Pallets |
10 | 10 | Project-URL: Issue Tracker, https://github.com/pallets/pallets-sphinx-themes/issues/ |
11 | 11 | Project-URL: Twitter, https://twitter.com/PalletsTeam |
12 | 12 | Project-URL: Chat, https://discord.gg/pallets |
13 | Description: Pallets Sphinx Themes | |
14 | ===================== | |
15 | ||
16 | Themes for the Pallets projects. If you're writing an extension, use the | |
17 | appropriate theme to make your documentation look consistent. | |
18 | ||
19 | Available themes: | |
20 | ||
21 | - flask | |
22 | - jinja | |
23 | - werkzeug | |
24 | - click | |
25 | ||
26 | Install this package: | |
27 | ||
28 | .. code-block:: text | |
29 | ||
30 | pip install Pallets-Sphinx-Themes | |
31 | ||
32 | Enable the extension and choose the theme in ``docs/conf.py``: | |
33 | ||
34 | .. code-block:: python | |
35 | ||
36 | extensions = [ | |
37 | "pallets_sphinx_themes", | |
38 | ... | |
39 | ] | |
40 | ||
41 | html_theme = "flask" | |
42 | ||
43 | 13 | Platform: UNKNOWN |
44 | 14 | Classifier: Development Status :: 5 - Production/Stable |
45 | 15 | Classifier: Framework :: Sphinx |
53 | 23 | Classifier: Topic :: Software Development :: Documentation |
54 | 24 | Requires-Python: >=3.6 |
55 | 25 | Description-Content-Type: text/x-rst |
26 | License-File: LICENSE.rst | |
27 | ||
28 | Pallets Sphinx Themes | |
29 | ===================== | |
30 | ||
31 | Themes for the Pallets projects. If you're writing an extension, use the | |
32 | appropriate theme to make your documentation look consistent. | |
33 | ||
34 | Available themes: | |
35 | ||
36 | - flask | |
37 | - jinja | |
38 | - werkzeug | |
39 | - click | |
40 | ||
41 | Install this package: | |
42 | ||
43 | .. code-block:: text | |
44 | ||
45 | pip install Pallets-Sphinx-Themes | |
46 | ||
47 | Enable the extension and choose the theme in ``docs/conf.py``: | |
48 | ||
49 | .. code-block:: python | |
50 | ||
51 | extensions = [ | |
52 | "pallets_sphinx_themes", | |
53 | ... | |
54 | ] | |
55 | ||
56 | html_theme = "flask" | |
57 | ||
58 |
0 | 0 | [metadata] |
1 | 1 | name = Pallets-Sphinx-Themes |
2 | version = 2.0.1 | |
2 | version = 2.0.2 | |
3 | 3 | url = https://github.com/pallets/pallets-sphinx-themes/ |
4 | 4 | project_urls = |
5 | 5 | Donate = https://palletsprojects.com/donate |
0 | 0 | Metadata-Version: 2.1 |
1 | 1 | Name: Pallets-Sphinx-Themes |
2 | Version: 2.0.1 | |
2 | Version: 2.0.2 | |
3 | 3 | Summary: Sphinx themes for Pallets and related projects. |
4 | 4 | Home-page: https://github.com/pallets/pallets-sphinx-themes/ |
5 | 5 | Author: Pallets |
10 | 10 | Project-URL: Issue Tracker, https://github.com/pallets/pallets-sphinx-themes/issues/ |
11 | 11 | Project-URL: Twitter, https://twitter.com/PalletsTeam |
12 | 12 | Project-URL: Chat, https://discord.gg/pallets |
13 | Description: Pallets Sphinx Themes | |
14 | ===================== | |
15 | ||
16 | Themes for the Pallets projects. If you're writing an extension, use the | |
17 | appropriate theme to make your documentation look consistent. | |
18 | ||
19 | Available themes: | |
20 | ||
21 | - flask | |
22 | - jinja | |
23 | - werkzeug | |
24 | - click | |
25 | ||
26 | Install this package: | |
27 | ||
28 | .. code-block:: text | |
29 | ||
30 | pip install Pallets-Sphinx-Themes | |
31 | ||
32 | Enable the extension and choose the theme in ``docs/conf.py``: | |
33 | ||
34 | .. code-block:: python | |
35 | ||
36 | extensions = [ | |
37 | "pallets_sphinx_themes", | |
38 | ... | |
39 | ] | |
40 | ||
41 | html_theme = "flask" | |
42 | ||
43 | 13 | Platform: UNKNOWN |
44 | 14 | Classifier: Development Status :: 5 - Production/Stable |
45 | 15 | Classifier: Framework :: Sphinx |
53 | 23 | Classifier: Topic :: Software Development :: Documentation |
54 | 24 | Requires-Python: >=3.6 |
55 | 25 | Description-Content-Type: text/x-rst |
26 | License-File: LICENSE.rst | |
27 | ||
28 | Pallets Sphinx Themes | |
29 | ===================== | |
30 | ||
31 | Themes for the Pallets projects. If you're writing an extension, use the | |
32 | appropriate theme to make your documentation look consistent. | |
33 | ||
34 | Available themes: | |
35 | ||
36 | - flask | |
37 | - jinja | |
38 | - werkzeug | |
39 | - click | |
40 | ||
41 | Install this package: | |
42 | ||
43 | .. code-block:: text | |
44 | ||
45 | pip install Pallets-Sphinx-Themes | |
46 | ||
47 | Enable the extension and choose the theme in ``docs/conf.py``: | |
48 | ||
49 | .. code-block:: python | |
50 | ||
51 | extensions = [ | |
52 | "pallets_sphinx_themes", | |
53 | ... | |
54 | ] | |
55 | ||
56 | html_theme = "flask" | |
57 | ||
58 |
4 | 4 | import textwrap |
5 | 5 | from collections import namedtuple |
6 | 6 | |
7 | from sphinx.application import Sphinx | |
7 | 8 | from sphinx.builders._epub_base import EpubBuilder |
9 | from sphinx.builders.dirhtml import DirectoryHTMLBuilder | |
8 | 10 | from sphinx.builders.singlehtml import SingleFileHTMLBuilder |
9 | 11 | from sphinx.errors import ExtensionError |
10 | 12 | |
71 | 73 | |
72 | 74 | |
73 | 75 | @only_pallets_theme() |
74 | def canonical_url(app, pagename, templatename, context, doctree): | |
75 | """Build the canonical URL for a page. Appends the path for the | |
76 | page to the base URL specified by the | |
77 | ``html_context["canonical_url"]`` config and stores it in | |
78 | ``html_context["page_canonical_url"]``. | |
76 | def canonical_url(app: Sphinx, pagename, templatename, context, doctree): | |
77 | """Sphinx 1.8 builds a canonical URL if ``html_baseurl`` config is | |
78 | set. However, it builds a URL ending with ".html" when using the | |
79 | dirhtml builder, which is incorrect. Detect this and generate the | |
80 | correct URL for each page. | |
81 | ||
82 | Also accepts the custom, deprecated ``canonical_url`` config as the | |
83 | base URL. This will be removed in version 2.1. | |
79 | 84 | """ |
80 | base = context.get("canonical_url") | |
85 | base = app.config.html_baseurl | |
81 | 86 | |
82 | if not base: | |
87 | if not base and context.get("canonical_url"): | |
88 | import warnings | |
89 | ||
90 | warnings.warn( | |
91 | "'canonical_url' config is deprecated and will be removed" | |
92 | " in Pallets-Sphinx-Themes 2.1. Set Sphinx's 'html_baseurl'" | |
93 | " config instead.", | |
94 | DeprecationWarning, | |
95 | ) | |
96 | base = context["canonical_url"] | |
97 | ||
98 | if ( | |
99 | not base | |
100 | or not isinstance(app.builder, DirectoryHTMLBuilder) | |
101 | or not context["pageurl"] | |
102 | or not context["pageurl"].endswith(".html") | |
103 | ): | |
83 | 104 | return |
84 | 105 | |
106 | # Fix pageurl for dirhtml builder if this version of Sphinx still | |
107 | # generates .html URLs. | |
85 | 108 | target = app.builder.get_target_uri(pagename) |
86 | context["page_canonical_url"] = base + target | |
109 | context["pageurl"] = base + target | |
87 | 110 | |
88 | 111 | |
89 | 112 | @only_pallets_theme() |
156 | 179 | version = ".".join(release.split(".", version_length)[:version_length]) |
157 | 180 | |
158 | 181 | if placeholder: |
159 | version = "{}.{}".format(version, placeholder) | |
182 | version = f"{version}.{placeholder}" | |
160 | 183 | |
161 | 184 | return release, version |
162 | 185 |
3 | 3 | {{- metatags }} |
4 | 4 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
5 | 5 | {%- endset %} |
6 | ||
7 | {% block extrahead %} | |
8 | {%- if page_canonical_url %} | |
9 | <link rel="canonical" href="{{ page_canonical_url }}"> | |
10 | {%- endif %} | |
11 | {{ super() }} | |
12 | {%- endblock %} | |
13 | 6 | |
14 | 7 | {% block sidebarlogo %} |
15 | 8 | {% if pagename != "index" or theme_index_sidebar_logo %} |
0 | import io | |
1 | 0 | import json |
2 | 1 | import os |
3 | 2 | from collections import namedtuple |
4 | 3 | |
5 | from jinja2 import contextfunction | |
4 | from jinja2 import pass_context | |
6 | 5 | from packaging import version as pv |
7 | 6 | |
8 | 7 | from .theme_check import only_pallets_theme |
26 | 25 | |
27 | 26 | if isinstance(config_versions, str): |
28 | 27 | if os.path.isfile(config_versions): |
29 | with io.open(config_versions, "rt", encoding="utf8") as f: | |
28 | with open(config_versions, encoding="utf8") as f: | |
30 | 29 | config_versions = json.load(f) |
31 | 30 | else: |
32 | 31 | config_versions = json.loads(config_versions) |
96 | 95 | |
97 | 96 | |
98 | 97 | def _is_version(value, placeholder="x"): |
99 | if value.endswith(".{}".format(placeholder)): | |
98 | if value.endswith(f".{placeholder}"): | |
100 | 99 | value = value[: -(len(placeholder) + 1)] |
101 | 100 | |
102 | 101 | try: |
118 | 117 | if _is_version(slug): |
119 | 118 | name = "Version " + name |
120 | 119 | |
121 | return super(DocVersion, cls).__new__( | |
122 | cls, name, slug, version, latest, dev, current | |
123 | ) | |
120 | return super().__new__(cls, name, slug, version, latest, dev, current) | |
124 | 121 | |
125 | @contextfunction | |
122 | @pass_context | |
126 | 123 | def href(self, context): |
127 | 124 | pathto = context["pathto"] |
128 | 125 | master_doc = context["master_doc"] |
133 | 130 | path = builder.get_target_uri(pagename) |
134 | 131 | return "/".join((master, "..", self.slug, path)) |
135 | 132 | |
136 | @contextfunction | |
133 | @pass_context | |
137 | 134 | def banner(self, context): |
138 | 135 | if self.latest: |
139 | 136 | return |