Merge commit '346b60358dd8ec2ca228e6635bff9d7914b398b7'

This commit is contained in:
Bjørn Erik Pedersen
2025-01-23 09:47:46 +01:00
384 changed files with 3305 additions and 3271 deletions

View File

@@ -10,9 +10,9 @@
}
code {
padding: 0.2em;
padding: 2px 3px;
margin: 0;
font-size: 85%;
font-size: 93.75%;
background-color: rgba(27,31,35,0.05);
border-radius: 3px;
}

View File

@@ -4769,9 +4769,9 @@ h6:hover .header-link {
margin: 0;
}
code {
padding: 0.2em;
padding: 2px 3px;
margin: 0;
font-size: 85%;
font-size: 93.75%;
background-color: rgba(27, 31, 35, .05);
border-radius: 3px;
}

View File

@@ -4,14 +4,14 @@
{{ $data := "" }}
{{ $url := urls.JoinPath "https://api.github.com/users" $author }}
{{ with resources.GetRemote $url }}
{{ with try (resources.GetRemote $url) }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
{{ else with .Value }}
{{ $data = . | transform.Unmarshal }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}
{{ end }}
<div class="tc">

View File

@@ -4,14 +4,14 @@
{{ $data := "" }}
{{ $url := urls.JoinPath "https://api.github.com/users" $author }}
{{ with resources.GetRemote $url }}
{{ with try (resources.GetRemote $url) }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
{{ else with .Value }}
{{ $data = . | transform.Unmarshal }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}
{{ end }}
{{ with $data }}

View File

@@ -11,13 +11,13 @@ Supports CSV, JSON, TOML, YAML, and XML.
{{ $url := . }}
{{ $data := dict }}
{{ with resources.GetRemote $url }}
{{ with try (resources.GetRemote $url) }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
{{ else with .Value }}
{{ $data = .Content | transform.Unmarshal }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}
{{ end }}
{{ return $data }}

View File

@@ -0,0 +1,11 @@
{{- /*
Returns syntax-highlighted code from the given text.
This is useful as a terse way to highlight inline code snippets. Calling the
highlight shortcode for inline snippets is verbose.
*/}}
{{- $code := .Inner | strings.TrimSpace }}
{{- $lang := or (.Get 0) "go" }}
{{- $opts := dict "hl_inline" true "noClasses" true }}
{{- transform.Highlight $code $lang $opts }}

View File

@@ -120,8 +120,8 @@ Renders the given image using the given filter, if any.
{{- $validFilters := slice
"autoorient" "brightness" "colorbalance" "colorize" "contrast" "dither"
"gamma" "gaussianblur" "grayscale" "hue" "invert" "none" "opacity" "overlay"
"padding" "pixelate" "process" "saturation" "sepia" "sigmoid" "text"
"gamma" "gaussianblur" "grayscale" "hue" "invert" "mask" "none" "opacity"
"overlay" "padding" "pixelate" "process" "saturation" "sepia" "sigmoid" "text"
"unsharpmask"
}}
@@ -229,6 +229,12 @@ Renders the given image using the given filter, if any.
{{- $ctx = merge $ctx (dict "argsRequired" 0) }}
{{- template "validate-arg-count" $ctx }}
{{- $f = images.Invert }}
{{- else if eq $filter "mask" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $ctx := dict "src" (index $filterArgs 0) "name" .Name "position" .Position }}
{{- $maskImage := partial "inline/get-resource.html" $ctx }}
{{- $f = images.Mask $maskImage }}
{{- else if eq $filter "opacity" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
@@ -322,11 +328,15 @@ Renders the given image using the given filter, if any.
{{- end }}
{{- /* Render. */}}
{{- $class := "di va b--black-20" }}
{{- if eq $filter "mask" }}
{{- $class = "di va" }}
{{- end }}
{{- if $example }}
<p>Original</p>
<img class='di ba b--black-20' style="width: initial;" src="{{ $i.RelPermalink }}" alt="{{ $alt }}">
<img class="{{ $class}}" style="width: initial;" src="{{ $i.RelPermalink }}" alt="{{ $alt }}">
<p>Processed</p>
<img class='di ba b--black-20' style="width: initial;" src="{{ $fi.RelPermalink }}" alt="{{ $alt }}">
<img class="{{ $class }}" style="width: initial;" src="{{ $fi.RelPermalink }}" alt="{{ $alt }}">
{{- else -}}
<img class='di' style="width: initial;" src="{{ $fi.RelPermalink }}" alt="{{ $alt }}">
{{- end }}
@@ -354,15 +364,15 @@ Renders the given image using the given filter, if any.
{{- $u := urls.Parse .src }}
{{- $msg := "The %q shortcode was unable to resolve %s. See %s" }}
{{- if $u.IsAbs }}
{{- with resources.GetRemote $u.String }}
{{- with try (resources.GetRemote $u.String) }}
{{- with .Err }}
{{- errorf "%s" . }}
{{- else }}
{{- else with .Value }}
{{- /* This is a remote resource. */}}
{{- $r = . }}
{{- else }}
{{- errorf $msg $.name $u.String $.position }}
{{- end }}
{{- else }}
{{- errorf $msg $.name $u.String $.position }}
{{- end }}
{{- else }}
{{- with .page.Resources.Get (strings.TrimPrefix "./" $u.Path) }}