Remove trailing whitespace and tabs from RSS templates
authorKyle Anderson <kyle@xkyle.com>
Wed, 12 Aug 2020 05:34:04 +0000 (22:34 -0700)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 12 Aug 2020 07:25:16 +0000 (09:25 +0200)
The rss templates had some tab characters mixed in with the spaces.
Additionally there would end up being trailing whitespace in output
rss feeds, which looks red in git diff.

tpl/tplimpl/embedded/templates.autogen.go
tpl/tplimpl/embedded/templates/_default/rss.xml
tpl/tplimpl/embedded/templates/_default/sitemap.xml
tpl/tplimpl/embedded/templates/_default/sitemapindex.xml

index 190c88e328698bc073d75a85ee462efa1dc8a673..6a684493339b4a9158c65e640b58968aaa27e17f 100644 (file)
@@ -43,9 +43,9 @@ var EmbeddedTemplates = [][2]string{
     <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
     <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
     <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
-    {{ with .OutputFormats.Get "RSS" }}
-       {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
-    {{ end }}
+    {{- with .OutputFormats.Get "RSS" -}}
+    {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
+    {{- end -}}
     {{ range $pages }}
     <item>
       <title>{{ .Title }}</title>
@@ -57,7 +57,8 @@ var EmbeddedTemplates = [][2]string{
     </item>
     {{ end }}
   </channel>
-</rss>`},
+</rss>
+`},
        {`_default/sitemap.xml`, `{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
   xmlns:xhtml="http://www.w3.org/1999/xhtml">
@@ -79,17 +80,18 @@ var EmbeddedTemplates = [][2]string{
                 />{{ end }}
   </url>
   {{ end }}
-</urlset>`},
+</urlset>
+`},
        {`_default/sitemapindex.xml`, `{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
 <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
-       {{ range . }}
-       <sitemap>
-               <loc>{{ .SitemapAbsURL }}</loc>
-               {{ if not .LastChange.IsZero }}
-               <lastmod>{{ .LastChange.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod>
-               {{ end }}
-       </sitemap>
-       {{ end }}
+  {{ range . }}
+  <sitemap>
+    <loc>{{ .SitemapAbsURL }}</loc>
+    {{ if not .LastChange.IsZero }}
+      <lastmod>{{ .LastChange.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod>
+    {{ end }}
+  </sitemap>
+  {{ end }}
 </sitemapindex>
 `},
        {`alias.html`, `<!DOCTYPE html><html><head><title>{{ .Permalink }}</title><link rel="canonical" href="{{ .Permalink }}"/><meta name="robots" content="noindex"><meta charset="utf-8" /><meta http-equiv="refresh" content="0; url={{ .Permalink }}" /></head></html>`},
index 8bdf02ad72f9c8409688b38d20f8a0e771fb56ed..7acdbef6be6c4d0af054ac402dd06171e5605f1f 100644 (file)
@@ -22,9 +22,9 @@
     <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
     <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
     <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
-    {{ with .OutputFormats.Get "RSS" }}
-       {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
-    {{ end }}
+    {{- with .OutputFormats.Get "RSS" -}}
+    {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
+    {{- end -}}
     {{ range $pages }}
     <item>
       <title>{{ .Title }}</title>
@@ -36,4 +36,4 @@
     </item>
     {{ end }}
   </channel>
-</rss>
\ No newline at end of file
+</rss>
index cd2cab732e49c5d274d088561a686eda0ed53fdf..63f51195b04167f620d72b9da01ddb10e53bf482 100644 (file)
@@ -19,4 +19,4 @@
                 />{{ end }}
   </url>
   {{ end }}
-</urlset>
\ No newline at end of file
+</urlset>
index 62131a987928ec406f0f392fed99e060881e7cbd..01cf65bc5989b92461523c222198dc84744b8775 100644 (file)
@@ -1,11 +1,11 @@
 {{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
 <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
-       {{ range . }}
-       <sitemap>
-               <loc>{{ .SitemapAbsURL }}</loc>
-               {{ if not .LastChange.IsZero }}
-               <lastmod>{{ .LastChange.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod>
-               {{ end }}
-       </sitemap>
-       {{ end }}
+  {{ range . }}
+  <sitemap>
+    <loc>{{ .SitemapAbsURL }}</loc>
+    {{ if not .LastChange.IsZero }}
+      <lastmod>{{ .LastChange.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod>
+    {{ end }}
+  </sitemap>
+  {{ end }}
 </sitemapindex>