This commit is contained in:
CaCO3
2023-02-04 01:03:46 +01:00
parent cb78ef07f6
commit 261a3374b4
73 changed files with 6 additions and 3 deletions

View File

@@ -13,7 +13,7 @@ parameterOverviewFile = "../docs/Parameters.md"
parameterOverviewTemplateFile = "./templates/overview.md" parameterOverviewTemplateFile = "./templates/overview.md"
def appendParameterFile(folder, file): def appendParameterFile(folder, file):
print(folder, file) #print(folder, file)
with open(file, 'r') as parameterFileHandle: with open(file, 'r') as parameterFileHandle:
parameterDoc = parameterFileHandle.read() parameterDoc = parameterFileHandle.read()

View File

@@ -1,6 +1,6 @@
""" """
For each parameter which can be found in the config file, For each parameter which can be found in the config file,
create a markdown file with a templated contentf it does not exist yet. create a markdown file with a templated content it does not exist yet.
The files are grouped in sub folders representing the config sections. The files are grouped in sub folders representing the config sections.
""" """
@@ -8,12 +8,14 @@ import os
import configparser import configparser
import urllib.request import urllib.request
configFileUrl = "https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/rolling/sd-card/config/config.ini" configFileUrl = "https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/rolling/sd-card/config/config.ini"
parameterDocsFolder = "parameter-pages" parameterDocsFolder = "parameter-pages"
parameterTemplateFile = "./templates/parameter.md" parameterTemplateFile = "./templates/parameter.md"
# Fetch default config file from URL # Fetch default config file from URL
print("Fetching %r..." % configFileUrl)
with urllib.request.urlopen(configFileUrl) as response: with urllib.request.urlopen(configFileUrl) as response:
content = response.read().decode("utf-8") content = response.read().decode("utf-8")
@@ -39,7 +41,7 @@ with open(parameterTemplateFile, 'r') as parameterTemplateFileHandle:
parameterTemplate = parameterTemplateFileHandle.read() parameterTemplate = parameterTemplateFileHandle.read()
print("For each section/parameter, check if there is already a documentation page in the folder %r..." % (os.getcwd() + "/" + parameterDocsFolder))
for section in config: for section in config:
if section != "DEFAULT": if section != "DEFAULT":
#print(section) #print(section)
@@ -60,6 +62,7 @@ for section in config:
parameterDocFile = subFolder + '/' + parameter + ".md" parameterDocFile = subFolder + '/' + parameter + ".md"
if not os.path.exists(parameterDocFile): # File does not exist yet, generate template if not os.path.exists(parameterDocFile): # File does not exist yet, generate template
print("%r does not exit yet, generating a templated file for it" % (os.getcwd() + "/" + parameterDocFile))
with open(parameterDocFile, 'w') as paramFileHandle: with open(parameterDocFile, 'w') as paramFileHandle:
content = parameterTemplate content = parameterTemplate
content = content.replace("$NAME", parameter) content = content.replace("$NAME", parameter)