github.com/rabbouni145/gg@v0.47.1/docs/layouts/shortcodes/datatable-filtered.html (about)

     1  {{ $package := (index .Params 0) }}
     2  {{ $listname := (index .Params 1) }}
     3  {{ $filter := split (index .Params 2) " " }}
     4  {{ $filter1 := index $filter 0 }}
     5  {{ $filter2 := index $filter 1 }}
     6  {{ $filter3 := index $filter 2 }}
     7  
     8  {{ $list := (index (index .Site.Data.docs $package) $listname) }}
     9  {{ $fields := after 3 .Params }}
    10  {{ $list := where $list $filter1 $filter2 $filter3 }}
    11  
    12  <table class="table table-bordered">
    13  	<tr>
    14  		{{ range $fields }}
    15  		<th>{{ . }}</th>
    16  		{{ end }}
    17  	</tr>
    18  	{{ range $list }}
    19  	<tr>
    20  		{{ range $k, $v := . }}
    21  		{{ $.Scratch.Set $k $v }}
    22  		{{ end }}
    23  		{{ range $fields }}
    24  			<td>{{ $.Scratch.Get . }}</td>
    25  		{{ end }}
    26  	</tr>
    27  	{{ end }}
    28  </table>