diff --git a/readme_generator/README.md b/readme_generator/README.md index 260e2fe..332e59d 100644 --- a/readme_generator/README.md +++ b/readme_generator/README.md @@ -1,23 +1,23 @@ # Auto-README generation -### Initial install +## Initial install -``` +```bash python3 -m venv venv source venv/bin/activate pip install -r requirements.txt ``` -### Use on a single app +## Use on a single app -``` +```bash source venv/bin/activate ./make_readme.py /path/to/app ``` Then the README.md in the app folder will be updated -### Launch webhook service for auto update +## Launch webhook service for auto update Configure the webhook on github diff --git a/readme_generator/make_readme.py b/readme_generator/make_readme.py index d71f973..048dd03 100755 --- a/readme_generator/make_readme.py +++ b/readme_generator/make_readme.py @@ -10,14 +10,14 @@ from jinja2 import Environment, FileSystemLoader def value_for_lang(values, lang): - if not isinstance(values, dict): - return values - if lang in values: - return values[lang] - elif "en" in values: - return values["en"] - else: - return list(values.values())[0] + if not isinstance(values, dict): + return values + if lang in values: + return values[lang] + elif "en" in values: + return values["en"] + else: + return list(values.values())[0] def generate_READMEs(app_path: str): @@ -35,8 +35,11 @@ def generate_READMEs(app_path: str): catalog = toml.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "apps.toml")) from_catalog = catalog.get(manifest['id'], {}) + print(catalog) + print(from_catalog) antifeatures_list = toml.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "antifeatures.toml")) + print(antifeatures_list) if not upstream and not (app_path / "doc" / "DISCLAIMER.md").exists(): print( @@ -82,6 +85,8 @@ def generate_READMEs(app_path: str): else: antifeatures[k]['description'] = value_for_lang(antifeatures[k]['description'], lang) + print(lang + "\n") + out = template.render( lang=lang, upstream=upstream,