2024-04-25 22:15:39 +00:00
|
|
|
{{/* 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 }}
|
2024-04-21 23:04:16 +00:00
|
|
|
</div>
|
2024-04-25 22:15:39 +00:00
|
|
|
{{ end -}}
|
|
|
|
<div class="card-body{{- cond $code " code p-0 m-0" "" -}}">
|
|
|
|
{{ with $.Get "title" -}}
|
2024-04-21 23:04:16 +00:00
|
|
|
<h5 class="card-title">
|
2024-04-25 22:15:39 +00:00
|
|
|
{{ . | markdownify -}}
|
2024-04-21 23:04:16 +00:00
|
|
|
</h5>
|
2024-04-25 22:15:39 +00:00
|
|
|
{{ end -}}
|
|
|
|
{{ with $.Get "subtitle" -}}
|
|
|
|
<h6 class="card-title ms-2 text-muted">
|
|
|
|
{{ . | markdownify -}}
|
2024-04-21 23:04:16 +00:00
|
|
|
</h6>
|
2024-04-25 22:15:39 +00:00
|
|
|
{{ end -}}
|
|
|
|
{{ with $.Inner -}}
|
|
|
|
{{ if $code -}}
|
|
|
|
{{ highlight . $lang $highlight -}}
|
|
|
|
{{ else -}}
|
2024-04-21 23:04:16 +00:00
|
|
|
<p class="card-text">
|
2024-04-25 22:15:39 +00:00
|
|
|
{{ . -}}
|
2024-04-21 23:04:16 +00:00
|
|
|
</p>
|
2024-04-25 22:15:39 +00:00
|
|
|
{{ end -}}
|
|
|
|
{{ end -}}
|
2024-04-21 23:04:16 +00:00
|
|
|
</div>
|
2024-04-25 22:15:39 +00:00
|
|
|
{{ with $.Get "footer" -}}
|
2024-04-21 23:04:16 +00:00
|
|
|
<div class="card-footer">
|
2024-04-25 22:15:39 +00:00
|
|
|
{{ . | markdownify -}}
|
2024-04-21 23:04:16 +00:00
|
|
|
</div>
|
2024-04-25 22:15:39 +00:00
|
|
|
{{ end -}}
|
2024-04-21 23:04:16 +00:00
|
|
|
</div>
|