mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit '337d0c5f516ee085205e8abefdb7f87e6d33ca05'
This commit is contained in:
28
docs/layouts/shortcodes/datatable-filtered.html
Normal file
28
docs/layouts/shortcodes/datatable-filtered.html
Normal file
@@ -0,0 +1,28 @@
|
||||
{{ $package := (index .Params 0) }}
|
||||
{{ $listname := (index .Params 1) }}
|
||||
{{ $filter := split (index .Params 2) " " }}
|
||||
{{ $filter1 := index $filter 0 }}
|
||||
{{ $filter2 := index $filter 1 }}
|
||||
{{ $filter3 := index $filter 2 }}
|
||||
|
||||
{{ $list := (index (index .Site.Data.docs $package) $listname) }}
|
||||
{{ $fields := after 3 .Params }}
|
||||
{{ $list := where $list $filter1 $filter2 $filter3 }}
|
||||
|
||||
<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>
|
@@ -1,4 +1,4 @@
|
||||
{{ $original := .Page.Resources.GetByPrefix (.Get 0) }}
|
||||
{{ $original := .Page.Resources.GetMatch (printf "%s*" (.Get 0)) }}
|
||||
{{ $command := .Get 1 }}
|
||||
{{ $options := .Get 2 }}
|
||||
{{ if eq $command "Fit"}}
|
||||
@@ -14,6 +14,12 @@
|
||||
<figure style="width: {{ add $image.Width 3 }}px; padding: 3px; background-color: #cccc">
|
||||
<img src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
|
||||
<figcaption>
|
||||
<small>.{{ $command }} "{{ $options }}"</small>
|
||||
<small>
|
||||
{{ with .Inner }}
|
||||
{{ . }}
|
||||
{{ else }}
|
||||
.{{ $command }} "{{ $options }}"
|
||||
{{ end }}
|
||||
</small>
|
||||
</figcaption>
|
||||
</figure>
|
Reference in New Issue
Block a user