piratify: reduce reader warnings #496

This commit is contained in:
Sören Weber 2023-02-10 17:30:41 +01:00
parent 7252f82bb6
commit 243bede83d
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
6 changed files with 10 additions and 9 deletions

View file

@ -2,4 +2,4 @@
archetype = "home" archetype = "home"
title = "Cap'n Hugo Relearrrn Theme" title = "Cap'n Hugo Relearrrn Theme"
+++ +++
{{< piratify >}} {{< piratify true >}}

View file

@ -2,4 +2,4 @@
descrption = "Beaut'fl math and chemical formulae" descrption = "Beaut'fl math and chemical formulae"
title = "Math" title = "Math"
+++ +++
{{< piratify >}} {{< piratify true >}}

View file

@ -2,4 +2,4 @@
descrption = "Generrrat'n o' diagrrram an' flowcharrrt frrrom text 'n a similar manner as Marrrkdown" descrption = "Generrrat'n o' diagrrram an' flowcharrrt frrrom text 'n a similar manner as Marrrkdown"
title = "Merrrmaid" title = "Merrrmaid"
+++ +++
{{< piratify >}} {{< piratify true >}}

View file

@ -2,4 +2,4 @@
description: "Adds UI fer yer Swaggerrr / OpenAPI Specificat'ns" description: "Adds UI fer yer Swaggerrr / OpenAPI Specificat'ns"
title: "Swaggerrr" title: "Swaggerrr"
--- ---
{{< piratify >}} {{< piratify true >}}

View file

@ -1,7 +1,7 @@
{{- $context := .context }} {{- $context := .context }}
{{- $content := .content }} {{- $content := .content }}
{{- $pagefield := cond (ne $content nil) nil (.pagefield | default "Content") }} {{- $pagefield := cond (ne $content nil) nil (.pagefield | default "Content") }}
{{- $writenotice := cond (ne $content nil) false (cond (eq $pagefield "Content") true false) }} {{- $writenotice := cond (ne .writenotice nil) .writenotice false }}
{{- $langtrg := "pir" }} {{- $langtrg := "pir" }}
{{- $langsrc := cond (eq $context.Page.Lang $langtrg) (.langsrc | default "en") $context.Page.Lang }} {{- $langsrc := cond (eq $context.Page.Lang $langtrg) (.langsrc | default "en") $context.Page.Lang }}
{{- $baseURL := urls.Parse site.BaseURL }} {{- $baseURL := urls.Parse site.BaseURL }}
@ -25,7 +25,7 @@
{{- if $writenotice }} {{- if $writenotice }}
{{- partial "shortcodes/notice.html" (dict {{- partial "shortcodes/notice.html" (dict
"context" . "context" .
"content" "<p>Fello' pirrrates, wrrrit'n are not fer us as yer can see! Also be awarrre <b>some stuff may not work</b> in this trrranslat'n. Like see'n <b>Merrrmaids</b>, do'n <b>math or chemistrrry</b> and stuff.</p>\n" "content" "<p>Fello' pirrrates, grog made us dizzy! Be awarrre <b>some stuff may not work</b> in this trrranslat'n. Like see'n <b>Merrrmaids</b>, do'n <b>math or chemistrrry</b>, writ'n docs and stuff.</p>\n"
"icon" "skull-crossbones" "icon" "skull-crossbones"
"style" "warning" "style" "warning"
"title" "Arrr! Pirrrates" "title" "Arrr! Pirrrates"
@ -119,6 +119,6 @@
{{- if (int (len $l)) }} {{- if (int (len $l)) }}
{{- $c = replaceRE "(src|href)=\"(images/[^\"]*?\")" (printf "${1}=\"%s${2}" $l) $c }} {{- $c = replaceRE "(src|href)=\"(images/[^\"]*?\")" (printf "${1}=\"%s${2}" $l) $c }}
{{- end }} {{- end }}
{{- $c = replaceRE "(src|href)=\"([^\"]*?)/pir/([^\"]*?.files/[^\"]*?\")" "${1}=\"${2}/${3}" $c }} {{- $c = replaceRE (printf "(src|href)=\"([^\"]*?)/%s/([^\"]*?.files/[^\"]*?\")" $langtrg) "${1}=\"${2}/${3}" $c }}
{{- end }} {{- end }}
{{ $c | safeHTML }} {{ $c | safeHTML }}

View file

@ -1,4 +1,5 @@
{{- partial "shortcodes/piratify.html" (dict {{- partial "shortcodes/piratify.html" (dict
"context" . "context" .
"pagefield" "Content" "pagefield" "Content"
"writenotice" (.Get "writenotice" | default (.Get 0))
) }} ) }}