diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-01-14 21:34:19 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-01-15 11:30:42 -0500 |
commit | 0acfdd61edb96585c6438698bcc21e366acd4291 (patch) | |
tree | 65ccf0186fdefb83b6b937b6372feb9e670e5ced /make-directive-index.py | |
parent | eeb019b5b5db785feb0666f3238b1240e7f3e42e (diff) |
make-directive-index: count how many directives and pages are shown
Diffstat (limited to 'make-directive-index.py')
-rwxr-xr-x | make-directive-index.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/make-directive-index.py b/make-directive-index.py index 51d28c4fae..3bf672e1a6 100755 --- a/make-directive-index.py +++ b/make-directive-index.py @@ -92,9 +92,19 @@ TEMPLATE = '''\ <variablelist id='bootchart-directives' /> </refsect1> + + <refsect1> + <title>Colophon</title> + <para id='colophon' /> + </refsect1> </refentry> ''' +COLOPHON = '''\ +This index contains {count} entries in {sections} sections, +referring to {pages} individual manual pages. +''' + def _extract_directives(directive_groups, page): t = tree.parse(page) section = t.find('./refmeta/manvolnum').text @@ -125,6 +135,19 @@ def _make_section(template, name, directives): d.text = manvolume entry.tail = '\n\n' +def _make_colophon(template, groups): + count = 0 + pages = set() + for group in groups: + count += len(group) + for pagelist in group.values(): + pages |= set(pagelist) + + para = template.find(".//para[@id='colophon']") + para.text = COLOPHON.format(count=count, + sections=len(groups), + pages=len(pages)) + def _make_page(template, directive_groups): """Create an XML tree from directive_groups. @@ -137,6 +160,8 @@ def _make_page(template, directive_groups): for name, directives in directive_groups.items(): _make_section(template, name, directives) + _make_colophon(template, directive_groups.values()) + return template def make_page(xml_files): |