From 1a9098166e58704b11dcf088948efa89e088b6f5 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Tue, 31 May 2022 07:40:54 +0200 Subject: [PATCH] [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 ac90529cc58507d9a07610809a795ec5fc3cbf8c from main. --- docs/_theme/djangodocs/static/djangodocs.css | 1 + docs/howto/overriding-templates.txt | 2 +- docs/howto/writing-migrations.txt | 10 +++---- .../writing-code/coding-style.txt | 2 +- .../contributing/writing-code/unit-tests.txt | 2 +- docs/internals/howto-release-django.txt | 2 +- docs/intro/overview.txt | 14 +++++----- docs/intro/reusable-apps.txt | 8 +++--- docs/intro/tutorial01.txt | 6 ++--- docs/intro/tutorial02.txt | 10 +++---- docs/intro/tutorial03.txt | 26 +++++++++---------- docs/intro/tutorial04.txt | 14 +++++----- docs/intro/tutorial05.txt | 20 +++++++------- docs/intro/tutorial06.txt | 6 ++--- docs/intro/tutorial07.txt | 18 ++++++------- docs/ref/contrib/admin/index.txt | 10 +++---- docs/ref/contrib/admin/javascript.txt | 4 +-- docs/ref/databases.txt | 2 +- docs/ref/models/expressions.txt | 2 +- docs/ref/models/fields.txt | 4 +-- docs/ref/templates/language.txt | 8 +++--- docs/releases/1.9.txt | 8 +++--- docs/topics/auth/passwords.txt | 6 ++--- .../class-based-views/generic-editing.txt | 14 +++++----- docs/topics/class-based-views/mixins.txt | 4 +-- docs/topics/db/models.txt | 2 +- docs/topics/forms/index.txt | 8 +++--- docs/topics/http/file-uploads.txt | 8 +++--- docs/topics/http/urls.txt | 8 +++--- docs/topics/logging.txt | 10 +++---- docs/topics/testing/advanced.txt | 8 +++--- 31 files changed, 124 insertions(+), 123 deletions(-) diff --git a/docs/_theme/djangodocs/static/djangodocs.css b/docs/_theme/djangodocs/static/djangodocs.css index bd47749a06a..0b6a8b9ad3b 100644 --- a/docs/_theme/djangodocs/static/djangodocs.css +++ b/docs/_theme/djangodocs/static/djangodocs.css @@ -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 */ diff --git a/docs/howto/overriding-templates.txt b/docs/howto/overriding-templates.txt index 0f880690698..55d7c66f426 100644 --- a/docs/howto/overriding-templates.txt +++ b/docs/howto/overriding-templates.txt @@ -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" %} diff --git a/docs/howto/writing-migrations.txt b/docs/howto/writing-migrations.txt index 00dc0dfadfa..3c571fdc94d 100644 --- a/docs/howto/writing-migrations.txt +++ b/docs/howto/writing-migrations.txt @@ -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: @@ -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 @@ -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): @@ -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 @@ -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 diff --git a/docs/internals/contributing/writing-code/coding-style.txt b/docs/internals/contributing/writing-code/coding-style.txt index 3c82aa20deb..61a350821e5 100644 --- a/docs/internals/contributing/writing-code/coding-style.txt +++ b/docs/internals/contributing/writing-code/coding-style.txt @@ -186,7 +186,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 diff --git a/docs/internals/contributing/writing-code/unit-tests.txt b/docs/internals/contributing/writing-code/unit-tests.txt index 490a4673b69..bd426099d6d 100644 --- a/docs/internals/contributing/writing-code/unit-tests.txt +++ b/docs/internals/contributing/writing-code/unit-tests.txt @@ -557,7 +557,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 diff --git a/docs/internals/howto-release-django.txt b/docs/internals/howto-release-django.txt index beb3581d54f..723804a95e3 100644 --- a/docs/internals/howto-release-django.txt +++ b/docs/internals/howto-release-django.txt @@ -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 diff --git a/docs/intro/overview.txt b/docs/intro/overview.txt index c0d528527f7..86b172f526f 100644 --- a/docs/intro/overview.txt +++ b/docs/intro/overview.txt @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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" %} @@ -299,7 +299,7 @@ Here's what the "base.html" template, including the use of :doc:`static files `, might look like: .. code-block:: html+django - :caption: mysite/templates/base.html + :caption: ``mysite/templates/base.html`` {% load static %} diff --git a/docs/intro/reusable-apps.txt b/docs/intro/reusable-apps.txt index d00879ea603..82bdaf27845 100644 --- a/docs/intro/reusable-apps.txt +++ b/docs/intro/reusable-apps.txt @@ -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 @@ -191,7 +191,7 @@ this. For a small app like polls, this process isn't too difficult. with the following contents: .. code-block:: ini - :caption: django-polls/setup.cfg + :caption: ``django-polls/setup.cfg`` [metadata] name = django-polls @@ -226,7 +226,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 @@ -240,7 +240,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 diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt index 05f99b6f761..f3b080e9bb1 100644 --- a/docs/intro/tutorial01.txt +++ b/docs/intro/tutorial01.txt @@ -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 @@ -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 @@ -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 diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt index b315027c5de..2fa780178ae 100644 --- a/docs/intro/tutorial02.txt +++ b/docs/intro/tutorial02.txt @@ -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 @@ -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', @@ -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 @@ -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 @@ -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 diff --git a/docs/intro/tutorial03.txt b/docs/intro/tutorial03.txt index 82fa35e4970..720a83a3e50 100644 --- a/docs/intro/tutorial03.txt +++ b/docs/intro/tutorial03.txt @@ -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) @@ -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 @@ -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 @@ -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 %}