redesign 2023
This commit is contained in:
41
themes/FixIt/layouts/shortcodes/admonition.html
Normal file
41
themes/FixIt/layouts/shortcodes/admonition.html
Normal file
@ -0,0 +1,41 @@
|
||||
{{- $inner := .Inner | .Page.RenderString -}}
|
||||
|
||||
{{- $iconMap := dict "note" "fa-solid fa-pencil-alt fa-fw" -}}
|
||||
{{- $iconMap = dict "abstract" "fa-solid fa-list-ul fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "info" "fa-solid fa-info-circle fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "tip" "fa-solid fa-lightbulb fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "success" "fa-solid fa-check-circle fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "question" "fa-solid fa-question-circle fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "warning" "fa-solid fa-exclamation-triangle fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "failure" "fa-solid fa-times-circle fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "danger" "fa-solid fa-skull-crossbones fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "bug" "fa-solid fa-bug fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "example" "fa-solid fa-list-ol fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "quote" "fa-solid fa-quote-right fa-fw" | merge $iconMap -}}
|
||||
{{- $iconDetails := "fa-solid fa-angle-right fa-fw" -}}
|
||||
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $type := .Get "type" | default "note" -}}
|
||||
<div class="details admonition {{ $type }}{{ if .Get `open` | ne false }} open{{ end }}">
|
||||
<div class="details-summary admonition-title">
|
||||
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}" aria-hidden="true"></i>{{ .Get "title" | .Page.RenderString | default (T (printf "admonition.%v" $type)) }}<i class="details-icon {{ $iconDetails }}" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="details-content">
|
||||
<div class="admonition-content">
|
||||
{{- $inner -}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{- else -}}
|
||||
{{- $type := .Get 0 | default "note" -}}
|
||||
<div class="details admonition {{ $type }}{{ if .Get 2 | ne false }} open{{ end }}">
|
||||
<div class="details-summary admonition-title">
|
||||
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}" aria-hidden="true"></i>{{ .Get 1 | .Page.RenderString | default (T (printf "admonition.%v" $type)) }}<i class="details-icon {{ $iconDetails }}" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="details-content">
|
||||
<div class="admonition-content">
|
||||
{{- $inner -}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{- end -}}
|
8
themes/FixIt/layouts/shortcodes/bilibili.html
Normal file
8
themes/FixIt/layouts/shortcodes/bilibili.html
Normal file
@ -0,0 +1,8 @@
|
||||
<div class="bilibili">
|
||||
{{- if .IsNamedParams -}}
|
||||
<iframe src="//player.bilibili.com/player.html?bvid={{ .Get `id` }}&page={{ .Get `p` | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
|
||||
{{- else -}}
|
||||
<iframe src="//player.bilibili.com/player.html?bvid={{ .Get 0 }}&page={{ .Get 1 | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- /* EOF */ -}}
|
4
themes/FixIt/layouts/shortcodes/center-quote.html
Normal file
4
themes/FixIt/layouts/shortcodes/center-quote.html
Normal file
@ -0,0 +1,4 @@
|
||||
<blockquote class="blockquote-center">
|
||||
{{ .Inner | .Page.RenderString }}
|
||||
</blockquote>
|
||||
{{- /* EOF */ -}}
|
5
themes/FixIt/layouts/shortcodes/details.html
Normal file
5
themes/FixIt/layouts/shortcodes/details.html
Normal file
@ -0,0 +1,5 @@
|
||||
<details>
|
||||
<summary>{{ .Get "summary" | default (.Get 0) | .Page.RenderString }}</summary>
|
||||
{{ .Inner | .Page.RenderString }}
|
||||
</details>
|
||||
{{- /* EOF */ -}}
|
6
themes/FixIt/layouts/shortcodes/echarts.html
Normal file
6
themes/FixIt/layouts/shortcodes/echarts.html
Normal file
@ -0,0 +1,6 @@
|
||||
{{- $content := .Inner | transform.Unmarshal | jsonify -}}
|
||||
{{- $id := dict "Content" $content "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $width := cond .IsNamedParams (.Get "width") (.Get 0) | default "100%" -}}
|
||||
{{- $height := cond .IsNamedParams (.Get "height") (.Get 1) | default "30rem" -}}
|
||||
<div class="echarts" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>
|
||||
{{- .Page.Scratch.SetInMap "this" "echarts" true -}}
|
34
themes/FixIt/layouts/shortcodes/fixit-encryptor.html
Normal file
34
themes/FixIt/layouts/shortcodes/fixit-encryptor.html
Normal file
@ -0,0 +1,34 @@
|
||||
{{- $password := "" -}}
|
||||
{{- $message := "" -}}
|
||||
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $password = .Get "password" | default "" -}}
|
||||
{{- $message = .Get "message" | default (T "single.encryptedMessage") -}}
|
||||
{{- else -}}
|
||||
{{- $password = .Get 0 | default "" -}}
|
||||
{{- $message = .Get 1 | default (T "single.encryptedMessage") -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $password -}}
|
||||
{{- $content := .Inner | .Page.RenderString -}}
|
||||
{{- $saltLen := strings.RuneCount (trim $password "") -}}
|
||||
{{- $saltLen = cond (eq (mod $saltLen 2) 0) (add $saltLen 1) $saltLen -}}
|
||||
{{- $base64EncodeContent := $content | base64Encode -}}
|
||||
{{- $content = printf "%v%v%v"
|
||||
(substr $base64EncodeContent 0 $saltLen)
|
||||
(substr (sha256 $password) $saltLen)
|
||||
(substr $base64EncodeContent $saltLen)
|
||||
-}}
|
||||
|
||||
<fixit-encryptor class="fixit-encryptor-shortcode">
|
||||
<div class="fixit-decryptor-container">
|
||||
<label title='{{ T "single.password" }}'>
|
||||
<input type="password" class="fixit-decryptor-input" placeholder="🔑 {{ $message }}" />
|
||||
</label>
|
||||
</div>
|
||||
<div data-password="{{ md5 $password }}" data-content="{{ $content }}"></div>
|
||||
</fixit-encryptor>
|
||||
{{- .Page.Scratch.SetInMap "this" "encryptPartial" true -}}
|
||||
{{- else -}}
|
||||
{{- .Inner -}}
|
||||
{{- end -}}
|
30
themes/FixIt/layouts/shortcodes/image.html
Normal file
30
themes/FixIt/layouts/shortcodes/image.html
Normal file
@ -0,0 +1,30 @@
|
||||
{{- $options := cond .IsNamedParams (.Get "src") (.Get 0) | dict "Src" -}}
|
||||
{{- $options = cond .IsNamedParams (.Get "alt") (.Get 1) | .Page.RenderString | dict "Alt" | merge $options -}}
|
||||
{{- $caption := cond .IsNamedParams (.Get "caption") (.Get 2) | .Page.RenderString -}}
|
||||
{{- $options = dict "Caption" $caption | merge $options -}}
|
||||
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $options = dict "Title" (.Get "title") | merge $options -}}
|
||||
{{- $options = dict "SrcSmall" (.Get "src_s") | merge $options -}}
|
||||
{{- $options = dict "SrcLarge" (.Get "src_l") | merge $options -}}
|
||||
{{- $options = dict "Height" (.Get "height") | merge $options -}}
|
||||
{{- $options = dict "Width" (.Get "width") | merge $options -}}
|
||||
{{- $options = .Get "linked" | ne false | dict "Linked" | merge $options -}}
|
||||
{{- $options = dict "Rel" (.Get "rel") | merge $options -}}
|
||||
{{- $options = dict "Loading" (.Get "loading") | merge $options -}}
|
||||
{{- else -}}
|
||||
{{- $options = cond $caption true false | dict "Linked" | merge $options -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $options = dict "Resources" .Page.Resources | merge $options -}}
|
||||
|
||||
{{- with $caption -}}
|
||||
<figure{{ with cond $.IsNamedParams ($.Get "class") "" }} class="{{ . }}"{{ end }}>
|
||||
{{- partial "plugin/image.html" $options -}}
|
||||
<figcaption class="image-caption">
|
||||
{{- . | safeHTML -}}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{- else -}}
|
||||
{{- partial "plugin/image.html" $options -}}
|
||||
{{- end -}}
|
20
themes/FixIt/layouts/shortcodes/link.html
Normal file
20
themes/FixIt/layouts/shortcodes/link.html
Normal file
@ -0,0 +1,20 @@
|
||||
{{- $destination := cond .IsNamedParams (.Get "href") (.Get 0) -}}
|
||||
{{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}}
|
||||
{{- $destination = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- $options := dict "Destination" $destination -}}
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $options = dict "Content" (.Get "content") | merge $options -}}
|
||||
{{- $options = dict "Title" (.Get "title") | merge $options -}}
|
||||
{{- $options = dict "Class" (.Get "class") | merge $options -}}
|
||||
{{- $options = dict "Rel" (.Get "rel") | merge $options -}}
|
||||
{{- $options = dict "Download" (.Get "download") | merge $options -}}
|
||||
{{- $options = dict "Card" (.Get "card") | merge $options -}}
|
||||
{{- $options = dict "Noreferrer" (.Get "noreferrer") | merge $options -}}
|
||||
{{- else -}}
|
||||
{{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}}
|
||||
{{- $options = dict "Title" (.Get 2) | merge $options -}}
|
||||
{{- $options = dict "Card" (.Get 3) | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- $options = dict "ExternalIcon" (.Get "external-icon" | default .Site.Params.externalIcon ) | merge $options -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
33
themes/FixIt/layouts/shortcodes/mapbox.html
Normal file
33
themes/FixIt/layouts/shortcodes/mapbox.html
Normal file
@ -0,0 +1,33 @@
|
||||
{{- $mapbox := (.Page.Scratch.Get "params").mapbox | default dict -}}
|
||||
|
||||
{{- $lng := cond .IsNamedParams (.Get "lng") (.Get 0) -}}
|
||||
{{- $lat := cond .IsNamedParams (.Get "lat") (.Get 1) -}}
|
||||
{{- $zoom := cond .IsNamedParams (.Get "zoom") (.Get 2) | default 10 -}}
|
||||
{{- $marked := cond .IsNamedParams (.Get "marked") (.Get 3) | ne false -}}
|
||||
{{- $lightStyle := $mapbox.lightStyle -}}
|
||||
{{- $darkStyle := $mapbox.darkStyle -}}
|
||||
{{- $navigation := $mapbox.navigation -}}
|
||||
{{- $geolocate := $mapbox.geolocate -}}
|
||||
{{- $scale := $mapbox.scale -}}
|
||||
{{- $fullscreen := $mapbox.fullscreen -}}
|
||||
{{- $width := "100%" -}}
|
||||
{{- $height := "20rem" -}}
|
||||
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $lightStyle = .Get "light-style" | default $lightStyle -}}
|
||||
{{- $darkStyle = .Get "dark-style" | default $darkStyle -}}
|
||||
{{- $navigation = .Get "navigation" | ne false | and $navigation -}}
|
||||
{{- $geolocate = .Get "geolocate" | ne false | and $geolocate -}}
|
||||
{{- $scale = .Get "scale" | ne false | and $scale -}}
|
||||
{{- $fullscreen = .Get "fullscreen" | ne false | and $fullscreen -}}
|
||||
{{- $width = .Get "width" | default $width -}}
|
||||
{{- $height = .Get "height" | default $height -}}
|
||||
{{- else -}}
|
||||
{{- $lightStyle = .Get 4 | default $lightStyle -}}
|
||||
{{- $darkStyle = .Get 5 | default $darkStyle -}}
|
||||
{{- end -}}
|
||||
{{- $darkStyle = $darkStyle | default $lightStyle -}}
|
||||
{{- $options := dict "lng" $lng "lat" $lat "zoom" $zoom "marked" $marked "lightStyle" $lightStyle "darkStyle" $darkStyle "geolocate" $geolocate "navigation" $navigation "scale" $scale "fullscreen" $fullscreen -}}
|
||||
{{- $id := dict "Content" $options "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
<div class="mapbox" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>
|
||||
{{- .Page.Scratch.SetInMap "this" "mapbox" true -}}
|
3
themes/FixIt/layouts/shortcodes/mermaid.html
Normal file
3
themes/FixIt/layouts/shortcodes/mermaid.html
Normal file
@ -0,0 +1,3 @@
|
||||
{{- $id := dict "Content" (trim (partial "function/dos2unix.html" .Inner) "\n") "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
<div class="mermaid" id="{{ $id }}"></div>
|
||||
{{- .Page.Scratch.SetInMap "this" "mermaid" true -}}
|
50
themes/FixIt/layouts/shortcodes/music.html
Normal file
50
themes/FixIt/layouts/shortcodes/music.html
Normal file
@ -0,0 +1,50 @@
|
||||
{{- $theme := "#448aff" -}}
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $theme = .Get "theme" | default $theme -}}
|
||||
{{- if .Get "url" -}}
|
||||
{{- $url := .Get "url" -}}
|
||||
{{- with dict "Path" $url "Resources" .Page.Resources | partial "function/resource.html" -}}
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- $cover := .Get "cover" -}}
|
||||
{{- with dict "Path" $cover "Resources" .Page.Resources | partial "function/resource.html" -}}
|
||||
{{- $cover = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<meting-js url="{{ $url }}" name="{{ .Get `name` }}" artist="{{ .Get `artist` }}" cover="{{ $cover }}" theme="{{ $theme }}"
|
||||
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
|
||||
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
|
||||
{{- with .Get "volume" }} volume="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}}
|
||||
></meting-js>
|
||||
{{- else if .Get "auto" -}}
|
||||
<meting-js auto="{{ .Get `auto` }}" theme="{{ $theme }}"
|
||||
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
|
||||
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
|
||||
{{- with .Get "loop" }} loop="{{ . }}"{{ end -}}
|
||||
{{- with .Get "order" }} order="{{ . }}"{{ end -}}
|
||||
{{- with .Get "volume" }} volume="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-folded" }} list-folded="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-max-height" }} list-max-height="{{ . }}"{{ end -}}
|
||||
></meting-js>
|
||||
{{- else -}}
|
||||
<meting-js server="{{ .Get `server` }}" type="{{ .Get `type` }}" id="{{ .Get `id` }}" theme="{{ $theme }}"
|
||||
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
|
||||
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
|
||||
{{- with .Get "loop" }} loop="{{ . }}"{{ end -}}
|
||||
{{- with .Get "order" }} order="{{ . }}"{{ end -}}
|
||||
{{- with .Get "volume" }} volume="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-folded" }} list-folded="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-max-height" }} list-max-height="{{ . }}"{{ end -}}
|
||||
></meting-js>
|
||||
{{- end -}}
|
||||
{{- else if (.Get 0 | urls.Parse).Host -}}
|
||||
<meting-js auto="{{ .Get 0 }}" theme="{{ $theme }}"></meting-js>
|
||||
{{- else -}}
|
||||
<meting-js server="{{ .Get 0 }}" type="{{ .Get 1 }}" id="{{ .Get 2 }}" theme="{{ $theme }}"></meting-js>
|
||||
{{- end -}}
|
||||
{{- .Page.Scratch.SetInMap "this" "music" true -}}
|
3
themes/FixIt/layouts/shortcodes/raw.html
Normal file
3
themes/FixIt/layouts/shortcodes/raw.html
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
{{- $tag := .Get "tag" | default (.Get 0) | default "div" -}}
|
||||
{{- printf `<%v class="fi-row">%v</%v>` $tag .Inner $tag | safeHTML -}}
|
12
themes/FixIt/layouts/shortcodes/reward.html
Normal file
12
themes/FixIt/layouts/shortcodes/reward.html
Normal file
@ -0,0 +1,12 @@
|
||||
{{- $id := dict "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $wechatpay := (.Get "wechatpay") | default (.Get 0) -}}
|
||||
{{- $alipay := (.Get "alipay") | default (.Get 1) -}}
|
||||
{{- $paypal := (.Get "paypal") | default (.Get 2) -}}
|
||||
{{- $bitcoin := (.Get "bitcoin") | default (.Get 3) -}}
|
||||
{{- $author := (.Get "author") | default (.Get 4) | default (.Page.Scratch.Get "author").name -}}
|
||||
{{- $comment := (.Get "comment") | default (.Get 5) -}}
|
||||
{{- $mode := (.Get "mode") | default (.Get 6) -}}
|
||||
{{- $reward := dict "enable" true "comment" $comment "mode" $mode -}}
|
||||
{{- $reward = dict "wechatpay" $wechatpay "alipay" $alipay "paypal" $paypal "bitcoin" $bitcoin | dict "ways" | merge $reward -}}
|
||||
{{- $options := dict "Reward" $reward "Id" $id "Author" $author -}}
|
||||
{{- partial "plugin/reward.html" $options -}}
|
2
themes/FixIt/layouts/shortcodes/script.html
Normal file
2
themes/FixIt/layouts/shortcodes/script.html
Normal file
@ -0,0 +1,2 @@
|
||||
{{- $scriptArr := (.Page.Scratch.Get "this").scriptArr | default slice -}}
|
||||
{{- $scriptArr | append (trim (partial "function/dos2unix.html" .Inner) "\n") | .Page.Scratch.SetInMap "this" "scriptArr" -}}
|
8
themes/FixIt/layouts/shortcodes/style.html
Normal file
8
themes/FixIt/layouts/shortcodes/style.html
Normal file
@ -0,0 +1,8 @@
|
||||
{{- $content := .Inner | .Page.RenderString -}}
|
||||
{{- $id := dict "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $tag := .Get 1 | default "div" -}}
|
||||
{{- printf `<%v id="%v">%v</%v>` $tag $id $content $tag | safeHTML -}}
|
||||
|
||||
{{- $style := .Get 0 | printf "#%v{%v}" $id -}}
|
||||
{{- $styleArr := (.Page.Scratch.Get "this").styleArr | default slice -}}
|
||||
{{- $styleArr | append $style | .Page.Scratch.SetInMap "this" "styleArr" -}}
|
39
themes/FixIt/layouts/shortcodes/typeit.html
Normal file
39
themes/FixIt/layouts/shortcodes/typeit.html
Normal file
@ -0,0 +1,39 @@
|
||||
{{- $content := trim (partial "function/dos2unix.html" .Inner) "\n" -}}
|
||||
{{- $classList := slice -}}
|
||||
{{- with .Get "class" -}}
|
||||
{{- $classList = $classList | append . -}}
|
||||
{{- end -}}
|
||||
{{- $tag := .Get "tag" | default "div" -}}
|
||||
{{- $loop := cond (ne (.Get "group") "") false (.Get "loop") -}}
|
||||
|
||||
{{- if .Get "code" -}}
|
||||
{{- /* highlight code content without line number */ -}}
|
||||
{{- $content = highlight $content (.Get "code") "lineNos=false, noClasses=false" -}}
|
||||
{{- /* delete outer label */ -}}
|
||||
{{- $content = replaceRE `.*<code[^<>]*>(?s)(.*)</code>.*` "$1" $content -}}
|
||||
{{- if .Get "code-link" -}}
|
||||
{{- /* parsing code links */ -}}
|
||||
{{- $content = replaceRE `(<span[^<>]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)(</span>)` "$1$2$6<a href=\"$4\">$3</a>$1$5$6" $content -}}
|
||||
{{- end -}}
|
||||
{{- /* split multiline string */ -}}
|
||||
{{- $content = split $content "\n" -}}
|
||||
{{- $classList = $classList | append "highlight" -}}
|
||||
{{- else -}}
|
||||
{{- $content = $content | .Page.RenderString -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* trim the newline */ -}}
|
||||
{{- $id := dict "Content" $content "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $key := .Get "group" | string | default $id -}}
|
||||
{{- $typeitMap := (.Page.Scratch.Get "this").typeitMap | default dict -}}
|
||||
{{- $group := index $typeitMap $key -}}
|
||||
{{- $group = $group | default slice | append $id -}}
|
||||
{{- dict $key $group | merge $typeitMap | .Page.Scratch.SetInMap "this" "typeitMap" -}}
|
||||
|
||||
{{- $attrs := printf `id="%v"` $id -}}
|
||||
{{- with $classList -}}
|
||||
{{- $attrs = delimit $classList " " | printf `%v class="%v"` $attrs -}}
|
||||
{{- end -}}
|
||||
|
||||
<div class="typeit"{{ if ne $loop "" }} data-loop="{{ $loop }}"{{ end }}>{{ printf `<%v %v></%v>` $tag $attrs $tag | safeHTML }}</div>
|
||||
{{- /* EOF */ -}}
|
14
themes/FixIt/layouts/shortcodes/version.html
Normal file
14
themes/FixIt/layouts/shortcodes/version.html
Normal file
@ -0,0 +1,14 @@
|
||||
{{- $version := .Get 0 -}}
|
||||
{{- $url := printf "https://github.com/hugo-fixit/FixIt/releases/tag/v%v" $version -}}
|
||||
{{- $type := .Get 1 | default "new" | lower -}}
|
||||
{{- $label := T (printf "version.%v" $type) -}}
|
||||
{{- $color := cond (eq $type "changed") "ff9101" "00b1ff" | cond (eq $type "deleted") "ff5252" -}}
|
||||
{{- $pathTemplate := cond .Site.IsMultiLingual (printf "svg/version/%%v-%%v.%v.svg" .Page.Language.Lang) "svg/version/%v-%v.svg" -}}
|
||||
{{- $path := printf $pathTemplate $version $type -}}
|
||||
{{- $resource := resources.Get "svg/version.template.svg" -}}
|
||||
{{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color "isCJK" .Page.Params.IsCJKLanguage) | minify -}}
|
||||
{{- $alt := printf "FixIt %v | %v" $version $label -}}
|
||||
<a href="{{ $url }}" rel="external nofollow noopener noreferrer" target="_blank">
|
||||
{{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}}
|
||||
</a>
|
||||
{{- /* EOF */ -}}
|
Reference in New Issue
Block a user