From 50dc414789231f5050a43daad2578d3ab2c617f1 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 14 Sep 2016 12:01:05 +0200 Subject: [PATCH] write default values in the configs Summary: show the default values in the generated docs. in case no default is indicated, fallback to different type dependednt empty values, such as 0 for Int, false for Bool, "empty list" for string lists the generated docs will look like: * '''ItemsGeometriesHorizontal''' (''String'', default ''empty string'') Reviewers: davidedmundson, #plasma Reviewed By: davidedmundson, #plasma Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D2770 --- doc/config_update_tool/extract_config.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/config_update_tool/extract_config.py b/doc/config_update_tool/extract_config.py index 5507cad05..2d462a476 100755 --- a/doc/config_update_tool/extract_config.py +++ b/doc/config_update_tool/extract_config.py @@ -48,12 +48,24 @@ for plasmoid in os.listdir(root): if (defaultTags.length > 0 and defaultTags[0].childNodes.length > 0): default = defaultTags[0].childNodes[0].data + if (default == ""): + if (type == "Bool"): + default = "false" + elif (type == "Int"): + default = "0" + elif (type == "StringList"): + default = "empty list" + elif (type == "String"): + default = "empty string" + else: + default = "null" + labelTags = entry.getElementsByTagName("label") if (labelTags.length > 0 and labelTags[0].childNodes.length > 0): description = labelTags[0].childNodes[0].data - print ("* '''%s''' (''%s'') %s" % (name , type, description)) + print ("* '''%s''' (''%s'', default ''%s'') %s" % (name , type, default, description)) except IOError: sys.stderr.write("No config in " + plasmoid +"\n") #abort on other errors so we can find them