From f583571e44fd86fad0f345f60e4ba41f85dc38f8 Mon Sep 17 00:00:00 2001 From: Niels Claes Date: Fri, 17 Sep 2021 15:38:56 +0200 Subject: [PATCH] updated doc generation script with link to stable/dev version --- docs/generate_docs.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/generate_docs.py b/docs/generate_docs.py index 0da4e8d0..b8ffdf2c 100644 --- a/docs/generate_docs.py +++ b/docs/generate_docs.py @@ -95,6 +95,22 @@ def modify_config_yml(branch): yaml.safe_dump(config, file, default_flow_style=False, sort_keys=False) +def modify_navigation_yml(branch): + if branch is None: + return + nav_yml = (DOCS / "_data/navigation.yml").resolve() + assert nav_yml.is_file() + with open(nav_yml, "r") as file: + nav = yaml.safe_load(file) + if branch == "stable": + button = {"title": "goto: dev ▶", "url": "https://dev.legolas.science"} + else: + button = {"title": "◀ goto: stable", "url": "https://legolas.science"} + nav["main"].append(button) + with open(nav_yml, "w") as file: + yaml.safe_dump(nav, file, default_flow_style=False, sort_keys=False) + + def main(): branch, clean_files = parse_command_arguments() if branch is not None: @@ -105,6 +121,7 @@ def main(): generate_ford_docs(branch) generate_sphinx_docs(branch) + modify_navigation_yml(branch) modify_config_yml(branch)