feat: initial documentation of state machine

This commit is contained in:
Ferrari Martino Giordano
2024-03-20 14:28:44 +01:00
parent d5e129c057
commit 553ec62de1
3 changed files with 51 additions and 5 deletions
+6 -4
View File
@@ -7,6 +7,7 @@ from datetime import datetime
import common as doc
from doc_state import *
from doc_state_machine import doc_state_machine
def __doc_app_state__(state, tab=""):
@@ -20,7 +21,7 @@ def __doc_app_state__(state, tab=" │ "):
def __doc_application__(label, app):
mdapp = f'\n## Real-time application "{label[1:]}"\n\n'
mdapp = f'\n## Real-time application: "{label[1:]}"\n\n'
mdapp += f"Below are descrbed the states and threads of the real-time application {label[1:]}.\n"
mdapp += "\n"
@@ -44,7 +45,7 @@ def __doc_application__(label, app):
mdapp += "```\n"
for label, obj in states.items():
if label[0] == "+":
mdapp += f'\n### State "{label[1:]}"\n'
mdapp += f'\n### State: "{label[1:]}"\n'
mdapp += doc_state(label, obj, app)
return mdapp
@@ -71,7 +72,8 @@ def document(fname, args, config):
if obj["Class"] == "RealTimeApplication":
mddoc += __doc_application__(label, obj)
if obj["Class"] == "StateMachine":
mddoc += f'\n## State-Machine "{label[1:]}"'
mddoc += f'\n## State-Machine: "{label[1:]}"\n'
mddoc += doc_state_machine(label[1:], obj)
fpath = os.path.join(doc.path(), f"{fname}.md")
outpath = os.path.join(doc.path(), fname)
logging.info(f"Saving markdown: {fpath}")
@@ -79,7 +81,7 @@ def document(fname, args, config):
file.write(mddoc)
logging.info(f"Generating html: {outpath}.html")
os.system(
f"pandoc --css styling.css --resource-path={doc.path()} --embed-resource --to html5 -s {fpath} -o {outpath}.html"
f"pandoc --css pandoc/styling.css --resource-path={doc.path()} --embed-resource --to html5 -s {fpath} -o {outpath}.html"
)
logging.info(f"Generating pdf: {outpath}.pdf")
os.system(