From 09ffd597a17877e8a8d41805bc7370e6d72a0307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Thu, 27 Jul 2023 16:11:46 +0200 Subject: [PATCH] piratify: support for shortcodes math, mermaid and openapi #596 --- exampleSite/content/shortcodes/openapi/_index.pir.md | 2 +- exampleSite/layouts/partials/shortcodes/piratify.html | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/exampleSite/content/shortcodes/openapi/_index.pir.md b/exampleSite/content/shortcodes/openapi/_index.pir.md index 8ba81bdd34..4aba78ab30 100644 --- a/exampleSite/content/shortcodes/openapi/_index.pir.md +++ b/exampleSite/content/shortcodes/openapi/_index.pir.md @@ -2,4 +2,4 @@ description: "Adds UI fer yer OpenAPI / Swaggerrr Specificat'ns" title: "OpenAPI" --- -{{< piratify true >}} \ No newline at end of file +{{< piratify >}} \ No newline at end of file diff --git a/exampleSite/layouts/partials/shortcodes/piratify.html b/exampleSite/layouts/partials/shortcodes/piratify.html index 0a5a67ec94..5eddc533c8 100644 --- a/exampleSite/layouts/partials/shortcodes/piratify.html +++ b/exampleSite/layouts/partials/shortcodes/piratify.html @@ -22,6 +22,7 @@ {{- $c = $content }} {{- else if eq $pagefield "Content" }} {{- $c = .Content }} + {{- $srcPage = . }} {{- else if eq $pagefield "TableOfContents" }} {{- $c = .TableOfContents }} {{- end }} @@ -32,7 +33,7 @@ {{- if $writenotice }} {{- partial "shortcodes/notice.html" (dict "context" $context - "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" + "content" "

Fello' pirrrates, grog made us dizzy! Be awarrre some stuff may look weird in this trrranslat'n. Like Merrrmaids, do'n math or chemistrrry and stuff.

\n" "icon" "skull-crossbones" "style" "warning" "title" "Arrr! Pirrrates" @@ -72,7 +73,6 @@ "Where" "Whar'" "where" "whar'" "After" "Aft" - "after" "aft" "And" "An'" "and" "an'" "Load" "Board" @@ -127,5 +127,10 @@ {{- $c = replaceRE "(src|href)=\"(images/[^\"]*?\")" (printf "${1}=\"%s${2}" $l) $c }} {{- end }} {{- $c = replaceRE (printf "(src|href)=\"([^\"]*?)/%s/([^\"]*?.files/[^\"]*?\")" $langtrg) "${1}=\"${2}/${3}" $c }} + {{- if $srcPage }} + {{- $context.Store.Set "hasMathJax" (or ($context.Store.Get "hasMathJax") ($srcPage.Store.Get "hasMathJax")) }} + {{- $context.Store.Set "hasMermaid" (or ($context.Store.Get "hasMermaid") ($srcPage.Store.Get "hasMermaid")) }} + {{- $context.Store.Set "hasOpenapi" (or ($context.Store.Get "hasOpenapi") ($srcPage.Store.Get "hasOpenapi")) }} + {{- end }} {{- end }} {{ $c | safeHTML }} \ No newline at end of file