attachments: streamline icon parameter with button shortcode #240

This commit is contained in:
Sören Weber 2022-05-29 10:04:06 +02:00
parent 4da5114388
commit 4b79d36155
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589

View file

@ -10,10 +10,13 @@
{{- if eq $style "tip" }}{{ $icon = default "lightbulb" }}{{ end }} {{- if eq $style "tip" }}{{ $icon = default "lightbulb" }}{{ end }}
{{- end }} {{- end }}
{{- $icon = trim $icon " " }} {{- $icon = trim $icon " " }}
{{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
{{- end }}
{{- $sort := .Get "sort" | default "asc" }} {{- $sort := .Get "sort" | default "asc" }}
{{- $pattern := .Get "pattern" | default "" }} {{- $pattern := .Get "pattern" | default "" }}
<div class="box attachments {{ $style }}"> <div class="box attachments cstyle {{ $style }}">
<div class="box-label">{{ if $icon }}<i class="fas fa-{{ $icon }} fa-fw"></i> {{ end }}{{ $title }}</div> <div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i> {{ end }}{{ $title }}</div>
<ul class="box-content attachments-files"> <ul class="box-content attachments-files">
{{- $filesName := "files" }} {{- $filesName := "files" }}
{{- if ne .Page.File.BaseFileName "index" }} {{- if ne .Page.File.BaseFileName "index" }}