use definition lists instead of tables in docs/configuration.rst
and strip some clutter from generated man pages
This commit is contained in:
parent
cc4ac80302
commit
117582d798
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright 2019 Mike Fährmann
|
# Copyright 2019-2020 Mike Fährmann
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License version 2 as
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
@ -238,40 +238,45 @@ def parse_docs_configuration():
|
|||||||
opt_name = None
|
opt_name = None
|
||||||
opt_desc = None
|
opt_desc = None
|
||||||
name = None
|
name = None
|
||||||
last = last2 = None
|
last = None
|
||||||
for line in doc_lines:
|
for line in doc_lines:
|
||||||
|
|
||||||
|
if line[0] == ".":
|
||||||
|
continue
|
||||||
|
|
||||||
# start of new section
|
# start of new section
|
||||||
if re.match(r"^=+$", line):
|
elif re.match(r"^=+$", line):
|
||||||
if sec_name and options:
|
if sec_name and options:
|
||||||
sections[sec_name] = options
|
sections[sec_name] = options
|
||||||
sec_name = last.strip()
|
sec_name = last.strip()
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
elif re.match(r"^=+ =+$", line):
|
# start of new option block
|
||||||
# start of option table
|
elif re.match(r"^-+$", line):
|
||||||
if re.match(r"^-+$", last):
|
opt_name = last.strip()
|
||||||
opt_name = last2.strip()
|
opt_desc = {}
|
||||||
opt_desc = {}
|
|
||||||
# end of option table
|
|
||||||
elif opt_desc:
|
|
||||||
options[opt_name] = opt_desc
|
|
||||||
opt_name = None
|
|
||||||
name = None
|
|
||||||
|
|
||||||
# inside option table
|
# end of option block
|
||||||
|
elif opt_name and opt_desc and line == "\n" and not last:
|
||||||
|
options[opt_name] = opt_desc
|
||||||
|
opt_name = None
|
||||||
|
name = None
|
||||||
|
|
||||||
|
# inside option block
|
||||||
elif opt_name:
|
elif opt_name:
|
||||||
if line[0].isalpha():
|
if line[0].isalpha():
|
||||||
name, _, line = line.partition(" ")
|
name = line.strip()
|
||||||
opt_desc[name] = ""
|
opt_desc[name] = ""
|
||||||
line = line.strip()
|
else:
|
||||||
if line.startswith(("* ", "- ")):
|
line = line.strip()
|
||||||
line = ".br\n" + line
|
if line.startswith(("* ", "- ")):
|
||||||
elif line.startswith("| "):
|
# list item
|
||||||
line = line[2:] + "\n.br"
|
line = ".br\n" + line
|
||||||
opt_desc[name] += line + "\n"
|
elif line.startswith("| "):
|
||||||
|
# line block
|
||||||
|
line = line[2:] + "\n.br"
|
||||||
|
opt_desc[name] += line + "\n"
|
||||||
|
|
||||||
last2 = last
|
|
||||||
last = line
|
last = line
|
||||||
sections[sec_name] = options
|
sections[sec_name] = options
|
||||||
|
|
||||||
@ -287,6 +292,8 @@ def strip_rst(text, extended=True, *, ITALIC=r"\\f[I]\1\\f[]", REGULAR=r"\1"):
|
|||||||
text = re.sub(r"``([^`]+)``", repl, text)
|
text = re.sub(r"``([^`]+)``", repl, text)
|
||||||
# |foo|_
|
# |foo|_
|
||||||
text = re.sub(r"\|([^|]+)\|_*", ITALIC, text)
|
text = re.sub(r"\|([^|]+)\|_*", ITALIC, text)
|
||||||
|
# `foo <bar>`__
|
||||||
|
text = re.sub(r"`([^`<]+) <[^>`]+>`_+", ITALIC, text)
|
||||||
# `foo`_
|
# `foo`_
|
||||||
text = re.sub(r"`([^`]+)`_+", ITALIC, text)
|
text = re.sub(r"`([^`]+)`_+", ITALIC, text)
|
||||||
# `foo`
|
# `foo`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user