diff options
-rw-r--r-- | layouts/_default/baseof.gmi | 8 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 8 | ||||
-rw-r--r-- | layouts/_default/single.gmi | 116 | ||||
-rw-r--r-- | layouts/index.gmi | 14 | ||||
-rw-r--r-- | layouts/index.html | 4 | ||||
-rw-r--r-- | layouts/partials/head.html | 16 | ||||
-rw-r--r-- | layouts/partials/metadata.gmi | 2 | ||||
-rw-r--r-- | layouts/taxonomy/taxonomy.gmi | 10 | ||||
-rw-r--r-- | layouts/term/term.html | 2 |
9 files changed, 90 insertions, 90 deletions
diff --git a/layouts/_default/baseof.gmi b/layouts/_default/baseof.gmi index a583bfe..8beabc1 100644 --- a/layouts/_default/baseof.gmi +++ b/layouts/_default/baseof.gmi @@ -1,7 +1,7 @@ {{ partial "header.gmi" . }} -{{ block "main" . }}{{ end }} +{{ block "main" . }}{{ end -}} -{{- if $.Site.Copyright }} -{{ partial "footer.gmi" . }} -{{- end -}}
\ No newline at end of file +{{ if $.Site.Copyright }} +{{ partial "footer.gmi" . -}} +{{ end }}
\ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index f2c9c61..1e32ff9 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -3,9 +3,9 @@ {{ partial "head.html" . }} <body class="body"> {{ partial "header.html" . }} - {{ block "main" . }}{{ end }} - {{- if $.Site.Copyright }} - {{ partial "footer.html" . }} - {{- end }} + {{ block "main" . }}{{ end -}} + {{ if $.Site.Copyright }} + {{ partial "footer.html" . -}} + {{ end }} </body> </html>
\ No newline at end of file diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi index 3f31051..ab94304 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -7,82 +7,82 @@ {{ end -}} # {{ .Name | safeHTML }} -{{ $content := .RawContent }} -{{- $scratch := newScratch }} +{{ $content := .RawContent -}} +{{ $scratch := newScratch -}} -{{- /* 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 }} +{{/* 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 }} +{{ $ref_index := 0 -}} -{{- range $chunks }} - {{- $above_pre := index . 1 }} - {{- $pre := index . 2 }} - {{- $below_pre := index . 3 }} +{{ 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 }} + {{/* 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) }} + {{ if ($.Page.Params.makerefs | default true) -}} - {{- /* find all the links within a chunk */}} - {{- $chunk_refs := findRESubmatch `!?\[\s*(.+?)\s*\]\(\s*(.+?)(?:\s+"(.+?)")?\s*\)` $rendered_text }} + {{/* find all the links within a chunk */ -}} + {{ $chunk_refs := findRESubmatch `!?\[\s*(.+?)\s*\]\(\s*(.+?)(?:\s+"(.+?)")?\s*\)` $rendered_text -}} - {{- $scratch.Add "refs" $chunk_refs }} - {{- range $chunk_refs }} - {{- $ref_index = add $ref_index 1 }} - {{- $ref_text := index . 1 }} + {{ $scratch.Add "refs" $chunk_refs -}} + {{ range $chunk_refs -}} + {{ $ref_index = add $ref_index 1 -}} + {{ $ref_text := index . 1 -}} - {{- /*- replace link with reference numbers enclosed in brackets */}} - {{- $rendered_text = replace $rendered_text (index . 0) (print $ref_text "[" $ref_index "]") 1 }} + {{/*- replace link with reference numbers enclosed in brackets */ -}} + {{ $rendered_text = replace $rendered_text (index . 0) (print $ref_text "[" $ref_index "]") 1 -}} - {{- end }} - {{- else }} + {{ end -}} + {{ else -}} - {{- /* render all links directly */}} - {{- $rendered_text = $rendered_text | replaceRE `(?m)^!?\[\s*(.+?)\s*\]\(\s*(.+?)(?:\s+"(.+?)")?\s*\)$` (print "=> $2 " $emoji "$1") }} + {{/* render all links directly */ -}} + {{ $rendered_text = $rendered_text | replaceRE `(?m)^!?\[\s*(.+?)\s*\]\(\s*(.+?)(?:\s+"(.+?)")?\s*\)$` (print "=> $2 " $emoji "$1") -}} - {{- end }} + {{ end -}} - {{- /* trim extra heading symbols */}} - {{- $rendered_text = $rendered_text | replaceRE `(?m)^####{1,3}` "###" }} + {{/* trim extra heading symbols */ -}} + {{ $rendered_text = $rendered_text | replaceRE `(?m)^####{1,3}` "###" -}} - {{- /* remove bold and italics asterisk symbols */}} - {{- $rendered_text = $rendered_text | replaceRE `\*{3}(\S|\S.*?\S)\*{3}` "$1" }} - {{- $rendered_text = $rendered_text | replaceRE `\*{2}(\S|\S.*?\S)\*{2}` "$1" }} - {{- $rendered_text = $rendered_text | replaceRE `\*{1}(\S|\S.*?\S)\*{1}` "$1" }} + {{/* remove bold and italics asterisk symbols */ -}} + {{ $rendered_text = $rendered_text | replaceRE `\*{3}(\S|\S.*?\S)\*{3}` "$1" -}} + {{ $rendered_text = $rendered_text | replaceRE `\*{2}(\S|\S.*?\S)\*{2}` "$1" -}} + {{ $rendered_text = $rendered_text | replaceRE `\*{1}(\S|\S.*?\S)\*{1}` "$1" -}} - {{- /* convert alternative unordered lists symbols to asterisks */}} - {{- $rendered_text = $rendered_text | replaceRE `(?m)^[-+] ` "* " }} + {{/* convert alternative unordered lists symbols to asterisks */ -}} + {{ $rendered_text = $rendered_text | replaceRE `(?m)^[-+] ` "* " -}} - {{- $rendered_text = $rendered_text | emojify }} + {{ $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 }} + {{/* demux regex matches above and below preformatted text */ -}} + {{ if $above_pre -}} + {{ $rendered_text | safeHTML -}} + {{ $pre | safeHTML -}} + {{ else -}} + {{ $pre | safeHTML -}} + {{ $rendered_text | safeHTML -}} + {{ end -}} -{{- end }} +{{ end -}} -{{- $refs := $scratch.Get "refs" }} -{{- if and (.Page.Params.makerefs | default true) $refs }} -{{- $ref_index := 0 }} +{{ $refs := $scratch.Get "refs" -}} +{{ if and (.Page.Params.makerefs | default true) $refs -}} +{{ $ref_index := 0 }} -## {{ i18n "refs" }} - {{- range $refs }} - {{- $ref_index = add $ref_index 1 }} - {{- $ref_text := index . 1 }} - {{- $ref_link := index . 2 }} - {{- $ref_title := index . 3 }} +## {{ i18n "refs" -}} + {{ range $refs -}} + {{ $ref_index = add $ref_index 1 -}} + {{ $ref_text := index . 1 -}} + {{ $ref_link := index . 2 -}} + {{ $ref_title := index . 3 -}} -{{- /* render referenced links */}} -{{ print "=> " $ref_link (emojify " :link: ") $ref_index ": " (cond (ne (len $ref_title) 0) $ref_title $ref_text) | safeHTML }} +{{/* render referenced links */ -}} +{{ print "=> " $ref_link (emojify " :link: ") $ref_index ": " (cond (ne (len $ref_title) 0) $ref_title $ref_text) | safeHTML -}} - {{- end }} -{{- end }} -{{- end }}
\ No newline at end of file + {{ end -}} +{{ end -}} +{{ end }}
\ No newline at end of file diff --git a/layouts/index.gmi b/layouts/index.gmi index ea867d2..1f1d5f1 100644 --- a/layouts/index.gmi +++ b/layouts/index.gmi @@ -1,11 +1,11 @@ -{{ define "main" }} -{{- if .Site.Params.indexTitle }} -# {{ .Site.Params.indexTitle | safeHTML }} -{{- end }} -{{- if .Site.Params.indexIntro }} -{{ .Site.Params.indexIntro | safeHTML }} +{{ define "main" -}} +{{ if .Site.Params.indexTitle }} +# {{ .Site.Params.indexTitle | safeHTML -}} +{{ end -}} +{{ if .Site.Params.indexIntro }} +{{ .Site.Params.indexIntro | safeHTML -}} -{{- end }} +{{ end }} ## {{ i18n "navLinks" }} {{ range .Site.Menus.main -}} => {{ .URL }} {{ emojify ":link:" | safeHTML }} {{ .Name | safeHTML }} diff --git a/layouts/index.html b/layouts/index.html index e42e751..8eafc6c 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -2,8 +2,8 @@ <main> {{- if .Site.Params.indexTitle }} <h1>{{ .Site.Params.indexTitle }}</h1> - {{- end }} - {{- if .Site.Params.indexIntro }} + {{- end -}} + {{ if .Site.Params.indexIntro }} <p>{{ .Site.Params.indexIntro }}</p> {{- end }} <h2>{{ i18n "navLinks" }}</h2> diff --git a/layouts/partials/head.html b/layouts/partials/head.html index b32f8ea..34a6ead 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,18 +1,18 @@ <head> <meta charset="utf-8"> + <meta name="theme-color" content="#000"> <meta name="viewport" content="width=device-width, initial-scale=1"> {{- if $.Site.Params.description }} <meta name="description" content="{{ $.Site.Params.description }}"> - {{- end }} - {{- if $.Site.Params.keywords }} + {{- end -}} + {{ if $.Site.Params.keywords }} <meta name="keywords" content="{{ $.Site.Params.keywords }}"> - {{- end }} - <meta name="theme-color" content="#000"> - {{- if .Site.Params.custom_css }} - {{- range .Site.Params.custom_css }} + {{- end -}} + {{ if .Site.Params.custom_css -}} + {{ range .Site.Params.custom_css }} <link rel="stylesheet" type="text/css" href="{{ relURL . }}"> - {{- end }} - {{- else }} + {{- end -}} + {{ else }} <link rel="stylesheet" type="text/css" href="{{ (resources.Get "css/style.css").RelPermalink }}"> {{- end }} <title>{{ .Title }}</title> diff --git a/layouts/partials/metadata.gmi b/layouts/partials/metadata.gmi index 1f8f513..00d78cd 100644 --- a/layouts/partials/metadata.gmi +++ b/layouts/partials/metadata.gmi @@ -1,2 +1,2 @@ -{{- partial "pageinfo.gmi" . }} +{{ partial "pageinfo.gmi" . }} => {{ .RelPermalink | replaceRE `(?m)index.gmi` "" }} {{ emojify ":link:" | safeHTML }} {{ .Title | safeHTML }}
\ No newline at end of file diff --git a/layouts/taxonomy/taxonomy.gmi b/layouts/taxonomy/taxonomy.gmi index 63f7163..196455a 100644 --- a/layouts/taxonomy/taxonomy.gmi +++ b/layouts/taxonomy/taxonomy.gmi @@ -6,8 +6,8 @@ ## {{ 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 +## {{ 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/term/term.html b/layouts/term/term.html index 89d31b5..fa89acf 100644 --- a/layouts/term/term.html +++ b/layouts/term/term.html @@ -9,6 +9,6 @@ <h2>{{ i18n "journalEntries" }}</h2> {{- range .Data.Pages.ByPublishDate.Reverse }} {{ partial "metadata.html" . -}} - {{- end -}} + {{ end }} </main> {{- end }}
\ No newline at end of file |