selfprivacy.org/_vendor/github.com/google/docsy/layouts/shortcodes/card.html
2024-04-26 01:15:39 +03:00

48 lines
1.2 KiB
HTML

{{/* 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>