File: no-external-resources.patch

package info (click to toggle)
sphinx-book-theme 1.1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,100 kB
  • sloc: python: 1,302; javascript: 170; makefile: 56; sh: 8
file content (259 lines) | stat: -rw-r--r-- 10,024 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
From: Dmitry Shachnev <mitya57@debian.org>
Date: Sun, 22 Dec 2024 13:18:09 +0300
Subject: Do not load external resources in the docs

Forwarded: not-needed
---
 docs/conf.py                              | 31 ++++---------------------------
 docs/reference/comments.md                | 18 ------------------
 docs/reference/kitchen-sink/generic.rst   |  4 ++--
 docs/reference/kitchen-sink/images.rst    | 12 ++++++------
 docs/reference/kitchen-sink/lists.rst     |  4 ++--
 docs/reference/kitchen-sink/structure.rst |  2 +-
 docs/reference/kitchen-sink/tables.rst    |  4 ++--
 docs/reference/special-theme-elements.md  |  6 ++----
 8 files changed, 19 insertions(+), 62 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index fe7f55f..b0fcc74 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,6 +1,5 @@
 # -- Project information -----------------------------------------------------
 import os
-from urllib.request import urlopen
 from pathlib import Path
 from datetime import datetime
 
@@ -140,8 +139,7 @@ html_theme_options = {
         {
             "name": "PyPI",
             "url": "https://pypi.org/project/sphinx-book-theme/",
-            "icon": "https://img.shields.io/pypi/dw/sphinx-book-theme",
-            "type": "url",
+            "icon": "fa-brands fa-python",
         },
     ],
     # For testing
@@ -187,12 +185,12 @@ linkcheck_exclude_documents = ["changelog"]
 
 # -- Download latest theme elements page from PyData -----------------------------
 
-path_pydata_content = "https://raw.githubusercontent.com/pydata/pydata-sphinx-theme/main/docs/user_guide/theme-elements.md"  # noqa
+path_pydata_content = "/usr/share/doc/python-pydata-sphinx-theme-doc/html/_sources/user_guide/theme-elements.md"  # noqa
 path_content_file = Path(__file__).parent / "content/pydata-content-blocks.md"
 if not path_content_file.exists():
-    with urlopen(path_pydata_content) as resp:
+    with open(path_pydata_content) as resp:
         # Read in the content page file, then update the title and add context
-        content = resp.read().decode().split("\n")
+        content = resp.read().split("\n")
         ix_title = content.index("# Theme-specific elements")
         content[ix_title] = "# PyData Theme Elements"
         content.insert(
@@ -204,24 +202,3 @@ if not path_content_file.exists():
         content = content.replace("../examples/pydata.ipynb", "notebooks.md")
         # Write to disk in a location that will be ignored by git
         path_content_file.write_text(content)
-
-
-def setup(app):
-    # -- To demonstrate ReadTheDocs switcher -------------------------------------
-    # This links a few JS and CSS files that mimic the environment that RTD uses
-    # so that we can test RTD-like behavior. We don't need to run it on RTD and we
-    # don't wanted it loaded in GitHub Actions because it messes up the lighthouse
-    # results.
-    if not os.environ.get("READTHEDOCS") and not os.environ.get("GITHUB_ACTIONS"):
-        app.add_css_file(
-            "https://assets.readthedocs.org/static/css/readthedocs-doc-embed.css"
-        )
-        app.add_css_file("https://assets.readthedocs.org/static/css/badge_only.css")
-
-        # Create the dummy data file so we can link it
-        # ref: https://github.com/readthedocs/readthedocs.org/blob/bc3e147770e5740314a8e8c33fec5d111c850498/readthedocs/core/static-src/core/js/doc-embed/footer.js  # noqa: E501
-        app.add_js_file("rtd-data.js")
-        app.add_js_file(
-            "https://assets.readthedocs.org/static/javascript/readthedocs-doc-embed.js",
-            priority=501,
-        )
diff --git a/docs/reference/comments.md b/docs/reference/comments.md
index faa68c9..133ebc4 100644
--- a/docs/reference/comments.md
+++ b/docs/reference/comments.md
@@ -11,10 +11,6 @@ You can activate hypothes.is with the following JS:
 <script async="async" src="https://hypothes.is/embed.js"></script>
 ```
 
-```{raw} html
-<script async="async" src="https://hypothes.is/embed.js"></script>
-```
-
 ## Utterances
 
 You can activate utterances with the following JS:
@@ -31,17 +27,3 @@ You can activate utterances with the following JS:
    crossorigin="anonymous"
 />
 ```
-
-
-```{raw} html
-<script
-   type="text/javascript"
-   src="https://utteranc.es/client.js"
-   async="async"
-   repo="executablebooks/jupyter-book"
-   issue-term="pathname"
-   theme="github-light"
-   label="💬 comment"
-   crossorigin="anonymous"
-/>
-```
diff --git a/docs/reference/kitchen-sink/generic.rst b/docs/reference/kitchen-sink/generic.rst
index 3952c43..37b2290 100644
--- a/docs/reference/kitchen-sink/generic.rst
+++ b/docs/reference/kitchen-sink/generic.rst
@@ -3,7 +3,7 @@
    Licensed under Creative Commons Attribution-ShareAlike 4.0 International License
    SPDX-License-Identifier: CC-BY-SA-4.0
 
-.. |EXAMPLE| image:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
+.. |EXAMPLE| image:: ../../images/cool.jpg
     :width: 1em
 
 =============
@@ -110,7 +110,7 @@ Sidebar
 
     Lorem ipsum dolor sit amet consectetur adipisicing elit.
 
-    .. image:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
+    .. image:: ../../images/cool.jpg
 
     Lorem ipsum dolor sit amet consectetur adipisicing elit.
 
diff --git a/docs/reference/kitchen-sink/images.rst b/docs/reference/kitchen-sink/images.rst
index de5b944..d6cf683 100644
--- a/docs/reference/kitchen-sink/images.rst
+++ b/docs/reference/kitchen-sink/images.rst
@@ -12,18 +12,18 @@ Images
 
 An image:
 
-.. image:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
+.. image:: ../../images/cool.jpg
    :height: 200
    :width: 200
 
 A clickable image:
 
-.. image:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
+.. image:: ../../images/cool.jpg
    :target: https://jupyter.org/
    :height: 200
    :width: 200
 
-.. image:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
+.. image:: ../../images/cool.jpg
    :align: right
    :height: 200
    :width: 200
@@ -43,7 +43,7 @@ sapiente veritatis doloribus accusantium molestiae modi recusandae
 excepturi facere, corrupti expedita sit nihil temporibus eius sequi
 animi, illo libero labore fuga.
 
-.. image:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
+.. image:: ../../images/cool.jpg
    :align: left
    :height: 200
    :width: 200
@@ -66,7 +66,7 @@ animi, illo libero labore fuga.
 Figures
 -------
 
-.. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
+.. figure:: ../../images/cool.jpg
    :alt: reStructuredText, the markup syntax
 
    A figure is an image with a caption and/or a legend:
@@ -83,7 +83,7 @@ Figures
 
 A figure directive with center alignment
 
-.. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
+.. figure:: ../../images/cool.jpg
    :align: center
 
    This caption should be centered.
diff --git a/docs/reference/kitchen-sink/lists.rst b/docs/reference/kitchen-sink/lists.rst
index e062a0c..2f829c0 100644
--- a/docs/reference/kitchen-sink/lists.rst
+++ b/docs/reference/kitchen-sink/lists.rst
@@ -246,11 +246,11 @@ Hlists
 .. hlist::
     :columns: 2
 
-    - .. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
+    - .. figure:: ../../images/cool.jpg
 
          This is a short caption for a figure.
 
-    - .. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
+    - .. figure:: ../../images/cool.jpg
 
          This is a long caption for a figure. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
          Donec porttitor dolor in odio posuere, vitae ornare libero mattis. In lobortis justo vestibulum nibh aliquet, non.
diff --git a/docs/reference/kitchen-sink/structure.rst b/docs/reference/kitchen-sink/structure.rst
index 1b2feff..ab42786 100644
--- a/docs/reference/kitchen-sink/structure.rst
+++ b/docs/reference/kitchen-sink/structure.rst
@@ -83,7 +83,7 @@ luctus efficitur arcu. Cras ut dictum mi. Nulla congue interdum lorem, semper se
 Document Subsection
 -------------------
 
-.. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
+.. figure:: ../../images/cool.jpg
     :align: right
     :figwidth: 200px
 
diff --git a/docs/reference/kitchen-sink/tables.rst b/docs/reference/kitchen-sink/tables.rst
index a9db926..182f8b9 100644
--- a/docs/reference/kitchen-sink/tables.rst
+++ b/docs/reference/kitchen-sink/tables.rst
@@ -97,11 +97,11 @@ List Tables
 
 .. list-table:: This is a list table with images in it.
 
-    * - .. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
+    * - .. figure:: ../../images/cool.jpg
 
            This is a short caption for a figure.
 
-      - .. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
+      - .. figure:: ../../images/cool.jpg
 
            This is a long caption for a figure. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
            Donec porttitor dolor in odio posuere, vitae ornare libero mattis. In lobortis justo vestibulum nibh aliquet, non.
diff --git a/docs/reference/special-theme-elements.md b/docs/reference/special-theme-elements.md
index 17f819d..1e246ec 100644
--- a/docs/reference/special-theme-elements.md
+++ b/docs/reference/special-theme-elements.md
@@ -68,9 +68,7 @@ plt.show()
 
 This is some markdown that should be shown at full width.
 
-Here's the Jupyter logo:
-
-![](https://raw.githubusercontent.com/adebar/awesome-jupyter/master/assets/logo.png)
+![](../images/cool.jpg)
 
 :::{note}
 Here's a full-width admonition!
@@ -224,7 +222,7 @@ how does it look?
 
 Markdown cell with images in sidebar
 
-<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Jupyter_logo.svg/883px-Jupyter_logo.svg.png" />
+![](../images/cool.jpg)
 
 ````
 +++