Skip to content

Commit 1a90981

Browse files
committed
[3.2.x] Fixed docs build with sphinxcontrib-spelling 7.5.0+.
sphinxcontrib-spelling 7.5.0+ includes captions of figures in the set of nodes for which the text is checked. Backport of ac90529 from main.
1 parent 37f4de2 commit 1a90981

31 files changed

+124
-123
lines changed

docs/_theme/djangodocs/static/djangodocs.css

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ dt .literal, table .literal { background:none; }
103103
#bd a.reference { text-decoration: none; }
104104
#bd a.reference tt.literal { border-bottom: 1px #234f32 dotted; }
105105
div.code-block-caption { color: white; background-color: #234F32; margin: 0; padding: 2px 5px; width: 100%; font-family: monospace; font-size: small; line-height: 1.3em; }
106+
div.code-block-caption .literal {color: white; }
106107
div.literal-block-wrapper pre { margin-top: 0; }
107108

108109
/* Restore colors of pygments hyperlinked code */

docs/howto/overriding-templates.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ For example, you can use this technique to add a custom logo to the
112112
``admin/base_site.html`` template:
113113

114114
.. code-block:: html+django
115-
:caption: templates/admin/base_site.html
115+
:caption: ``templates/admin/base_site.html``
116116

117117
{% extends "admin/base_site.html" %}
118118

docs/howto/writing-migrations.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ You can also provide hints that will be passed to the :meth:`allow_migrate()`
4040
method of database routers as ``**hints``:
4141

4242
.. code-block:: python
43-
:caption: myapp/dbrouters.py
43+
:caption: ``myapp/dbrouters.py``
4444

4545
class MyRouter:
4646

@@ -98,7 +98,7 @@ the respective field according to your needs.
9898
``AlterField``, and add imports of ``uuid`` and ``models``. For example:
9999

100100
.. code-block:: python
101-
:caption: 0006_remove_uuid_null.py
101+
:caption: ``0006_remove_uuid_null.py``
102102

103103
# Generated by Django A.B on YYYY-MM-DD HH:MM
104104
from django.db import migrations, models
@@ -122,7 +122,7 @@ the respective field according to your needs.
122122
similar to this:
123123

124124
.. code-block:: python
125-
:caption: 0004_add_uuid_field.py
125+
:caption: ``0004_add_uuid_field.py``
126126

127127
class Migration(migrations.Migration):
128128

@@ -149,7 +149,7 @@ the respective field according to your needs.
149149
of ``uuid``. For example:
150150

151151
.. code-block:: python
152-
:caption: 0005_populate_uuid_values.py
152+
:caption: ``0005_populate_uuid_values.py``
153153

154154
# Generated by Django A.B on YYYY-MM-DD HH:MM
155155
from django.db import migrations
@@ -283,7 +283,7 @@ project anywhere without first installing and then uninstalling the old app.
283283
Here's a sample migration:
284284

285285
.. code-block:: python
286-
:caption: myapp/migrations/0124_move_old_app_to_new_app.py
286+
:caption: ``myapp/migrations/0124_move_old_app_to_new_app.py``
287287

288288
from django.apps import apps as global_apps
289289
from django.db import migrations

docs/internals/contributing/writing-code/coding-style.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Imports
186186
For example (comments are for explanatory purposes only):
187187

188188
.. code-block:: python
189-
:caption: django/contrib/admin/example.py
189+
:caption: ``django/contrib/admin/example.py``
190190

191191
# future
192192
from __future__ import unicode_literals

docs/internals/contributing/writing-code/unit-tests.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ Since this pattern involves a lot of boilerplate, Django provides the
557557
installed, you should pass the set of targeted ``app_label`` as arguments:
558558

559559
.. code-block:: python
560-
:caption: tests/app_label/tests.py
560+
:caption: ``tests/app_label/tests.py``
561561

562562
from django.db import models
563563
from django.test import SimpleTestCase

docs/internals/howto-release-django.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ You'll need a few things before getting started:
6363
* Access to Django's record on PyPI. Create a file with your credentials:
6464

6565
.. code-block:: ini
66-
:caption: ~/.pypirc
66+
:caption: ``~/.pypirc``
6767

6868
[pypi]
6969
username:YourUsername

docs/intro/overview.txt

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ representing your models -- so far, it's been solving many years' worth of
2626
database-schema problems. Here's a quick example:
2727

2828
.. code-block:: python
29-
:caption: mysite/news/models.py
29+
:caption: ``mysite/news/models.py``
3030

3131
from django.db import models
3232

@@ -146,7 +146,7 @@ a website that lets authenticated users add, change and delete objects. The
146146
only step required is to register your model in the admin site:
147147

148148
.. code-block:: python
149-
:caption: mysite/news/models.py
149+
:caption: ``mysite/news/models.py``
150150

151151
from django.db import models
152152

@@ -157,7 +157,7 @@ only step required is to register your model in the admin site:
157157
reporter = models.ForeignKey(Reporter, on_delete=models.CASCADE)
158158

159159
.. code-block:: python
160-
:caption: mysite/news/admin.py
160+
:caption: ``mysite/news/admin.py``
161161

162162
from django.contrib import admin
163163

@@ -189,7 +189,7 @@ Here's what a URLconf might look like for the ``Reporter``/``Article``
189189
example above:
190190

191191
.. code-block:: python
192-
:caption: mysite/news/urls.py
192+
:caption: ``mysite/news/urls.py``
193193

194194
from django.urls import path
195195

@@ -229,7 +229,7 @@ and renders the template with the retrieved data. Here's an example view for
229229
``year_archive`` from above:
230230

231231
.. code-block:: python
232-
:caption: mysite/news/views.py
232+
:caption: ``mysite/news/views.py``
233233

234234
from django.shortcuts import render
235235

@@ -258,7 +258,7 @@ Let's say the ``news/year_archive.html`` template was found. Here's what that
258258
might look like:
259259

260260
.. code-block:: html+django
261-
:caption: mysite/news/templates/news/year_archive.html
261+
:caption: ``mysite/news/templates/news/year_archive.html``
262262

263263
{% extends "base.html" %}
264264

@@ -299,7 +299,7 @@ Here's what the "base.html" template, including the use of :doc:`static files
299299
</howto/static-files/index>`, might look like:
300300

301301
.. code-block:: html+django
302-
:caption: mysite/templates/base.html
302+
:caption: ``mysite/templates/base.html``
303303

304304
{% load static %}
305305
<html>

docs/intro/reusable-apps.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ this. For a small app like polls, this process isn't too difficult.
144144
#. Create a file ``django-polls/README.rst`` with the following contents:
145145

146146
.. code-block:: rst
147-
:caption: django-polls/README.rst
147+
:caption: ``django-polls/README.rst``
148148

149149
=====
150150
Polls
@@ -191,7 +191,7 @@ this. For a small app like polls, this process isn't too difficult.
191191
with the following contents:
192192

193193
.. code-block:: ini
194-
:caption: django-polls/setup.cfg
194+
:caption: ``django-polls/setup.cfg``
195195

196196
[metadata]
197197
name = django-polls
@@ -226,7 +226,7 @@ this. For a small app like polls, this process isn't too difficult.
226226
Django >= X.Y # Replace "X.Y" as appropriate
227227

228228
.. code-block:: python
229-
:caption: django-polls/setup.py
229+
:caption: ``django-polls/setup.py``
230230

231231
from setuptools import setup
232232

@@ -240,7 +240,7 @@ this. For a small app like polls, this process isn't too difficult.
240240
contents:
241241

242242
.. code-block:: text
243-
:caption: django-polls/MANIFEST.in
243+
:caption: ``django-polls/MANIFEST.in``
244244

245245
include LICENSE
246246
include README.rst

docs/intro/tutorial01.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ Let's write the first view. Open the file ``polls/views.py``
245245
and put the following Python code in it:
246246

247247
.. code-block:: python
248-
:caption: polls/views.py
248+
:caption: ``polls/views.py``
249249

250250
from django.http import HttpResponse
251251

@@ -273,7 +273,7 @@ Your app directory should now look like::
273273
In the ``polls/urls.py`` file include the following code:
274274

275275
.. code-block:: python
276-
:caption: polls/urls.py
276+
:caption: ``polls/urls.py``
277277

278278
from django.urls import path
279279

@@ -288,7 +288,7 @@ The next step is to point the root URLconf at the ``polls.urls`` module. In
288288
:func:`~django.urls.include` in the ``urlpatterns`` list, so you have:
289289

290290
.. code-block:: python
291-
:caption: mysite/urls.py
291+
:caption: ``mysite/urls.py``
292292

293293
from django.contrib import admin
294294
from django.urls import include, path

docs/intro/tutorial02.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ These concepts are represented by Python classes. Edit the
141141
:file:`polls/models.py` file so it looks like this:
142142

143143
.. code-block:: python
144-
:caption: polls/models.py
144+
:caption: ``polls/models.py``
145145

146146
from django.db import models
147147

@@ -217,7 +217,7 @@ add that dotted path to the :setting:`INSTALLED_APPS` setting. It'll look like
217217
this:
218218

219219
.. code-block:: python
220-
:caption: mysite/settings.py
220+
:caption: ``mysite/settings.py``
221221

222222
INSTALLED_APPS = [
223223
'polls.apps.PollsConfig',
@@ -424,7 +424,7 @@ representation of this object. Let's fix that by editing the ``Question`` model
424424
``Choice``:
425425

426426
.. code-block:: python
427-
:caption: polls/models.py
427+
:caption: ``polls/models.py``
428428

429429
from django.db import models
430430

@@ -448,7 +448,7 @@ automatically-generated admin.
448448
Let's also add a custom method to this model:
449449

450450
.. code-block:: python
451-
:caption: polls/models.py
451+
:caption: ``polls/models.py``
452452

453453
import datetime
454454

@@ -646,7 +646,7 @@ have an admin interface. To do this, open the :file:`polls/admin.py` file, and
646646
edit it to look like this:
647647

648648
.. code-block:: python
649-
:caption: polls/admin.py
649+
:caption: ``polls/admin.py``
650650

651651
from django.contrib import admin
652652

docs/intro/tutorial03.txt

+13-13
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Now let's add a few more views to ``polls/views.py``. These views are
7070
slightly different, because they take an argument:
7171

7272
.. code-block:: python
73-
:caption: polls/views.py
73+
:caption: ``polls/views.py``
7474

7575
def detail(request, question_id):
7676
return HttpResponse("You're looking at question %s." % question_id)
@@ -86,7 +86,7 @@ Wire these new views into the ``polls.urls`` module by adding the following
8686
:func:`~django.urls.path` calls:
8787

8888
.. code-block:: python
89-
:caption: polls/urls.py
89+
:caption: ``polls/urls.py``
9090

9191
from django.urls import path
9292

@@ -147,7 +147,7 @@ view, which displays the latest 5 poll questions in the system, separated by
147147
commas, according to publication date:
148148

149149
.. code-block:: python
150-
:caption: polls/views.py
150+
:caption: ``polls/views.py``
151151

152152
from django.http import HttpResponse
153153

@@ -196,7 +196,7 @@ Django as ``polls/index.html``.
196196
Put the following code in that template:
197197

198198
.. code-block:: html+django
199-
:caption: polls/templates/polls/index.html
199+
:caption: ``polls/templates/polls/index.html``
200200

201201
{% if latest_question_list %}
202202
<ul>
@@ -218,7 +218,7 @@ __ https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Gett
218218
Now let's update our ``index`` view in ``polls/views.py`` to use the template:
219219

220220
.. code-block:: python
221-
:caption: polls/views.py
221+
:caption: ``polls/views.py``
222222

223223
from django.http import HttpResponse
224224
from django.template import loader
@@ -251,7 +251,7 @@ template. Django provides a shortcut. Here's the full ``index()`` view,
251251
rewritten:
252252

253253
.. code-block:: python
254-
:caption: polls/views.py
254+
:caption: ``polls/views.py``
255255

256256
from django.shortcuts import render
257257

@@ -280,7 +280,7 @@ Now, let's tackle the question detail view -- the page that displays the questio
280280
for a given poll. Here's the view:
281281

282282
.. code-block:: python
283-
:caption: polls/views.py
283+
:caption: ``polls/views.py``
284284

285285
from django.http import Http404
286286
from django.shortcuts import render
@@ -302,7 +302,7 @@ later, but if you'd like to quickly get the above example working, a file
302302
containing just:
303303

304304
.. code-block:: html+django
305-
:caption: polls/templates/polls/detail.html
305+
:caption: ``polls/templates/polls/detail.html``
306306

307307
{{ question }}
308308

@@ -316,7 +316,7 @@ and raise :exc:`~django.http.Http404` if the object doesn't exist. Django
316316
provides a shortcut. Here's the ``detail()`` view, rewritten:
317317

318318
.. code-block:: python
319-
:caption: polls/views.py
319+
:caption: ``polls/views.py``
320320

321321
from django.shortcuts import get_object_or_404, render
322322

@@ -358,7 +358,7 @@ variable ``question``, here's what the ``polls/detail.html`` template might look
358358
like:
359359

360360
.. code-block:: html+django
361-
:caption: polls/templates/polls/detail.html
361+
:caption: ``polls/templates/polls/detail.html``
362362

363363
<h1>{{ question.question_text }}</h1>
364364
<ul>
@@ -432,7 +432,7 @@ The answer is to add namespaces to your URLconf. In the ``polls/urls.py``
432432
file, go ahead and add an ``app_name`` to set the application namespace:
433433

434434
.. code-block:: python
435-
:caption: polls/urls.py
435+
:caption: ``polls/urls.py``
436436

437437
from django.urls import path
438438

@@ -449,14 +449,14 @@ file, go ahead and add an ``app_name`` to set the application namespace:
449449
Now change your ``polls/index.html`` template from:
450450

451451
.. code-block:: html+django
452-
:caption: polls/templates/polls/index.html
452+
:caption: ``polls/templates/polls/index.html``
453453

454454
<li><a href="{% url 'detail' question.id %}">{{ question.question_text }}</a></li>
455455

456456
to point at the namespaced detail view:
457457

458458
.. code-block:: html+django
459-
:caption: polls/templates/polls/index.html
459+
:caption: ``polls/templates/polls/index.html``
460460

461461
<li><a href="{% url 'polls:detail' question.id %}">{{ question.question_text }}</a></li>
462462

0 commit comments

Comments
 (0)