Commit 8279a8bc authored by Kaushal Modi's avatar Kaushal Modi

Use backquoted strings where strings contain the double-quotes

That way the double-quotes in those strings do not need to be escaped.
parent 27eef356
......@@ -34,7 +34,7 @@ home = ["HTML", "RSS", "ATOM"] # default = ["HTML", "RSS"]
<generator>Hugo -- gohugo.io</generator>
{{- range (where .Pages "Type" "in" .Site.Params.mainSections) }}
<entry>
{{ printf "<title type=\"html\"><![CDATA[%s]]></title>" .Title | safeHTML }}
{{ printf `<title type="html"><![CDATA[%s]]></title>` .Title | safeHTML }}
<link href="{{ .Permalink }}"/>
<id>{{ .Permalink }}</id>
{{- range .Param "author" }}
......@@ -44,7 +44,7 @@ home = ["HTML", "RSS", "ATOM"] # default = ["HTML", "RSS"]
{{ end -}}
<published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published>
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
{{ printf "<content type=\"html\"><![CDATA[%s]]></content>" .Content | safeHTML }}
{{ printf `<content type="html"><![CDATA[%s]]></content>` .Content | safeHTML }}
</entry>
{{ end }}
</feed>
......@@ -59,7 +59,7 @@
<hr />
<div>
<small>
{{ printf "<span style=\"font-variant: small-caps;\">Versions used</span>:" | safeHTML }}
{{ printf `<span style="font-variant: small-caps;">Versions used</span>:` | safeHTML }}
{{ range $k, $v := . }}
{{ printf "<code>%s</code> " $k | safeHTML }}
{{ if (eq "string" (printf "%T" $v)) }} <!-- Check if the value is a string -->
......
......@@ -10,7 +10,7 @@
(ox-hugo), they will be unequal. In that case, add the "Updated on"
string.
-->
{{ printf "<time datetime=\"%s\" class=\"dt-published\">%s</time>" $date_meta $date_display | safeHTML }}
{{ printf `<time datetime="%s" class="dt-published">%s</time>` $date_meta $date_display | safeHTML }}
{{ if (and (not .Lastmod.IsZero) (not (eq .Lastmod .Date))) }}
{{ $lastmod_format_display := $.Param "dateform" | default "Mon Jan 2, 2006" }}
{{ $lastmod_display := dateFormat $lastmod_format_display .Lastmod }}
......
......@@ -4,10 +4,10 @@
{{ if (or (eq $name_upper "RSS") (eq $name_upper "ATOM")) }}
{{ $offset := (cond (eq .Name "RSS") 30 40) }}
<li>
{{ printf "<a href=\"%s\">" .Permalink | safeHTML }}
{{ printf `<a href="%s">` .Permalink | safeHTML }}
<span class="fa-layers">
{{ printf "<i class=\"%s fa-rss fa-1x\"></i>" "far" | safeHTML }}
{{ printf "<span class=\"fa-layers-text\" data-fa-transform=\"up-10 right-%d\">%s</span>" $offset $name_upper | safeHTML }}
{{ printf `<i class="%s fa-rss fa-1x"></i>` "far" | safeHTML }}
{{ printf `<span class="fa-layers-text" data-fa-transform="up-10 right-%d">%s</span>` $offset $name_upper | safeHTML }}
</span>
{{ printf "</a>" | safeHTML }}
</li>
......
......@@ -5,7 +5,7 @@
Generated using
{{ with .Site.Params.source.org_dir }}
{{ with $.Params.creator }}
{{ . | replaceRE "ox-hugo" "<a href=\"https://github.com/kaushalmodi/ox-hugo\"><code>ox-hugo</code></a>" | safeHTML }}
{{ . | replaceRE "ox-hugo" `<a href="https://github.com/kaushalmodi/ox-hugo"><code>ox-hugo</code></a>` | safeHTML }}
{{ else }}
the <a href="https://github.com/kaushalmodi/ox-hugo"><code class="nobr">ox-hugo</code></a> package for Emacs/Org-mode
{{ end }} +
......@@ -14,7 +14,7 @@
{{ $hugo_version := .Hugo.Version }}
<span class="nobr">
{{ with .Hugo.CommitHash }}
Hugo {{ . | replaceRE "^[0-9a-f]{7,}" "<a href=\"https://github.com/gohugoio/hugo/commit/${0}\">" | replaceRE ":chroma-([0-9a-f]{7,})" "" | safeHTML -}}{{ $hugo_version }}
Hugo {{ . | replaceRE "^[0-9a-f]{7,}" `<a href="https://github.com/gohugoio/hugo/commit/${0}">` | replaceRE ":chroma-([0-9a-f]{7,})" "" | safeHTML -}}{{ $hugo_version }}
{{- printf "</a>" | safeHTML -}}.
{{ else }}
Hugo {{ $hugo_version }}.
......
......@@ -13,7 +13,7 @@
<a class="p-name u-url" href="{{ $.Site.BaseURL }}">{{ with .name }}{{ . }}{{ end }}</a>
{{ with .email }}
<p>
{{ printf "<a class=\"u-email\" href=\"mailto:%s\" rel=\"me\">%s</a>" . . | safeHTML }}
{{ printf `<a class="u-email" href="mailto:%s" rel="me">%s</a>` . . | safeHTML }}
</p>
{{ end }}
{{ with .bio }}
......
......@@ -114,13 +114,13 @@
<!-- RSS -->
<!-- https://gohugo.io/templates/rss/#reference-your-rss-feed-in-head -->
{{ range .AlternativeOutputFormats -}}
{{ printf "<link rel=\"%s\" type=\"%s+%s\" href=\"%s\" title=\"%s\" />" .Rel .MediaType.Type .MediaType.Suffix .Permalink (printf "%s for %s" (.Name | title) $.Site.Title) | safeHTML }}
{{ printf `<link rel="%s" type="%s+%s" href="%s" title="%s" />` .Rel .MediaType.Type .MediaType.Suffix .Permalink (printf "%s for %s" (.Name | title) $.Site.Title) | safeHTML }}
{{ end -}}
<!-- Hugo info -->
<!-- https://stackoverflow.com/a/10534167/1219634 -->
<!-- https://w3c.github.io/html/single-page.html#the-meta-element -->
{{ printf "<meta name=\"hugo-build-date\" content=\"%s\"/>" .Hugo.BuildDate | safeHTML }}
{{ printf "<meta name=\"hugo-commit-hash\" content=\"%s\"/>" .Hugo.CommitHash | safeHTML }}
{{ printf `<meta name="hugo-build-date" content="%s"/>` .Hugo.BuildDate | safeHTML }}
{{ printf `<meta name="hugo-commit-hash" content="%s"/>` .Hugo.CommitHash | safeHTML }}
{{ .Hugo.Generator }}
</head>
{{ . | replaceRE "(<h[2-9] id=\"([^\"]+)\".+)(</h[2-9]+>)" "${1}&nbsp;<a class=\"headline-hash\" href=\"#${2}\">#</a> ${3}" | safeHTML }}
{{ . | replaceRE "(<h[2-9] id=\"([^\"]+)\".+)(</h[2-9]+>)" `${1}&nbsp;<a class="headline-hash" href="#${2}">#</a> ${3}` | safeHTML }}
<!-- https://indieauth.com/setup -->
{{ printf "<!-- rel=\"me\" links for IndieAuth -->" | safeHTML }}
{{ printf `<!-- rel="me" links for IndieAuth -->` | safeHTML }}
{{ $.Scratch.Set "__relme_exists" false }}
{{ range $.Site.Params.social -}}
{{- if .relme -}}
{{- printf "<link href=\"%s\" rel=\"me\">" .link | safeHTML -}}
{{- printf `<link href="%s" rel="me">` .link | safeHTML -}}
{{ $.Scratch.Set "__relme_exists" true }}
{{- end -}}
{{- end }}
......@@ -19,10 +19,10 @@
{{ with .Site.Params.indieweb }}
{{ $domain := .domain }}
{{ with .webmention }}
{{ printf "<link rel=\"pingback\" href=\"%s%s/xmlrpc\" />" .endpoint .account | safeHTML }}
{{ printf "<link rel=\"webmention\" href=\"%s%s/webmention\" />" .endpoint .account | safeHTML }}
{{ printf `<link rel="pingback" href="%s%s/xmlrpc" />` .endpoint .account | safeHTML }}
{{ printf `<link rel="webmention" href="%s%s/webmention" />` .endpoint .account | safeHTML }}
{{ end }}
{{ with .micropub }}
{{ printf "<link rel=\"micropub\" href=\"%s%s\" />" $domain .url | safeHTML }}
{{ printf `<link rel="micropub" href="%s%s" />` $domain .url | safeHTML }}
{{ end }}
{{ end }}
......@@ -52,7 +52,7 @@
<dl class="webmention comment">
<dt>
Comment by <a href="{{ $author_url }}">{{ $author_name }}</a>
{{ printf "<a href=\"%s\">" $mention_url | safeHTML }}
{{ printf `<a href="%s">` $mention_url | safeHTML }}
{{ with $.Scratch.Get "__verified_date" }}on {{ . }}{{ end }}
{{ printf "</a>" | safeHTML }}
</dt>
......@@ -74,14 +74,14 @@
<dl class="webmention mention">
<dt>
Mentioned by <a href="{{ $author_url }}">{{ $author_name }}</a>
{{ printf "<a href=\"%s\">" $mention_url | safeHTML }}
{{ printf `<a href="%s">` $mention_url | safeHTML }}
{{ with $.Scratch.Get "__verified_date" }}on {{ . }}{{ end }}
{{ printf "</a>" | safeHTML }}
</dt>
<dd>
{{ $mention_title := (index $data "name") }}
{{ with $mention_title }}
{{ printf "<strong><a href=\"%s\">%s</a></strong>" $mention_url . | safeHTML }}<br />
{{ printf `<strong><a href="%s">%s</a></strong>` $mention_url . | safeHTML }}<br />
{{ with $.Scratch.Get "__published_date" }}—Published on {{ . }}{{ end }}
<hr />
{{ end }}
......@@ -105,12 +105,12 @@
<!-- Likes -->
<span class="like">
{{ with $page.Params.syndication.twitter }}
{{ printf "<a title=\"Like using Twitter\" href=\"https://twitter.com/intent/like?tweet_id=%d\">" . | safeHTML }}
{{ printf `<a title="Like using Twitter" href="https://twitter.com/intent/like?tweet_id=%d">` . | safeHTML }}
{{ end }}
<!-- Show the icon only if the associated count is non-zero or if syndication link is present. -->
{{ if (or (ge ($.Scratch.Get "__like_cnt") 1) ($page.Params.syndication.twitter)) }}
<span class="icon">
{{ printf "<i class=\"%s fa-heart\"></i>" ($.Param "fontawesome.style" | default "fal") | safeHTML }}
{{ printf `<i class="%s fa-heart"></i>` ($.Param "fontawesome.style" | default "fal") | safeHTML }}
</span>
{{ end }}
{{ with $page.Params.syndication.twitter }}
......@@ -127,12 +127,12 @@
<!-- Retweets/reposts -->
<span class="retweet">
{{ with $page.Params.syndication.twitter }}
{{ printf "<a title=\"Retweet using Twitter\" href=\"https://twitter.com/intent/retweet?tweet_id=%d\">" . | safeHTML }}
{{ printf `<a title="Retweet using Twitter" href="https://twitter.com/intent/retweet?tweet_id=%d">` . | safeHTML }}
{{ end }}
<!-- Show the icon only if the associated count is non-zero or if syndication link is present. -->
{{ if (or (ge ($.Scratch.Get "__repost_cnt") 1) ($page.Params.syndication.twitter)) }}
<span class="icon">
{{ printf "<i class=\"%s fa-retweet\"></i>" ($.Param "fontawesome.style" | default "fal") | safeHTML }}
{{ printf `<i class="%s fa-retweet"></i>` ($.Param "fontawesome.style" | default "fal") | safeHTML }}
</span>
{{ end }}
{{ with $page.Params.syndication.twitter }}
......@@ -149,9 +149,9 @@
<!-- Reply-->
{{ with $page.Params.syndication.twitter }}
<span class="tweet">
{{ printf "<a title=\"Reply using Twitter (but hey, I'd urge you to instead use that Comment button above ☺)\" href=\"https://twitter.com/intent/tweet?in_reply_to=%d\">" . | safeHTML }}
{{ printf `<a title="Reply using Twitter (but hey, I'd urge you to instead use that Comment button above ☺)" href="https://twitter.com/intent/tweet?in_reply_to=%d">` . | safeHTML }}
<span class="icon">
{{ printf "<i class=\"%s fa-reply\"></i>" ($.Param "fontawesome.style" | default "fal") | safeHTML }}
{{ printf `<i class="%s fa-reply"></i>` ($.Param "fontawesome.style" | default "fal") | safeHTML }}
</span>
{{ printf "</a>" | safeHTML }}
</span>
......
......@@ -9,9 +9,9 @@
If you have written a <a href="https://indieweb.org/responses">response</a>
to this, enter your response post's URL below.
</p>
{{ printf "<form action=\"%s%s/webmention\" method=\"post\">" .endpoint .account | safeHTML }}
{{ printf "<input name=\"source\" placeholder=\"https://example.com/reply-to-%s/\" type=\"url\">" ($page.Title | urlize) | safeHTML }}
{{ printf "<input name=\"target\" value=\"%s\" type=\"hidden\">" ($page.Permalink | replaceRE "^http://localhost:[0-9]+/" $domain) | safeHTML }}
{{ printf `<form action="%s%s/webmention" method="post">` .endpoint .account | safeHTML }}
{{ printf `<input name="source" placeholder="https://example.com/reply-to-%s/" type="url">` ($page.Title | urlize) | safeHTML }}
{{ printf `<input name="target" value="%s" type="hidden">` ($page.Permalink | replaceRE "^http://localhost:[0-9]+/" $domain) | safeHTML }}
<input value="Send Webmention" type="submit">
{{ printf "</form>" | safeHTML }}
</div>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment