mirror of
https://github.com/jomjol/AI-on-the-edge-device-docs.git
synced 2025-12-11 05:56:59 +03:00
.
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user