mirror of
https://github.com/thegeeklab/ansible-doctor.git
synced 2024-11-21 20:30:43 +00:00
add basic hugo template
This commit is contained in:
parent
f020bb7738
commit
a7daf485ef
12
ansibledoctor/templates/hugo/_meta.j2
Normal file
12
ansibledoctor/templates/hugo/_meta.j2
Normal 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 %}
|
14
ansibledoctor/templates/hugo/_toc.j2
Normal file
14
ansibledoctor/templates/hugo/_toc.j2
Normal 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)
|
||||
|
||||
---
|
41
ansibledoctor/templates/hugo/_vars.j2
Normal file
41
ansibledoctor/templates/hugo/_vars.j2
Normal 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 %}
|
17
ansibledoctor/templates/hugo/index.md.j2
Normal file
17
ansibledoctor/templates/hugo/index.md.j2
Normal 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' %}
|
Loading…
Reference in New Issue
Block a user