# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
#
# This file is part of systemd.
#
# Copyright 2012-2013 Zbigniew Jędrzejewski-Szmek
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# systemd is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see .
import sys
import collections
import xml.etree.ElementTree as tree
import re
TEMPLATE = '''\
systemd.directivessystemdDeveloperZbigniewJędrzejewski-Szmekzbyszek@in.waw.plsystemd.directives7systemd.directivesIndex of configuration directivesUnit directivesDirectives for configuring units, used in unit
files.Options on the kernel command lineKernel boot options for configuring the behaviour of the
systemd process.Environment variablesEnvironment variables understood by the systemd
manager and other programs.UDEV directivesDirectives for configuring systemd units through the
udev database.Journal fieldsFields in the journal events with a well known meaning.PAM configuration directivesDirectives for configuring PAM behaviour.crypttab optionsOptions which influence mounted filesystems and
encrypted volumes.System manager directivesDirectives for configuring the behaviour of the
systemd process.bootchart.conf directivesDirectives for configuring the behaviour of the
systemd-bootchart process.command-line optionsCommand-line options accepted by programs in the
systemd suite.Miscellaneous options and directivesOther configuration elements which don't fit in
any of the above groups.Colophon
'''
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
pagename = t.find('./refmeta/refentrytitle').text
for variablelist in t.iterfind('.//variablelist'):
klass = variablelist.attrib.get('class')
storvar = directive_groups[klass or 'miscellaneous']
storopt = directive_groups['options']
#