summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2026-03-06 16:45:39 +0100
committerJonathan Corbet <corbet@lwn.net>2026-03-09 10:34:38 -0600
commit5828d3564729e61306456fae02e9d0dc9f2e772d (patch)
treec554ee35e3517ef1018e5d5f60d0a075d15a95bd
parent0d3ab0e4bbfd688bfaef66b6365a71c70a0f0450 (diff)
downloadlwn-5828d3564729e61306456fae02e9d0dc9f2e772d.tar.gz
lwn-5828d3564729e61306456fae02e9d0dc9f2e772d.zip
docs: sphinx-build-wrapper: better handle troff .TH markups
Using a regular expression to match .TH is problematic, as it doesn't handle well quotation marks. Use shlex instead. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <9436806316d33aaf68625c00ce068463d3917660.1772810752.git.mchehab+huawei@kernel.org>
-rwxr-xr-xtools/docs/sphinx-build-wrapper8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/docs/sphinx-build-wrapper b/tools/docs/sphinx-build-wrapper
index b7c149dff06b..e6418e22e2ff 100755
--- a/tools/docs/sphinx-build-wrapper
+++ b/tools/docs/sphinx-build-wrapper
@@ -576,7 +576,6 @@ class SphinxBuilder:
"""
re_kernel_doc = re.compile(r"^\.\.\s+kernel-doc::\s*(\S+)")
- re_man = re.compile(r'^\.TH "[^"]*" (\d+) "([^"]*)"')
if docs_dir == src_dir:
#
@@ -616,8 +615,7 @@ class SphinxBuilder:
fp = None
try:
for line in result.stdout.split("\n"):
- match = re_man.match(line)
- if not match:
+ if not line.startswith(".TH"):
if fp:
fp.write(line + '\n')
continue
@@ -625,7 +623,9 @@ class SphinxBuilder:
if fp:
fp.close()
- fname = f"{output_dir}/{match.group(2)}.{match.group(1)}"
+ # Use shlex here, as it handles well parameters with commas
+ args = shlex.split(line)
+ fname = f"{output_dir}/{args[3]}.{args[2]}"
if self.verbose:
print(f"Creating {fname}")