1
0
Fork 0

Add Anti-Features in READMEs

This commit is contained in:
Tagadda 2022-02-23 07:18:05 +00:00
parent dc0688a368
commit 448dd80c5f
4 changed files with 29 additions and 0 deletions

View file

@ -3,6 +3,7 @@
import argparse
import json
import os
import yaml
from pathlib import Path
from jinja2 import Environment, FileSystemLoader
@ -18,6 +19,11 @@ def generate_READMEs(app_path: str):
manifest = json.load(open(app_path / "manifest.json"))
upstream = manifest.get("upstream", {})
catalog = json.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "apps.json"))
from_catalog = catalog.get(manifest['id'], {})
antifeatures_list = yaml.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "antifeatures.yaml"))
if not upstream and not (app_path / "doc" / "DISCLAIMER.md").exists():
print(
"There's no 'upstream' key in the manifest, and doc/DISCLAIMER.md doesn't exists - therefore assuming that we shall not auto-update the README.md for this app yet."
@ -53,6 +59,12 @@ def generate_READMEs(app_path: str):
else:
disclaimer = None
# TODO: Add url to the documentation... and actually create that documentation :D
antifeatures = [antifeatures_list[a] for a in from_catalog.get('antifeatures', [])]
for antifeature in antifeatures:
antifeature['title'] = antifeature['title'].get(lang_suffix, 'en')
antifeature['description'] = antifeature['description'].get(lang_suffix, 'en')
out = template.render(
lang=lang,
upstream=upstream,

View file

@ -1,2 +1,3 @@
jinja2
sanic
pyyaml

View file

@ -49,6 +49,14 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
{{ disclaimer }}
{% endif -%}
{% if antifeatures -%}
## Antifeatures
{% for antifeature in antifeatures -%}
- **{{ antifeature.title }}**: {{ antifeature.description }}
{% endfor -%}
{% endif -%}
## Documentation and resources
{% if upstream.website -%}* Official app website: {{ upstream.website }}

View file

@ -31,6 +31,14 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
{{ disclaimer }}
{% endif -%}
{% if antifeatures -%}
## Fonctions indésirables
{% for antifeature in antifeatures -%}
- **{{ antifeature.title }}**: {{ antifeature.description }}
{% endfor -%}
{% endif -%}
## Documentations et ressources
{% if upstream.website -%}* Site officiel de l'app : {{ upstream.website }}