LoveIt/layouts/partials/function/icon.html
2020-02-17 21:31:53 +08:00

23 lines
833 B
HTML

{{- $type := index . "type" | default "fa" -}}
{{- $classList := split (index . "class") " " -}}
{{- $scratch := index . "scratch" -}}
{{- /* Font Awesome */ -}}
{{- if eq $type "fa" -}}
<i class="{{ delimit $classList ` ` }}"></i>
{{- /* Fork Awesome */ -}}
{{- else if eq $type "fo" -}}
{{- $newClassList := slice -}}
{{- range $classList -}}
{{- if eq . "fa" -}}
{{- $newClassList = $newClassList | append "fo" -}}
{{- else -}}
{{- $newClassList = $newClassList | append (replaceRE `^fa\-(.+)$` `fo-$1` .) -}}
{{- end -}}
{{- end -}}
<i class="{{ delimit $newClassList ` ` }}"></i>
{{- $scratch.Set "forkawesome" true -}}
{{- /* Others */ -}}
{{- else -}}
<i class="{{ delimit $classList ` ` }}"></i>
{{- $scratch.Set "iconfont" true -}}
{{- end -}}