Remove raw param

master
Will Faught 2 years ago
parent a2477daa5a
commit 693fe4b088

@ -315,7 +315,6 @@ paige:
image:
alt: "" # Image alt
height: "" # CSS unit; image height
raw: false # Do not copy the file
stretch: false # Stretch the image fully horizontally if true; center the image otherwise
url: "" # Local or remote resource glob
width: "" # CSS unit; image width
@ -456,7 +455,6 @@ The `paige/image` shortcode provides a figure with an image.
maxwidth="10rem"
method="resize"
options="550x webp picture Lanczos"
raw=false
src="me.jpg"
title="My title"
width="10rem"
@ -482,8 +480,6 @@ Parameters:
<dd>Optional. String. Hugo image processing method. Must be <code>crop</code>, <code>fill</code>, <code>fit</code>, or <code>resize</code>. Must be specified with <code>options</code>. See the <a href="https://gohugo.io/content-management/image-processing/#image-processing-methods">methods</a>.</dd>
<dt><code>options</code></dt>
<dd>Optional. String. Hugo image processing options. Must be specified with <code>method</code>. See the <a href="https://gohugo.io/content-management/image-processing/#image-processing-options">options</a>.</dd>
<dt><code>raw</code></dt>
<dd>Optional. Boolean. Whether to reference an image without copying it. Default is <code>false</code>.</dd>
<dt><code>src</code></dt>
<dd>Required. Position 0. String. URL. Image source.</dd>
<dt><code>title</code></dt>

@ -8,7 +8,6 @@ paige:
blurb: "This is the blurb."
greeting: "This is the greeting"
image:
raw: false
stretch: false
url: "landscape.webp"
main:
@ -126,7 +125,6 @@ paige:
blurb: "This is the blurb."
greeting: "This is the greeting"
image:
raw: false
stretch: false
url: "landscape.webp"
main:

@ -83,30 +83,6 @@ Result:
{{< paige/image link="https://github.com/willfaught/paige" method="resize" options="550x webp picture Lanczos" src="landscape.webp" >}}
## Raw parameter
Code:
```go-text-template
{{</* paige/image raw=false src="https://picsum.photos/1296/600.webp" */>}}
```
Result:
{{< paige/image raw=false src="https://picsum.photos/1296/600.webp" >}}
---
Code:
```go-text-template
{{</* paige/image raw=true src="https://picsum.photos/1296/600.webp" */>}}
```
Result:
{{< paige/image raw=true src="https://picsum.photos/1296/600.webp" >}}
## Src parameter
Code:

@ -22,7 +22,6 @@
"fetchpriority" "high"
"loading" "eager"
"page" $page
"raw" $page.Params.paige.home.image.raw
"src" $page.Params.paige.home.image.url
"style" $style
) }}

@ -12,7 +12,6 @@
{{ $method := $params.method }}
{{ $options := $params.options }}
{{ $page := $params.page }}
{{ $raw := $params.raw }}
{{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }}
{{ $resource := $params.resource }}
{{ $src := $params.src }}
@ -27,16 +26,14 @@
{{ $intrinsicheight := $height }}
{{ $intrinsicwidth := $width }}
{{ if $raw }}
{{ $src = relLangURL $src }}
{{ else }}
{{ if not $resource }}
{{ $resource = partial "paige/resource.html" (dict
"page" $page
"url" $src
) }}
{{ end }}
{{ if not $resource }}
{{ $resource = partial "paige/resource.html" (dict
"page" $page
"url" $src
) }}
{{ end }}
{{ with $resource }}
{{ if and $method $options }}
{{ if eq $method "crop" }}
{{ $resource = $resource.Crop $options }}
@ -59,6 +56,8 @@
{{ end }}
{{ $src = $resource.RelPermalink }}
{{ else }}
{{ $src = relLangURL $src }}
{{ end }}
{{ if and (or $height $maxheight) (not (or $maxwidth $width)) }}

@ -7,7 +7,6 @@
{{ $integrity := $params.integrity }}
{{ $outputstyle := cond hugo.IsProduction "compressed" "" }}
{{ $page := $params.page }}
{{ $raw := $params.raw }}
{{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }}
{{ $sass := $params.sass }}
@ -15,13 +14,8 @@
{{ errorf "paige/link: no href" }}
{{ end }}
{{ if not $raw }}
{{ $resource := partial "paige/resource.html" (dict
"page" $page
"url" $href
) }}
{{ $resource = resources.ExecuteAsTemplate $href (or $page dict) $resource }}
{{ with partial "paige/resource.html" (dict "page" $page "url" $href) }}
{{ $resource := resources.ExecuteAsTemplate $href (or $page dict) . }}
{{ if $sass }}
{{ $resource = $resource | toCSS (dict
@ -34,6 +28,8 @@
{{ $resource = $resource | minify | fingerprint }}
{{ $href = $resource.RelPermalink }}
{{ $integrity = $resource.Data.Integrity }}
{{ else }}
{{ $href = relLangURL $href }}
{{ end }}
<link {{ with $crossorigin }} crossorigin="{{ . }}" {{ end }} href="{{ $href | safeURL }}" {{ with $integrity }} integrity="{{ . }}" {{ end }} {{ with $referrerpolicy }} referrerpolicy="{{ . }}" {{ end }} rel="stylesheet">

@ -35,8 +35,4 @@
{{ end }}
{{ end }}
{{ if not $result }}
{{ errorf "paige/resource: invalid resource: %q" $url }}
{{ end }}
{{ return $result }}

@ -6,23 +6,18 @@
{{ $onload := $params.onload | safeJS }}
{{ $page := $params.page }}
{{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }}
{{ $raw := $params.raw }}
{{ $src := $params.src }}
{{ if not $src }}
{{ errorf "paige/script: no src" }}
{{ end }}
{{ if $raw }}
{{ $src = $src }}
{{ else }}
{{ $resource := (partial "paige/resource.html" (dict
"page" $page
"url" $src
)) | minify | fingerprint }}
{{ with partial "paige/resource.html" (dict "page" $page "url" $src) }}
{{ $resource := . | minify | fingerprint }}
{{ $integrity = $resource.Data.Integrity }}
{{ $src = $resource.RelPermalink }}
{{ else }}
{{ $href = relLangURL $href }}
{{ end }}
<script {{ with $crossorigin }} crossorigin="{{ . }}" {{ end }} {{ with $defer }} defer {{ end }} integrity="{{ $integrity }}" {{ with $onload }} onload="{{ . }}" {{ end }} {{ with $referrerpolicy }} referrerpolicy="{{ . }}" {{ end }} src="{{ $src | safeURL }}"></script>

@ -5,7 +5,6 @@
{{ $maxwidth := .Get "maxwidth" }}
{{ $method := .Get "method" }}
{{ $options := .Get "options" }}
{{ $raw := .Get "raw" }}
{{ $src := .Get 0 | default (.Get "src") }}
{{ $title := .Get "title" }}
{{ $width := .Get "width" }}
@ -23,7 +22,6 @@
"method" $method
"options" $options
"page" .Page
"raw" $raw
"src" $src
"title" $title
"width" $width

Loading…
Cancel
Save