From: Jonathan Corbet <corbet@lwn.net>
To: Jani Nikula <jani.nikula@intel.com>, linux-doc@vger.kernel.org
Cc: Jani Nikula <jani.nikula@intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH] Documentation: use a source-read extension for the index link boilerplate
Date: Fri, 23 Jan 2026 12:01:33 -0700 [thread overview]
Message-ID: <87cy3017ci.fsf@trenco.lwn.net> (raw)
In-Reply-To: <20260123143149.2024303-1-jani.nikula@intel.com>
Jani Nikula <jani.nikula@intel.com> writes:
> The root document usually has a special :ref:`genindex` link to the
> generated index. This is also the case for Documentation/index.rst. The
> other index.rst files deeper in the directory hierarchy usually don't.
>
> For SPHINXDIRS builds, the root document isn't Documentation/index.rst,
> but some other index.rst in the hierarchy. Currently they have a
> ".. only::" block to add the index link when doing SPHINXDIRS html
> builds.
>
> This is obviously very tedious and repetitive. The link is also added to
> all index.rst files in the hierarchy for SPHINXDIRS builds, not just the
> root document.
>
> Put the boilerplate in a sphinx-includes/subproject-index.rst file, and
> include it at the end of the root document for subproject builds in an
> ad-hoc source-read extension defined in conf.py.
>
> For now, keep having the boilerplate in translations, because this
> approach currently doesn't cover translated index link headers.
[...]
> 101 files changed, 30 insertions(+), 685 deletions(-)
Whee ... I do like that!
This patch, when applied after Mauro's massive python-doc series, causes
the build to crash, since he renamed "doctree". So I've taken the
liberty of applying it with this tweak.
Thanks,
jon
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 74ae78b6c510..7e246101630f 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -595,7 +595,7 @@ def add_subproject_index(app, docname, content):
# Add the index link at the root of translations, but not at the root of
# individual translations. They have their own language specific links.
- rel = os.path.relpath(app.srcdir, start=doctree).split('/')
+ rel = os.path.relpath(app.srcdir, start=kern_doc_dir).split('/')
if rel[0] == 'translations' and len(rel) > 1:
return
@@ -604,7 +604,7 @@ def add_subproject_index(app, docname, content):
return
# The include directive needs a relative path from the srcdir
- rel = os.path.relpath(os.path.join(doctree, 'sphinx-includes/subproject-index.rst'), start=app.srcdir)
+ rel = os.path.relpath(os.path.join(kern_doc_dir, 'sphinx-includes/subproject-index.rst'), start=app.srcdir)
content[0] += f'\n.. include:: {rel}\n\n'
prev parent reply other threads:[~2026-01-23 19:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-23 14:31 [PATCH] Documentation: use a source-read extension for the index link boilerplate Jani Nikula
2026-01-23 15:52 ` Mauro Carvalho Chehab
2026-01-23 19:01 ` Jonathan Corbet [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cy3017ci.fsf@trenco.lwn.net \
--to=corbet@lwn.net \
--cc=jani.nikula@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rdunlap@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox