mark expert parameters and non-ui-parameters

This commit is contained in:
CaCO3
2023-02-04 15:06:24 +01:00
parent 3d5aee189f
commit 5cd6bac889
75 changed files with 380 additions and 6 deletions

View File

@@ -13,6 +13,9 @@ configFileUrl = "https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/
parameterDocsFolder = "parameter-pages"
parameterTemplateFile = "./templates/parameter.md"
expertParameterListFile = "./expert-params.txt"
hiddenInUiParameterListFile = "./hidden-in-ui.txt"
# Fetch default config file from URL
print("Fetching %r..." % configFileUrl)
@@ -28,6 +31,14 @@ for l in range(len(lines)):
content = "".join(lines)
# Fetch list of expert parameters
with open(expertParameterListFile) as f:
expertParameters = f.read().splitlines()
# Fetch list of parameters not available through the UI
with open(hiddenInUiParameterListFile) as f:
hiddenInUiParameters = f.read().splitlines()
config = configparser.ConfigParser(allow_no_value=True)
config.optionxform = str # Make it case-insensitive
@@ -56,6 +67,9 @@ for section in config:
value = config[section][parameter]
#print(" %s = %s" % (parameter, value))
if "main." in parameter:
parameter = parameter.replace("main.", "<NUMBER>.")
"""
For each config line, create a markdown file
"""
@@ -68,4 +82,14 @@ for section in config:
content = content.replace("$NAME", parameter)
content = content.replace("$DEFAULT", value)
if parameter in expertParameters:
content = content.replace("$EXPERT_PARAMETER", "!!! Warning\n This is an expert parameter!") # Note: Needs a 4 whitespace Intent!
else:
content = content.replace("$EXPERT_PARAMETER", "")
if parameter in hiddenInUiParameters:
content = content.replace("$HIDDEN_IN_UI", "!!! Note\n This parameter is not accessible through the Web Interface Configuration Page!") # Note: Needs a 4 whitespace Intent!
else:
content = content.replace("$HIDDEN_IN_UI", "")
paramFileHandle.write(content)