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
wilder-5.14
Marco Martin 10 years ago
parent 2eebd129cf
commit 50dc414789
  1. 14
      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

Loading…
Cancel
Save