diff options
Diffstat (limited to 'layouts')
43 files changed, 407 insertions, 433 deletions
diff --git a/layouts/404.html b/layouts/404.html index f3b9742..fffedc1 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,8 +1,8 @@ {{ define "main" -}} <nav> - <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> + <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> </nav> -<main> +<main class="main"> <h1 id="404">{{ i18n "pageNotFound" }}</h1> </main> {{- end }} diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html deleted file mode 100644 index 934c0ef..0000000 --- a/layouts/_default/_markup/render-link.html +++ /dev/null @@ -1,2 +0,0 @@ -{{ $emoji := cond (and (not (.Page.Params.makerefs | default true)) (.Page.Params.showlinkemoji | default true)) (emojify ":link: ") "" -}} -{{ $emoji }}<a class="link" href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }} rel="noreferrer">{{ .Text | safeHTML }}</a>
\ No newline at end of file diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi deleted file mode 100644 index 2064bdd..0000000 --- a/layouts/_default/single.gmi +++ /dev/null @@ -1,126 +0,0 @@ -{{ define "main" -}} -{{ $emoji := cond (.Page.Params.showlinkemoji | default true) (emojify ":link: ") "" -}} -=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ i18n "returnHome" -}} - -{{ if (.Page.Params.pageinfo | default true) }} - -{{ partial "pageinfo.gmi" . -}} -{{ end }} - - -# {{ .Name | safeHTML }} - -{{ $content := chomp (.RawContent) -}} -{{ $scratch := newScratch -}} - -{{/* if content begins with a heading, add an extra newline */ -}} -{{ if (findRE `^#{1,6} ` $content 1) }} -{{ end -}} - -{{/* split text into chunks, with each chunk containing 3 parts: above, within, and below preformatted text */ -}} -{{/* the regex matching below the preformatted text matches exactly once in the entire text */ -}} -{{ $chunks := findRESubmatch `(?sm)(?:(.+?)(^\x60{3}[^\x60].*?^\x60{3}$))|(.+$)` $content -}} - -{{ $ref_index := 0 -}} - -{{ range $chunks -}} - {{ $above_pre := index . 1 -}} - {{ $pre := index . 2 -}} - {{ $below_pre := index . 3 -}} - - {{/* mux regex matches above and below preformatted text for rendering (the matches are mutually exclusive) */ -}} - {{ $rendered_text := print $above_pre $below_pre -}} - - {{ if ($.Page.Params.makerefs | default true) -}} - - {{/* find all the links within a chunk */ -}} - {{ $chunk_refs := findRESubmatch `!?\[[\t ]*(.+?)[\t ]*\]\([\t ]*(.+?)(?:[\t ]+"(.+?)")?[\t ]*\)` $rendered_text -}} - - {{ range $chunk_refs -}} - {{ $ref_index = add $ref_index 1 -}} - {{ $chunk_ref := dict - "index" $ref_index - "text" (index . 1) - "link" (index . 2) - "title" (index . 3) - -}} - - {{ $scratch.Add "refs" (slice $chunk_ref) -}} - - {{ $ref_index := $chunk_ref.index -}} - {{ $ref_text := $chunk_ref.text -}} - - {{/* create superscript of $ref_index */ -}} - {{ $ref_index := replace $ref_index "0" "⁰" -}} - {{ $ref_index = replace $ref_index "1" "¹" -}} - {{ $ref_index = replace $ref_index "2" "²" -}} - {{ $ref_index = replace $ref_index "3" "³" -}} - {{ $ref_index = replace $ref_index "4" "⁴" -}} - {{ $ref_index = replace $ref_index "5" "⁵" -}} - {{ $ref_index = replace $ref_index "6" "⁶" -}} - {{ $ref_index = replace $ref_index "7" "⁷" -}} - {{ $ref_index = replace $ref_index "8" "⁸" -}} - {{ $ref_index = replace $ref_index "9" "⁹" -}} - - {{/* replace Markdown links with link text and their superscripted reference numbers */ -}} - {{ $rendered_text = replace $rendered_text (index . 0) (print $ref_text $ref_index) 1 -}} - - {{ end -}} - - {{ else -}} - - {{/* render all links directly */ -}} - {{ $rendered_text = $rendered_text | replaceRE `(?m)^!?\[[\t ]*(.+?)[\t ]*\]\([\t ]*(.+?)(?:[\t ]+"(.+?)")?[\t ]*\)$` (print "=> $2 " $emoji "$1") -}} - - {{ end -}} - - {{/* trim extra heading symbols */ -}} - {{ $rendered_text = $rendered_text | replaceRE `(?m)^####{1,3} ` "### " -}} - - {{/* convert Markdown alternative heading syntax to gemtext heading syntax */ -}} - {{ $rendered_text = $rendered_text | replaceRE `(?m)^[\t ]*(\S.+?)[\t ]*\n\=+$` "# $1" -}} - {{ $rendered_text = $rendered_text | replaceRE `(?m)^[\t ]*(\S.+?)[\t ]*\n\-+$` "## $1" -}} - - {{/* convert Markdown alternative unordered list syntax to gemtext unordered list syntax */ -}} - {{ $rendered_text = $rendered_text | replaceRE `(?m)^[-+] ` "* " -}} - - {{/* convert Markdown ordered list items to gemtext unordered list items */ -}} - {{ $rendered_text = $rendered_text | replaceRE `(?m)^[1-9]\d*\.[\t ]+(.*?)[\t ]*$` "* $1" -}} - - {{/* remove bold and italics asterisk symbols */ -}} - {{/* note: this operation is performed in 3 steps to handle nested bold and italics */ -}} - {{/* note: this operation is performed last to avoid incorrectly rendering (un)ordered lists */ -}} - {{ $rendered_text = $rendered_text | replaceRE `\*{3}(\S(?:.*?\S)?)\*{3}` "$1" -}} - {{ $rendered_text = $rendered_text | replaceRE `\*{2}(\S(?:.*?\S)?)\*{2}` "$1" -}} - {{ $rendered_text = $rendered_text | replaceRE `\*{1}(\S(?:.*?\S)?)\*{1}` "$1" -}} - - {{ $rendered_text = $rendered_text | emojify -}} - - {{/* demux regex matches above and below preformatted text */ -}} - {{ if $above_pre -}} - {{ $rendered_text | safeHTML -}} - {{ $pre | safeHTML -}} - {{ else -}} - {{ $pre | safeHTML -}} - {{ $rendered_text | safeHTML -}} - {{ end -}} - -{{ end -}} - -{{ $refs := $scratch.Get "refs" -}} -{{ if and (.Page.Params.makerefs | default true) $refs }} - - -## {{ i18n "refs" }} -{{ range $refs -}} - {{ $ref_index := .index -}} - {{ $ref_text := .text -}} - {{ $ref_link := .link -}} - {{ $ref_title := .title -}} - - {{/* render referenced links */}} -{{ print "=> " $ref_link (emojify " :link: [") $ref_index "]: " (cond (ne (len $ref_title) 0) $ref_title $ref_text) | safeHTML -}} -{{ end -}} - -{{ end -}} -{{ end }} diff --git a/layouts/_default/_markup/render-image.html b/layouts/_markup/render-image.html index 590c9bf..590c9bf 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_markup/render-image.html diff --git a/layouts/_markup/render-link.html b/layouts/_markup/render-link.html new file mode 100644 index 0000000..8fb3c26 --- /dev/null +++ b/layouts/_markup/render-link.html @@ -0,0 +1,3 @@ +{{ $emoji := cond (and (not (.Page.Params.makerefs | default true)) (.Page.Params.showlinkemoji | default true)) (emojify ":link: ") "" -}} +{{ $isExternalLink := (urls.Parse .Destination).IsAbs -}} +{{ $emoji }}<a class="link {{ if $isExternalLink }}link--external{{ else }}link--internal{{ end }}" href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }} rel="{{ if $isExternalLink }}external {{ end }}noreferrer">{{ .Text }}</a>
\ No newline at end of file diff --git a/layouts/_partials/footer.gmi b/layouts/_partials/footer.gmi new file mode 100644 index 0000000..06b0678 --- /dev/null +++ b/layouts/_partials/footer.gmi @@ -0,0 +1 @@ +{{ replace $.Site.Copyright "{currentYear}" (now.Format "2006") }}
\ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/_partials/footer.html index 00194b2..5f8ffc6 100644 --- a/layouts/partials/footer.html +++ b/layouts/_partials/footer.html @@ -1,3 +1,3 @@ <footer class="footer"> - <p class="footer__text">{{ replace $.Site.Copyright "{currentYear}" (now.UTC.Format "2006") }}</p> + <p class="footer__text">{{ replace $.Site.Copyright "{currentYear}" (now.Format "2006") }}</p> </footer>
\ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/_partials/head.html index 8132ec8..8250e19 100644 --- a/layouts/partials/head.html +++ b/layouts/_partials/head.html @@ -13,7 +13,7 @@ <link rel="stylesheet" type="text/css" href="{{ relURL . }}"> {{- end -}} {{ else }} - <link rel="stylesheet" type="text/css" href="{{ (resources.Get "style.css").RelPermalink }}"> + <link rel="stylesheet" type="text/css" href="{{ (resources.Get "static/css/style.css").RelPermalink }}"> {{- end -}} {{ if (not (fileExists "static/favicon.ico")) }} <link rel="icon" href="data:,"> diff --git a/layouts/_partials/header.gmi b/layouts/_partials/header.gmi new file mode 100644 index 0000000..c70f84a --- /dev/null +++ b/layouts/_partials/header.gmi @@ -0,0 +1,3 @@ +```plaintext +{{ chomp (readFile "templates/logo.txt") }} +```
\ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/_partials/header.html index d8ec881..d8ec881 100644 --- a/layouts/partials/header.html +++ b/layouts/_partials/header.html diff --git a/layouts/_partials/metadata.gmi b/layouts/_partials/metadata.gmi new file mode 100644 index 0000000..48d3db4 --- /dev/null +++ b/layouts/_partials/metadata.gmi @@ -0,0 +1,2 @@ +{{ partial "pageinfo.gmi" . }} +=> {{ .RelPermalink | strings.TrimSuffix "index.gmi" }} {{ emojify ":link:" }} {{ .Title }}
\ No newline at end of file diff --git a/layouts/_partials/metadata.html b/layouts/_partials/metadata.html new file mode 100644 index 0000000..ed091b8 --- /dev/null +++ b/layouts/_partials/metadata.html @@ -0,0 +1,6 @@ +<article> + <header> + <p>{{ partial "pageinfo.html" . }}<br> + {{ emojify ":link:" }} <a class="link link--internal" href="{{ .RelPermalink }}" rel="noreferrer">{{ .Title }}</a></p> + </header> +</article>
\ No newline at end of file diff --git a/layouts/_partials/pageinfo.gmi b/layouts/_partials/pageinfo.gmi new file mode 100644 index 0000000..9993d93 --- /dev/null +++ b/layouts/_partials/pageinfo.gmi @@ -0,0 +1,18 @@ +{{ $dateFormat := .Site.Params.dateFormat | default ":date_long" -}} + +{{ $nonBreakingPublishDate := .Page.PublishDate | time.Format $dateFormat -}} +{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate " " " " -}} +{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate "-" "‑" -}} + +{{ $nonBreakingReadingTime := i18n "readingTime" .ReadingTime -}} +{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime " " " " -}} +{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime "-" "‑" -}} + +{{ $nonBreakingTags := slice -}} +{{ range .Param (lower (i18n "tags")) -}} + {{ $nonBreakingTag := replace . " " " " -}} + {{ $nonBreakingTag = replace $nonBreakingTag "-" "‑" -}} + {{ $nonBreakingTags = $nonBreakingTags | append $nonBreakingTag -}} +{{ end -}} + +{{ emojify ":calendar:" }} {{ $nonBreakingPublishDate }} | {{ emojify ":stopwatch:" }} {{ $nonBreakingReadingTime }}{{ if $nonBreakingTags }} | {{ emojify ":label:" }} {{ end }}{{ range $key, $val := $nonBreakingTags }}{{ if $key }}, {{ end }}{{ $val }}{{ end }}
\ No newline at end of file diff --git a/layouts/_partials/pageinfo.html b/layouts/_partials/pageinfo.html new file mode 100644 index 0000000..3ca8fe9 --- /dev/null +++ b/layouts/_partials/pageinfo.html @@ -0,0 +1,23 @@ +{{ $dateFormat := .Site.Params.dateFormat | default ":date_long" -}} + +{{/* user-overridable parameter $dateFormat is escaped pre-insertion so that HTML entities can be inserted */ -}} +{{ $nonBreakingPublishDate := .Page.PublishDate | time.Format $dateFormat | htmlEscape -}} +{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate " " " " -}} +{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate "-" "‑" -}} + +{{/* user-overridable parameter $readingTime is escaped pre-insertion so that HTML entities can be inserted */ -}} +{{ $nonBreakingReadingTime := i18n "readingTime" .ReadingTime | htmlEscape -}} +{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime " " " " -}} +{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime "-" "‑" -}} + +{{ $breakingTags := .Param (lower (i18n "tags")) -}} +{{ $nonBreakingTags := slice -}} +{{ range $breakingTags -}} + {{/* user-defined tags are escaped pre-insertion so that HTML entities can be inserted */ -}} + {{ $nonBreakingTag := htmlEscape . -}} + {{ $nonBreakingTag = replace $nonBreakingTag " " " " -}} + {{ $nonBreakingTag = replace $nonBreakingTag "-" "‑" -}} + {{ $nonBreakingTags = $nonBreakingTags | append $nonBreakingTag -}} +{{ end -}} + +{{ emojify ":calendar:" }} <time {{ printf "datetime=%q" (.Page.PublishDate | time.Format "2006-01-02T15:04:05-0700") | safeHTMLAttr }}>{{ $nonBreakingPublishDate | safeHTML }}</time> | {{ emojify ":stopwatch:" }} <time datetime="PT{{ .ReadingTime }}M">{{ $nonBreakingReadingTime | safeHTML }}</time>{{ if $nonBreakingTags }} | {{ emojify ":label:" }} {{ end }}{{ range $key, $val := $nonBreakingTags }}{{ if $key }} {{ end }}<a class="link link--internal" href='{{ relLangURL (lower (i18n "tags")) }}/{{ index $breakingTags $key | urlize }}/' rel="noreferrer">{{ $val | safeHTML }}</a>{{ end }} diff --git a/layouts/_default/baseof.gmi b/layouts/baseof.gmi index 09cdbac..09cdbac 100644 --- a/layouts/_default/baseof.gmi +++ b/layouts/baseof.gmi diff --git a/layouts/_default/baseof.html b/layouts/baseof.html index a36bd49..fbe1fa1 100644 --- a/layouts/_default/baseof.html +++ b/layouts/baseof.html @@ -2,8 +2,10 @@ <html lang="{{ $.Site.Language }}"> {{ partial "head.html" . }} <body class="body"> - {{ partial "header.html" . }} - {{ block "main" . }}{{ end }} + <div class="base"> + {{ partial "header.html" . }} + {{ block "main" . }}{{ end }} + </div> {{ partial "footer.html" . }} </body> </html>
\ No newline at end of file diff --git a/layouts/index.atom.xml b/layouts/home.atom.xml index 6c3a111..c4f4eae 100644 --- a/layouts/index.atom.xml +++ b/layouts/home.atom.xml @@ -1,4 +1,3 @@ -{{/* Deprecate site.Author.name in favor of site.Params.author.name */}} {{- $authorName := "" }} {{- with site.Params.author }} {{- if reflect.IsMap . }} @@ -8,14 +7,8 @@ {{- else }} {{- $authorName = . }} {{- end }} -{{- else }} - {{- with site.Author.name }} - {{- $authorName = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }} - {{- end }} {{- end }} -{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}} {{- $authorEmail := "" }} {{- with site.Params.author }} {{- if reflect.IsMap . }} @@ -23,18 +16,13 @@ {{- $authorEmail = . }} {{- end }} {{- end }} -{{- else }} - {{- with site.Author.email }} - {{- $authorEmail = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }} - {{- end }} {{- end -}} {{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} <feed xmlns="http://www.w3.org/2005/Atom"> <id>{{ .Permalink }}</id> <title>{{ .Site.Title }}</title> - <updated>{{ .Date.UTC.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated> + <updated>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated> <link href="{{ .Permalink }}atom.xml" rel="self" /> <link href="{{ .Permalink }}" rel="alternate" /> {{- with $authorName }} @@ -44,12 +32,12 @@ <email>{{ . }}</email>{{ end }} </author>{{ end }} <generator>Hugo -- gohugo.io</generator> - <rights type="html">{{ replace .Site.Copyright "{currentYear}" (now.UTC.Format "2006") }}</rights> + <rights type="html">{{ replace .Site.Copyright "{currentYear}" (now.Format "2006") }}</rights> <subtitle>{{ .Site.Params.Description }}</subtitle>{{ range first .Site.Config.Services.RSS.Limit .Site.RegularPages }} <entry> <id>{{ .Permalink }}</id> <title type="html">{{ .Title }}</title> - <updated>{{ .Date.UTC.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated> + <updated>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated> <link href="{{ .Permalink }}" /> <content type="html">{{ .Content | html }}</content> </entry>{{ end }} diff --git a/layouts/home.gemini_atom.xml b/layouts/home.gemini_atom.xml new file mode 100644 index 0000000..6189f83 --- /dev/null +++ b/layouts/home.gemini_atom.xml @@ -0,0 +1,43 @@ +{{- $authorName := "" }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .name }} + {{- $authorName = . }} + {{- end }} + {{- else }} + {{- $authorName = . }} + {{- end }} +{{- end }} + +{{- $authorEmail := "" }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .email }} + {{- $authorEmail = . }} + {{- end }} + {{- end }} +{{- end -}} + +{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +<feed xmlns="http://www.w3.org/2005/Atom"> + <id>{{ .Permalink | strings.TrimSuffix "index.gmi" }}</id> + <title>{{ .Site.Title }}</title> + <updated>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated> + <link href="{{ .Permalink | replaceRE `index.gmi$` "atom.xml" | safeURL }}" rel="self" /> + <link href="{{ .Permalink | strings.TrimSuffix "index.gmi" | safeURL }}" rel="alternate" /> + {{- with $authorName }} + <author> + <name>{{ . }}</name> + {{- with $authorEmail }} + <email>{{ . }}</email>{{ end }} + </author>{{ end }} + <generator>Hugo -- gohugo.io</generator> + <rights type="html">{{ replace .Site.Copyright "{currentYear}" (now.Format "2006") }}</rights> + <subtitle>{{ .Site.Params.Description }}</subtitle>{{ range first .Site.Config.Services.RSS.Limit .Site.RegularPages }} + <entry> + <id>{{ .Permalink | strings.TrimSuffix "index.gmi" }}</id> + <title>{{ .Title }}</title> + <updated>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated> + <link href="{{ .Permalink | strings.TrimSuffix "index.gmi" | safeURL }}" rel="alternate" /> + </entry>{{ end }} +</feed> diff --git a/layouts/index.gmi b/layouts/home.gmi index 05250fd..4ce3bf1 100644 --- a/layouts/index.gmi +++ b/layouts/home.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/index.html b/layouts/home.html index 6f231df..cdf2d01 100644 --- a/layouts/index.html +++ b/layouts/home.html @@ -1,5 +1,5 @@ {{ define "main" -}} -<main> +<main class="main"> <h1>{{ .Site.Params.indexTitle }}</h1> <p>{{ .Site.Params.indexIntro }}</p> {{ if .Site.Menus.main -}} @@ -7,7 +7,7 @@ <nav> <ul class="list"> {{- range .Site.Menus.main }} - <li class="list__item">{{ emojify ":link:" | safeHTML }} <a class="link" href="{{ .URL }}" rel="noreferrer">{{ .Name }}</a></li> + <li class="list__item">{{ emojify ":link:" }} <a class="link link--internal" href="{{ .URL }}" rel="noreferrer">{{ .Name }}</a></li> {{- end }} </ul> </nav> diff --git a/layouts/index.gemini_atom.xml b/layouts/index.gemini_atom.xml deleted file mode 100644 index a6abebc..0000000 --- a/layouts/index.gemini_atom.xml +++ /dev/null @@ -1,55 +0,0 @@ -{{/* Deprecate site.Author.name in favor of site.Params.author.name */}} -{{- $authorName := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .name }} - {{- $authorName = . }} - {{- end }} - {{- else }} - {{- $authorName = . }} - {{- end }} -{{- else }} - {{- with site.Author.name }} - {{- $authorName = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }} - {{- end }} -{{- end }} - -{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}} -{{- $authorEmail := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .email }} - {{- $authorEmail = . }} - {{- end }} - {{- end }} -{{- else }} - {{- with site.Author.email }} - {{- $authorEmail = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }} - {{- end }} -{{- end -}} - -{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} -<feed xmlns="http://www.w3.org/2005/Atom"> - <id>{{ .Permalink | replaceRE `^https://(.*)index.gmi$` "gemini://$1" }}</id> - <title>{{ .Site.Title }}</title> - <updated>{{ .Date.UTC.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated> - <link href="{{ .Permalink | replaceRE `^https://(.*)/index.gmi$` "gemini://$1/atom.xml" | safeURL }}" rel="self" /> - <link href="{{ .Permalink | replaceRE `^https://(.*)index.gmi$` "gemini://$1" | safeURL }}" rel="alternate" /> - {{- with $authorName }} - <author> - <name>{{ . }}</name> - {{- with $authorEmail }} - <email>{{ . }}</email>{{ end }} - </author>{{ end }} - <generator>Hugo -- gohugo.io</generator> - <rights type="html">{{ replace .Site.Copyright "{currentYear}" (now.UTC.Format "2006") }}</rights> - <subtitle>{{ .Site.Params.Description }}</subtitle>{{ range first .Site.Config.Services.RSS.Limit .Site.RegularPages }} - <entry> - <id>{{ .Permalink | replaceRE `^https://(.*)index.gmi$` "gemini://$1" }}</id> - <title>{{ .Title }}</title> - <updated>{{ .Date.UTC.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated> - <link href="{{ .Permalink | replaceRE `^https://(.*)index.gmi$` "gemini://$1" | safeURL }}" rel="alternate" /> - </entry>{{ end }} -</feed> diff --git a/layouts/partials/footer.gmi b/layouts/partials/footer.gmi deleted file mode 100644 index 957c9d0..0000000 --- a/layouts/partials/footer.gmi +++ /dev/null @@ -1 +0,0 @@ -{{ replace $.Site.Copyright "{currentYear}" (now.UTC.Format "2006") | safeHTML }}
\ No newline at end of file diff --git a/layouts/partials/header.gmi b/layouts/partials/header.gmi deleted file mode 100644 index a7f87a9..0000000 --- a/layouts/partials/header.gmi +++ /dev/null @@ -1,3 +0,0 @@ -```plaintext -{{ chomp (readFile "templates/logo.txt") | safeHTML }} -```
\ No newline at end of file diff --git a/layouts/partials/metadata.gmi b/layouts/partials/metadata.gmi deleted file mode 100644 index a4bf636..0000000 --- a/layouts/partials/metadata.gmi +++ /dev/null @@ -1,2 +0,0 @@ -{{ partial "pageinfo.gmi" . }} -=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ .Title | safeHTML }}
\ No newline at end of file diff --git a/layouts/partials/metadata.html b/layouts/partials/metadata.html deleted file mode 100644 index 47106e8..0000000 --- a/layouts/partials/metadata.html +++ /dev/null @@ -1,6 +0,0 @@ -<article> - <header> - <p>{{ partial "pageinfo.html" . }}<br> - {{ emojify ":link:" }} <a class="link" href="{{ .RelPermalink }}" rel="noreferrer">{{ .Title }}</a></p> - </header> -</article>
\ No newline at end of file diff --git a/layouts/partials/pageinfo.gmi b/layouts/partials/pageinfo.gmi deleted file mode 100644 index 951bdf4..0000000 --- a/layouts/partials/pageinfo.gmi +++ /dev/null @@ -1,2 +0,0 @@ -{{ $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 diff --git a/layouts/partials/pageinfo.html b/layouts/partials/pageinfo.html deleted file mode 100644 index ace8d18..0000000 --- a/layouts/partials/pageinfo.html +++ /dev/null @@ -1,2 +0,0 @@ -{{ $dateFormat := .Site.Params.dateFormat | default ":date_long" -}} -{{ emojify ":calendar:" | safeHTML }} {{ .Page.PublishDate | time.Format $dateFormat | safeHTML }} | {{ emojify ":stopwatch:" | safeHTML }} {{ i18n "readingTime" .ReadingTime | safeHTML }}{{ if (.Param (lower (i18n "tags"))) }} | {{ emojify ":label:" | safeHTML }} {{ end }}{{ range $key, $val := (.Param (lower (i18n "tags"))) }}{{ if $key }}, {{ end }}<a class="link" href='{{ relLangURL (lower (i18n "tags")) }}/{{ . | urlize }}/' rel="noreferrer">{{ $val }}</a>{{ end }}
\ No newline at end of file diff --git a/layouts/single.gmi b/layouts/single.gmi new file mode 100644 index 0000000..1502830 --- /dev/null +++ b/layouts/single.gmi @@ -0,0 +1,132 @@ +{{ define "main" -}} +{{ $emoji := cond (.Page.Params.showlinkemoji | default true) (emojify ":link: ") "" -}} +=> {{ .Site.Home.RelPermalink | strings.TrimSuffix "index.gmi" }} {{ emojify ":link:" }} {{ i18n "returnHome" -}} + +{{ if (.Page.Params.pageinfo | default true) }} + +{{ partial "pageinfo.gmi" . -}} +{{ end }} + + +# {{ .Name }} + +{{ $content := chomp (.RawContent) -}} +{{ $scratch := newScratch -}} + +{{/* if content begins with a heading, add an extra newline */ -}} +{{ if (findRE `^#{1,6} ` $content 1) }} +{{ end -}} + +{{/* split text into chunks, with each chunk containing 3 parts: above, within, and below preformatted text */ -}} +{{/* the regex matching below the preformatted text matches exactly once in the entire text */ -}} +{{ $chunks := findRESubmatch `(?sm)(?:(.+?)(^\x60{3}[^\x60].*?^\x60{3}$))|(.+$)` $content -}} + +{{ $ref_index := 0 -}} + +{{ range $chunks -}} + {{ $above_pre := index . 1 -}} + {{ $pre := index . 2 -}} + {{ $below_pre := index . 3 -}} + + {{/* mux regex matches above and below preformatted text for rendering (the matches are mutually exclusive) */ -}} + {{ $rendered_text := print $above_pre $below_pre -}} + + {{ if ($.Page.Params.makerefs | default true) -}} + + {{/* find all the links within a chunk */ -}} + {{ $chunk_refs := findRESubmatch `!?\[[\t ]*(.+?)[\t ]*\]\([\t ]*(.+?)(?:[\t ]+"(.+?)")?[\t ]*\)` $rendered_text -}} + + {{ range $chunk_refs -}} + {{ $ref_index = add $ref_index 1 -}} + {{ $chunk_ref := dict + "index" $ref_index + "text" (index . 1) + "link" (index . 2) + "title" (index . 3) + -}} + + {{ $scratch.Add "refs" (slice $chunk_ref) -}} + + {{ $ref_index := $chunk_ref.index -}} + {{ $ref_text := $chunk_ref.text -}} + + {{/* create superscript of $ref_index */ -}} + {{ $superscript_map := dict + "0" "⁰" + "1" "¹" + "2" "²" + "3" "³" + "4" "⁴" + "5" "⁵" + "6" "⁶" + "7" "⁷" + "8" "⁸" + "9" "⁹" + -}} + {{ $ref_superscript := "" -}} + {{ range (split $ref_index "") -}} + {{ $ref_superscript = print $ref_superscript (index $superscript_map .) -}} + {{ end -}} + + {{/* replace Markdown links with link text and their superscripted reference numbers */ -}} + {{ $rendered_text = replace $rendered_text (index . 0) (print $ref_text $ref_superscript) 1 -}} + + {{ end -}} + + {{ else -}} + + {{/* render all links directly */ -}} + {{ $rendered_text = $rendered_text | replaceRE `(?m)^!?\[[\t ]*(.+?)[\t ]*\]\([\t ]*(.+?)(?:[\t ]+"(.+?)")?[\t ]*\)$` (print "=> $2 " $emoji "$1") -}} + + {{ end -}} + + {{/* trim extra heading symbols */ -}} + {{ $rendered_text = $rendered_text | replaceRE `(?m)^####{1,3} ` "### " -}} + + {{/* convert Markdown alternative heading syntax to gemtext heading syntax */ -}} + {{ $rendered_text = $rendered_text | replaceRE `(?m)^[\t ]*(\S.+?)[\t ]*\n\=+$` "# $1" -}} + {{ $rendered_text = $rendered_text | replaceRE `(?m)^[\t ]*(\S.+?)[\t ]*\n\-+$` "## $1" -}} + + {{/* convert Markdown alternative unordered list syntax to gemtext unordered list syntax */ -}} + {{ $rendered_text = $rendered_text | replaceRE `(?m)^[-+] ` "* " -}} + + {{/* convert Markdown ordered list items to gemtext unordered list items */ -}} + {{ $rendered_text = $rendered_text | replaceRE `(?m)^[1-9]\d*\.[\t ]+(.*?)[\t ]*$` "* $1" -}} + + {{/* remove bold and italics asterisk symbols */ -}} + {{/* note: this operation is performed in 3 steps to handle nested bold and italics */ -}} + {{/* note: this operation is performed last to avoid incorrectly rendering (un)ordered lists */ -}} + {{ $rendered_text = $rendered_text | replaceRE `\*{3}(\S(?:.*?\S)?)\*{3}` "$1" -}} + {{ $rendered_text = $rendered_text | replaceRE `\*{2}(\S(?:.*?\S)?)\*{2}` "$1" -}} + {{ $rendered_text = $rendered_text | replaceRE `\*{1}(\S(?:.*?\S)?)\*{1}` "$1" -}} + + {{ $rendered_text = $rendered_text | emojify -}} + + {{/* demux regex matches above and below preformatted text */ -}} + {{ if $above_pre -}} + {{ $rendered_text -}} + {{ $pre -}} + {{ else -}} + {{ $pre -}} + {{ $rendered_text -}} + {{ end -}} + +{{ end -}} + +{{ $refs := $scratch.Get "refs" -}} +{{ if and (.Page.Params.makerefs | default true) $refs }} + + +## {{ i18n "refs" }} +{{ range $refs -}} + {{ $ref_index := .index -}} + {{ $ref_text := .text -}} + {{ $ref_link := .link -}} + {{ $ref_title := .title -}} + + {{/* render referenced links */}} +{{ print "=> " $ref_link (emojify " :link: [") $ref_index "]: " (cond (ne (len $ref_title) 0) $ref_title $ref_text) -}} +{{ end -}} + +{{ end -}} +{{ end }} diff --git a/layouts/_default/single.html b/layouts/single.html index cd80256..67029c0 100644 --- a/layouts/_default/single.html +++ b/layouts/single.html @@ -1,11 +1,11 @@ {{ define "main" -}} <nav> - <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> + <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> </nav> {{- if (.Page.Params.pageinfo | default true) }} <p>{{ partial "pageinfo.html" . }}</p> {{- end }} -<main> +<main class="main"> <h1 id="{{ .File.TranslationBaseName }}">{{ .Name }}</h1> {{ chomp (.Content) }} </main> diff --git a/layouts/taxonomy/taxonomy.atom.xml b/layouts/taxonomy.atom.xml index 9ceeb79..1364f27 100644 --- a/layouts/taxonomy/taxonomy.atom.xml +++ b/layouts/taxonomy.atom.xml @@ -1,4 +1,3 @@ -{{/* Deprecate site.Author.name in favor of site.Params.author.name */}} {{- $authorName := "" }} {{- with site.Params.author }} {{- if reflect.IsMap . }} @@ -8,14 +7,8 @@ {{- else }} {{- $authorName = . }} {{- end }} -{{- else }} - {{- with site.Author.name }} - {{- $authorName = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }} - {{- end }} {{- end }} -{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}} {{- $authorEmail := "" }} {{- with site.Params.author }} {{- if reflect.IsMap . }} @@ -23,18 +16,13 @@ {{- $authorEmail = . }} {{- end }} {{- end }} -{{- else }} - {{- with site.Author.email }} - {{- $authorEmail = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }} - {{- end }} {{- end -}} {{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} <feed xmlns="http://www.w3.org/2005/Atom"> <id>{{ .Permalink }}</id> <title>{{ .Site.Title }}</title> - <updated>{{ .Date.UTC.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated> + <updated>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated> <link href="{{ .Permalink }}atom.xml" rel="self" /> <link href="{{ .Permalink }}" rel="alternate" /> {{- with $authorName }} @@ -44,12 +32,12 @@ <email>{{ . }}</email>{{ end }} </author>{{ end }} <generator>Hugo -- gohugo.io</generator> - <rights type="html">{{ replace .Site.Copyright "{currentYear}" (now.UTC.Format "2006") }}</rights> + <rights type="html">{{ replace .Site.Copyright "{currentYear}" (now.Format "2006") }}</rights> <subtitle>{{ .Site.Params.Description }}</subtitle>{{ range first .Site.Config.Services.RSS.Limit .Data.Pages }} <entry> <id>{{ .Permalink }}</id> <title type="html">{{ .Title }}</title> - <updated>{{ .Date.UTC.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated> + <updated>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated> <link href="{{ .Permalink }}" /> <content type="html">{{ .Content | html }}</content> </entry>{{ end }} diff --git a/layouts/taxonomy.gemini_atom.xml b/layouts/taxonomy.gemini_atom.xml new file mode 100644 index 0000000..d8ab06e --- /dev/null +++ b/layouts/taxonomy.gemini_atom.xml @@ -0,0 +1,43 @@ +{{- $authorName := "" }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .name }} + {{- $authorName = . }} + {{- end }} + {{- else }} + {{- $authorName = . }} + {{- end }} +{{- end }} + +{{- $authorEmail := "" }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .email }} + {{- $authorEmail = . }} + {{- end }} + {{- end }} +{{- end -}} + +{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +<feed xmlns="http://www.w3.org/2005/Atom"> + <id>{{ .Permalink | strings.TrimSuffix "index.gmi" }}</id> + <title>{{ .Site.Title }}</title> + <updated>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated> + <link href="{{ .Permalink | replaceRE `index.gmi$` "atom.xml" | safeURL }}" rel="self" /> + <link href="{{ .Permalink | strings.TrimSuffix "index.gmi" | safeURL }}" rel="alternate" /> + {{- with $authorName }} + <author> + <name>{{ . }}</name> + {{- with $authorEmail }} + <email>{{ . }}</email>{{ end }} + </author>{{ end }} + <generator>Hugo -- gohugo.io</generator> + <rights type="html">{{ replace .Site.Copyright "{currentYear}" (now.Format "2006") }}</rights> + <subtitle>{{ .Site.Params.Description }}</subtitle>{{ range first .Site.Config.Services.RSS.Limit .Data.Pages }} + <entry> + <id>{{ .Permalink | strings.TrimSuffix "index.gmi" }}</id> + <title>{{ .Title }}</title> + <updated>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated> + <link href="{{ .Permalink | strings.TrimSuffix "index.gmi" | safeURL }}" rel="alternate" /> + </entry>{{ end }} +</feed> diff --git a/layouts/taxonomy.gmi b/layouts/taxonomy.gmi new file mode 100644 index 0000000..9c2a9f0 --- /dev/null +++ b/layouts/taxonomy.gmi @@ -0,0 +1,17 @@ +{{ define "main" -}} +=> {{ .Site.Home.RelPermalink | strings.TrimSuffix "index.gmi" }} {{ emojify ":link:" }} {{ i18n "returnHome" }} + + +# {{ .Type | humanize }} + + +## {{ i18n "feeds" }} + +=> {{ .RelPermalink | replaceRE `index.gmi$` "atom.xml" }} {{ emojify ":link:" }} {{ i18n "atomFeed" }} + + +## {{ i18n "list" }} +{{ range .Data.Pages }} +=> {{ .RelPermalink | strings.TrimSuffix "index.gmi" }} {{ emojify ":link:" }} {{ .Title -}} +{{ end -}} +{{ end }}
\ No newline at end of file diff --git a/layouts/taxonomy.html b/layouts/taxonomy.html new file mode 100644 index 0000000..2002ed3 --- /dev/null +++ b/layouts/taxonomy.html @@ -0,0 +1,16 @@ +{{ define "main" -}} +<nav> + <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> +</nav> +<main class="main"> + <h1>{{ .Type | humanize }}</h1> + <h2>{{ i18n "feeds" }}</h2> + <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer">{{ i18n "atomFeed" }}</a></p> + <h2>{{ i18n "list" }}</h2> + <ul class="list"> + {{- range .Data.Pages }} + <li class="list__item">{{ emojify ":link:" }} <a class="link link--internal" href="{{ .RelPermalink }}" rel="noreferrer">{{ .Title }}</a></li> + {{- end }} + </ul> +</main> +{{- end }}
\ No newline at end of file diff --git a/layouts/taxonomy/taxonomy.gemini_atom.xml b/layouts/taxonomy/taxonomy.gemini_atom.xml deleted file mode 100644 index 5eadc00..0000000 --- a/layouts/taxonomy/taxonomy.gemini_atom.xml +++ /dev/null @@ -1,55 +0,0 @@ -{{/* Deprecate site.Author.name in favor of site.Params.author.name */}} -{{- $authorName := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .name }} - {{- $authorName = . }} - {{- end }} - {{- else }} - {{- $authorName = . }} - {{- end }} -{{- else }} - {{- with site.Author.name }} - {{- $authorName = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }} - {{- end }} -{{- end }} - -{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}} -{{- $authorEmail := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .email }} - {{- $authorEmail = . }} - {{- end }} - {{- end }} -{{- else }} - {{- with site.Author.email }} - {{- $authorEmail = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }} - {{- end }} -{{- end -}} - -{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} -<feed xmlns="http://www.w3.org/2005/Atom"> - <id>{{ .Permalink | replaceRE `^https://(.*)index.gmi$` "gemini://$1" }}</id> - <title>{{ .Site.Title }}</title> - <updated>{{ .Date.UTC.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated> - <link href="{{ .Permalink | replaceRE `^https://(.*)/index.gmi$` "gemini://$1/atom.xml" | safeURL }}" rel="self" /> - <link href="{{ .Permalink | replaceRE `^https://(.*)index.gmi$` "gemini://$1" | safeURL }}" rel="alternate" /> - {{- with $authorName }} - <author> - <name>{{ . }}</name> - {{- with $authorEmail }} - <email>{{ . }}</email>{{ end }} - </author>{{ end }} - <generator>Hugo -- gohugo.io</generator> - <rights type="html">{{ replace .Site.Copyright "{currentYear}" (now.UTC.Format "2006") }}</rights> - <subtitle>{{ .Site.Params.Description }}</subtitle>{{ range first .Site.Config.Services.RSS.Limit .Data.Pages }} - <entry> - <id>{{ .Permalink | replaceRE `^https://(.*)index.gmi$` "gemini://$1" }}</id> - <title>{{ .Title }}</title> - <updated>{{ .Date.UTC.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated> - <link href="{{ .Permalink | replaceRE `^https://(.*)index.gmi$` "gemini://$1" | safeURL }}" rel="alternate" /> - </entry>{{ end }} -</feed> diff --git a/layouts/taxonomy/taxonomy.gmi b/layouts/taxonomy/taxonomy.gmi deleted file mode 100644 index 873571d..0000000 --- a/layouts/taxonomy/taxonomy.gmi +++ /dev/null @@ -1,17 +0,0 @@ -{{ define "main" -}} -=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ i18n "returnHome" }} - - -# {{ .Type | humanize }} - - -## {{ i18n "feeds" }} - -=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "atom.xml" | safeHTML }} {{ emojify ":link:" | safeHTML }} {{ i18n "atomFeed" }} - - -## {{ i18n "list" }} -{{ range .Data.Pages }} -=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ .Title | safeHTML -}} -{{ end -}} -{{ end }}
\ No newline at end of file diff --git a/layouts/taxonomy/taxonomy.html b/layouts/taxonomy/taxonomy.html deleted file mode 100644 index 51e00a3..0000000 --- a/layouts/taxonomy/taxonomy.html +++ /dev/null @@ -1,16 +0,0 @@ -{{ define "main" -}} -<nav> - <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> -</nav> -<main> - <h1>{{ .Type | humanize }}</h1> - <h2>{{ i18n "feeds" }}</h2> - <p><a class="link" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer"> {{ emojify ":link:" | safeHTML }} {{ i18n "atomFeed" }}</a></p> - <h2>{{ i18n "list" }}</h2> - <ul class="list"> - {{- range .Data.Pages }} - <li class="list__item">{{ emojify ":link:" }} <a class="link" href="{{ .RelPermalink }}" rel="noreferrer">{{ .Title }}</a></li> - {{- end }} - </ul> -</main> -{{- end }}
\ No newline at end of file diff --git a/layouts/term/term.atom.xml b/layouts/term.atom.xml index 9ceeb79..1364f27 100644 --- a/layouts/term/term.atom.xml +++ b/layouts/term.atom.xml @@ -1,4 +1,3 @@ -{{/* Deprecate site.Author.name in favor of site.Params.author.name */}} {{- $authorName := "" }} {{- with site.Params.author }} {{- if reflect.IsMap . }} @@ -8,14 +7,8 @@ {{- else }} {{- $authorName = . }} {{- end }} -{{- else }} - {{- with site.Author.name }} - {{- $authorName = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }} - {{- end }} {{- end }} -{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}} {{- $authorEmail := "" }} {{- with site.Params.author }} {{- if reflect.IsMap . }} @@ -23,18 +16,13 @@ {{- $authorEmail = . }} {{- end }} {{- end }} -{{- else }} - {{- with site.Author.email }} - {{- $authorEmail = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }} - {{- end }} {{- end -}} {{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} <feed xmlns="http://www.w3.org/2005/Atom"> <id>{{ .Permalink }}</id> <title>{{ .Site.Title }}</title> - <updated>{{ .Date.UTC.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated> + <updated>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated> <link href="{{ .Permalink }}atom.xml" rel="self" /> <link href="{{ .Permalink }}" rel="alternate" /> {{- with $authorName }} @@ -44,12 +32,12 @@ <email>{{ . }}</email>{{ end }} </author>{{ end }} <generator>Hugo -- gohugo.io</generator> - <rights type="html">{{ replace .Site.Copyright "{currentYear}" (now.UTC.Format "2006") }}</rights> + <rights type="html">{{ replace .Site.Copyright "{currentYear}" (now.Format "2006") }}</rights> <subtitle>{{ .Site.Params.Description }}</subtitle>{{ range first .Site.Config.Services.RSS.Limit .Data.Pages }} <entry> <id>{{ .Permalink }}</id> <title type="html">{{ .Title }}</title> - <updated>{{ .Date.UTC.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated> + <updated>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated> <link href="{{ .Permalink }}" /> <content type="html">{{ .Content | html }}</content> </entry>{{ end }} diff --git a/layouts/term.gemini_atom.xml b/layouts/term.gemini_atom.xml new file mode 100644 index 0000000..d8ab06e --- /dev/null +++ b/layouts/term.gemini_atom.xml @@ -0,0 +1,43 @@ +{{- $authorName := "" }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .name }} + {{- $authorName = . }} + {{- end }} + {{- else }} + {{- $authorName = . }} + {{- end }} +{{- end }} + +{{- $authorEmail := "" }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .email }} + {{- $authorEmail = . }} + {{- end }} + {{- end }} +{{- end -}} + +{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +<feed xmlns="http://www.w3.org/2005/Atom"> + <id>{{ .Permalink | strings.TrimSuffix "index.gmi" }}</id> + <title>{{ .Site.Title }}</title> + <updated>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated> + <link href="{{ .Permalink | replaceRE `index.gmi$` "atom.xml" | safeURL }}" rel="self" /> + <link href="{{ .Permalink | strings.TrimSuffix "index.gmi" | safeURL }}" rel="alternate" /> + {{- with $authorName }} + <author> + <name>{{ . }}</name> + {{- with $authorEmail }} + <email>{{ . }}</email>{{ end }} + </author>{{ end }} + <generator>Hugo -- gohugo.io</generator> + <rights type="html">{{ replace .Site.Copyright "{currentYear}" (now.Format "2006") }}</rights> + <subtitle>{{ .Site.Params.Description }}</subtitle>{{ range first .Site.Config.Services.RSS.Limit .Data.Pages }} + <entry> + <id>{{ .Permalink | strings.TrimSuffix "index.gmi" }}</id> + <title>{{ .Title }}</title> + <updated>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated> + <link href="{{ .Permalink | strings.TrimSuffix "index.gmi" | safeURL }}" rel="alternate" /> + </entry>{{ end }} +</feed> diff --git a/layouts/term.gmi b/layouts/term.gmi new file mode 100644 index 0000000..5d7f7b1 --- /dev/null +++ b/layouts/term.gmi @@ -0,0 +1,19 @@ +{{ define "main" -}} +=> {{ .Site.Home.RelPermalink | strings.TrimSuffix "index.gmi" }} {{ emojify ":link:" }} {{ i18n "returnHome" }} + + +# {{ .Type | singularize | humanize }} "{{ .Title }}" + + +## {{ i18n "feeds" }} + +=> {{ .RelPermalink | replaceRE `index.gmi$` "atom.xml" }} {{ emojify ":link:" }} {{ i18n "atomFeed" }} + + +## {{ i18n "journalEntries" -}} + +{{ range .Data.Pages.ByPublishDate.Reverse }} + +{{ partial "metadata.gmi" . -}} +{{ end -}} +{{ end }}
\ No newline at end of file diff --git a/layouts/term.html b/layouts/term.html new file mode 100644 index 0000000..3870c69 --- /dev/null +++ b/layouts/term.html @@ -0,0 +1,14 @@ +{{ define "main" -}} +<nav> + <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> +</nav> +<main class="main"> + <h1>{{ .Type | singularize | humanize }} "{{ .Title }}"</h1> + <h2>{{ i18n "feeds" }}</h2> + <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer">{{ i18n "atomFeed" }}</a></p> + <h2>{{ i18n "journalEntries" }}</h2> + {{- range .Data.Pages.ByPublishDate.Reverse }} + {{ partial "metadata.html" . -}} + {{ end }} +</main> +{{- end }}
\ No newline at end of file diff --git a/layouts/term/term.gemini_atom.xml b/layouts/term/term.gemini_atom.xml deleted file mode 100644 index e02d2fe..0000000 --- a/layouts/term/term.gemini_atom.xml +++ /dev/null @@ -1,55 +0,0 @@ -{{/*Deprecate site.Author.name in favor of site.Params.author.name */}} -{{- $authorName := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .name }} - {{- $authorName = . }} - {{- end }} - {{- else }} - {{- $authorName = . }} - {{- end }} -{{- else }} - {{- with site.Author.name }} - {{- $authorName = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }} - {{- end }} -{{- end }} - -{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}} -{{- $authorEmail := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .email }} - {{- $authorEmail = . }} - {{- end }} - {{- end }} -{{- else }} - {{- with site.Author.email }} - {{- $authorEmail = . }} - {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }} - {{- end }} -{{- end -}} - -{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} -<feed xmlns="http://www.w3.org/2005/Atom"> - <id>{{ .Permalink | replaceRE `^https://(.*)index.gmi$` "gemini://$1" }}</id> - <title>{{ .Site.Title }}</title> - <updated>{{ .Date.UTC.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated> - <link href="{{ .Permalink | replaceRE `^https://(.*)/index.gmi$` "gemini://$1/atom.xml" | safeURL }}" rel="self" /> - <link href="{{ .Permalink | replaceRE `^https://(.*)index.gmi$` "gemini://$1" | safeURL }}" rel="alternate" /> - {{- with $authorName }} - <author> - <name>{{ . }}</name> - {{- with $authorEmail }} - <email>{{ . }}</email>{{ end }} - </author>{{ end }} - <generator>Hugo -- gohugo.io</generator> - <rights type="html">{{ replace .Site.Copyright "{currentYear}" (now.UTC.Format "2006") }}</rights> - <subtitle>{{ .Site.Params.Description }}</subtitle>{{ range first .Site.Config.Services.RSS.Limit .Data.Pages }} - <entry> - <id>{{ .Permalink | replaceRE `^https://(.*)index.gmi$` "gemini://$1" }}</id> - <title>{{ .Title }}</title> - <updated>{{ .Date.UTC.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated> - <link href="{{ .Permalink | replaceRE `^https://(.*)index.gmi$` "gemini://$1" | safeURL }}" rel="alternate" /> - </entry>{{ end }} -</feed> diff --git a/layouts/term/term.gmi b/layouts/term/term.gmi deleted file mode 100644 index 8d6158f..0000000 --- a/layouts/term/term.gmi +++ /dev/null @@ -1,19 +0,0 @@ -{{ define "main" -}} -=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ i18n "returnHome" }} - - -# {{ .Type | singularize | humanize | safeHTML }} "{{ .Title | safeHTML }}" - - -## {{ i18n "feeds" }} - -=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "atom.xml" | safeHTML }} {{ emojify ":link:" | safeHTML }} {{ i18n "atomFeed" }} - - -## {{ i18n "journalEntries" -}} - -{{ range .Data.Pages.ByPublishDate.Reverse }} - -{{ partial "metadata.gmi" . -}} -{{ end -}} -{{ end }}
\ No newline at end of file diff --git a/layouts/term/term.html b/layouts/term/term.html deleted file mode 100644 index fa89acf..0000000 --- a/layouts/term/term.html +++ /dev/null @@ -1,14 +0,0 @@ -{{ define "main" -}} -<nav> - <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> -</nav> -<main> - <h1>{{ .Type | singularize | humanize }} "{{ .Title }}"</h1> - <h2>{{ i18n "feeds" }}</h2> - <p><a class="link" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer"> {{ emojify ":link:" | safeHTML }} {{ i18n "atomFeed" }}</a></p> - <h2>{{ i18n "journalEntries" }}</h2> - {{- range .Data.Pages.ByPublishDate.Reverse }} - {{ partial "metadata.html" . -}} - {{ end }} -</main> -{{- end }}
\ No newline at end of file |