107 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			107 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| {{ $alt := .alt }}
 | |
| {{ $class := .class }}
 | |
| {{ $crossorigin := .crossorigin | default "anonymous" }}
 | |
| {{ $fetchpriority := .fetchpriority }}
 | |
| {{ $fingerprint := .fingerprint | default true }}
 | |
| {{ $height := .height }}
 | |
| {{ $loading := .loading | default "lazy" }}
 | |
| {{ $maxheight := .maxheight }}
 | |
| {{ $maxwidth := .maxwidth }}
 | |
| {{ $method := .method }}
 | |
| {{ $options := .options }}
 | |
| {{ $page := .page }}
 | |
| {{ $raw := .raw }}
 | |
| {{ $referrerpolicy := .referrerpolicy | default "no-referrer" }}
 | |
| {{ $resource := .resource }}
 | |
| {{ $src := .src }}
 | |
| {{ $style := .style }}
 | |
| {{ $title := .title }}
 | |
| {{ $width := .width }}
 | |
| 
 | |
| {{ $intrinsicheight := $height }}
 | |
| {{ $intrinsicwidth := $width }}
 | |
| 
 | |
| {{ if $raw }}
 | |
|     {{ $src = relLangURL $src }}
 | |
| {{ else }}
 | |
|     {{ if not $resource }}
 | |
|         {{ $resource = partial "paige/func-resource.html" (dict
 | |
|             "page" $page
 | |
|             "url" (relLangURL $src)
 | |
|         ) }}
 | |
|     {{ end }}
 | |
| 
 | |
|     {{ if and $method $options }}
 | |
|         {{ if eq $method "crop" }}
 | |
|             {{ $resource = $resource.Crop $options }}
 | |
|         {{ else if eq $method "fill" }}
 | |
|             {{ $resource = $resource.Fill $options }}
 | |
|         {{ else if eq $method "fit" }}
 | |
|             {{ $resource = $resource.Fit $options }}
 | |
|         {{ else if eq $method "resize" }}
 | |
|             {{ $resource = $resource.Resize $options }}
 | |
|         {{ else }}
 | |
|             {{ errorf "invalid method: %q" $method }}
 | |
|         {{ end }}
 | |
|     {{ end }}
 | |
| 
 | |
|     {{ $intrinsicheight = $resource.Height }}
 | |
|     {{ $intrinsicwidth = $resource.Width }}
 | |
| 
 | |
|     {{ if $fingerprint }}
 | |
|         {{ $resource = $resource | fingerprint }}
 | |
|     {{ end }}
 | |
| 
 | |
|     {{ $src = $resource.RelPermalink }}
 | |
| {{ end }}
 | |
| 
 | |
| {{ if and (or $height $maxheight) (not (or $maxwidth $width)) }}
 | |
|     {{ $width = "auto" }}
 | |
| {{ end }}
 | |
| 
 | |
| {{ if and (or $maxwidth $width) (not (or $height $maxheight)) }}
 | |
|     {{ $height = "auto" }}
 | |
| {{ end }}
 | |
| 
 | |
| {{ if $height }}
 | |
|     {{ with printf "height: %v" $height }}
 | |
|         {{ if $style }}
 | |
|             {{ $style = printf "%v; %v" $style . }}
 | |
|         {{ else }}
 | |
|             {{ $style = . }}
 | |
|         {{ end }}
 | |
|     {{ end }}
 | |
| {{ end }}
 | |
| 
 | |
| {{ if $maxheight }}
 | |
|     {{ with printf "max-height: %v" $maxheight }}
 | |
|         {{ if $style }}
 | |
|             {{ $style = printf "%v; %v" $style . }}
 | |
|         {{ else }}
 | |
|             {{ $style = . }}
 | |
|         {{ end }}
 | |
|     {{ end }}
 | |
| {{ end }}
 | |
| 
 | |
| {{ if $maxwidth }}
 | |
|     {{ with printf "max-width: %v" $maxwidth }}
 | |
|         {{ if $style }}
 | |
|             {{ $style = printf "%v; %v" $style . }}
 | |
|         {{ else }}
 | |
|             {{ $style = . }}
 | |
|         {{ end }}
 | |
|     {{ end }}
 | |
| {{ end }}
 | |
| 
 | |
| {{ if $width }}
 | |
|     {{ with printf "width: %v" $width }}
 | |
|         {{ if $style }}
 | |
|             {{ $style = printf "%v; %v" $style . }}
 | |
|         {{ else }}
 | |
|             {{ $style = . }}
 | |
|         {{ end }}
 | |
|     {{ end }}
 | |
| {{ end }}
 | |
| 
 | |
| <img {{ with $alt }} alt="{{ . }}" {{ end }} {{ with $class }} class="{{ . }}" {{ end }} crossorigin="{{ $crossorigin }}" {{ with $fetchpriority }} fetchpriority="{{ . }}" {{ end }} {{ with $intrinsicheight }} height="{{ . }}" {{ end }} loading="{{ $loading }}" referrerpolicy="{{ $referrerpolicy }}" src="{{ $src }}" {{ with $style }} style="{{ . | safeCSS }}" {{ end }} {{ with $title }} title="{{ . }}" {{ end }} {{ with $intrinsicwidth }} width="{{ . }}" {{ end }}>
 |