diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-04-05 16:18:53 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-04-07 10:52:16 +0200 |
commit | 3c405f5172a6081483c9e5f4264a4d60e60bc8ac (patch) | |
tree | dbf2651314bfba7d6b8a8eaeb9f4acdd7814de5f /docs/layouts | |
parent | 95808724595ab97042c204f3d92ea5c2929a8241 (diff) |
all: Document the Output Formats feature
This commit also adds a new command, docshelper, with some utility funcs that adds a JSON datafiles to /docs/data that would be a pain to create and maintain by hand.
Fixes #3242
Diffstat (limited to 'docs/layouts')
-rw-r--r-- | docs/layouts/shortcodes/datatable-vertical.html | 26 | ||||
-rw-r--r-- | docs/layouts/shortcodes/datatable.html | 23 |
2 files changed, 49 insertions, 0 deletions
diff --git a/docs/layouts/shortcodes/datatable-vertical.html b/docs/layouts/shortcodes/datatable-vertical.html new file mode 100644 index 000000000..1d2629eca --- /dev/null +++ b/docs/layouts/shortcodes/datatable-vertical.html @@ -0,0 +1,26 @@ +{{ $package := (index .Params 0) }} +{{ $listname := (index .Params 1) }} +{{ $list := (index (index .Site.Data.docs $package) $listname) }} +{{ $fields := after 2 .Params }} +<table class="table table-bordered"> + {{ range $list }} + {{ range $k, $v := . }} + {{ $.Scratch.Set $k $v }} + {{ end }} + {{ end }} + + {{ range $i, $_ := $fields }} + <tr> + {{ $.Scratch.Set "i" $i }} + + {{ $field := (index $fields ($.Scratch.Get "i") ) }} + <th>{{ $field }}</th> + {{ range $list }} + <td> + {{ index . $field }} + </td> + {{ end }} + + </tr> + {{ end }} +</table>
\ No newline at end of file diff --git a/docs/layouts/shortcodes/datatable.html b/docs/layouts/shortcodes/datatable.html new file mode 100644 index 000000000..f40605404 --- /dev/null +++ b/docs/layouts/shortcodes/datatable.html @@ -0,0 +1,23 @@ +{{ $package := (index .Params 0) }} +{{ $listname := (index .Params 1) }} +{{ $list := (index (index .Site.Data.docs $package) $listname) }} +{{ $fields := after 2 .Params }} + +<table class="table table-bordered"> + <tr> + {{ range $fields }} + <th>{{ . }}</th> + {{ end }} + </tr> + {{ range $list }} + <tr> + {{ range $k, $v := . }} + {{ $.Scratch.Set $k $v }} + {{ end }} + {{ range $fields }} + <td>{{ $.Scratch.Get . }}</td> + {{ end }} + </tr> + {{ end }} +</table> + |