This repository has been archived by the owner on Dec 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update for minimal-test-theme updates
Signed-off-by: Daniel F. Dickinson <[email protected]>
- Loading branch information
1 parent
3de7025
commit 2ef03f4
Showing
8 changed files
with
166 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
github.com/danielfdickinson/image-handling-mod-demo v0.0.0-20230509133327-e451b1695fa1 h1:5o/znepGEduxv0v7b6zw3nBBPaWnEF2C1mHBuKRN7Aw= | ||
github.com/danielfdickinson/image-handling-mod-demo v0.0.0-20230509133327-e451b1695fa1/go.mod h1:qx251KbyTQVhEg03K8en+fNbFNK4Vq8dmqiqndm98Hg= | ||
github.com/danielfdickinson/image-handling-mod-demo v0.0.0-20230510044803-cd4236a91ee2 h1:VgZz20xxsP9rkG211/0Y8ONXsKNyA6MjFzHASCU2ERs= | ||
github.com/danielfdickinson/image-handling-mod-demo v0.0.0-20230510044803-cd4236a91ee2/go.mod h1:JEHjx5TqNrs7KW89wC2H5ET+I6nTJUyleLi9XhbIfE4= | ||
github.com/danielfdickinson/image-handling-mod-hugo-dfd v0.0.0-20230502185344-ad0d7937d90f/go.mod h1:PKb7pGYDJO23NhRgFAf25DxUqELpEHHidbLBCwte09Y= | ||
github.com/danielfdickinson/image-handling-mod-hugo-dfd v0.0.0-20230510042222-1bce782a3bf0/go.mod h1:PKb7pGYDJO23NhRgFAf25DxUqELpEHHidbLBCwte09Y= | ||
github.com/danielfdickinson/link-handling-mod-hugo-dfd v0.3.3-0.20221028012233-aa14c648c5a2 h1:e1kf4nRllGvzSDz6OvHbfCgoANBGUH95NsOAtNrCAMw= | ||
github.com/danielfdickinson/link-handling-mod-hugo-dfd v0.3.3-0.20221028012233-aa14c648c5a2/go.mod h1:ajYr1qZHU5FJloKLT9rF8jSzKhuv5uSzQ/kA5M1vsY8= | ||
github.com/danielfdickinson/minimal-test-theme-hugo-dfd v0.4.4-0.20230508152613-76634213f5cd/go.mod h1:37XkrDengUFYzMKRN7XU6V3G2AtecY3z+Z0nzQ0Pv20= | ||
github.com/danielfdickinson/minimal-test-theme-hugo-dfd v0.4.4-0.20230510035937-5d1cad314bb2 h1:9cLKZ7vzADUPA7PDlUsSHEJape9mRGJScxEJLieA1kw= | ||
github.com/danielfdickinson/minimal-test-theme-hugo-dfd v0.4.4-0.20230510035937-5d1cad314bb2/go.mod h1:37XkrDengUFYzMKRN7XU6V3G2AtecY3z+Z0nzQ0Pv20= | ||
github.com/danielfdickinson/minimal-test-theme-hugo-dfd v0.4.4-alpha.4 h1:VnJaz6DS8bLIZQwO8R6cdFLsPJIuypka6Qp81les2XY= | ||
github.com/danielfdickinson/minimal-test-theme-hugo-dfd v0.4.4-alpha.4/go.mod h1:3zR5rQ8QliVNkzEuGx8rJeNF9EZ2dCCiDgqPmFAkt1I= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
github.com/danielfdickinson/minimal-test-theme-hugo-dfd v0.4.4-alpha.2 h1:utiFoj5ElToTgjqlGrfxu0TXWRcDK5m9jNbeQxQvqCM= | ||
github.com/danielfdickinson/minimal-test-theme-hugo-dfd v0.4.4-alpha.2/go.mod h1:3zR5rQ8QliVNkzEuGx8rJeNF9EZ2dCCiDgqPmFAkt1I= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
{{- /* Set default values. */}} | ||
{{- $markdownImageLinkClass := .Page.Params.imageMarkdownLinkClass | default .Page.Site.Params.imageMarkdownLinkClass -}} | ||
{{- $markdownImageClass := .Page.Params.imageMarkdownClass | default .Page.Site.Params.imageMarkdownClass -}} | ||
{{- $markdownImageWrapper := .Page.Params.imageMarkdownAddWrapper | default .Page.Site.Params.imageMarkdownAddWrapper -}} | ||
{{- $markdownImageWrapperType := .Page.Params.imageMarkdownWrapperType | default .Page.Site.Params.imageMarkdownWrapperType -}} | ||
{{- $markdownImageOverlayImage := .Page.Params.imageMarkdownOverlayImage | default .Page.Site.Params.imageMarkdownOverlayImage -}} | ||
{{- $markdownImageOverlayText := .Page.Params.imageMarkdownOverlayText | default .Page.Site.Params.imageMarkdownOverlayText -}} | ||
{{- $height := 0 }} | ||
{{- $width := 0 }} | ||
{{- $anchor := "smart" }} | ||
{{- $format := .Page.Site.Params.imageConvertTo | default "webp" }} | ||
{{- $loading := .Page.Params.imageMarkdownLoading | default .Page.Site.Params.imageMarkdownLoading | default "lazy" }} | ||
{{- $method := .Page.Params.imageMarkdownMethod | default .Page.Site.Params.imageMarkdownMethod | default "Resize" }} | ||
{{- $hint := .Page.Params.imageMarkdownHint| default .Page.Site.Params.imageMarkdownHint | default "photo" }} | ||
{{- $quality := .Page.Params.imageMarkdownQuality | default .Page.Site.Params.imageMarkdownQuality | default 90 }} | ||
{{- $rotation := 0 }} | ||
{{- $imageClass := "" }} | ||
{{- $dictionary := "" }} | ||
|
||
{{- /* Define allowable values. */}} | ||
{{- $validAnchors := slice "bottom" "bottomleft" "bottomright" "center" "left" "right" "smart" "top" "topleft" "topright" }} | ||
{{- $validFormats := slice "bmp" "gif" "jpg" "jpeg" "png" "tif" "tiff" "webp" }} | ||
{{- $validMethods := slice "Crop" "Fill" "Fit" "Resize" }} | ||
{{- $validHints := slice "drawing" "icon" "photo" "picture" "text" }} | ||
{{- $validLoading := slice "eager" "lazy" }} | ||
{{- $validWrapperType := slice "div" "picture" "figure" }} | ||
|
||
|
||
{{- /* Parse Query options */}} | ||
{{- $u := urls.Parse .destMap.Destination }} | ||
{{- with $u.Query }} | ||
{{- with .Get "h" }} | ||
{{- $height = int . }} | ||
{{- end }} | ||
{{- with .Get "w" }} | ||
{{- $width = int . }} | ||
{{- end }} | ||
{{- with .Get "a" | lower }} | ||
{{- if in $validAnchors . }} | ||
{{- $anchor = . }} | ||
{{- else }} | ||
{{- errorf "Unable to render image. %q is not a valid anchor. See %s" . $u }} | ||
{{- end }} | ||
{{- end }} | ||
{{- with .Get "f" | lower }} | ||
{{- if in $validFormats . }} | ||
{{- $format = . }} | ||
{{- else }} | ||
{{- errorf "Unable to render image. %q is not a valid format. See %s" . $u }} | ||
{{- end }} | ||
{{- end }} | ||
{{- with .Get "l" | lower }} | ||
{{- if in $validLoading . }} | ||
{{- $loading = . }} | ||
{{- else }} | ||
{{- errorf "Unable to render image. %q is not a valid loading. See %s" . $u }} | ||
{{- end }} | ||
{{- end }} | ||
{{- with .Get "m" | humanize }} | ||
{{- if in $validMethods . }} | ||
{{- $method = . }} | ||
{{- else }} | ||
{{- errorf "Unable to render image. %q is not a valid method. See %s" . $u }} | ||
{{- end }} | ||
{{- end }} | ||
{{- with .Get "r" }} | ||
{{- $rotation = int . }} | ||
{{- end }} | ||
{{- with .Get "wr" | lower -}} | ||
{{- if in $validWrapperType . }} | ||
{{- $markdownImageWrapperType = . -}} | ||
{{- $markdownImageWrapper = true -}} | ||
{{- else }} | ||
{{- errorf "Unable to render image. %q is not a valid wrapper. See %s" . $u }} | ||
{{- end }} | ||
{{- end -}} | ||
{{- if .Has "c" }} | ||
{{- $markdownImageClass = delimit (index . "c") " " | lower }} | ||
{{- end }} | ||
{{- if .Has "i" }} | ||
{{- $imageClass = delimit (index . "i") " " | lower }} | ||
{{- end }} | ||
{{- with .Get "q" }} | ||
{{- $quality = int . -}} | ||
{{- end }} | ||
{{- with .Get "hi" | lower }} | ||
{{- if in $validHints . }} | ||
{{- $hint = . }} | ||
{{- else }} | ||
{{- errorf "Unable to render image. %q is not a valid hint. See %s" . $u }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
|
||
{{- $image := partial "helpers/lib/image-handling/find-image-src" (dict "destMap" .destMap "page" .Page "getRelative" true "ignoreBundleAssets" false) -}} | ||
{{- $dictionary = (dict "alt" .Text "altRendered" true "title" .Title "image" $image "page" .Page "rotation" $rotation "noImageWrapper" (not $markdownImageWrapper) "linkClass" $markdownImageLinkClass "class" $markdownImageClass "imageOverlay" $markdownImageOverlayImage "textOverlay" $markdownImageOverlayText "convertTo" $format "loading" $loading "imageConvertMethod" $method "quality" $quality) -}} | ||
{{- /* Adding width and height */ -}} | ||
{{- if and $width $height }} | ||
{{- $dictionary = merge $dictionary (dict "width" $width "height" $height) -}} | ||
{{- else if and $width (not $height) }} | ||
{{- $dictionary = merge $dictionary (dict "width" $width) -}} | ||
{{- else if and $height (not $width) }} | ||
{{- $dictionary = merge $dictionary (dict "height" $height ) -}} | ||
{{- else }} | ||
{{- $dictionary = merge $dictionary (dict "width" $image.Width "height" $image.Height) }} | ||
{{- end }} | ||
{{- /* Adding anchor */ -}} | ||
{{- if $anchor }} | ||
{{- if or (eq $method "Crop") (eq $method "Fill")}} | ||
{{- $dictionary = merge $dictionary (dict "anchor" $anchor) -}} | ||
{{- end -}} | ||
{{- end }} | ||
{{- /* Adding image wrapper */ -}} | ||
{{- if ne $markdownImageWrapperType "" }} | ||
{{- $dictionary = merge $dictionary (dict "imageWrapper" $markdownImageWrapperType) -}} | ||
{{- end }} | ||
{{- /* Adding image class */ -}} | ||
{{- if ne $imageClass "" }} | ||
{{- $dictionary = merge $dictionary (dict "imageClass" $imageClass) -}} | ||
{{- end }} | ||
{{- /* Adding convert preset */ -}} | ||
{{- if $hint }} | ||
{{- $dictionary = merge $dictionary (dict "hint" $hint) -}} | ||
{{- end }} | ||
{{- /* Calling image wrapper */ -}} | ||
{{- partial "helpers/wrapped-image" $dictionary -}} | ||
|
||
{{- /* Remove trailing newlines */ -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters