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:
parent
87cfe600c7
commit
80cb917e62
1
README
1
README
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user