Back to Meshery

List

docs/layouts/models/list.html

1.0.301.2 KB
Original Source

{{ define "main" }} {{ .Content }} {{ $currentSection := .Section }} {{ $models := where site.RegularPages "Section" $currentSection }} {{ $modelPages := slice }} {{ $modelGroups := newScratch }} {{ $groupOrder := slice "#" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" }} {{ range sort $models "Title" }} {{ if and (ne .Kind "section") (strings.Contains .File.Dir "/models/") }} {{ $modelPages = $modelPages | append . }} {{ $groupKey := "#" }} {{ $firstCharacter := upper (substr .Title 0 1) }} {{ if gt (len (findRE "^[A-Z]" $firstCharacter)) 0 }} {{ $groupKey = $firstCharacter }} {{ end }} {{ $existingGroup := $modelGroups.Get $groupKey }} {{ if $existingGroup }} {{ $modelGroups.Set $groupKey ($existingGroup | append .) }} {{ else }} {{ $modelGroups.Set $groupKey (slice .) }} {{ end }} {{ end }} {{ end }} {{ if gt (len $modelPages) 0 }}

{{ range $group := $groupOrder }} {{ with $modelGroups.Get $group }}

{{ if eq $group "#" }}0-9 and Symbols{{ else }}{{ $group }}{{ end }}

{{ range . }} - {{ .Title }} {{ end }}

Back to Top

{{ end }} {{ end }} {{ end }} {{ end }}