make-man-index: apply "ruff format"

This commit is contained in:
Yu Watanabe
2026-05-18 02:44:47 +09:00
parent 8b24db05d4
commit 3675924f5b
+5
View File
@@ -49,6 +49,7 @@ def check_id(page, t):
if not re.search('/' + page_id + '[.]', page.translate(str.maketrans('@', '_'))):
raise ValueError(f"id='{page_id}' is not the same as page name '{page}'")
def make_index(pages):
index = collections.defaultdict(list)
for p in pages:
@@ -63,6 +64,7 @@ def make_index(pages):
index[f.text[0].upper()].append(infos)
return index
def add_letter(template, letter, pages):
refsect1 = tree.SubElement(template, 'refsect1')
title = tree.SubElement(refsect1, 'title')
@@ -81,6 +83,7 @@ def add_letter(template, letter, pages):
tree.SubElement(para, 'sbr')
def add_summary(template, indexpages):
count = 0
pages = set()
@@ -96,6 +99,7 @@ def add_summary(template, indexpages):
para = template.find(".//para[@id='counts']")
para.text = COUNTS.format(count=count, pages=len(pages))
def make_page(*xml_files):
template = tree.fromstring(TEMPLATE)
index = make_index(xml_files)
@@ -107,6 +111,7 @@ def make_page(*xml_files):
return template
if __name__ == '__main__':
with open(sys.argv[1], 'wb') as file:
file.write(xml_print(make_page(*sys.argv[2:])))