doc: improve app resource doc

This commit is contained in:
Alexandre Aubin 2023-02-09 19:00:17 +01:00
parent 658940079d
commit a154e811db
2 changed files with 25 additions and 2 deletions

View file

@ -24,7 +24,7 @@ def render(helpers):
data = {
"helpers": helpers,
"date": datetime.datetime.now().strftime("%m/%d/%Y"),
"date": datetime.datetime.now().strftime("%d/%m/%Y"),
"version": open("../debian/changelog").readlines()[0].split()[1].strip("()"),
}

View file

@ -1,6 +1,25 @@
import ast
import datetime
import subprocess
print("""---
version = open("../debian/changelog").readlines()[0].split()[1].strip("()"),
today = datetime.datetime.now().strftime("%d/%m/%Y")
def get_current_commit():
p = subprocess.Popen(
"git rev-parse --verify HEAD",
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
stdout, stderr = p.communicate()
current_commit = stdout.strip().decode("utf-8")
return current_commit
current_commit = get_current_commit()
print(f"""---
title: App resources
template: docs
taxonomy:
@ -9,6 +28,8 @@ routes:
default: '/packaging_apps_resources'
---
Doc auto-generated by [this script](https://github.com/YunoHost/yunohost/blob/{current_commit}/doc/generate_resource_doc.py) on {today} (YunoHost version {version})
""")
@ -35,7 +56,9 @@ for c in ResourceClasses:
for resource_id, doc in sorted(ResourceDocString.items()):
doc = doc.replace("\n ", "\n")
print("----------------")
print("")
print(f"## {resource_id.replace('_', ' ').title()}")
print("")
print(doc)
print("")