Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: automarkup.py: Skip common English words as C identifiers

The automarkup extension incorrectly recognizes common English words
as C identifiers when they follow struct/union/enum/typedef keywords,
causing normal text like "... (a simple) struct that" (in `workqueue.rst`)
to be rendered as code blocks.

This patch adds Skipidentifiers list to filter out these words.

Signed-off-by: Yulong Han <wheatfox17@icloud.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <20260125124450.2005006-1-wheatfox17@icloud.com>

authored by

wheatfox and committed by
Jonathan Corbet
6b8edfcd a592a36e

+10
+10
Documentation/sphinx/automarkup.py
··· 46 46 # 47 47 Skipnames = [ 'for', 'if', 'register', 'sizeof', 'struct', 'unsigned' ] 48 48 49 + # 50 + # Common English words that should not be recognized as C identifiers 51 + # when following struct/union/enum/typedef keywords. 52 + # Example: "a simple struct that" in workqueue.rst should not be marked as code. 53 + # 54 + Skipidentifiers = [ 'that', 'which', 'where', 'whose' ] 49 55 50 56 # 51 57 # Many places in the docs refer to common system calls. It is ··· 168 162 # cross-referencing inside it first. 169 163 if c_namespace: 170 164 possible_targets.insert(0, c_namespace + "." + base_target) 165 + 166 + # Skip common English words that match identifier pattern but are not C code. 167 + if base_target in Skipidentifiers: 168 + return target_text 171 169 172 170 if base_target not in Skipnames: 173 171 for target in possible_targets: