]>
pere.pagekite.me Git - text-free-culture-lessig.git/blob - scripts/verify-indexterm-range
3 # Verify the <indexterm> ranges of a docbook document, ensuring
4 # endofrange come after startofrange, and the IDs used by startofrange
9 filename
= 'freeculture.xml'
10 doc
= etree
.parse(filename
)
13 for it
in doc
.getroot().xpath('//indexterm'):
17 if 'class' in it
.attrib
:
18 indextermclass
= it
.attrib
['class']
19 if 'startofrange' == indextermclass
:
22 print "error: non-unique indexterm id: %s" % id
24 if 'endofrange' == indextermclass
:
25 id = it
.attrib
['startref']
27 print "error: indexterm id=\"%s\" not listed before endofrange" % id
28 print indextermclass
, id
30 if __name__
== "main":