From nobody Sun Feb 8 05:42:35 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74BE6359FB8; Sat, 31 Jan 2026 14:25:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769869522; cv=none; b=Efownj+km/LgUsdaNtoYyHUualt/GBfekxGhlNnYC6FO2Dmv8ilFIm98iEf9oR9aZLHEVo9UPnqBareRuA34x8HsyclZHAZZNyk4gaNMUiD1ccrGWGjxUGD6ncPFMnuTKTm35h6eK3OjSvw4qMF3/DT5ZEZfhT5kneuDMIEQwEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769869522; c=relaxed/simple; bh=ZDgtUhg2xj+M7eiW7ljRE3PrlESL14jiN0cCN9aIl+c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aunS0ROcIhAD3mznRfkBS2nIfMxNnTbXEWrRTi5twQb9D4NRyAeNOwyxZ0eeImfGzvHzigMRz/vOW+seNSwLVLEFL0e+U4IT6sknHzYdlCmzwR+ErdzwWWhgGLnwq0HHyH+u7qsc+nQdpImXaFWLBm6Ygd+hipouxgRSMb0007c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mElXao9y; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mElXao9y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E19B8C4AF5F; Sat, 31 Jan 2026 14:25:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769869522; bh=ZDgtUhg2xj+M7eiW7ljRE3PrlESL14jiN0cCN9aIl+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mElXao9y30lRlSfpVtg3eDT9wtAXjfGnpkDTDKoe7L5Ol/J9zWWyaPRjl6FMGl/hS PMRQFW2NrYPDGbhoOyZd0RnmHVSOctMhQx3ZZOn1b2OHrh0xvTYKGPq6zFsWh4q5N8 JxfowYerQf7tcIjQLaPz+9C+UD++YeKeBkS3mzQtBOFvIEcOolGenu/C26lSdUp/6u +t0OI3hXqZzbzZXKg0QrRaUHEK34jZ+c+XoZIt+nCfuEXPj7zOz0NAuqQFFAbhOpIE z9b9KaCdLxwp4sgFRd3/leU3c2swVljHE2LoKoEYmibadeYizGwhwXZNHS+ngpQJcl UalErO7YsO7jA== Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vmBua-0000000AVln-0hEO; Sat, 31 Jan 2026 15:25:20 +0100 From: Mauro Carvalho Chehab To: Jonathan Corbet , Linux Doc Mailing List Cc: Mauro Carvalho Chehab , intel-wired-lan@lists.osuosl.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Aleksandr Loktionov , Mauro Carvalho Chehab , Randy Dunlap , Akira Yokosawa Subject: [PATCH v4 31/41] docs: kdoc_re: Fix NestedMatch.sub() which causes PDF builds to break Date: Sat, 31 Jan 2026 15:25:05 +0100 Message-ID: <47bbc4753235edb31c9faec00bfa790f798a2ca0.1769867953.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Having a "\digit" inside a docstring with normal strings causes PDF output to break, as it will add a weird character inside the string. It should be using a raw string instead. Yet, having r"\0" won't solve, as this would be converted in Sphinx as "0". So, this has to be inside a pre formatted text. That's said, the comment itself is probably not the best one. Rewrite the entire comment to properly document each parameter and add a "delim" parameter that will be passed to the ancillary function. Reported-by: Akira Yokosawa Closes: https://lore.kernel.org/linux-doc/63e99049-cc72-4156-83af-414fdde34= 312@gmail.com/ Signed-off-by: Mauro Carvalho Chehab --- tools/lib/python/kdoc/kdoc_re.py | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/tools/lib/python/kdoc/kdoc_re.py b/tools/lib/python/kdoc/kdoc_= re.py index 886e33ffd2b9..f67ebe86c458 100644 --- a/tools/lib/python/kdoc/kdoc_re.py +++ b/tools/lib/python/kdoc/kdoc_re.py @@ -323,19 +323,28 @@ class NestedMatch: =20 return args =20 - def sub(self, sub, line, count=3D0): - """ - This is similar to re.sub: + def sub(self, sub, line, delim=3D",", count=3D0): + r""" + Perform a regex=E2=80=91based replacement on ``line`` for all matc= hes with + the ``self.regex`` pattern. It uses the following parameters: =20 - It matches a regex that it is followed by a delimiter, - replacing occurrences only if all delimiters are paired. + ``sub`` + Replacement string that may contain placeholders in the form + ``\{digit}``, where ``digit`` is an integer referring to the = regex + capture group number. =20 - if r'\0' is used, it works on a similar way of using re.group(0): - it places the entire args of the matched paired data, with the - delimiter stripped. + ``\{0}`` is a special case that expands to the entire matched = text. =20 - If count is different than zero, it will replace at most count - items. + ``line`` + The string to operate on. + + ``delim`` + The delimiter used by identify the placeholder groups + (defaults to ","). + + ``count`` + Maximum number of replacements per match. If 0 or omitted, + all matches are replaced. """ out =3D "" =20 @@ -355,7 +364,7 @@ class NestedMatch: # replace arguments new_sub =3D sub if "\\" in sub: - args =3D self._split_args(value) + args =3D self._split_args(value, delim=3Ddelim) =20 new_sub =3D re.sub(r'\\(\d+)', lambda m: args[int(m.group(1))], new_sub) --=20 2.52.0