From: Mauro Carvalho Chehab Date: Mon, 27 Apr 2026 14:22:22 +0000 (+0200) Subject: docs: maintainers_include: use a better title for profiles X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=b01f7f29f71b4c1b0dc402d9b4e48e2f0ea541f8;p=thirdparty%2Flinux.git docs: maintainers_include: use a better title for profiles As we're picking the name of the subsystem from MAINTAINERS, also use its subsystem name for the titles. Reviewed-by: Randy Dunlap Tested-by: Randy Dunlap Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet Message-ID: <8ce9c77c4d8c98e6bad37d838b0e359c8416040c.1777295258.git.mchehab+huawei@kernel.org> --- diff --git a/Documentation/sphinx/maintainers_include.py b/Documentation/sphinx/maintainers_include.py index 1dac83bf1a65b..cf428db7599cc 100755 --- a/Documentation/sphinx/maintainers_include.py +++ b/Documentation/sphinx/maintainers_include.py @@ -36,7 +36,7 @@ class MaintainersParser: """Parse MAINTAINERS file(s) content""" def __init__(self, base_path, path): - self.profiles = list() + self.profiles = {} result = list() result.append(".. _maintainers:") @@ -54,6 +54,7 @@ class MaintainersParser: prev = None field_prev = "" field_content = "" + subsystem_name = None for line in open(path): # Have we reached the end of the preformatted Descriptions text? @@ -75,7 +76,10 @@ class MaintainersParser: if match: fname = os.path.relpath(match.group(1), base_path) if fname not in self.profiles: - self.profiles.append(fname) + if self.profiles.get(fname) is None: + self.profiles[fname] = subsystem_name + else: + self.profiles[fname] += f", {subsystem_name}" # Linkify all non-wildcard refs to ReST files in Documentation/. pat = r'(Documentation/([^\s\?\*]*)\.rst)' @@ -112,6 +116,8 @@ class MaintainersParser: output = field_content + "\n\n" field_content = "" + subsystem_name = line.title() + # Collapse whitespace in subsystem name. heading = re.sub(r"\s+", " ", line) output = output + "%s\n%s" % (heading, "~" * len(heading)) @@ -217,7 +223,13 @@ class MaintainersProfile(Include): output = ".. toctree::\n" output += " :maxdepth: 2\n\n" - output += indent("\n".join(profiles), " ") + + items = sorted(profiles.items(), key=lambda kv: (kv[1] or "", kv[0])) + for fname, profile in items: + if profile: + output += f" {profile} <{fname}>\n" + else: + output += f" {fname}\n" self.state_machine.insert_input(statemachine.string2lines(output), path)