summaryrefslogtreecommitdiff
path: root/tools/generate-docs-nm-property-infos.py
diff options
context:
space:
mode:
authorWen Liang <liangwen12year@gmail.com>2021-05-23 21:52:18 -0400
committerWen Liang <wenliang@redhat.com>2021-06-23 08:59:45 -0400
commit0b87d8d6c50b4e2d68384d1122b3d75dfa5de3fd (patch)
tree471b8d111ffcedc5220a1e3b5dd29aa7502a8ca8 /tools/generate-docs-nm-property-infos.py
parent6ac304b67303980b579153e113ec4285a758def4 (diff)
downloadNetworkManager-0b87d8d6c50b4e2d68384d1122b3d75dfa5de3fd.tar.gz
Support new attribute tag `description-docbook`
`description-docbook` is the alternative tag to `description`, the difference is that `description-docbook` expects docbook XML but not plaintext. Signed-off-by: Wen Liang <liangwen12year@gmail.com>
Diffstat (limited to 'tools/generate-docs-nm-property-infos.py')
-rwxr-xr-xtools/generate-docs-nm-property-infos.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/generate-docs-nm-property-infos.py b/tools/generate-docs-nm-property-infos.py
index 238469c66c..74e88d6ad1 100755
--- a/tools/generate-docs-nm-property-infos.py
+++ b/tools/generate-docs-nm-property-infos.py
@@ -66,6 +66,7 @@ def process_data(data):
"default",
"example",
"description",
+ "description-docbook",
]
kwd_pat = "|".join(keywords)
keyword = ""
@@ -76,14 +77,20 @@ def process_data(data):
kwd_more_line_found = re.search(r"^\s*\**\s+(.*?)\s*$", line)
if kwd_first_line_found:
keyword = kwd_first_line_found.group(1)
- value = kwd_first_line_found.group(2) + " "
+ if keyword == "description-docbook":
+ value = kwd_first_line_found.group(2) + "\n"
+ else:
+ value = kwd_first_line_found.group(2) + " "
parsed_data[keyword] = value
elif kwd_more_line_found:
if not keyword:
print("Extra mess in a comment: %s" % (line))
exit(1)
else:
- value = kwd_more_line_found.group(1) + " "
+ if keyword == "description-docbook":
+ value = kwd_more_line_found.group(1) + "\n"
+ else:
+ value = kwd_more_line_found.group(1) + " "
parsed_data[keyword] += value
for keyword in keywords:
if keyword == "variable" and keyword not in parsed_data:
@@ -104,6 +111,13 @@ def write_data(setting_node, parsed_data):
property_node.set("default", parsed_data["default"])
property_node.set("example", parsed_data["example"])
property_node.set("description", parsed_data["description"])
+ if parsed_data["description-docbook"]:
+ des = ET.fromstring(
+ "<description-docbook>"
+ + parsed_data["description-docbook"]
+ + "</description-docbook>"
+ )
+ property_node.append(des)
def pretty_xml(element, newline, level=0):