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: kdoc_files: allows the caller to use a different xforms class

While the main goal for kernel-doc is to be used inside the Linux
Kernel, other open source projects could benefit for it. That's
currently the case of QEMU, which has a fork, mainly due to two
reasons:

- they need an extra C function transform rule;
- they handle the html output a little bit different.

Add an extra optional argument to make easier for the code to be
shared, as, with that, QEMU can just create a new derivated class
that will contain its specific rulesets, and just copy the
remaining kernel-doc files as-is.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <6b274ddbdcd9d438c6848e00e410a2f65ef80ec2.1772810574.git.mchehab+huawei@kernel.org>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
861dcdb6 b8e7e033

+7 -2
+7 -2
tools/lib/python/kdoc/kdoc_files.py
··· 118 118 if fname in self.files: 119 119 return 120 120 121 - doc = KernelDoc(self.config, fname, CTransforms()) 121 + doc = KernelDoc(self.config, fname, self.xforms) 122 122 export_table, entries = doc.parse_kdoc() 123 123 124 124 self.export_table[fname] = export_table ··· 154 154 155 155 self.error(f"Cannot find file {fname}") 156 156 157 - def __init__(self, verbose=False, out_style=None, 157 + def __init__(self, verbose=False, out_style=None, xforms=None, 158 158 werror=False, wreturn=False, wshort_desc=False, 159 159 wcontents_before_sections=False, 160 160 logger=None): ··· 192 192 self.config.wreturn = wreturn 193 193 self.config.wshort_desc = wshort_desc 194 194 self.config.wcontents_before_sections = wcontents_before_sections 195 + 196 + if xforms: 197 + self.xforms = xforms 198 + else: 199 + self.xforms = CTransforms() 195 200 196 201 if not logger: 197 202 self.config.log = logging.getLogger("kernel-doc")