github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/doc/themes/docsy/layouts/shortcodes/tab.html (about)

     1  <!-- Make sure that we are enclosed within a tabpane shortcode block -->
     2  {{ with $.Parent }}
     3  {{- if ne $.Parent.Name "tabpane" -}}
     4  {{- errorf "tab must be used within a tabpane block" -}}
     5  {{- end -}}
     6  {{- end -}}
     7  
     8  <!-- Prefill header if not given as parameter -->
     9  {{ $header := default (printf "Tab %v" ( add $.Ordinal 1)) (.Get "header") }}
    10  
    11  <!-- store all tab info in dict tab -->
    12  {{ $tab := dict "header" $header }}
    13  {{ with $.Get "lang" }}
    14  {{ $tab = merge $tab (dict "language" ($.Get "lang")) }}
    15  {{ end }}
    16  {{ with $.Get "highlight" }}
    17  {{ $tab = merge $tab (dict "highlight" ($.Get "highlight")) }}
    18  {{ end }}
    19  {{ with $.Inner }}
    20  <!-- Trim any leading and trailing newlines from .Inner, this avoids
    21       spurious lines during syntax highlighting -->
    22  {{ $tab = merge $tab (dict "content" (trim $.Inner "\n")) }}
    23  {{ end }}
    24  
    25  <!-- add dict tab to parent's scratchpad -->
    26  {{ with .Parent }}
    27  {{- $.Parent.Scratch.SetInMap "tabs" (printf "%v" $.Ordinal) $tab -}}
    28  {{ end }}