www/themes/hellug-minimal-2/layouts/_default/single.gmi

34 γραμμές
2,3 KiB
Text

2021-11-04 20:10:08 +02:00
# {{ .Title }} - {{ dateFormat "02/01/2006" .Date }}{{ $scratch := newScratch }}
2021-10-07 16:23:07 +03:00
{{ $content := .RawContent -}}
{{ $content := $content | replaceRE "<br/??>" "\n" -}}
{{ $content := $content | replaceRE "<br??/??>" "\n" -}}
{{ $content := $content | replaceRE "<tr>" "\n" -}}
{{ $content := $content | replaceRE `<a .*href="(.+?)".*>(.+?)</a>` "[$2]($1)" -}}
{{ $content := $content | plainify -}}
2021-10-06 14:10:10 +03:00
{{ $content := $content | replaceRE `#### ` "### " -}}
{{ $content := $content | replaceRE `\n- (.+?)` "\n* $1" -}}
{{ $content := $content | replaceRE `\n(\d+). (.+?)` "\n* $2" -}}
{{ $content := $content | replaceRE `\[\^(.+?)\]:?` "" -}}
{{ $content := $content | replaceRE `\sgemini://(\S*)` " [gemini://$1](gemini://$1)" -}}
2021-10-07 16:23:07 +03:00
{{ $content := $content | replaceRE `([^"])<.*?>([^"])` "$1$2" -}}
2021-10-06 14:10:10 +03:00
{{ $content := $content | replaceRE `\n\n!\[.*\]\((.+?) \"(.+?)\"\)` "\n\n=> $1 Image: $2" -}}
{{ $content := $content | replaceRE `\n\n!\[.*]\((.+?)\)` "\n\n=> $1 Embedded Image: $1" -}}
2021-10-07 16:23:07 +03:00
{{ $links := findRE "\n=> " $content }}{{ $scratch.Set "ref" (add (len $links) 1) }}
2021-10-06 14:10:10 +03:00
{{ $refs := findRE `\[.+?\]\(.+?\)` $content }}
{{ $scratch.Set "content" $content }}{{ range $refs }}{{ $ref := $scratch.Get "ref" }}{{ $contentInLoop := $scratch.Get "content" }}{{ $url := (printf "%s #%d" . $ref) }}{{ $contentInLoop := replace $contentInLoop . $url -}}{{ $scratch.Set "content" $contentInLoop }}{{ $scratch.Set "ref" (add $ref 1) }}{{ end }}{{ $content := $scratch.Get "content" | replaceRE `\[(.+?)\]\((.+?)\) #(\d+)` "$1 [$3]" -}}
2021-10-06 19:27:01 +03:00
{{ $content | safeHTML }}
2021-10-06 14:10:10 +03:00
---
{{ $scratch.Set "ref" (add (len $links) 1) }}{{ if $refs }}
## Παραπομπές
{{ range $refs }}{{ $ref := $scratch.Get "ref" }}{{ $url := (printf "%s #%d" . $ref) }}
2021-10-06 14:10:10 +03:00
=> {{ $url | replaceRE `\[(.+?)\]\((.+?)\) #(\d+)` "$2 [$3] $1 ($2)" -}}
{{ $scratch.Set "ref" (add $ref 1) }}{{ end}}---{{end}}
2021-10-06 14:10:10 +03:00
2021-11-04 20:10:08 +02:00
{{ if .Next }}=> {{ replace .Next.RelPermalink "/gemini" "" 1}} ← Νεότερο: {{ dateFormat "02/01/2006" .Next.Date }} - {{ .Next.Title }}{{ end }}
{{ if .Prev -}}=> {{ replace .Prev.RelPermalink "/gemini" "" 1}} → Παλαιότερο: {{ dateFormat "02/01/2006" .Prev.Date }} - {{ .Prev.Title }}{{- end }}
2021-10-06 14:10:10 +03:00
=> / Αρχική
=> https://www.hellug.gr{{ replace (replace .RelPermalink "/gemini" "" 1) "index.gmi" "" }} Έκδοση HTML - Web Page