X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=make-directive-index.py;h=b43fea0b99e386936da6d32be21c6877504295d9;hp=396947b3030f6c271fcec46d55e911abfbbc3a8a;hb=305f78bff3904add317847c4a27483b993dec99b;hpb=845c53246f73a505f12bb7f685a530045fa60a40 diff --git a/make-directive-index.py b/make-directive-index.py index 396947b30..b43fea0b9 100755 --- a/make-directive-index.py +++ b/make-directive-index.py @@ -21,6 +21,7 @@ import sys import collections import re from xml_helper import * +from copy import deepcopy TEMPLATE = '''\ @@ -137,6 +138,14 @@ TEMPLATE = '''\ + + Constants + + Various constant used and/or defined by systemd. + + + + Miscellaneous options and directives @@ -221,24 +230,35 @@ def _extract_directives(directive_groups, formatting, page): storfile[text].append((pagename, section)) formatting[text] = name + storfile = directive_groups['constants'] + for name in t.iterfind('.//constant'): + if name.attrib.get('noindex'): + continue + name.tail = '' + if name.text.startswith('('): # a cast, strip it + name.text = name.text.partition(' ')[2] + storfile[name.text].append((pagename, section)) + formatting[name.text] = name + def _make_section(template, name, directives, formatting): varlist = template.find(".//*[@id='{}']".format(name)) for varname, manpages in sorted(directives.items()): entry = tree.SubElement(varlist, 'varlistentry') term = tree.SubElement(entry, 'term') - term.append(formatting[varname]) + display = deepcopy(formatting[varname]) + term.append(display) para = tree.SubElement(tree.SubElement(entry, 'listitem'), 'para') b = None for manpage, manvolume in sorted(set(manpages)): - if b is not None: - b.tail = ', ' - b = tree.SubElement(para, 'citerefentry') - c = tree.SubElement(b, 'refentrytitle') - c.text = manpage - d = tree.SubElement(b, 'manvolnum') - d.text = manvolume + if b is not None: + b.tail = ', ' + b = tree.SubElement(para, 'citerefentry') + c = tree.SubElement(b, 'refentrytitle') + c.text = manpage + d = tree.SubElement(b, 'manvolnum') + d.text = manvolume entry.tail = '\n\n' def _make_colophon(template, groups): @@ -264,7 +284,7 @@ def _make_page(template, directive_groups, formatting): } """ for name, directives in directive_groups.items(): - _make_section(template, name, directives, formatting) + _make_section(template, name, directives, formatting) _make_colophon(template, directive_groups.values())