diff --git a/exampleSite/content/_index.pir.md b/exampleSite/content/_index.pir.md index 4881ae4880..f42f796d82 100644 --- a/exampleSite/content/_index.pir.md +++ b/exampleSite/content/_index.pir.md @@ -2,4 +2,4 @@ archetype = "home" title = "Cap'n Hugo Relearrrn Theme" +++ -{{< piratify >}} \ No newline at end of file +{{< piratify true >}} \ No newline at end of file diff --git a/exampleSite/content/shortcodes/math.pir.md b/exampleSite/content/shortcodes/math.pir.md index aa47f52307..2773a02319 100644 --- a/exampleSite/content/shortcodes/math.pir.md +++ b/exampleSite/content/shortcodes/math.pir.md @@ -2,4 +2,4 @@ descrption = "Beaut'fl math and chemical formulae" title = "Math" +++ -{{< piratify >}} \ No newline at end of file +{{< piratify true >}} \ No newline at end of file diff --git a/exampleSite/content/shortcodes/mermaid.pir.md b/exampleSite/content/shortcodes/mermaid.pir.md index 5f20eab4fe..6d8752b78b 100644 --- a/exampleSite/content/shortcodes/mermaid.pir.md +++ b/exampleSite/content/shortcodes/mermaid.pir.md @@ -2,4 +2,4 @@ descrption = "Generrrat'n o' diagrrram an' flowcharrrt frrrom text 'n a similar manner as Marrrkdown" title = "Merrrmaid" +++ -{{< piratify >}} \ No newline at end of file +{{< piratify true >}} \ No newline at end of file diff --git a/exampleSite/content/shortcodes/swagger/_index.pir.md b/exampleSite/content/shortcodes/swagger/_index.pir.md index c3216dbf3e..ec5060fd05 100644 --- a/exampleSite/content/shortcodes/swagger/_index.pir.md +++ b/exampleSite/content/shortcodes/swagger/_index.pir.md @@ -2,4 +2,4 @@ description: "Adds UI fer yer Swaggerrr / OpenAPI Specificat'ns" title: "Swaggerrr" --- -{{< piratify >}} \ No newline at end of file +{{< piratify true >}} \ No newline at end of file diff --git a/exampleSite/layouts/partials/shortcodes/piratify.html b/exampleSite/layouts/partials/shortcodes/piratify.html index b65a8c34a2..c983805691 100644 --- a/exampleSite/layouts/partials/shortcodes/piratify.html +++ b/exampleSite/layouts/partials/shortcodes/piratify.html @@ -1,7 +1,7 @@ {{- $context := .context }} {{- $content := .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" }} {{- $langsrc := cond (eq $context.Page.Lang $langtrg) (.langsrc | default "en") $context.Page.Lang }} {{- $baseURL := urls.Parse site.BaseURL }} @@ -25,7 +25,7 @@ {{- if $writenotice }} {{- partial "shortcodes/notice.html" (dict "context" . - "content" "
Fello' pirrrates, wrrrit'n are not fer us as yer can see! Also be awarrre some stuff may not work in this trrranslat'n. Like see'n Merrrmaids, do'n math or chemistrrry and stuff.
\n" + "content" "Fello' pirrrates, grog made us dizzy! Be awarrre some stuff may not work in this trrranslat'n. Like see'n Merrrmaids, do'n math or chemistrrry, writ'n docs and stuff.
\n" "icon" "skull-crossbones" "style" "warning" "title" "Arrr! Pirrrates" @@ -119,6 +119,6 @@ {{- if (int (len $l)) }} {{- $c = replaceRE "(src|href)=\"(images/[^\"]*?\")" (printf "${1}=\"%s${2}" $l) $c }} {{- end }} - {{- $c = replaceRE "(src|href)=\"([^\"]*?)/pir/([^\"]*?.files/[^\"]*?\")" "${1}=\"${2}/${3}" $c }} + {{- $c = replaceRE (printf "(src|href)=\"([^\"]*?)/%s/([^\"]*?.files/[^\"]*?\")" $langtrg) "${1}=\"${2}/${3}" $c }} {{- end }} {{ $c | safeHTML }} \ No newline at end of file diff --git a/exampleSite/layouts/shortcodes/piratify.html b/exampleSite/layouts/shortcodes/piratify.html index b652908498..f9cf6c7f85 100644 --- a/exampleSite/layouts/shortcodes/piratify.html +++ b/exampleSite/layouts/shortcodes/piratify.html @@ -1,4 +1,5 @@ {{- partial "shortcodes/piratify.html" (dict - "context" . - "pagefield" "Content" + "context" . + "pagefield" "Content" + "writenotice" (.Get "writenotice" | default (.Get 0)) ) }} \ No newline at end of file