Skip to content

Commit

Permalink
[4.0.x] Fixed docs build with sphinxcontrib-spelling 7.5.0+.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
felixxm committed Jun 27, 2022
1 parent 8a294ee commit 4d20d2f
Show file tree
Hide file tree
Showing 31 changed files with 128 additions and 127 deletions.
1 change: 1 addition & 0 deletions docs/_theme/djangodocs/static/djangodocs.css
Expand Up @@ -103,6 +103,7 @@ dt .literal, table .literal { background:none; }
#bd a.reference { text-decoration: none; }
#bd a.reference tt.literal { border-bottom: 1px #234f32 dotted; }
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; }
div.code-block-caption .literal {color: white; }
div.literal-block-wrapper pre { margin-top: 0; }

/* Restore colors of pygments hyperlinked code */
Expand Down
2 changes: 1 addition & 1 deletion docs/howto/overriding-templates.txt
Expand Up @@ -112,7 +112,7 @@ For example, you can use this technique to add a custom logo to the
``admin/base_site.html`` template:

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

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

Expand Down
10 changes: 5 additions & 5 deletions docs/howto/writing-migrations.txt
Expand Up @@ -40,7 +40,7 @@ You can also provide hints that will be passed to the :meth:`allow_migrate()`
method of database routers as ``**hints``:

.. code-block:: python
:caption: myapp/dbrouters.py
:caption: ``myapp/dbrouters.py``

class MyRouter:

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

.. code-block:: python
:caption: 0006_remove_uuid_null.py
:caption: ``0006_remove_uuid_null.py``

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

.. code-block:: python
:caption: 0004_add_uuid_field.py
:caption: ``0004_add_uuid_field.py``

class Migration(migrations.Migration):

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

.. code-block:: python
:caption: 0005_populate_uuid_values.py
:caption: ``0005_populate_uuid_values.py``

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

.. code-block:: python
:caption: myapp/migrations/0124_move_old_app_to_new_app.py
:caption: ``myapp/migrations/0124_move_old_app_to_new_app.py``

from django.apps import apps as global_apps
from django.db import migrations
Expand Down
2 changes: 1 addition & 1 deletion docs/internals/contributing/writing-code/coding-style.txt
Expand Up @@ -171,7 +171,7 @@ Imports
For example (comments are for explanatory purposes only):

.. code-block:: python
:caption: django/contrib/admin/example.py
:caption: ``django/contrib/admin/example.py``

# future
from __future__ import unicode_literals
Expand Down
2 changes: 1 addition & 1 deletion docs/internals/contributing/writing-code/unit-tests.txt
Expand Up @@ -563,7 +563,7 @@ Since this pattern involves a lot of boilerplate, Django provides the
installed, you should pass the set of targeted ``app_label`` as arguments:

.. code-block:: python
:caption: tests/app_label/tests.py
:caption: ``tests/app_label/tests.py``

from django.db import models
from django.test import SimpleTestCase
Expand Down
2 changes: 1 addition & 1 deletion docs/internals/howto-release-django.txt
Expand Up @@ -63,7 +63,7 @@ You'll need a few things before getting started:
* Access to Django's record on PyPI. Create a file with your credentials:

.. code-block:: ini
:caption: ~/.pypirc
:caption: ``~/.pypirc``

[pypi]
username:YourUsername
Expand Down
14 changes: 7 additions & 7 deletions docs/intro/overview.txt
Expand Up @@ -26,7 +26,7 @@ representing your models -- so far, it's been solving many years' worth of
database-schema problems. Here's a quick example:

.. code-block:: python
:caption: mysite/news/models.py
:caption: ``mysite/news/models.py``

from django.db import models

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

.. code-block:: python
:caption: mysite/news/models.py
:caption: ``mysite/news/models.py``

from django.db import models

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

.. code-block:: python
:caption: mysite/news/admin.py
:caption: ``mysite/news/admin.py``

from django.contrib import admin

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

.. code-block:: python
:caption: mysite/news/urls.py
:caption: ``mysite/news/urls.py``

from django.urls import path

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

.. code-block:: python
:caption: mysite/news/views.py
:caption: ``mysite/news/views.py``

from django.shortcuts import render

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

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

{% extends "base.html" %}

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

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

{% load static %}
<html>
Expand Down
10 changes: 5 additions & 5 deletions docs/intro/reusable-apps.txt
Expand Up @@ -144,7 +144,7 @@ this. For a small app like polls, this process isn't too difficult.
#. Create a file ``django-polls/README.rst`` with the following contents:

.. code-block:: rst
:caption: django-polls/README.rst
:caption: ``django-polls/README.rst``

=====
Polls
Expand Down Expand Up @@ -192,14 +192,14 @@ this. For a small app like polls, this process isn't too difficult.
following contents:

.. code-block:: toml
:caption: django-polls/pyproject.toml
:caption: ``django-polls/pyproject.toml``

[build-system]
requires = ['setuptools>=40.8.0', 'wheel']
build-backend = 'setuptools.build_meta:__legacy__'

.. code-block:: ini
:caption: django-polls/setup.cfg
:caption: ``django-polls/setup.cfg``

[metadata]
name = django-polls
Expand Down Expand Up @@ -233,7 +233,7 @@ this. For a small app like polls, this process isn't too difficult.
Django >= X.Y # Replace "X.Y" as appropriate

.. code-block:: python
:caption: django-polls/setup.py
:caption: ``django-polls/setup.py``

from setuptools import setup

Expand All @@ -247,7 +247,7 @@ this. For a small app like polls, this process isn't too difficult.
contents:

.. code-block:: text
:caption: django-polls/MANIFEST.in
:caption: ``django-polls/MANIFEST.in``

include LICENSE
include README.rst
Expand Down
6 changes: 3 additions & 3 deletions docs/intro/tutorial01.txt
Expand Up @@ -245,7 +245,7 @@ Let's write the first view. Open the file ``polls/views.py``
and put the following Python code in it:

.. code-block:: python
:caption: polls/views.py
:caption: ``polls/views.py``

from django.http import HttpResponse

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

.. code-block:: python
:caption: polls/urls.py
:caption: ``polls/urls.py``

from django.urls import path

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

.. code-block:: python
:caption: mysite/urls.py
:caption: ``mysite/urls.py``

from django.contrib import admin
from django.urls import include, path
Expand Down
10 changes: 5 additions & 5 deletions docs/intro/tutorial02.txt
Expand Up @@ -141,7 +141,7 @@ These concepts are represented by Python classes. Edit the
:file:`polls/models.py` file so it looks like this:

.. code-block:: python
:caption: polls/models.py
:caption: ``polls/models.py``

from django.db import models

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

.. code-block:: python
:caption: mysite/settings.py
:caption: ``mysite/settings.py``

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

.. code-block:: python
:caption: polls/models.py
:caption: ``polls/models.py``

from django.db import models

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

.. code-block:: python
:caption: polls/models.py
:caption: ``polls/models.py``

import datetime

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

.. code-block:: python
:caption: polls/admin.py
:caption: ``polls/admin.py``

from django.contrib import admin

Expand Down
26 changes: 13 additions & 13 deletions docs/intro/tutorial03.txt
Expand Up @@ -70,7 +70,7 @@ Now let's add a few more views to ``polls/views.py``. These views are
slightly different, because they take an argument:

.. code-block:: python
:caption: polls/views.py
:caption: ``polls/views.py``

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

.. code-block:: python
:caption: polls/urls.py
:caption: ``polls/urls.py``

from django.urls import path

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

.. code-block:: python
:caption: polls/views.py
:caption: ``polls/views.py``

from django.http import HttpResponse

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

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

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

.. code-block:: python
:caption: polls/views.py
:caption: ``polls/views.py``

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

.. code-block:: python
:caption: polls/views.py
:caption: ``polls/views.py``

from django.shortcuts import render

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

.. code-block:: python
:caption: polls/views.py
:caption: ``polls/views.py``

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

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

{{ question }}

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

.. code-block:: python
:caption: polls/views.py
:caption: ``polls/views.py``

from django.shortcuts import get_object_or_404, render

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

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

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

.. code-block:: python
:caption: polls/urls.py
:caption: ``polls/urls.py``

from django.urls import path

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

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

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

to point at the namespaced detail view:

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

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

Expand Down

0 comments on commit 4d20d2f

Please sign in to comment.