Opened 3 weeks ago

Last modified 3 weeks ago

#37251 assigned Cleanup/optimization

Document Incomplete substitution rendering of inline `|version|` placeholder in tutorial01.txt

Reported by: Vainl Owned by: Vainl
Component: Documentation Version: 6.0
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Section The development server at File: docs/intro/tutorial01.txt

The raw string in the source text:
For more information on production servers see: https://docs.djangoproject.com/en/|version|/howto/deployment/

Compiles into HTML as:
For more information on production servers see: <a class="reference external" href="https://docs.djangoproject.com/en/">https://docs.djangoproject.com/en/</a>6.2/howto/deployment/

The |version| tag breaks the link.

The following change fixes the issue, but it still hardcodes the language to en. There might be a better way to implement this dynamically.

diff --git a/docs/conf.py b/docs/conf.py
index 864b9f7..e32e6f9 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -146,6 +146,7 @@ extlinks = {
     # A file or directory. GitHub redirects from blob to tree if needed.
     "source": ("https://github.com/django/django/blob/main/%s", "%s"),
     "ticket": ("https://code.djangoproject.com/ticket/%s", "#%s"),
+    "djlink": (f"https://djangoproject.com/en/{version}/%s", None),
 }
 
 if sphinx_version < (8, 1):
diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt
index db6150a..643ba44 100644
--- a/docs/intro/tutorial01.txt
+++ b/docs/intro/tutorial01.txt
@@ -131,7 +131,7 @@ You'll see the following output on the command line:
     Quit the server with CONTROL-C.
 
     WARNING: This is a development server. Do not use it in a production setting. Use a production WSGI or ASGI server instead.
-    For more information on production servers see: https://docs.djangoproject.com/en/|version|/howto/deployment/
+    For more information on production servers see: :djlink:`howto/deployment/`
 
 .. note::
     Ignore the warning about unapplied database migrations for now; we'll deal

Attachments (2)

remove-dev-warning.png (163.0 KB ) - added by Vainl 3 weeks ago.
runserver-info.png (32.1 KB ) - added by Vainl 3 weeks ago.

Download all attachments as: .zip

Change History (7)

comment:1 by David Smith, 3 weeks ago

Triage Stage: UnreviewedAccepted

Thanks for the report. I agree we should do something to avoid the broken link. If fixing it is too cumbersome we should also consider if it is easier to remove the link.

The example fix doesn't work though as it results in a link of https://djangoproject.com/en/6.2/howto/deployment/ . Notice it is missing the 'docs' subdomain.

by Vainl, 3 weeks ago

Attachment: remove-dev-warning.png added

by Vainl, 3 weeks ago

Attachment: runserver-info.png added

comment:2 by Vainl, 3 weeks ago

Component: UncategorizedDocumentation
Owner: set to Vainl
Status: newassigned

Removing this link from the docs would require removing the link from the runserver command as well.


I believe it is still helpful to keep the link, as it actually shows a clickable hyperlink in IDEs like PyCharm.
I also found another broken link in docs/ref/django-admin.txt. If this fix is accepted, I will submit a patch to fix that one as well.


comment:3 by Vainl, 3 weeks ago

Has patch: set

comment:4 by David Smith, 3 weeks ago

Has patch: unset

When I suggested removing the link I was referring to how it is rendered in the docs rather than the message itself.

If this fix is accepted,

Please open a PR with your proposals on GitHub. Review of code and assessment if a fix is acceptable happens on that platform.

comment:5 by Vainl, 3 weeks ago

I have just submitted a PR: https://github.com/django/django/pull/21740 .
I tested it locally with make html and it seems to work. If this PR is not accepted, I would like to try rendering it as plain text instead.

Note: See TracTickets for help on using tickets.
Back to Top