From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Jonathan Corbet <corbet@lwn.net>,
Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
Kees Cook <mchehab+huawei@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 22/24] docs: kernel_include.py: document all supported parameters
Date: Fri, 22 Aug 2025 16:19:34 +0200 [thread overview]
Message-ID: <f193160889a2dc296b4df2cc7ebc9934d717ccef.1755872208.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1755872208.git.mchehab+huawei@kernel.org>
As we're actually a fork of Sphinx Include, update its
docstring to contain the documentation for the actual
implemented parameters.
Let's use :param: for parameters, as defined at:
https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
Documentation/sphinx/kernel_include.py | 88 +++++++++++++++++---------
1 file changed, 58 insertions(+), 30 deletions(-)
diff --git a/Documentation/sphinx/kernel_include.py b/Documentation/sphinx/kernel_include.py
index e6f734476ab3..23566ab74866 100755
--- a/Documentation/sphinx/kernel_include.py
+++ b/Documentation/sphinx/kernel_include.py
@@ -2,53 +2,81 @@
# SPDX-License-Identifier: GPL-2.0
# pylint: disable=R0903, R0912, R0914, R0915, C0209,W0707
+
"""
- kernel-include
- ~~~~~~~~~~~~~~
+Implementation of the ``kernel-include`` reST-directive.
- Implementation of the ``kernel-include`` reST-directive.
+:copyright: Copyright (C) 2016 Markus Heiser
+:license: GPL Version 2, June 1991 see linux/COPYING for details.
- :copyright: Copyright (C) 2016 Markus Heiser
- :license: GPL Version 2, June 1991 see linux/COPYING for details.
+The ``kernel-include`` reST-directive is a replacement for the ``include``
+directive. The ``kernel-include`` directive expand environment variables in
+the path name and allows to include files from arbitrary locations.
- The ``kernel-include`` reST-directive is a replacement for the ``include``
- directive. The ``kernel-include`` directive expand environment variables in
- the path name and allows to include files from arbitrary locations.
+.. hint::
- .. hint::
+ Including files from arbitrary locations (e.g. from ``/etc``) is a
+ security risk for builders. This is why the ``include`` directive from
+ docutils *prohibit* pathnames pointing to locations *above* the filesystem
+ tree where the reST document with the include directive is placed.
- Including files from arbitrary locations (e.g. from ``/etc``) is a
- security risk for builders. This is why the ``include`` directive from
- docutils *prohibit* pathnames pointing to locations *above* the filesystem
- tree where the reST document with the include directive is placed.
+Substrings of the form $name or ${name} are replaced by the value of
+environment variable name. Malformed variable names and references to
+non-existing variables are left unchanged.
- Substrings of the form $name or ${name} are replaced by the value of
- environment variable name. Malformed variable names and references to
- non-existing variables are left unchanged.
+**Supported Sphinx Include Options**:
- This extension overrides Sphinx include directory, adding some extra
- arguments:
+:param literal:
+ If present, the included file is inserted as a literal block.
- 1. :generate-cross-refs:
+:param code:
+ Specify the language for syntax highlighting (e.g., 'c', 'python').
- If present, instead of reading the file, it calls ParseDataStructs()
- class, which converts C data structures into cross-references to
- be linked to ReST files containing a more comprehensive documentation;
+:param encoding:
+ Specify the encoding of the included file (default: 'utf-8').
- 2. :exception-file:
+:param tab-width:
+ Specify the number of spaces that a tab represents.
- Used together with :generate-cross-refs
+:param start-line:
+ Line number at which to start including the file (1-based).
- Points to a file containing rules to ignore C data structs or to
- use a different reference name, optionally using a different
- reference type.
+:param end-line:
+ Line number at which to stop including the file (inclusive).
- 3. :warn-broken:
+:param start-after:
+ Include lines after the first line matching this text.
- Used together with :generate-cross-refs:
+:param end-before:
+ Include lines before the first line matching this text.
- Detect if the auto-generated cross references doesn't exist.
+:param number-lines:
+ Number the included lines (integer specifies start number).
+ Only effective with 'literal' or 'code' options.
+:param class:
+ Specify HTML class attribute for the included content.
+
+**Kernel-specific Extensions**:
+
+:param generate-cross-refs:
+ If present, instead of directly including the file, it calls
+ ParseDataStructs() to convert C data structures into cross-references
+ that link to comprehensive documentation in other ReST files.
+
+:param exception-file:
+ (Used with generate-cross-refs)
+
+ Path to a file containing rules for handling special cases:
+ - Ignore specific C data structures
+ - Use alternative reference names
+ - Specify different reference types
+
+:param warn-broken:
+ (Used with generate-cross-refs)
+
+ Enables warnings when auto-generated cross-references don't point to
+ existing documentation targets.
"""
# ==============================================================================
--
2.50.1
next prev parent reply other threads:[~2025-08-22 14:19 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 14:19 [PATCH v2 00/24] better handle media headers Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 01/24] docs: parse-headers.pl: improve its debug output format Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 02/24] docs: parse-headers.py: convert parse-headers.pl Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 03/24] docs: parse-headers.py: improve --help logic Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 04/24] docs: parse-headers.py: better handle @var arguments Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 05/24] docs: parse-headers.py: simplify the rules for hashes Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 06/24] tools: docs: parse-headers.py: move it from sphinx dir Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 07/24] tools: docs: parse_data_structs.py: add methods to return output Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 08/24] MAINTAINERS: add files from tools/docs to documentation entry Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 09/24] docs: uapi: media: Makefile: use parse-headers.py Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 10/24] docs: kernel_include.py: Update its coding style Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 11/24] docs: kernel_include.py: allow cross-reference generation Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 12/24] docs: kernel_include.py: generate warnings for broken refs Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 13/24] docs: kernel_include.py: move rawtext logic to separate functions Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 14/24] docs: kernel_include.py: move range logic to a separate function Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 15/24] docs: kernel_include.py: remove range restriction for gen docs Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 16/24] docs: kernel_include.py: move code and literal functions Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 17/24] docs: kernel_include.py: add support to generate a TOC table Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 18/24] docs: kernel_include.py: append line numbers to better report errors Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 19/24] docs: kernel_include.py: move apply_range() and add a docstring Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 20/24] docs: kernel_include.py: remove line numbers from parsed-literal Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 21/24] docs: kernel_include.py: remove Include class inheritance Mauro Carvalho Chehab
2025-08-22 14:19 ` Mauro Carvalho Chehab [this message]
2025-08-22 14:19 ` [PATCH v2 23/24] scripts: sphinx-build-wrapper: get rid of uapi/media Makefile Mauro Carvalho Chehab
2025-08-22 14:32 ` Mauro Carvalho Chehab
2025-08-22 14:19 ` [PATCH v2 24/24] docs: sphinx: drop parse-headers.pl Mauro Carvalho Chehab
2025-08-29 22:03 ` [PATCH v2 00/24] better handle media headers Jonathan Corbet
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=f193160889a2dc296b4df2cc7ebc9934d717ccef.1755872208.git.mchehab+huawei@kernel.org \
--to=mchehab+huawei@kernel.org \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®