add basic hugo template

This commit is contained in:
Robert Kaussow 2019-11-26 16:40:55 +01:00
parent f020bb7738
commit a7daf485ef
4 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,12 @@
{% set meta = role.meta | default({}) %}
{% if meta %}
## Dependencies
{% if meta | deep_get(meta, "dependencies.value") %}
{% for item in meta.dependencies.value %}
* {{ item }}
{% endfor %}
{% else %}
None.
{% endif %}
{% endif %}

View File

@ -0,0 +1,14 @@
## Table of content
{% set var = role.var | default({}) %}
{% if var %}
* [Default Variables](#default-variables)
{% for key, item in var | dictsort %}
* [{{ key }}](#{{ key }})
{% endfor %}
{% endif %}
* [Dependencies](#dependencies)
* [License](#license)
* [Author](#author)
---

View File

@ -0,0 +1,41 @@
{% set var = role.var | default({}) %}
{% if var %}
## Default Variables
{% for key, item in var | dictsort %}
### {{ key }}
{% if item.description is defined and item.description %}
{{ item.description | save_join(" ") | striptags }}
{% endif %}
{% if item.value is defined and item.value %}
#### Default value
```YAML
{% if item.value is mapping %}
{{ item.value | to_nice_yaml(indent=2) }}
{% else %}
{% for ve_line in item.value %}
{{ ve_line }}
{% endfor %}
{% endif %}
```
{% endif %}
{% if item.example is defined and item.example %}
#### Example usage
```YAML
{% if item.example is mapping %}
{{ item.example | to_nice_yaml(indent=2) }}
{% else %}
{% for ex_line in item.example %}
{{ ex_line }}
{% endfor %}
{% endif %}
```
{% endif %}
{% endfor %}
{% endif %}

View File

@ -0,0 +1,17 @@
{% set meta = role.meta | default({}) %}
---
title: {{ meta.name.value | save_join(" ") }}
---
{% if description | deep_get(meta, "description.value") %}
{{ meta.description.value | save_join(" ") }}
{% endif %}
{# TOC #}
{% include '_toc.j2' %}
{# Vars #}
{% include '_vars.j2' %}
{# Meta #}
{% include '_meta.j2' %}