#!/usr/bin/env python3
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright © 2012-2013 Zbigniew Jędrzejewski-Szmek
import sys
import collections
import re
from xml_helper import xml_parse, xml_print, tree
from copy import deepcopy
TEMPLATE = '''\
elogind.directives
elogind
elogind.directives
7
elogind.directives
Index of configuration directives
Unit directives
Directives for configuring units, used in unit
files.
Options on the kernel command line
Kernel boot options for configuring the behaviour of the
elogind process.
Environment variables
Environment variables understood by the elogind
manager and other programs.
UDEV directives
Directives for configuring elogind units through the
udev database.
Network directives
Directives for configuring network links through the
net-setup-link udev builtin and networks through
elogind-networkd.
Journal fields
Fields in the journal events with a well known meaning.
PAM configuration directives
Directives for configuring PAM behaviour.
/etc/crypttab and
/etc/fstab options
Options which influence mounted filesystems and
encrypted volumes.
System manager directives
Directives for configuring the behaviour of the
elogind process.
command line options
Command-line options accepted by programs in the
elogind suite.
Constants
Various constant used and/or defined by elogind.
Miscellaneous options and directives
Other configuration elements which don't fit in
any of the above groups.
Files and directories
Paths and file names referred to in the
documentation.
Colophon
'''
COLOPHON = '''\
This index contains {count} entries in {sections} sections,
referring to {pages} individual manual pages.
'''
def _extract_directives(directive_groups, formatting, page):
t = xml_parse(page)
section = t.find('./refmeta/manvolnum').text
pagename = t.find('./refmeta/refentrytitle').text
storopt = directive_groups['options']
for variablelist in t.iterfind('.//variablelist'):
klass = variablelist.attrib.get('class')
storvar = directive_groups[klass or 'miscellaneous']
#