Merge pull request #1168 from Salamandar/helper_template

Enhance the jinja template for bash helpers
This commit is contained in:
Alexandre Aubin 2021-03-01 18:13:18 +01:00 committed by GitHub
commit 4a20cf8003
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,45 +12,46 @@ Doc auto-generated by [this script](https://github.com/YunoHost/yunohost/blob/{{
{% for category, helpers in data.helpers %}
### {{ category.upper() }}
{% for h in helpers %}
**{{ h.name }}**
**{{ h.name }}**<br/>
[details summary="<i>{{ h.brief }}</i>" class="helper-card-subtitle text-muted"]
<p></p>
**Usage**: `{{ h.usage }}`
{% if h.args %}
{%- if h.args %}
**Arguments**:
{% for infos in h.args %}
{% if infos|length == 2 %}
**Arguments**:
{%- for infos in h.args %}
{%- if infos|length == 2 %}
- `{{ infos[0] }}`: {{ infos[1] }}
{% else %}
{%- else %}
- `{{ infos[0] }}`, `{{ infos[1] }}`: {{ infos[2] }}
{% endif %}
{% endfor %}
{% endif %}
{% if h.ret %}
{%- endif %}
{%- endfor %}
{%- endif %}
{%- if h.ret %}
**Returns**: {{ h.ret }}
{% endif %}
{% if "example" in h.keys() %}
{%- endif %}
{%- if "example" in h.keys() %}
**Example**: `{{ h.example }}`
{% endif %}
{% if "examples" in h.keys() %}
{%- endif %}
{%- if "examples" in h.keys() %}
**Examples**:
{% for example in h.examples %}
{% if not example.strip().startswith("# ") %}
**Examples**:
{% for example in h.examples %}
{% if not example.strip().startswith("# ") %}
- `{{ example }}`
{% else %}
{% else %}
- `{{ example.strip("# ") }}`
{% endif %}
{% endfor %}
{% endif %}
{% if h.details %}
{% endif %}
{% endfor %}
{%- endif %}
{%- if h.details %}
**Details**:
{{ h.details.replace('\n', '</br>').replace('_', '\_') }}
{% endif %}
**Details**:<br/>
{{ h.details }}
{%- endif %}
[Dude, show me the code!](https://github.com/YunoHost/yunohost/blob/{{ current_commit }}/data/helpers.d/{{ category }}#L{{ h.line + 1 }})
[/details]