Linux Documentation
 help / color / mirror / Atom feed
* [PATCH] docs: conf.py: use master_doc instead of hardcoding index
@ 2026-11-24 16:38 Jani Nikula
  2026-12-02 15:28 ` Jani Nikula
  2026-12-02 19:41 ` Jonathan Corbet
  0 siblings, 2 replies; 4+ messages in thread
From: Jani Nikula @ 2026-11-24 16:38 UTC (permalink / raw)
  To: linux-doc; +Cc: jani.nikula

The name of the root document is specified by the master_doc
configuration option. Use that instead of hardcoding "index" in conf.py.

It would be preferrable to use root_doc, but that was only introduced in
Sphinx 4.0. While at it, add a FIXME comment next to master_doc about
it.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 Documentation/conf.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 5ab26ce89daf..6c986f64f764 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -103,9 +103,8 @@ def config_init(app, config):
 
         # get index.rst, if it exists
         doc = os.path.basename(app.srcdir)
-        fname = "index"
-        if os.path.exists(os.path.join(app.srcdir, fname + ".rst")):
-            latex_documents.append((fname, doc + ".tex",
+        if os.path.exists(os.path.join(app.srcdir, master_doc + ".rst")):
+            latex_documents.append((master_doc, doc + ".tex",
                                     "Linux %s Documentation" % doc.capitalize(),
                                     "The kernel development community",
                                     "manual"))
@@ -114,7 +113,7 @@ def config_init(app, config):
     # When building all docs, or when a main index.rst doesn't exist, seek
     # for it on subdirectories
     for doc in os.listdir(app.srcdir):
-        fname = os.path.join(doc, "index")
+        fname = os.path.join(doc, master_doc)
         if not os.path.exists(os.path.join(app.srcdir, fname + ".rst")):
             continue
 
@@ -267,6 +266,7 @@ source_suffix = {
 # source_encoding = 'utf-8-sig'
 
 # The master toctree document.
+# FIXME: switch to root_doc when needs_sphinx gets bumped to >= 4.0.
 master_doc = "index"
 
 # General information about the project.
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] docs: conf.py: use master_doc instead of hardcoding index
  2026-11-24 16:38 [PATCH] docs: conf.py: use master_doc instead of hardcoding index Jani Nikula
@ 2026-12-02 15:28 ` Jani Nikula
  2026-12-02 15:51   ` Jonathan Corbet
  2026-12-02 19:41 ` Jonathan Corbet
  1 sibling, 1 reply; 4+ messages in thread
From: Jani Nikula @ 2026-12-02 15:28 UTC (permalink / raw)
  To: linux-doc, Jonathan Corbet

On Tue, 24 Nov 2026, Jani Nikula <jani.nikula@intel.com> wrote:
> The name of the root document is specified by the master_doc
> configuration option. Use that instead of hardcoding "index" in conf.py.
>
> It would be preferrable to use root_doc, but that was only introduced in
> Sphinx 4.0. While at it, add a FIXME comment next to master_doc about
> it.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Forgot to add Jon in recipients originally. Ping. :)

> ---
>  Documentation/conf.py | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/conf.py b/Documentation/conf.py
> index 5ab26ce89daf..6c986f64f764 100644
> --- a/Documentation/conf.py
> +++ b/Documentation/conf.py
> @@ -103,9 +103,8 @@ def config_init(app, config):
>  
>          # get index.rst, if it exists
>          doc = os.path.basename(app.srcdir)
> -        fname = "index"
> -        if os.path.exists(os.path.join(app.srcdir, fname + ".rst")):
> -            latex_documents.append((fname, doc + ".tex",
> +        if os.path.exists(os.path.join(app.srcdir, master_doc + ".rst")):
> +            latex_documents.append((master_doc, doc + ".tex",
>                                      "Linux %s Documentation" % doc.capitalize(),
>                                      "The kernel development community",
>                                      "manual"))
> @@ -114,7 +113,7 @@ def config_init(app, config):
>      # When building all docs, or when a main index.rst doesn't exist, seek
>      # for it on subdirectories
>      for doc in os.listdir(app.srcdir):
> -        fname = os.path.join(doc, "index")
> +        fname = os.path.join(doc, master_doc)
>          if not os.path.exists(os.path.join(app.srcdir, fname + ".rst")):
>              continue
>  
> @@ -267,6 +266,7 @@ source_suffix = {
>  # source_encoding = 'utf-8-sig'
>  
>  # The master toctree document.
> +# FIXME: switch to root_doc when needs_sphinx gets bumped to >= 4.0.
>  master_doc = "index"
>  
>  # General information about the project.

-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] docs: conf.py: use master_doc instead of hardcoding index
  2026-12-02 15:28 ` Jani Nikula
@ 2026-12-02 15:51   ` Jonathan Corbet
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Corbet @ 2026-12-02 15:51 UTC (permalink / raw)
  To: Jani Nikula, linux-doc

Jani Nikula <jani.nikula@intel.com> writes:

> On Tue, 24 Nov 2026, Jani Nikula <jani.nikula@intel.com> wrote:
>> The name of the root document is specified by the master_doc
>> configuration option. Use that instead of hardcoding "index" in conf.py.
>>
>> It would be preferrable to use root_doc, but that was only introduced in
>> Sphinx 4.0. While at it, add a FIXME comment next to master_doc about
>> it.
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> Forgot to add Jon in recipients originally. Ping. :)

Indeed, I had missed it ... I hope to get to docs stuff this afternoon,
if all goes well.

Thanks,

jon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] docs: conf.py: use master_doc instead of hardcoding index
  2026-11-24 16:38 [PATCH] docs: conf.py: use master_doc instead of hardcoding index Jani Nikula
  2026-12-02 15:28 ` Jani Nikula
@ 2026-12-02 19:41 ` Jonathan Corbet
  1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Corbet @ 2026-12-02 19:41 UTC (permalink / raw)
  To: Jani Nikula, linux-doc; +Cc: jani.nikula

Jani Nikula <jani.nikula@intel.com> writes:

> The name of the root document is specified by the master_doc
> configuration option. Use that instead of hardcoding "index" in conf.py.
>
> It would be preferrable to use root_doc, but that was only introduced in
> Sphinx 4.0. While at it, add a FIXME comment next to master_doc about
> it.

It's probably time to consider our minimal Sphinx requirement.  Some of
those older versions are painful enough to use that *not* supporting
them is likely to be a service to humanity.

> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  Documentation/conf.py | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/conf.py b/Documentation/conf.py
> index 5ab26ce89daf..6c986f64f764 100644
> --- a/Documentation/conf.py
> +++ b/Documentation/conf.py
> @@ -103,9 +103,8 @@ def config_init(app, config):
>  
>          # get index.rst, if it exists
>          doc = os.path.basename(app.srcdir)
> -        fname = "index"
> -        if os.path.exists(os.path.join(app.srcdir, fname + ".rst")):
> -            latex_documents.append((fname, doc + ".tex",
> +        if os.path.exists(os.path.join(app.srcdir, master_doc + ".rst")):
> +            latex_documents.append((master_doc, doc + ".tex",
>                                      "Linux %s Documentation" % doc.capitalize(),
>                                      "The kernel development community",
>                                      "manual"))
> @@ -114,7 +113,7 @@ def config_init(app, config):
>      # When building all docs, or when a main index.rst doesn't exist, seek
>      # for it on subdirectories
>      for doc in os.listdir(app.srcdir):
> -        fname = os.path.join(doc, "index")
> +        fname = os.path.join(doc, master_doc)
>          if not os.path.exists(os.path.join(app.srcdir, fname + ".rst")):
>              continue
>  
> @@ -267,6 +266,7 @@ source_suffix = {
>  # source_encoding = 'utf-8-sig'
>  
>  # The master toctree document.
> +# FIXME: switch to root_doc when needs_sphinx gets bumped to >= 4.0.
>  master_doc = "index"

Applied, thanks.

jon

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-12-02 19:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 16:38 [PATCH] docs: conf.py: use master_doc instead of hardcoding index Jani Nikula
2026-12-02 15:28 ` Jani Nikula
2026-12-02 15:51   ` Jonathan Corbet
2026-12-02 19:41 ` Jonathan Corbet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox