summaryrefslogtreecommitdiff
path: root/make-directive-index.py
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-05-03 00:55:20 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-05-03 01:00:42 -0400
commit845c53246f73a505f12bb7f685a530045fa60a40 (patch)
treefe6524ea0546e971b5ad509a3557efb4e4ac8c69 /make-directive-index.py
parent202288be83b56a724c316ce0ad2fcb41bd63f0eb (diff)
man: add various filenames to the index
Everything which is an absolute filename marked with <filename></filename> lands in the index, unless noindex= attribute is present. Should make it easier for people to find stuff when they are looking at a file on disk. Various formatting errors in manpages are fixed, kernel-install(1) is restored to formatting sanity.
Diffstat (limited to 'make-directive-index.py')
-rwxr-xr-xmake-directive-index.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/make-directive-index.py b/make-directive-index.py
index 99e7bfaf28..396947b303 100755
--- a/make-directive-index.py
+++ b/make-directive-index.py
@@ -193,16 +193,25 @@ def _extract_directives(directive_groups, formatting, page):
formatting[text] = name
storfile = directive_groups['filenames']
- for xpath in ('.//refsynopsisdiv//filename',
- './/refsynopsisdiv//command'):
+ for xpath, absolute_only in (('.//refsynopsisdiv//filename', False),
+ ('.//refsynopsisdiv//command', False),
+ ('.//filename', True)):
for name in t.iterfind(xpath):
+ if absolute_only and not (name.text and name.text.startswith('/')):
+ continue
+ if name.attrib.get('noindex'):
+ continue
name.tail = ''
if name.text:
+ if name.text.endswith('*'):
+ name.text = name.text[:-1]
if not name.text.startswith('.'):
text = name.text.partition(' ')[0]
if text != name.text:
name.clear()
name.text = text
+ if text.endswith('/'):
+ text = text[:-1]
storfile[text].append((pagename, section))
if text not in formatting:
# use element as formatted display