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