linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: linux-doc@vger.kernel.org, Randy Dunlap <rdunlap@infradead.org>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>
Subject: Re: [PATCH 3/4] Documentation: include the boilerplate for SPHINXDIRS index link
Date: Thu, 13 Nov 2025 10:04:17 +0200	[thread overview]
Message-ID: <e5d0dd034919c0d1e9e327be25e47543190310e1@intel.com> (raw)
In-Reply-To: <jhrbxpwu7ef6f72mxxsw4r4xstte2ncydotp4ygmnbwmw7e4lh@hfhaitekjgc3>

On Wed, 12 Nov 2025, Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote:
> On Wed, Nov 12, 2025 at 01:56:53PM +0200, Jani Nikula wrote:
>> Repeating the index link boilerplate everywhere is tedious. Put it in a
>> subproject-index.rst snippet in a new sphinx-includes directory, and
>> include it.
>> 
>> We'll have to use the relative include, because a) includes are relative
>> to the source file, b) top level include with
>> /sphinx-includes/subproject-index.rst does not work with SPHINXDIRS
>> builds, because the root is the subdirectory in that case.
>> 
>> Cc: Randy Dunlap <rdunlap@infradead.org>
>> Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
>> Cc: Jonathan Corbet <corbet@lwn.net>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
>
>> diff --git a/Documentation/conf.py b/Documentation/conf.py
>> index 574896cca198..b9a43ee32a00 100644
>> --- a/Documentation/conf.py
>> +++ b/Documentation/conf.py
>> @@ -38,7 +38,7 @@ else:
>>  doctree = os.path.abspath(".")
>>  
>>  # Exclude of patterns that don't contain directory names, in glob format.
>> -exclude_patterns = []
>> +exclude_patterns = ['sphinx-includes/*']
>
> This doesn't work the way on might expect. The problem also affects
> patch 4.
>
> Basically, when SUBDIRS is used, include and exclude patterns need
> to be dynamically calculated, as, instead of building docs using
>
> Documentation/, the logic builds inside documentation/<directory>
>
> So, instead, you need to do:
>
>     dyn_exclude_patterns.append("sphinx-includes/*")
>
> To ensure that it will pick just the right includes directory.

Sphinx will only look for files within the source directory passed to
sphinx-build. With SPHINXDIRS, the Documentation/ is not it. There's no
need to specifically exclude anything that's outside of the source
directory hierarchy.

The whole dyn_exclude_patterns looks like overkill to me. It should just
look at exclude_patterns, and remove anything that's outside of the
SPHINXDIRS specified, and remove the SPHINXDIRS prefix from the
remaining ones.

In any case, the above exclude_patterns setting will work just fine.


BR,
Jani.


-- 
Jani Nikula, Intel

  reply	other threads:[~2025-11-13  8:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12 11:56 [PATCH 0/4] Documentation: clean up subproject index boilerplate Jani Nikula
2025-11-12 11:56 ` [PATCH 1/4] Documentation: remove subproject index links deep in the structure Jani Nikula
2025-11-12 13:27   ` Mauro Carvalho Chehab
2025-11-12 11:56 ` [PATCH 2/4] Documentation: streamline subproject index link in translations Jani Nikula
2025-11-12 11:56 ` [PATCH 3/4] Documentation: include the boilerplate for SPHINXDIRS index link Jani Nikula
2025-11-12 13:35   ` Mauro Carvalho Chehab
2025-11-13  8:04     ` Jani Nikula [this message]
2025-11-13 10:11       ` Mauro Carvalho Chehab
2025-11-12 11:56 ` [PATCH 4/4] Documentation: use a source-read extension to include the index boilerplate Jani Nikula
2025-11-12 13:39   ` Mauro Carvalho Chehab
2025-11-13  8:12     ` Jani Nikula
2025-11-13 10:25       ` Mauro Carvalho Chehab
2025-11-13 19:36       ` Randy Dunlap
2025-11-13  6:50 ` [PATCH 0/4] Documentation: clean up subproject " Randy Dunlap
2025-11-13 16:33 ` Jonathan Corbet
2025-11-13 16:59   ` Jani Nikula
2025-12-04 13:43     ` Jani Nikula

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=e5d0dd034919c0d1e9e327be25e47543190310e1@intel.com \
    --to=jani.nikula@intel.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=mchehab+huawei@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;
as well as URLs for NNTP newsgroup(s).