diff --git a/layouts/events/single.html b/layouts/events/single.html index 853cd94fe4e7db53822968140acc495b42f2632f..f1c4debe5ba46368453b5b81f8d8c7e0c242af38 100644 --- a/layouts/events/single.html +++ b/layouts/events/single.html @@ -4,8 +4,8 @@ <div class="document-content" itemscope itemtype="https://schema.org/Event"> <meta itemprop="name" content="{{ partial "PrepareHTML" .Title }}"> <meta itemprop="url" content="{{ .Permalink }}"> - {{ if .Params.summary }}<meta itemprop="abstract" content="{{ partial "PrepareText" .Params.summary }}">{{ end }} - {{ if .Summary }}<meta itemprop="description" content="{{ partial "PrepareText" .Summary }}">{{ end }} + {{ with .Params.summary }}<meta itemprop="abstract" content="{{ . | safeHTML }}">{{ end }} + {{ with .Summary }}<meta itemprop="description" content="{{ . | safeHTML }}">{{ end }} {{ partial "events/sidebar.html" . }} diff --git a/layouts/partials/CorrectPunctuation b/layouts/partials/CorrectPunctuation deleted file mode 100644 index 4671b77feb466f3787cdcf0e56123bf5eb2d14e4..0000000000000000000000000000000000000000 --- a/layouts/partials/CorrectPunctuation +++ /dev/null @@ -1,6 +0,0 @@ -{{ $correct := . }} -{{ $signs := slice ";" ":" "!" "?" }} -{{ range $signs }} - {{ $correct = replace $correct (printf " %s" .) (printf " %s" .) }} -{{ end }} -{{ return $correct }} diff --git a/layouts/partials/GetTruncateContent b/layouts/partials/GetTruncateContent index ab6ddc1081302ae2c5e29f45ca434816abff9b60..1c066b839efd7143ed47145cf526080ad5b5c6ec 100644 --- a/layouts/partials/GetTruncateContent +++ b/layouts/partials/GetTruncateContent @@ -6,4 +6,4 @@ {{ $text = chomp (truncate $length "…" (safeHTML (plainify $text))) }} {{ end }} -{{ return (partial "PrepareText" $text) }} \ No newline at end of file +{{ return safeHTML ($text) }} \ No newline at end of file diff --git a/layouts/partials/PrepareHTML b/layouts/partials/PrepareHTML index 2d3f25ddfb724d20fa61e92c060b353106bed059..ea37d6018eee7bd33217ac4c51fc761d011b2b7c 100644 --- a/layouts/partials/PrepareHTML +++ b/layouts/partials/PrepareHTML @@ -1,10 +1,8 @@ -{{ return -safeHTML ( - chomp ( - partial "CorrectPunctuation" ( - partial "FilterIframeLazy" ( - . - ) +{{ +return + safeHTML ( + partial "FilterIframeLazy" ( + . ) - ) -) }} + ) +}} diff --git a/layouts/partials/PrepareText b/layouts/partials/PrepareText deleted file mode 100644 index a4d0f064297d6f5092c821d24ef980f10e6fe540..0000000000000000000000000000000000000000 --- a/layouts/partials/PrepareText +++ /dev/null @@ -1,6 +0,0 @@ -{{ $text := . }} -{{ $text = replace $text "\r\n" "\n" }} -{{ $text = replace $text "\r" "\n" }} -{{ $text = replace $text "\n" "<br/>" }} -{{ $text = $text | safeHTML }} -{{ return $text}} \ No newline at end of file diff --git a/layouts/partials/blocks/templates/definitions.html b/layouts/partials/blocks/templates/definitions.html index 7cf7d62446f19b9a360cf44995ddb4dbf578eb16..64a79a9fc914fd145ad62fea0563e178eaaa8d5e 100644 --- a/layouts/partials/blocks/templates/definitions.html +++ b/layouts/partials/blocks/templates/definitions.html @@ -12,8 +12,8 @@ <div class="definitions"> {{- range .elements }} <details itemscope itemtype="https://schema.org/DefinedTerm"> - <summary itemprop="name">{{ partial "PrepareText" .title }}</summary> - <p itemprop="description">{{ partial "PrepareText" .description }}</p> + <summary itemprop="name">{{ .title | safeHTML }}</summary> + <p itemprop="description">{{ .description | safeHTML }}</p> </details> {{ end -}} </div> diff --git a/layouts/partials/blocks/templates/features.html b/layouts/partials/blocks/templates/features.html index 76e172a7612686d21cd1b8e0e83909ad4eb77a9b..8f7f9f82ddd31eeeb86a64aedaebb940bd1aaa52 100644 --- a/layouts/partials/blocks/templates/features.html +++ b/layouts/partials/blocks/templates/features.html @@ -22,9 +22,9 @@ "attributes" "class='name' itemprop='name'" ) -}} {{ $heading_tag.open -}} - {{ partial "PrepareText" .title }} + {{ .title | safeHTML }} {{ $heading_tag.close -}} - <p>{{ partial "PrepareText" .description }}</p> + <p>{{ .description | safeHTML }}</p> </div> {{- if .image -}} <figure> diff --git a/layouts/partials/blocks/templates/gallery/carousel.html b/layouts/partials/blocks/templates/gallery/carousel.html index de6811bc510f8a9f02ba011f742855b85bb497ca..b1b5a396b11049866370b520d64b9a00ce9061f5 100644 --- a/layouts/partials/blocks/templates/gallery/carousel.html +++ b/layouts/partials/blocks/templates/gallery/carousel.html @@ -33,11 +33,11 @@ {{ end }} {{ if or .text .credit }} <figcaption> - {{ if .text }} - <p>{{ partial "PrepareText" .text }}</p> + {{ with .text }} + <p>{{ . | safeHTML }}</p> {{ end }} - {{ if .credit }} - <div class="credit">{{ partial "PrepareText" .credit }}</div> + {{ with .credit }} + <div class="credit">{{ . | safeHTML }}</div> {{ end }} </figcaption> {{ end }} diff --git a/layouts/partials/blocks/templates/gallery/grid.html b/layouts/partials/blocks/templates/gallery/grid.html index 999cb8cd75e9bb1060b6ca1ff6158e7866e2e962..8ffcd8ba278fc2b6b0c43003af0eb6515f1b010f 100644 --- a/layouts/partials/blocks/templates/gallery/grid.html +++ b/layouts/partials/blocks/templates/gallery/grid.html @@ -33,9 +33,9 @@ {{ if not site.Params.image_sizes.design_system.lightbox.disabled }} </a> {{ end }} - {{ if .text }} + {{ with .text }} <figcaption> - <p>{{- partial "PrepareText" .text -}}</p> + <p>{{- . | safeHTML -}}</p> </figcaption> {{ end }} </figure> diff --git a/layouts/partials/blocks/templates/sound.html b/layouts/partials/blocks/templates/sound.html index b52ed91accea40ffc0ecb3b7c66c346736df3069..c6fc6f0259d7c9b55f5b40947539a27d01cb1bc8 100644 --- a/layouts/partials/blocks/templates/sound.html +++ b/layouts/partials/blocks/templates/sound.html @@ -14,7 +14,7 @@ {{ if .file }} {{ $file := partial "GetMedia" .file.id }} {{ if $file }} - <audio src="{{ $file.direct_url }}" controls title="{{ partial "PrepareText" .title }}"></audio> + <audio src="{{ $file.direct_url }}" controls title="{{ .title | safeHTML }}"></audio> {{ end }} {{ end }} diff --git a/layouts/partials/blocks/templates/timeline/horizontal.html b/layouts/partials/blocks/templates/timeline/horizontal.html index 03e5c5ef0323fe8eca61c0d3e88f2b86c99ea464..d029f0918ec243f4c7170b778dfb1699ddee3e72 100644 --- a/layouts/partials/blocks/templates/timeline/horizontal.html +++ b/layouts/partials/blocks/templates/timeline/horizontal.html @@ -12,7 +12,7 @@ <li class="timeline-event"> {{ $heading_tag.open -}} - {{ partial "PrepareText" .title }} + {{ .title | safeHTML }} {{ $heading_tag.close -}} <div class="line"></div> <div class="description text">{{- partial "PrepareHTML" .text | markdownify -}}</div> diff --git a/layouts/partials/blocks/templates/timeline/vertical.html b/layouts/partials/blocks/templates/timeline/vertical.html index 77fbfdfda90bd6accf5b9e83dc66797f3e5a9c2c..1abf2727b8f18bf93d268dc7f7c57a21db7d3709 100644 --- a/layouts/partials/blocks/templates/timeline/vertical.html +++ b/layouts/partials/blocks/templates/timeline/vertical.html @@ -8,13 +8,13 @@ <div class="timeline-events"> {{ range .events -}} <article class="timeline-event"> - {{ if .title }} + {{ with .title }} {{ $heading_tag.open -}} - {{ partial "PrepareText" .title }} + {{ . | safeHTML }} {{ $heading_tag.close -}} {{ end }} - {{ if .text }} - <p>{{ partial "PrepareText" .text }}</p> + {{ with .text }} + <p>{{ . | safeHTML }}</p> {{ end }} </article> {{ end -}} diff --git a/layouts/partials/commons/summary-in-content.html b/layouts/partials/commons/summary-in-content.html index 18bf1c32660f10864dd33b266a416b2add6dcd63..077e44e11640d83760ed894b5c91bd83c4d336bc 100644 --- a/layouts/partials/commons/summary-in-content.html +++ b/layouts/partials/commons/summary-in-content.html @@ -1,4 +1,4 @@ -{{ $summary := .summary | default (partial "PrepareText" .context.Params.summary) }} +{{ $summary := .summary | default (.context.Params.summary | safeHTML) }} {{- if and (eq site.Params.summary.position "content") $summary -}} {{- if .block_wrapped -}} <div class="block block-summary"> diff --git a/layouts/partials/diplomas/diplomas.html b/layouts/partials/diplomas/diplomas.html index aed223f94b3b370eb0c20090d28b0cf16419c2fe..0c15a8d06e4c969510d6100de26fdc6a3230a16d 100644 --- a/layouts/partials/diplomas/diplomas.html +++ b/layouts/partials/diplomas/diplomas.html @@ -11,7 +11,7 @@ </a> <div class="content"> <div class="description"> - {{- partial "PrepareText" .Params.summary -}} + {{- .Params.summary | safeHTML -}} </div> <ol class="programs"> diff --git a/layouts/partials/diplomas/hero-single.html b/layouts/partials/diplomas/hero-single.html index 39ed569800a6055a09f98db45ab338323867c449..c45f7fb492f4beff68e818d18d512630ca48d1ca 100644 --- a/layouts/partials/diplomas/hero-single.html +++ b/layouts/partials/diplomas/hero-single.html @@ -1,7 +1,7 @@ {{- $breadcrumb_is_after_hero := eq site.Params.breadcrumb.position "after-hero" -}} {{- $title := or .Params.header_text .Title -}} {{ $subtitle := "" }} -{{- $summary := partial "PrepareText" .Params.summary -}} +{{- $summary := .Params.summary | safeHTML -}} {{ if and (eq site.Params.summary.position "hero") $summary }} {{ $subtitle = $summary }} {{ end }} diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html index ac7dc711dbc7c8b07457d7f8005d43f23c709618..b812e410d9e4f8e34873723994928563667bb11d 100644 --- a/layouts/partials/head/seo.html +++ b/layouts/partials/head/seo.html @@ -11,7 +11,7 @@ {{- else if .Params.description -}} {{- $seoDescription = partial "PrepareHTML" .Params.description -}} {{/* LEGACY */}} {{- else if .Params.summary -}} - {{- $seoDescription = partial "PrepareText" .Params.summary -}} + {{- $seoDescription = .Params.summary | safeHTML -}} {{- else if .Content -}} {{- $seoDescription = partial "GetTruncateContent" ( dict "text" .Content ) -}} {{- else if .Params.legacy_text -}} diff --git a/layouts/partials/header/hero.html b/layouts/partials/header/hero.html index 65f8abf544eb021abe22180c8de0f4bd0a854cb4..78fe93990d0d4d01863efb7f7e72523f2d24b740 100644 --- a/layouts/partials/header/hero.html +++ b/layouts/partials/header/hero.html @@ -6,7 +6,7 @@ {{- $direction = partial "GetImageDirection" .image -}} {{ end }} -{{- $summary := partial "PrepareText" .context.Params.summary -}} +{{- $summary := .context.Params.summary | safeHTML -}} {{- $subtitle_is_summary := false -}} {{ if not $subtitle }} diff --git a/layouts/partials/pages/page.html b/layouts/partials/pages/page.html index d3ecfcf867cfed43f13ebcba2891b9fa42c25f64..6bc6d96e96d0cd0c8fb2898536b738ede143b849 100644 --- a/layouts/partials/pages/page.html +++ b/layouts/partials/pages/page.html @@ -16,8 +16,8 @@ {{- partial "PrepareHTML" .Title -}} </a> {{- partial "PrepareHTML" (printf "</%s>" $heading) -}} - {{- if .Params.summary }} - <p>{{ partial "PrepareText" .Params.summary }}</p> + {{- with .Params.summary }} + <p>{{ . | safeHTML }}</p> {{ end -}} </div> </article> diff --git a/layouts/partials/papers/abstract.html b/layouts/partials/papers/abstract.html index 702fde2f40a1f4d71482d05bb259f9dd7e42c418..1b6a5cbc1ae77fd3c0785e3bc878f921d4238ee5 100644 --- a/layouts/partials/papers/abstract.html +++ b/layouts/partials/papers/abstract.html @@ -1,7 +1,7 @@ <section class="paper-essentials" id="abstract"> {{ with .Params.Abstract }} <h2>{{ i18n "papers.abstract" }}</h2> - <p itemprop="abstract">{{ partial "PrepareText" . }}</p> + <p itemprop="abstract">{{ . | safeHTML }}</p> {{ end }} {{ if .Params.Pdf }} <h2>{{ i18n "papers.download" }}</h2> diff --git a/layouts/partials/papers/citations.html b/layouts/partials/papers/citations.html index 508515cfeabf76dc7fa9712ebb1aa3a0a874050d..2675cef564a82dfb84c56eea0ad6ee5aa7343132 100644 --- a/layouts/partials/papers/citations.html +++ b/layouts/partials/papers/citations.html @@ -4,7 +4,13 @@ <div> {{ range .Params.citations }} <div class="citation"> - <a data-click-to-copy="{{- partial "PrepareText" .content -}}" role="button" title="{{ i18n "commons.click_to_copy.button_title" }}" aria-label="{{ i18n "commons.click_to_copy.aria_label" (dict "description" .label )}}" tabindex="0">{{ .label }}</a> + <a data-click-to-copy="{{- .content | safeHTML -}}" + role="button" + title="{{ i18n "commons.click_to_copy.button_title" }}" + aria-label="{{ i18n "commons.click_to_copy.aria_label" (dict "description" .label )}}" + tabindex="0"> + {{ .label }} + </a> <p>{{ partial "PrepareHTML" .content }}</p> </div> {{ end }} diff --git a/layouts/partials/papers/summary.html b/layouts/partials/papers/summary.html index 45c401a2ced34930b5498a17b9ea91189e5c5e78..08de78ed0b494aa8dafdb3470c894882b58e54ec 100644 --- a/layouts/partials/papers/summary.html +++ b/layouts/partials/papers/summary.html @@ -1,4 +1,4 @@ -{{ $summary := (partial "PrepareText" .Params.summary) }} +{{ $summary := .Params.summary | safeHTML }} {{- if and (eq site.Params.summary.position "content") $summary -}} <section> <h2 class="lead">{{ $summary }}</h2> diff --git a/layouts/partials/persons/hero-single.html b/layouts/partials/persons/hero-single.html index 928702e8ea481a7391e49d791dc7f3feff260616..eb46dc1c8bc238d1dfbcc7cb9933e9e1badcf146 100644 --- a/layouts/partials/persons/hero-single.html +++ b/layouts/partials/persons/hero-single.html @@ -1,6 +1,6 @@ {{- $breadcrumb_is_after_hero := eq site.Params.breadcrumb.position "after-hero" -}} {{ $subtitle := "" }} -{{- $summary := partial "PrepareText" .Params.summary -}} +{{- $summary := .Params.summary | safeHTML -}} {{ if and (eq site.Params.summary.position "hero") $summary }} {{ $subtitle = $summary }} {{ end }} diff --git a/layouts/partials/persons/list-item.html b/layouts/partials/persons/list-item.html index 8f004ecad97f163238cfcac35d618fd13c9a17e9..dd7f669ca8db07eb2c963ba3e2b74fc03ed3df3d 100644 --- a/layouts/partials/persons/list-item.html +++ b/layouts/partials/persons/list-item.html @@ -1,6 +1,6 @@ <li itemscope itemtype="https://schema.org/Person"> <p itemprop="name"><a href="{{ .Permalink }}">{{ partial "PrepareHTML" .Title }}</a></p> {{- if partial "GetTextFromHTML" .Params.summary }} - <p itemprop="jobTitle">{{- partial "PrepareText" .Params.summary -}}</p> + <p itemprop="jobTitle">{{- .Params.summary | safeHTML -}}</p> {{ end -}} </li> \ No newline at end of file diff --git a/layouts/partials/persons/person.html b/layouts/partials/persons/person.html index 2b709098481da6ad98ff1ab8d8c67670776f97a6..b047ff1e311e490b62ad7ed884a983bd293c2114 100644 --- a/layouts/partials/persons/person.html +++ b/layouts/partials/persons/person.html @@ -3,7 +3,7 @@ {{- $title := partial "PrepareHTML" .Title }} <p class="name"><a href="{{ .Permalink }}">{{- $title -}}</a></p> {{- if partial "GetTextFromHTML" .Params.summary }} - <p>{{- partial "PrepareText" .Params.summary -}}</p> + <p>{{- .Params.summary | safeHTML -}}</p> {{ else if (partial "GetTextFromHTML" .Content) }} <p>{{- partial "GetTruncateContent" ( dict "text" .Content ) -}}</p> {{ end -}} diff --git a/layouts/partials/posts/author.html b/layouts/partials/posts/author.html index f0766546acc949643375f77b8c2218d66ddd53e4..6daa619974951a31e216458d7fc18c86fd82b79e 100644 --- a/layouts/partials/posts/author.html +++ b/layouts/partials/posts/author.html @@ -2,7 +2,7 @@ {{- $person := site.GetPage (printf "/persons/%s" .Slug) -}} {{ with $person }} <div class="post-author" itemscope itemtype="https://schema.org/Person" itemprop="author"> - <p itemprop="name">{{ partial "PrepareText" .Title }}</p> + <p itemprop="name">{{ .Title | safeHTML }}</p> </div> {{ end }} {{ end }} \ No newline at end of file diff --git a/layouts/partials/programs/hero-single.html b/layouts/partials/programs/hero-single.html index 652ebe208049c5f998659f873716d88f49432bf8..deb0f4ae2da54d0047773693e12b80cc92142c9d 100644 --- a/layouts/partials/programs/hero-single.html +++ b/layouts/partials/programs/hero-single.html @@ -1,7 +1,7 @@ {{- $breadcrumb_is_after_hero := eq site.Params.breadcrumb.position "after-hero" -}} {{- $title := or .Params.header_text .Title -}} {{ $subtitle := "" }} -{{- $summary := partial "PrepareText" .Params.summary -}} +{{- $summary := .Params.summary | safeHTML -}} {{ if and (eq site.Params.summary.position "hero") $summary }} {{ $subtitle = $summary }} {{ end }} diff --git a/layouts/partials/publications/citations.html b/layouts/partials/publications/citations.html index 559b6d8e941d3d99c9b294718e2ee4b67b9b7099..c98fb3315ff2d485b28566b63392ab58025aef76 100644 --- a/layouts/partials/publications/citations.html +++ b/layouts/partials/publications/citations.html @@ -4,7 +4,13 @@ <div> {{ range .Params.citations }} <div class="citation"> - <a data-click-to-copy="{{- partial "PrepareText" .content -}}" role="button" title="{{ i18n "commons.click_to_copy.button_title" }}" aria-label="{{ i18n "commons.click_to_copy.aria_label" (dict "description" .label )}}" tabindex="0">{{ .label }}</a> + <a data-click-to-copy="{{- .content | safeHTML -}}" + role="button" + title="{{ i18n "commons.click_to_copy.button_title" }}" + aria-label="{{ i18n "commons.click_to_copy.aria_label" (dict "description" .label )}}" + tabindex="0"> + {{ .label }} + </a> <p>{{ partial "PrepareHTML" .content }}</p> </div> {{ end }} diff --git a/layouts/posts/single.html b/layouts/posts/single.html index b87446a425138d69c92b803fa4f134d670ce9846..5523950f11e3c1ff4e8a53d5aa63400e7ccabc66 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -4,9 +4,9 @@ <div class="document-content" itemscope itemtype="https://schema.org/NewsArticle"> <meta itemprop="headline" content="{{ partial "PrepareHTML" .Title }}"> <meta itemprop="url" content="{{ .Permalink }}"> - {{ if .Date }}<meta itemprop="datePublished" content="{{ .Date.Format "2006-01-02T15:04" }}">{{ end }} - {{ if .Params.summary }}<meta itemprop="abstract" content="{{ partial "PrepareText" .Params.summary }}">{{ end }} - {{ if .Summary }}<meta itemprop="description" content="{{ partial "PrepareText" .Summary }}">{{ end }} + {{ with .Date }}<meta itemprop="datePublished" content="{{ .Format "2006-01-02T15:04" }}">{{ end }} + {{ with .Params.summary }}<meta itemprop="abstract" content="{{ . | safeHTML }}">{{ end }} + {{ with .Summary }}<meta itemprop="description" content="{{ . | safeHTML }}">{{ end }} {{ partial "posts/sidebar.html" . }}