1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

man: use lxml for faster generation and pretty printing

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2013-03-07 20:13:40 -05:00
parent 87cfe600c7
commit 80cb917e62
3 changed files with 15 additions and 4 deletions

1
README
View File

@ -116,6 +116,7 @@ REQUIREMENTS:
gtkdocize (optional)
python (optional)
sphinx (optional)
python-lxml (entirely optional)
When systemd-hostnamed is used it is strongly recommended to
install nss-myhostname to ensure that in a world of

View File

@ -19,7 +19,12 @@
import sys
import collections
import xml.etree.ElementTree as tree
try:
from lxml import etree as tree
PRETTY = dict(pretty_print=True)
except ImportError:
import xml.etree.ElementTree as tree
PRETTY = {}
import re
TEMPLATE = '''\
@ -277,4 +282,4 @@ def make_page(*xml_files):
return _make_page(template, directive_groups, formatting)
if __name__ == '__main__':
tree.dump(make_page(*sys.argv[1:]))
tree.dump(make_page(*sys.argv[1:]), **PRETTY)

View File

@ -19,7 +19,12 @@
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
import collections
import xml.etree.ElementTree as tree
try:
from lxml import etree as tree
PRETTY = dict(pretty_print=True)
except ImportError:
import xml.etree.ElementTree as tree
PRETTY = {}
import sys
import re
MDASH = '' if sys.version_info.major >= 3 else ' -- '
@ -130,4 +135,4 @@ def make_page(xml_files):
return template
if __name__ == '__main__':
tree.dump(make_page(sys.argv[1:]))
tree.dump(make_page(sys.argv[1:]), **PRETTY)