forked from google/docsy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcard.html
47 lines (45 loc) · 1.18 KB
/
card.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
35
36
37
38
39
40
41
42
43
44
45
46
47
{{/* Check parameter type */ -}}
{{ $code := false -}}
{{ with .Get "code" -}}
{{ $type := printf "%T" . -}}
{{ if ne $type "bool" -}}
{{ errorf `shortcode 'card': boolean value expected for parameter 'code', but got %s` $type -}}
{{ else }}
{{ $code = . -}}
{{ end -}}
{{ end -}}
{{ $lang := default "" (.Get "lang") -}}
{{ $highlight := default "" (.Get "highlight") -}}
<div class="td-card card border me-4">
{{ with $.Get "header" -}}
<div class="card-header{{- cond $code " bg-white" "" -}}">
{{ . | markdownify }}
</div>
{{ end -}}
<div class="card-body{{- cond $code " code p-0 m-0" "" -}}">
{{ with $.Get "title" -}}
<h5 class="card-title">
{{ . | markdownify -}}
</h5>
{{ end -}}
{{ with $.Get "subtitle" -}}
<h6 class="card-title ms-2 text-muted">
{{ . | markdownify -}}
</h6>
{{ end -}}
{{ with $.Inner -}}
{{ if $code -}}
{{ highlight . $lang $highlight -}}
{{ else -}}
<p class="card-text">
{{ . -}}
</p>
{{ end -}}
{{ end -}}
</div>
{{ with $.Get "footer" -}}
<div class="card-footer">
{{ . | markdownify -}}
</div>
{{ end -}}
</div>