diff --git a/README-generator/make_readme.py b/README-generator/make_readme.py index ddcc3d2..3e8be5a 100755 --- a/README-generator/make_readme.py +++ b/README-generator/make_readme.py @@ -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, diff --git a/README-generator/requirements.txt b/README-generator/requirements.txt index 88cd6e2..33fe25a 100644 --- a/README-generator/requirements.txt +++ b/README-generator/requirements.txt @@ -1,2 +1,3 @@ jinja2 sanic +pyyaml diff --git a/README-generator/templates/README.md.j2 b/README-generator/templates/README.md.j2 index 6e58002..8713a9a 100644 --- a/README-generator/templates/README.md.j2 +++ b/README-generator/templates/README.md.j2 @@ -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 }} diff --git a/README-generator/templates/README_fr.md.j2 b/README-generator/templates/README_fr.md.j2 index 9169cbb..9e89c10 100644 --- a/README-generator/templates/README_fr.md.j2 +++ b/README-generator/templates/README_fr.md.j2 @@ -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 }}