mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 15:31:52 +00:00
Support base64 image format
This commit is contained in:
@@ -25,20 +25,21 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- $disableImageOptimizationMD := .Page.Site.Params.disableImageOptimizationMD | default false }}
|
{{- $disableImageOptimizationMD := .Page.Site.Params.disableImageOptimizationMD | default false }}
|
||||||
{{- $url := urls.Parse .Destination }}
|
{{- $urlStr := .Destination | safeURL -}}
|
||||||
|
{{- $url := urls.Parse $urlStr -}}
|
||||||
{{- $altText := .Text }}
|
{{- $altText := .Text }}
|
||||||
{{- $caption := .Title }}
|
{{- $caption := .Title }}
|
||||||
{{- $isRemote := findRE "^https?" $url.Scheme }}
|
{{- $isRemote := findRE "^(https?|data)" $url.Scheme }}
|
||||||
{{- $resource := "" }}
|
{{- $resource := "" }}
|
||||||
|
|
||||||
{{- if not $isRemote }}
|
{{- if not $isRemote }}
|
||||||
{{- $resource = or ($.Page.Resources.GetMatch $url.String) (resources.Get $url.String) }}
|
{{- $resource = or ($.Page.Resources.GetMatch $urlStr) (resources.Get $urlStr) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
<figure>
|
<figure>
|
||||||
{{- if $isRemote }}
|
{{- if $isRemote }}
|
||||||
{{ template "RenderImageSimple" (dict "src" $url.String "alt" $altText) }}
|
{{ template "RenderImageSimple" (dict "src" $urlStr "alt" $altText) }}
|
||||||
{{- else if $resource }}
|
{{- else if $resource }}
|
||||||
{{- $isSVG := eq $resource.MediaType.SubType "svg" }}
|
{{- $isSVG := eq $resource.MediaType.SubType "svg" }}
|
||||||
{{- $shouldOptimize := and (not $disableImageOptimizationMD) (not $isSVG) }}
|
{{- $shouldOptimize := and (not $disableImageOptimizationMD) (not $isSVG) }}
|
||||||
@@ -48,7 +49,7 @@
|
|||||||
{{ template "RenderImageSimple" (dict "src" $resource.RelPermalink "alt" $altText) }}
|
{{ template "RenderImageSimple" (dict "src" $resource.RelPermalink "alt" $altText) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{ template "RenderImageSimple" (dict "src" $url.String "alt" $altText) }}
|
{{ template "RenderImageSimple" (dict "src" $urlStr "alt" $altText) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{ template "RenderImageCaption" (dict "caption" $caption) }}
|
{{ template "RenderImageCaption" (dict "caption" $caption) }}
|
||||||
|
|||||||
Reference in New Issue
Block a user