aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Johnson <mail@nicholasjohnson.ch>2024-11-07 00:00:00 +0000
committerNicholas Johnson <mail@nicholasjohnson.ch>2024-11-07 00:00:00 +0000
commite8ce80b80dc1ebfc1db1e0cee7a7f7ac1e0e7e94961e456e5e60d1a15caeb7fe (patch)
treef6b9cd467ef103f8e2aca8b1f34b18ea847e8267b1dcf2aeef0dea10834c5727
parent49ac99612abe9fbe54547934fc76cba4bc277e2597b33716dbda4da00e5c6593 (diff)
downloadhugo-theme-journal-e8ce80b80dc1ebfc1db1e0cee7a7f7ac1e0e7e94961e456e5e60d1a15caeb7fe.tar.gz
hugo-theme-journal-e8ce80b80dc1ebfc1db1e0cee7a7f7ac1e0e7e94961e456e5e60d1a15caeb7fe.zip
Disable HTML renderer for Gemini output format
This avoids littering the gemtext templates with "safeHTML".
-rw-r--r--config/_default/hugo.toml1
-rw-r--r--layouts/_default/single.gmi14
-rw-r--r--layouts/index.gmi6
-rw-r--r--layouts/partials/footer.gmi2
-rw-r--r--layouts/partials/header.gmi2
-rw-r--r--layouts/partials/metadata.gmi2
-rw-r--r--layouts/partials/pageinfo.gmi2
-rw-r--r--layouts/taxonomy/taxonomy.gmi6
-rw-r--r--layouts/term/term.gmi6
9 files changed, 21 insertions, 20 deletions
diff --git a/config/_default/hugo.toml b/config/_default/hugo.toml
index e2e77ea..7b4cc1e 100644
--- a/config/_default/hugo.toml
+++ b/config/_default/hugo.toml
@@ -10,6 +10,7 @@
baseName = "atom"
[outputFormats.Gemini]
mediaType = "text/gemini"
+ isPlainText = true # Disable HTML renderer
[outputFormats.Gemini_Atom]
mediaType = "application/atom"
baseName = "atom"
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi
index f51d403..207bb87 100644
--- a/layouts/_default/single.gmi
+++ b/layouts/_default/single.gmi
@@ -1,6 +1,6 @@
{{ define "main" -}}
{{ $emoji := cond (.Page.Params.showlinkemoji | default true) (emojify ":link: ") "" -}}
-=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ i18n "returnHome" -}}
+=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" }} {{ i18n "returnHome" -}}
{{ if (.Page.Params.pageinfo | default true) }}
@@ -8,7 +8,7 @@
{{ end }}
-# {{ .Name | safeHTML }}
+# {{ .Name }}
{{ $content := chomp (.RawContent) -}}
{{ $scratch := newScratch -}}
@@ -98,11 +98,11 @@
{{/* demux regex matches above and below preformatted text */ -}}
{{ if $above_pre -}}
- {{ $rendered_text | safeHTML -}}
- {{ $pre | safeHTML -}}
+ {{ $rendered_text -}}
+ {{ $pre -}}
{{ else -}}
- {{ $pre | safeHTML -}}
- {{ $rendered_text | safeHTML -}}
+ {{ $pre -}}
+ {{ $rendered_text -}}
{{ end -}}
{{ end -}}
@@ -119,7 +119,7 @@
{{ $ref_title := .title -}}
{{/* render referenced links */}}
-{{ print "=> " $ref_link (emojify " :link: [") $ref_index "]: " (cond (ne (len $ref_title) 0) $ref_title $ref_text) | safeHTML -}}
+{{ print "=> " $ref_link (emojify " :link: [") $ref_index "]: " (cond (ne (len $ref_title) 0) $ref_title $ref_text) -}}
{{ end -}}
{{ end -}}
diff --git a/layouts/index.gmi b/layouts/index.gmi
index 05250fd..ec9a959 100644
--- a/layouts/index.gmi
+++ b/layouts/index.gmi
@@ -1,14 +1,14 @@
{{ define "main" -}}
-# {{ .Site.Params.indexTitle | safeHTML }}
+# {{ .Site.Params.indexTitle }}
-{{ .Site.Params.indexIntro | safeHTML }}
+{{ .Site.Params.indexIntro }}
{{- if .Site.Menus.main }}
## {{ i18n "navLinks" }}
{{ range .Site.Menus.main }}
-=> {{ .URL }} {{ emojify ":link:" | safeHTML }} {{ .Name | safeHTML -}}
+=> {{ .URL }} {{ emojify ":link:" }} {{ .Name -}}
{{ end -}}
{{ end -}}
diff --git a/layouts/partials/footer.gmi b/layouts/partials/footer.gmi
index 338e88e..06b0678 100644
--- a/layouts/partials/footer.gmi
+++ b/layouts/partials/footer.gmi
@@ -1 +1 @@
-{{ replace $.Site.Copyright "{currentYear}" (now.Format "2006") | safeHTML }} \ No newline at end of file
+{{ replace $.Site.Copyright "{currentYear}" (now.Format "2006") }} \ No newline at end of file
diff --git a/layouts/partials/header.gmi b/layouts/partials/header.gmi
index a7f87a9..c70f84a 100644
--- a/layouts/partials/header.gmi
+++ b/layouts/partials/header.gmi
@@ -1,3 +1,3 @@
```plaintext
-{{ chomp (readFile "templates/logo.txt") | safeHTML }}
+{{ chomp (readFile "templates/logo.txt") }}
``` \ No newline at end of file
diff --git a/layouts/partials/metadata.gmi b/layouts/partials/metadata.gmi
index a4bf636..7ee4064 100644
--- a/layouts/partials/metadata.gmi
+++ b/layouts/partials/metadata.gmi
@@ -1,2 +1,2 @@
{{ partial "pageinfo.gmi" . }}
-=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ .Title | safeHTML }} \ No newline at end of file
+=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" }} {{ .Title }} \ No newline at end of file
diff --git a/layouts/partials/pageinfo.gmi b/layouts/partials/pageinfo.gmi
index 951bdf4..0e2d051 100644
--- a/layouts/partials/pageinfo.gmi
+++ b/layouts/partials/pageinfo.gmi
@@ -1,2 +1,2 @@
{{ $dateFormat := .Site.Params.dateFormat | default ":date_long" -}}
-{{ emojify ":calendar:" | safeHTML }} {{ .Page.PublishDate | time.Format $dateFormat | safeHTML }} | {{ emojify ":stopwatch:" | safeHTML }} {{ i18n "readingTime" .ReadingTime }}{{ if (.Param (lower (i18n "tags"))) }} | {{ emojify ":label:" | safeHTML }} {{ end }}{{ range $key, $val := (.Param (lower (i18n "tags"))) }}{{ if $key }}, {{ end }}{{ $val }}{{ end }} \ No newline at end of file
+{{ emojify ":calendar:" }} {{ .Page.PublishDate | time.Format $dateFormat }} | {{ emojify ":stopwatch:" }} {{ i18n "readingTime" .ReadingTime }}{{ if (.Param (lower (i18n "tags"))) }} | {{ emojify ":label:" }} {{ end }}{{ range $key, $val := (.Param (lower (i18n "tags"))) }}{{ if $key }}, {{ end }}{{ $val }}{{ end }} \ No newline at end of file
diff --git a/layouts/taxonomy/taxonomy.gmi b/layouts/taxonomy/taxonomy.gmi
index 873571d..4777616 100644
--- a/layouts/taxonomy/taxonomy.gmi
+++ b/layouts/taxonomy/taxonomy.gmi
@@ -1,5 +1,5 @@
{{ define "main" -}}
-=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ i18n "returnHome" }}
+=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" }} {{ i18n "returnHome" }}
# {{ .Type | humanize }}
@@ -7,11 +7,11 @@
## {{ i18n "feeds" }}
-=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "atom.xml" | safeHTML }} {{ emojify ":link:" | safeHTML }} {{ i18n "atomFeed" }}
+=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "atom.xml" }} {{ emojify ":link:" }} {{ i18n "atomFeed" }}
## {{ i18n "list" }}
{{ range .Data.Pages }}
-=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ .Title | safeHTML -}}
+=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" }} {{ .Title -}}
{{ end -}}
{{ end }} \ No newline at end of file
diff --git a/layouts/term/term.gmi b/layouts/term/term.gmi
index 8d6158f..fc765bf 100644
--- a/layouts/term/term.gmi
+++ b/layouts/term/term.gmi
@@ -1,13 +1,13 @@
{{ define "main" -}}
-=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ i18n "returnHome" }}
+=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" }} {{ i18n "returnHome" }}
-# {{ .Type | singularize | humanize | safeHTML }} "{{ .Title | safeHTML }}"
+# {{ .Type | singularize | humanize }} "{{ .Title }}"
## {{ i18n "feeds" }}
-=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "atom.xml" | safeHTML }} {{ emojify ":link:" | safeHTML }} {{ i18n "atomFeed" }}
+=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "atom.xml" }} {{ emojify ":link:" }} {{ i18n "atomFeed" }}
## {{ i18n "journalEntries" -}}