From 173872ea263b7bcf533c98c043fbc5146a5733f7 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Fri, 15 Sep 2023 23:44:56 -0700 Subject: [PATCH] Add missing uses of safeHTML --- layouts/_default/home.json | 6 +++--- layouts/_default/paige/cloud.html | 2 +- layouts/_default/rss.xml | 4 ++-- layouts/partials/paige/alert.html | 4 ++-- layouts/partials/paige/breadcrumbs.html | 2 +- layouts/partials/paige/footer.html | 2 +- layouts/partials/paige/metadata.html | 4 ++-- layouts/partials/paige/page.html | 6 +++--- layouts/partials/paige/title.html | 4 ++-- layouts/shortcodes/paige/figure.html | 4 ++-- layouts/shortcodes/paige/quote.html | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/layouts/_default/home.json b/layouts/_default/home.json index 4cbc541c..a2f52680 100644 --- a/layouts/_default/home.json +++ b/layouts/_default/home.json @@ -5,11 +5,11 @@ {{- $page.Scratch.Add "paige_index" (dict "categories" .Params.categories "date" .PublishDate - "description" (.Description | markdownify | plainify | htmlUnescape) + "description" (.Description | markdownify | plainify | htmlUnescape | safeHTML) "keywords" .Params.keywords "link" .RelPermalink "tags" .Params.tags - "text" (strings.TrimRight " " (replace (.Plain | htmlUnescape) "\n" " ")) - "title" (.Title | markdownify | plainify | htmlUnescape)) -}} + "text" (strings.TrimRight " " (replace (.Plain | htmlUnescape | safeHTML) "\n" " ")) + "title" (.Title | markdownify | plainify | htmlUnescape | safeHTML)) -}} {{- end -}} {{- $page.Scratch.Get "paige_index" | jsonify -}} diff --git a/layouts/_default/paige/cloud.html b/layouts/_default/paige/cloud.html index f7ee027c..c73f726c 100644 --- a/layouts/_default/paige/cloud.html +++ b/layouts/_default/paige/cloud.html @@ -8,7 +8,7 @@ diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 87962c01..b348ce0a 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -50,7 +50,7 @@ {{ if .Content }} {{ printf "" .Content | safeHTML }} {{ else if .Description }} - {{ .Description | markdownify | html }} + {{ .Description | markdownify | safeHTML }} {{ end }} {{ with .Permalink }} {{ . }} @@ -60,7 +60,7 @@ {{ .Format "Mon, 02 Jan 2006 15:04:05 -0700" }} {{ end }} {{ with .Title }} - {{ . | markdownify | plainify | htmlUnescape }} + {{ . | markdownify | plainify | htmlUnescape | safeHTML }} {{ end }} {{ end }} diff --git a/layouts/partials/paige/alert.html b/layouts/partials/paige/alert.html index 76254397..4ed745e8 100644 --- a/layouts/partials/paige/alert.html +++ b/layouts/partials/paige/alert.html @@ -2,8 +2,8 @@ {{ with $page.Param "paige.alert" }} {{ if reflect.IsMap . }} - + {{ else }} - + {{ end }} {{ end }} diff --git a/layouts/partials/paige/breadcrumbs.html b/layouts/partials/paige/breadcrumbs.html index ff5bda6e..2266a8a7 100644 --- a/layouts/partials/paige/breadcrumbs.html +++ b/layouts/partials/paige/breadcrumbs.html @@ -5,7 +5,7 @@
diff --git a/layouts/partials/paige/footer.html b/layouts/partials/paige/footer.html index 507d4502..35724eb2 100644 --- a/layouts/partials/paige/footer.html +++ b/layouts/partials/paige/footer.html @@ -5,7 +5,7 @@ {{ partial "paige/footer-first.html" . }} {{ end }} - {{ with site.Copyright | markdownify }} + {{ with site.Copyright | markdownify | safeHTML }} {{ end }} diff --git a/layouts/partials/paige/metadata.html b/layouts/partials/paige/metadata.html index d9d13994..46567a17 100644 --- a/layouts/partials/paige/metadata.html +++ b/layouts/partials/paige/metadata.html @@ -5,12 +5,12 @@ {{ $commiturl := "" }} {{ $date := $page.PublishDate }} {{ $dateformat := $page.Param "paige.date.format" | default ":date_long" }} -{{ $description := $page.Description | markdownify }} +{{ $description := $page.Description | markdownify | safeHTML }} {{ $link := $page.Params.link }} {{ $readingtime := $page.ReadingTime }} {{ $series := $page.Params.series }} {{ $tags := $page.Params.tags | default slice | uniq }} -{{ $title := $page.Title | markdownify }} +{{ $title := $page.Title | markdownify | safeHTML }} {{ if and ($page.Param "paige.git.commit_url") $page.GitInfo }} {{ $commiturl = printf ($page.Param "paige.git.commit_url") $page.GitInfo.Hash }} diff --git a/layouts/partials/paige/page.html b/layouts/partials/paige/page.html index dd12ec7c..035ec83e 100644 --- a/layouts/partials/paige/page.html +++ b/layouts/partials/paige/page.html @@ -5,7 +5,7 @@ {{ $commiturl := "" }} {{ $date := $page.PublishDate }} {{ $dateformat := $page.Param "paige.date.format" | default ":date_long" }} -{{ $description := $page.Description | markdownify }} +{{ $description := $page.Description | markdownify | safeHTML }} {{ $draft := $page.Draft }} {{ $expired := and $page.ExpiryDate (lt $page.ExpiryDate now) }} {{ $flags := slice }} @@ -14,9 +14,9 @@ {{ $pinned := $page.Params.paige.pin }} {{ $readingtime := $page.ReadingTime }} {{ $series := $page.Params.series }} -{{ $summary := $page.Summary | htmlUnescape | plainify }} +{{ $summary := $page.Summary | plainify | htmlUnescape | safeHTML }} {{ $tags := $page.Params.tags | default slice | uniq }} -{{ $title := $page.Title | markdownify }} +{{ $title := $page.Title | markdownify | safeHTML }} {{ $titlelink := $page.RelPermalink }} {{ if and (.Param "paige.git.commit_url") .GitInfo }} diff --git a/layouts/partials/paige/title.html b/layouts/partials/paige/title.html index ef44bbf8..b3fe2ed5 100644 --- a/layouts/partials/paige/title.html +++ b/layouts/partials/paige/title.html @@ -1,8 +1,8 @@ {{ $page := . }} -{{ $pagetitle := $page.Title | markdownify | plainify | htmlUnescape }} +{{ $pagetitle := $page.Title | markdownify | plainify | htmlUnescape | safeHTML }} {{ $result := "" }} -{{ $sitetitle := site.Title | markdownify | plainify | htmlUnescape }} +{{ $sitetitle := site.Title | markdownify | plainify | htmlUnescape | safeHTML }} {{ if and $pagetitle $sitetitle }} {{ if .IsHome }} diff --git a/layouts/shortcodes/paige/figure.html b/layouts/shortcodes/paige/figure.html index f1c1d299..48e26ef5 100644 --- a/layouts/shortcodes/paige/figure.html +++ b/layouts/shortcodes/paige/figure.html @@ -1,5 +1,5 @@ -{{ $caption := .Get 0 | default (.Get "caption") | markdownify }} -{{ $content := .Inner | markdownify }} +{{ $caption := .Get 0 | default (.Get "caption") | markdownify | safeHTML }} +{{ $content := .Inner | markdownify | safeHTML }} {{ $float := .Get "float" }} {{ $horizontal := .Get "horizontal" | default "center" }} {{ $maxwidth := .Get "maxwidth" }} diff --git a/layouts/shortcodes/paige/quote.html b/layouts/shortcodes/paige/quote.html index 525fd1c9..edb3ac9a 100644 --- a/layouts/shortcodes/paige/quote.html +++ b/layouts/shortcodes/paige/quote.html @@ -1,5 +1,5 @@ {{ $cite := .Get 0 | default (.Get "cite") }} -{{ $content := .Inner | replaceRE "^\n" "" | replaceRE "\n$" "" | markdownify }} +{{ $content := .Inner | replaceRE "^\n" "" | replaceRE "\n$" "" | markdownify | safeHTML }} {{ if not $content }} {{ errorf "layouts/shortcodes/paige/quote.html: no content" }}