mirror of
https://github.com/torvalds/linux.git
synced 2026-07-29 02:31:27 +02:00
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 <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <8ce9c77c4d8c98e6bad37d838b0e359c8416040c.1777295258.git.mchehab+huawei@kernel.org>
This commit is contained in:
parent
8eae6da5f5
commit
b01f7f29f7
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user