Remove uses of safeURL

master
Will Faught 5 months ago
parent dcbc7775ea
commit 268997acf2

@ -1,35 +1,35 @@
{{ $page := . }} {{ $page := . }}
{{ if fileExists "static/apple-touch-icon.png" }} {{ if fileExists "static/apple-touch-icon.png" }}
<link href="{{ relLangURL `apple-touch-icon.png` | safeURL }}" rel="apple-touch-icon" sizes="180x180"> <link href="{{ relLangURL `apple-touch-icon.png` }}" rel="apple-touch-icon" sizes="180x180">
{{ end }} {{ end }}
{{ if fileExists "static/favicon.ico" }} {{ if fileExists "static/favicon.ico" }}
<link href="{{ relLangURL `favicon.ico` | safeURL }}" rel="shortcut icon"> <link href="{{ relLangURL `favicon.ico` }}" rel="shortcut icon">
{{ end }} {{ end }}
{{ if fileExists "static/favicon.png" }} {{ if fileExists "static/favicon.png" }}
<link href="{{ relLangURL `favicon.png` | safeURL }}" rel="icon" type="image/png"> <link href="{{ relLangURL `favicon.png` }}" rel="icon" type="image/png">
{{ end }} {{ end }}
{{ if fileExists "static/favicon.svg" }} {{ if fileExists "static/favicon.svg" }}
<link href="{{ relLangURL `favicon.svg` | safeURL }}" rel="icon" type="image/svg+xml"> <link href="{{ relLangURL `favicon.svg` }}" rel="icon" type="image/svg+xml">
{{ end }} {{ end }}
{{ if fileExists "static/favicon-16x16.png" }} {{ if fileExists "static/favicon-16x16.png" }}
<link href="{{ relLangURL `favicon-16x16.png` | safeURL }}" rel="icon" sizes="16x16" type="image/png"> <link href="{{ relLangURL `favicon-16x16.png` }}" rel="icon" sizes="16x16" type="image/png">
{{ end }} {{ end }}
{{ if fileExists "static/favicon-32x32.png" }} {{ if fileExists "static/favicon-32x32.png" }}
<link href="{{ relLangURL `favicon-32x32.png` | safeURL }}" rel="icon" sizes="32x32" type="image/png"> <link href="{{ relLangURL `favicon-32x32.png` }}" rel="icon" sizes="32x32" type="image/png">
{{ end }} {{ end }}
{{ if fileExists "static/safari-pinned-tab.svg" }} {{ if fileExists "static/safari-pinned-tab.svg" }}
<link color="{{ $page.Param `paige.color` | default `#0d6efd` }}" href="{{ relLangURL `safari-pinned-tab.svg` | safeURL }}" rel="mask-icon"> <link color="{{ $page.Param `paige.color` | default `#0d6efd` }}" href="{{ relLangURL `safari-pinned-tab.svg` }}" rel="mask-icon">
{{ end }} {{ end }}
{{ if fileExists "assets/site.webmanifest" }} {{ if fileExists "assets/site.webmanifest" }}
<link href="{{ (resources.Get `site.webmanifest` | resources.ExecuteAsTemplate `site.webmanifest` .).RelPermalink | safeURL }}" rel="manifest"> <link href="{{ (resources.Get `site.webmanifest` | resources.ExecuteAsTemplate `site.webmanifest` .).RelPermalink }}" rel="manifest">
{{ end }} {{ end }}
{{ $color := $page.Param "paige.color" | default "#0d6efd" }} {{ $color := $page.Param "paige.color" | default "#0d6efd" }}
@ -45,5 +45,5 @@
{{ end }} {{ end }}
{{ range $page.AlternativeOutputFormats }} {{ range $page.AlternativeOutputFormats }}
{{ printf `<link href="%s" rel="%s" type="%s">` (.Permalink | safeURL) .Rel .MediaType | safeHTML }} {{ printf `<link href="%s" rel="%s" type="%s">` .Permalink .Rel .MediaType | safeHTML }}
{{ end }} {{ end }}

@ -68,11 +68,11 @@
{{- if $normal -}} {{- if $normal -}}
{{- if gt $i 0 }} · {{ end -}} {{- if gt $i 0 }} · {{ end -}}
<a class="link-secondary paige-keyword paige-keyword-{{ $kind }}" href="{{ .RelPermalink | safeURL }}">{{ .LinkTitle }}</a> <a class="link-secondary paige-keyword paige-keyword-{{ $kind }}" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{- else -}} {{- else -}}
{{- if gt $i 0 }} {{ end -}} {{- if gt $i 0 }} {{ end -}}
<a class="badge paige-keyword paige-keyword-{{ $kind }} text-bg-secondary text-decoration-none" href="{{ .RelPermalink | safeURL }}">{{ .LinkTitle }}</a> <a class="badge paige-keyword paige-keyword-{{ $kind }} text-bg-secondary text-decoration-none" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{- end -}} {{- end -}}
{{- end }} {{- end }}
</p> </p>

@ -27,13 +27,13 @@
<div id="paige-file"> <div id="paige-file">
{{ with $edit }} {{ with $edit }}
<div class="paige-row-narrow text-center text-secondary" id="paige-edit"> <div class="paige-row-narrow text-center text-secondary" id="paige-edit">
<a class="link-secondary" href="{{ . | safeURL }}">{{ i18n "paige_edit_this_page" }}</a> <a class="link-secondary" href="{{ . }}">{{ i18n "paige_edit_this_page" }}</a>
</div> </div>
{{ end }} {{ end }}
{{ with $history }} {{ with $history }}
<div class="paige-row-narrow text-center text-secondary" id="paige-history"> <div class="paige-row-narrow text-center text-secondary" id="paige-history">
<a class="link-secondary" href="{{ . | safeURL }}">{{ i18n "paige_edit_history" }}</a> <a class="link-secondary" href="{{ . }}">{{ i18n "paige_edit_history" }}</a>
</div> </div>
{{ end }} {{ end }}
</div> </div>

@ -50,11 +50,11 @@
{{- if $normal -}} {{- if $normal -}}
{{- if gt $i 0 }} · {{ end -}} {{- if gt $i 0 }} · {{ end -}}
<a class="link-secondary paige-keyword paige-keyword-{{ $kind }}" href="{{ .RelPermalink | safeURL }}" {{ if $microdata }} itemprop="keywords" {{ end }}>{{ .LinkTitle }}</a> <a class="link-secondary paige-keyword paige-keyword-{{ $kind }}" href="{{ .RelPermalink }}" {{ if $microdata }} itemprop="keywords" {{ end }}>{{ .LinkTitle }}</a>
{{- else -}} {{- else -}}
{{- if gt $i 0 }} {{ end -}} {{- if gt $i 0 }} {{ end -}}
<a class="badge paige-keyword paige-keyword-{{ $kind }} text-bg-secondary text-decoration-none" href="{{ .RelPermalink | safeURL }}" {{ if $microdata }} itemprop="keywords" {{ end }}>{{ .LinkTitle }}</a> <a class="badge paige-keyword paige-keyword-{{ $kind }} text-bg-secondary text-decoration-none" href="{{ .RelPermalink }}" {{ if $microdata }} itemprop="keywords" {{ end }}>{{ .LinkTitle }}</a>
{{- end -}} {{- end -}}
{{- end }} {{- end }}
</p> </p>

@ -60,7 +60,7 @@
{{ $active := or $home $menu $section }} {{ $active := or $home $menu $section }}
<li class="nav-item {{ if .Children }} dropdown {{ end }}"> <li class="nav-item {{ if .Children }} dropdown {{ end }}">
<a {{ if $active }} aria-current="page" {{ end }} {{ if .Children }} aria-expanded="false" {{ end }} class="{{ if $active }} active {{ if $links }} fw-bold text-body {{ end }} {{ end }} {{ if .Params.paige.disabled }} disabled {{ end }} nav-link {{ if .Children }} dropdown-toggle {{ end }} {{ if $links }} text-decoration-underline {{ end }}" {{ if .Children }} data-bs-toggle="dropdown" {{ end }} href="{{ if not .Children -}} {{- .URL | safeURL -}} {{- end }}" {{ if .Children }} role="button" {{ end }} {{ if not .Children }} {{ with partial "paige/func-target.html" (dict "page" $page "url" .URL) }} target="{{ . }}" {{ end }} {{ end }}>{{ .Name | markdownify }}</a> <a {{ if $active }} aria-current="page" {{ end }} {{ if .Children }} aria-expanded="false" {{ end }} class="{{ if $active }} active {{ if $links }} fw-bold text-body {{ end }} {{ end }} {{ if .Params.paige.disabled }} disabled {{ end }} nav-link {{ if .Children }} dropdown-toggle {{ end }} {{ if $links }} text-decoration-underline {{ end }}" {{ if .Children }} data-bs-toggle="dropdown" {{ end }} href="{{ if not .Children -}} {{- .URL -}} {{- end }}" {{ if .Children }} role="button" {{ end }} {{ if not .Children }} {{ with partial "paige/func-target.html" (dict "page" $page "url" .URL) }} target="{{ . }}" {{ end }} {{ end }}>{{ .Name | markdownify }}</a>
{{ with .Children }} {{ with .Children }}
<ul class="dropdown-menu"> <ul class="dropdown-menu">
@ -78,7 +78,7 @@
{{ end }} {{ end }}
<li> <li>
<a class="{{ if .Params.paige.disabled }} disabled {{ end }} dropdown-item" href="{{ .URL | safeURL }}" {{ with partial "paige/func-target.html" (dict "page" $page "url" .URL) }} target="{{ . }}" {{ end }}>{{ .Name | markdownify }}</a> <a class="{{ if .Params.paige.disabled }} disabled {{ end }} dropdown-item" href="{{ .URL }}" {{ with partial "paige/func-target.html" (dict "page" $page "url" .URL) }} target="{{ . }}" {{ end }}>{{ .Name | markdownify }}</a>
</li> </li>
{{ if .Params.paige.divider_below }} {{ if .Params.paige.divider_below }}
@ -130,7 +130,7 @@
{{ $active := or $home $menu $section }} {{ $active := or $home $menu $section }}
<li class="nav-item"> <li class="nav-item">
<a {{ if $active }} aria-current="page" {{ end }} class="{{ if $active }} active {{ if $links }} fw-bold text-body {{ end }} {{ end }} nav-link {{ if $links }} text-decoration-underline {{ end }}" href="{{ .RelPermalink | safeURL }}" {{ with partial "paige/func-target.html" (dict "page" $page "url" .RelPermalink) }} target="{{ . }}" {{ end }}>{{ .LinkTitle }}</a> <a {{ if $active }} aria-current="page" {{ end }} class="{{ if $active }} active {{ if $links }} fw-bold text-body {{ end }} {{ end }} nav-link {{ if $links }} text-decoration-underline {{ end }}" href="{{ .RelPermalink }}" {{ with partial "paige/func-target.html" (dict "page" $page "url" .RelPermalink) }} target="{{ . }}" {{ end }}>{{ .LinkTitle }}</a>
</li> </li>
{{ end }} {{ end }}
</ul> </ul>

@ -8,4 +8,4 @@
{{ $target := partial "paige/func-target.html" (dict "page" $page "url" $href) }} {{ $target := partial "paige/func-target.html" (dict "page" $page "url" $href) }}
<a {{ with $class }} class="{{ . }}" {{ end }} {{ with $href }} href="{{ . | safeURL }}" {{ end }} {{ with $style }} style="{{ . | safeCSS }}" {{ end }} {{ with $target }} target="{{ . }}" {{ end }}>{{ $content }}</a> <a {{ with $class }} class="{{ . }}" {{ end }} {{ with $href }} href="{{ . }}" {{ end }} {{ with $style }} style="{{ . | safeCSS }}" {{ end }} {{ with $target }} target="{{ . }}" {{ end }}>{{ $content }}</a>

@ -5,4 +5,4 @@
{{ $src := $params.src }} {{ $src := $params.src }}
{{ $title := $params.title }} {{ $title := $params.title }}
<iframe {{ if $fullscreen }} allowfullscreen {{ end }} {{ with $policy }} referrerpolicy="{{ . }}" {{ end }} {{ with $src }} src="{{ . | safeURL }}" {{ end }} {{ with $title }} title="{{ . }}" {{ end }}></iframe> <iframe {{ if $fullscreen }} allowfullscreen {{ end }} {{ with $policy }} referrerpolicy="{{ . }}" {{ end }} {{ with $src }} src="{{ . }}" {{ end }} {{ with $title }} title="{{ . }}" {{ end }}></iframe>

@ -38,4 +38,4 @@
{{ $href = relLangURL $href }} {{ $href = relLangURL $href }}
{{ end }} {{ end }}
<link {{ with $origin }} crossorigin="{{ . }}" {{ end }} href="{{ $href | safeURL }}" {{ with $integrity }} integrity="{{ . }}" {{ end }} {{ with $policy }} referrerpolicy="{{ . }}" {{ end }} rel="stylesheet"> <link {{ with $origin }} crossorigin="{{ . }}" {{ end }} href="{{ $href }}" {{ with $integrity }} integrity="{{ . }}" {{ end }} {{ with $policy }} referrerpolicy="{{ . }}" {{ end }} rel="stylesheet">

@ -22,4 +22,4 @@
{{ $src = relLangURL $src }} {{ $src = relLangURL $src }}
{{ end }} {{ end }}
<script {{ with $origin }} crossorigin="{{ . }}" {{ end }} {{ with $defer }} defer {{ end }} integrity="{{ $integrity }}" {{ with $onload }} onload="{{ . }}" {{ end }} {{ with $policy }} referrerpolicy="{{ . }}" {{ end }} src="{{ $src | safeURL }}" {{ with $type }} {{ printf `type="%v"` . | safeHTMLAttr }} {{ end }}></script> <script {{ with $origin }} crossorigin="{{ . }}" {{ end }} {{ with $defer }} defer {{ end }} integrity="{{ $integrity }}" {{ with $onload }} onload="{{ . }}" {{ end }} {{ with $policy }} referrerpolicy="{{ . }}" {{ end }} src="{{ $src }}" {{ with $type }} {{ printf `type="%v"` . | safeHTMLAttr }} {{ end }}></script>

Loading…
Cancel
Save