chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
analyze: use defines where we don't need static variables
[elogind.git]
/
make-man-index.py
diff --git
a/make-man-index.py
b/make-man-index.py
index 2dbc2da995bf9d5ece4f1ff234be5ff189dc42eb..d38d5b63f64feaf6328a1877058d03b23f006746 100755
(executable)
--- a/
make-man-index.py
+++ b/
make-man-index.py
@@
-21,10
+21,11
@@
import collections
import xml.etree.ElementTree as tree
import sys
import collections
import xml.etree.ElementTree as tree
import sys
+import re
MDASH = ' — ' if sys.version_info.major >= 3 else ' -- '
TEMPLATE = '''\
MDASH = ' — ' if sys.version_info.major >= 3 else ' -- '
TEMPLATE = '''\
-<refentry id="systemd.index">
+<refentry id="systemd.index"
conditional="HAVE_PYTHON"
>
<refentryinfo>
<title>systemd.index</title>
<refentryinfo>
<title>systemd.index</title>
@@
-66,10
+67,16
@@
SUMMARY = '''\
COUNTS = '\
This index contains {count} entries, referring to {pages} individual manual pages.'
COUNTS = '\
This index contains {count} entries, referring to {pages} individual manual pages.'
+def check_id(page, t):
+ id = t.getroot().get('id')
+ if not re.search('/' + id + '[.]', page):
+ raise ValueError("id='{}' is not the same as page name '{}'".format(id, page))
+
def make_index(pages):
index = collections.defaultdict(list)
for p in pages:
t = tree.parse(p)
def make_index(pages):
index = collections.defaultdict(list)
for p in pages:
t = tree.parse(p)
+ check_id(p, t)
section = t.find('./refmeta/manvolnum').text
refname = t.find('./refnamediv/refname').text
purpose = ' '.join(t.find('./refnamediv/refpurpose').text.split())
section = t.find('./refmeta/manvolnum').text
refname = t.find('./refnamediv/refname').text
purpose = ' '.join(t.find('./refnamediv/refpurpose').text.split())