From f2e5574c45cc3be0107006d1c1e60cdef732bcf1 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 22 Aug 2021 16:57:07 +0200 Subject: [PATCH] Add description --- README-generator/make_readme.py | 9 +++++++++ README-generator/templates/README.md.j2 | 2 +- README-generator/templates/README_fr.md.j2 | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README-generator/make_readme.py b/README-generator/make_readme.py index 5491860..ddcc3d2 100755 --- a/README-generator/make_readme.py +++ b/README-generator/make_readme.py @@ -30,6 +30,14 @@ def generate_READMEs(app_path: str): template = env.get_template(f"README{lang_suffix}.md.j2") + if (app_path / "doc" / f"DESCRIPTION{lang_suffix}.md").exists(): + description = (app_path / "doc" / f"DESCRIPTION{lang_suffix}.md").read_text() + # Fallback to english if maintainer too lazy to translate the description + elif (app_path / "doc" / "DESCRIPTION.md").exists(): + description = (app_path / "doc" / "DESCRIPTION.md").read_text() + else: + description = None + if (app_path / "doc" / "screenshots").exists(): screenshots = os.listdir(os.path.join(app_path, "doc", "screenshots")) if ".gitkeep" in screenshots: @@ -48,6 +56,7 @@ def generate_READMEs(app_path: str): out = template.render( lang=lang, upstream=upstream, + description=description, screenshots=screenshots, disclaimer=disclaimer, manifest=manifest, diff --git a/README-generator/templates/README.md.j2 b/README-generator/templates/README.md.j2 index 9ceda16..6e58002 100644 --- a/README-generator/templates/README.md.j2 +++ b/README-generator/templates/README.md.j2 @@ -29,7 +29,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -{{manifest.description[lang]}} +{% if description %}{{description}}{% else %}{{manifest.description[lang]}}{% endif %} **Shipped version:** {% if upstream.version %}{{upstream.version}}{% else %}{{manifest.version}}{% endif %} diff --git a/README-generator/templates/README_fr.md.j2 b/README-generator/templates/README_fr.md.j2 index 2fa3850..9169cbb 100644 --- a/README-generator/templates/README_fr.md.j2 +++ b/README-generator/templates/README_fr.md.j2 @@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Vue d'ensemble -{{manifest.description[lang]}} +{% if description %}{{description}}{% else %}{{manifest.description[lang]}}{% endif %} **Version incluse :** {% if upstream.version %}{{upstream.version}}{% else %}{{manifest.version}}{% endif %}