2021-09-11 22:40:03 +00:00
{{- $langsrc := .Get 1 | default "en" }}
{{- $langtrg := .Page.Language.Lang }}
2022-02-06 00:58:32 +00:00
{{- $baseURL := urls.Parse .Site.BaseURL }}
{{- $baseURLpath := $baseURL.Path | default "/" }}
2021-09-11 22:40:03 +00:00
{{- $words := dict
2021-09-11 13:46:14 +00:00
"Hugo" "Cap'n Hugo"
"Info" "Ahoi"
"Note" "Avast"
"Tip" "Smarrrt Arrrse"
"Warning" "Arrr"
"good" "bloody"
"shortcode" "shorrrtcode"
"Shortcode" "Shorrrtcode"
"shortcodes" "shorrrtcodes"
"Shortcodes" "Shorrrtcodes"
"Mermaid" "Merrrmaid"
"Markdown" "Marrrkdown"
"Markup" "Marrrkup"
"markup" "marrrkup"
"for" "fer"
"Your" "Yer"
"your" "yer"
"You" "Ye"
"you" "ye"
"the" "th'"
"The" "Th'"
"is" "be"
"Is" "Be"
"are" "be"
"Are" "Be"
"Of" "O'"
"of" "o'"
"To" "T'"
"to" "t'"
"in" "'n"
"With" "Wit'"
"with" "wit'"
"Where" "Whar'"
"where" "whar'"
"After" "Aft"
"after" "aft"
"And" "An'"
"and" "an'"
"Load" "Board"
"load" "board"
"Loaded" "Boarded"
"loaded" "boarded"
2022-02-06 13:10:11 +00:00
"Content" "Rrrambling"
"content" "rrrambling"
2021-09-11 13:46:14 +00:00
"icon" "ay'con"
"Icon" "Ay'con"
"icons" "ay'cons"
"Icons" "Ay'cons"
"syntax" "rules"
"Syntax" "Rules"
"Site" "Ship"
"site" "ship"
"Page" "Plank"
"page" "plank"
"Pages" "Planks"
"pages" "planks"
"Relearn" "Relearrrn"
"Learn" "Learrrn"
2022-02-06 13:10:11 +00:00
-}}
2021-09-11 22:40:03 +00:00
{{- $specials := dict
2021-09-11 13:46:14 +00:00
"(\\w)ing([\\s\\n< . , ; ? ! : ] ) " " ' n "
"(\\w)ings([\\s\\n< . , ; ? ! : ] ) " " ' ns "
"(\\w)tion([\\s\\n< . , ; ? ! : ] ) " " t ' n "
"(\\w)tions([\\s\\n< . , ; ? ! : ] ) " " t ' ns "
"(\\w)(?:[aeiou])ble([\\s\\n< . , ; ? ! : ] ) " " ' ble "
"(\\w)(?:[aeiou])mize([\\s\\n< . , ; ? ! : ] ) " " ' mize "
"(\\w)(?:[aeiou])mizes([\\s\\n< . , ; ? ! : ] ) " " ' mizes "
"(\\w)(?:[aeiou])nize([\\s\\n< . , ; ? ! : ] ) " " ' nize "
"(\\w)(?:[aeiou])nizes([\\s\\n< . , ; ? ! : ] ) " " ' nizes "
2022-02-06 00:58:32 +00:00
(printf "(.)=\"%s([^\"]*?\")" $baseURLpath) (printf "=\"%s%s/" $baseURLpath $langtrg)
2022-02-06 13:10:11 +00:00
-}}
2021-09-11 22:40:03 +00:00
{{- $fix := dict
2021-09-11 13:46:14 +00:00
"warn'n" "warning"
"sect'n" "section"
"n Cap'n" "n"
"Avast right o' John" "Note right of John"
2022-02-06 13:10:11 +00:00
-}}
2021-09-11 22:40:03 +00:00
{{- $c := "" }}
{{- range .Page.Translations }}
{{- if eq .Language.Lang $langsrc }}
2022-02-06 00:58:32 +00:00
{{- $l := .RelPermalink }}
2021-09-11 22:40:03 +00:00
{{- $c = .Content }}
{{- range $from, $to := $words }}
{{- $c = replaceRE (printf "([\\s\\n>])%s([\\s\\n< . , ; ? ! : ] ) " $ from ) ( printf " $ { 1 } % s $ { 2 } " $ to ) $ c } }
{{- end }}
{{- range $from, $to := $specials }}
{{- $c = replaceRE $from (printf "${1}%s${2}" $to) $c }}
{{- end }}
{{- range $from, $to := $fix }}
2022-02-06 13:10:11 +00:00
{{- $c = replace $c $from $to }}
2021-09-11 22:40:03 +00:00
{{- end }}
2022-02-06 00:58:32 +00:00
{{- $c = replaceRE "(src|href)=\"(images/[^\"]*?\")" (printf "${1}=\"%s${2}" $l) $c }}
{{- $c = replaceRE "(src|href)=\"([^\"]*?)/pir/([^\"]*?.files/[^\"]*?\")" "${1}=\"${2}/${3}" $c }}
2021-09-11 22:40:03 +00:00
{{- end }}
{{- end }}
2022-06-22 18:47:30 +00:00
{{- partial "shortcodes/notice.html" (dict
"context" .
2022-07-02 12:20:17 +00:00
"content" "< p > Fello' pirrates, be awarrre < b > some stuff may not work< / b > fer us in this trrranslat'n. Like < b > table of rrramblings< / b > , see'ng < b > Merrrmaids< / b > , do'ng < b > math or chemistrrry< / b > and stuff.< / p > "
2022-06-22 18:47:30 +00:00
"icon" "skull-crossbones"
"style" "warning"
"title" "Arrr! Pirrrates"
) }}
2022-02-06 13:10:11 +00:00
{{ $c | safeHTML }}