From 59d3e387f16fdad9fcc51fdd89f7e457e28c2ec0 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Sun, 7 Feb 2021 15:52:50 +0100 Subject: [PATCH] Update template for the new doc (grav) --- .gitlab/ci/doc.gitlab-ci.yml | 2 +- doc/generate_helper_doc.py | 4 +- doc/helper_doc_template.html | 112 ----------------------------------- doc/helper_doc_template.md | 59 ++++++++++++++++++ 4 files changed, 62 insertions(+), 115 deletions(-) delete mode 100644 doc/helper_doc_template.html create mode 100644 doc/helper_doc_template.md diff --git a/.gitlab/ci/doc.gitlab-ci.yml b/.gitlab/ci/doc.gitlab-ci.yml index 7227b8acb..c2ad255ba 100644 --- a/.gitlab/ci/doc.gitlab-ci.yml +++ b/.gitlab/ci/doc.gitlab-ci.yml @@ -14,7 +14,7 @@ generate-helpers-doc: - cd doc - python generate_helper_doc.py - hub clone https://$GITHUB_TOKEN:x-oauth-basic@github.com/YunoHost/doc.git doc_repo - - cp helpers.html doc_repo/packaging_apps_helpers.md + - cp helpers.md doc_repo/pages/02.contribute/04.packaging_apps/11.helpers/packaging_apps_helpers.md - cd doc_repo # replace ${CI_COMMIT_REF_NAME} with ${CI_COMMIT_TAG} ? - hub checkout -b "${CI_COMMIT_REF_NAME}" diff --git a/doc/generate_helper_doc.py b/doc/generate_helper_doc.py index 1d3a95e39..f2d5bf444 100644 --- a/doc/generate_helper_doc.py +++ b/doc/generate_helper_doc.py @@ -39,7 +39,7 @@ def render(helpers): def shell_to_html(shell): return conv.convert(shell, False) - template = open("helper_doc_template.html", "r").read() + template = open("helper_doc_template.md", "r").read() t = Template(template) t.globals["now"] = datetime.datetime.utcnow result = t.render( @@ -48,7 +48,7 @@ def render(helpers): convert=shell_to_html, shell_css=shell_css, ) - open("helpers.html", "w").write(result) + open("helpers.md", "w").write(result) ############################################################################## diff --git a/doc/helper_doc_template.html b/doc/helper_doc_template.html deleted file mode 100644 index 60bfe0ecd..000000000 --- a/doc/helper_doc_template.html +++ /dev/null @@ -1,112 +0,0 @@ - - -

App helpers

- -

Doc auto-generated by this script on {{data.date}} (Yunohost version {{data.version}})

- -{% for category, helpers in data.helpers %} - -

{{ category }}

- -{% for h in helpers %} - -
-
-
-
{{ h.name }}
-
{{ h.brief }}
-
-
-
-

- {% if not '\n' in h.usage %} - Usage: {{ h.usage }} - {% else %} - Usage: {{ h.usage }} - {% endif %} -

- {% if h.args %} -

- Arguments: -

    - {% for infos in h.args %} - {% if infos|length == 2 %} -
  • {{ infos[0] }} : {{ infos[1] }}
  • - {% else %} -
  • {{ infos[0] }}, {{ infos[1] }} : {{ infos[2] }}
  • - {% endif %} - {% endfor %} -
-

- {% endif %} - {% if h.ret %} -

- Returns: {{ h.ret }} -

- {% endif %} - {% if "example" in h.keys() %} -

- Example: {{ h.example }} -

- {% endif %} - {% if "examples" in h.keys() %} -

- Examples:

    - {% for example in h.examples %} - {% if not example.strip().startswith("# ") %} - {{ example }} - {% else %} - {{ example.strip("# ") }} - {% endif %} -
    - {% endfor %} -
-

- {% endif %} - {% if h.details %} -

- Details: -

- {{ h.details.replace('\n', '
') }} -

-

- {% endif %} -

- Dude, show me the code ! -

- -
-
- -
- -{% endfor %} -{% endfor %} - - diff --git a/doc/helper_doc_template.md b/doc/helper_doc_template.md new file mode 100644 index 000000000..1ae6095a3 --- /dev/null +++ b/doc/helper_doc_template.md @@ -0,0 +1,59 @@ +--- +title: App helpers +template: docs +taxonomy: + category: docs +routes: + default: '/packaging_apps_helpers' +--- + +Doc auto-generated by [this script](https://github.com/YunoHost/yunohost/blob/{{ current_commit }}/doc/generate_helper_doc.py) on {{data.date}} (Yunohost version {{data.version}}) + +{% for category, helpers in data.helpers %} +### {{ category.upper() }} +{% for h in helpers %} +**{{ h.name }}** +[details summary="{{ h.brief }}" class="helper-card-subtitle text-muted"] +

+ +**Usage**: `{{ h.usage }}` + {% if h.args %} + +**Arguments**: + {% for infos in h.args %} + {% if infos|length == 2 %} +- `{{ infos[0] }}`: {{ infos[1] }} + {% else %} +- `{{ infos[0] }}`, `{{ infos[1] }}`: {{ infos[2] }} + {% endif %} + {% endfor %} + {% endif %} + {% if h.ret %} + +**Returns**: {{ h.ret }} + {% endif %} + {% if "example" in h.keys() %} +**Example**: `{{ h.example }}` + {% endif %} + {% if "examples" in h.keys() %} + +**Examples**: + {% for example in h.examples %} + {% if not example.strip().startswith("# ") %} +- `{{ example }}` + {% else %} +- `{{ example.strip("# ") }}` + {% endif %} + {% endfor %} + {% endif %} + {% if h.details %} + +**Details**: +{{ h.details.replace('\n', '
').replace('_', '\_') }} + {% endif %} + +[Dude, show me the code!](https://github.com/YunoHost/yunohost/blob/{{ current_commit }}/data/helpers.d/{{ category }}#L{{ h.line + 1 }}) +[/details] +---------------- +{% endfor %} +{% endfor %}