Commit 948c561d authored by CSA's avatar CSA
Browse files

Document pillar behaviour

parent 405e1a93
{{/*
Pillar widget, creates a multi-column layout. Columns are same width.
Usage :
{{ $.Scratch.SetInMap "pillar" "PARAM" "VALUE" }}
{{ $.Scratch.SetInMap "pillar" "items" (slice (dict "name" "column1" "type" "menu") (dict "name" "column2" "type" "markdown" "content" "[Tor](https://torproject.org) is amazing!") ) }}
{{ partial "pillar.html" $ }}
Pillar parameters:
- childClass: adds a specific class to the generated column
The 'items' key is reserved for a list of the columns. Each column needs
a 'type' and a 'name'. Some column types may need additional parameters.
A generated column will have the id #pillar-'name'
Here are the supported column types:
- template: call a partial template called 'name' or 'name'.html
- menu: call a menu.html template for a vertical menu called 'name'
- markdown (content): render Markdown from 'content' string
*/}}
{{ $pillar := $.Scratch.Get "pillar" }}
{{ $columns := len $pillar.items }}
<div class="pure-g pillar-widget">
......@@ -5,8 +25,15 @@
<!-- Maximum 3 columns on medium screens -->
<div class="pure-u-1 pure-u-md-1-{{ cond (gt $columns 3) 3 $columns }} pure-u-lg-1-{{ $columns }}{{ if $pillar.childClass }} {{ $pillar.childClass }}{{ end }}">
{{ if eq $i.type "menu" }}
<!-- Menu type needs name -->
{{ $.Scratch.Set "menu" (dict "name" $i.name "template" "v" "class" "") }}
{{ partial "menu.html" $ }}
{{ else if eq $i.type "template" }}
<!-- Template type needs name -->
{{ partial (printf "%s.html" ($i.name | strings.TrimSuffix ".html")) $ }}
{{ else if eq $i.type "markdown" }}
<!-- Markdown type needs content -->
{{ $i.content | markdownify }}
{{ end }}
</div>
{{ end }}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment