Progress; refactor partial
This commit is contained in:
@@ -1,20 +1,2 @@
|
|||||||
# {{ .Title }}
|
# {{ .Title }}
|
||||||
{{ $content := .RawContent -}}
|
{{ partial "gemtext.gmi" (dict "content" .RawContent "page" $.Page) }}
|
||||||
{{ $content = $content | replaceRE `<!--more-->\n+` "" -}}
|
|
||||||
{{ $content = $content | replaceRE `\[([^\]]+)\]\[(\d+)\]` "$1[$2]" -}}
|
|
||||||
{{ $content = $content | replaceRE `(?m)^\[(\d+)\]: (.*)$` "=> $2 [$1] $2" -}}
|
|
||||||
{{ $content = $content | replaceRE `=> (/.+\.pdf)` "=> https://davideisinger.com$1"}}
|
|
||||||
{{ $content = $content | replaceRE `(?m)\n\n >` "\n\n>" -}}
|
|
||||||
{{ $content = $content | replaceRE `(?m)\n\n ([A-Z])` " $1" -}}
|
|
||||||
{{ $audioRE := `<audio controls src="(.*/([^"]+))"></audio>` }}
|
|
||||||
{{ range findRE $audioRE $content -}}
|
|
||||||
{{ $url := . | replaceRE $audioRE "$1" | replaceRE ` ` "%20" -}}
|
|
||||||
{{ $title := . | replaceRE $audioRE "$2" -}}
|
|
||||||
{{ $content = replace $content . (printf "=> %s %s" $url $title) -}}
|
|
||||||
{{ end -}}
|
|
||||||
{{ range findRE `{{<(dither|thumbnail) [^/]+/>}}` $content -}}
|
|
||||||
{{ $rendered := $.Page.RenderString . -}}
|
|
||||||
{{ $url := $rendered | replaceRE `(?s).*src="([^"]+)".*` "=> $1" -}}
|
|
||||||
{{ $content = replace $content . $url -}}
|
|
||||||
{{ end -}}
|
|
||||||
{{ $content | safeHTML }}
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# David Eisinger
|
# David Eisinger
|
||||||
|
|
||||||
{{ .RawContent }}
|
{{ partial "gemtext.gmi" (dict "content" .RawContent "page" $.Page) }}
|
||||||
{{ range (where .Site.RegularPages "Type" "in" "journal") -}}
|
{{ range (where .Site.RegularPages "Type" "in" "journal") -}}
|
||||||
=> {{ .RelPermalink | replaceRE `index.gmi` "" }} {{ .Title }}
|
=> {{ .RelPermalink | replaceRE `index.gmi` "" }} {{ .Title }}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|||||||
21
themes/v2/layouts/partials/gemtext.gmi
Normal file
21
themes/v2/layouts/partials/gemtext.gmi
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{{ $content := .content -}}
|
||||||
|
{{ $page := .page -}}
|
||||||
|
{{ $content = $content | replaceRE `<!--more-->\n+` "" -}}
|
||||||
|
{{ $content = $content | replaceRE `\[([^\]]+)\]\[(\d+)\]` "$1[$2]" -}}
|
||||||
|
{{ $content = $content | replaceRE `(?m)^\[(\d+)\]: (.*)$` "=> $2 [$1] $2" -}}
|
||||||
|
{{ $content = $content | replaceRE `=> (/.+\.pdf)` "=> https://davideisinger.com$1" -}}
|
||||||
|
{{ $content = $content | replaceRE `(?m) >` ">" -}}
|
||||||
|
{{ $content = $content | replaceRE `(?m)^ \*` "* ⇢" -}}
|
||||||
|
{{ $content = $content | replaceRE `(?m)^[\*-]{3}$` "✱ ✱ ✱" -}}
|
||||||
|
{{ $audioRE := `<audio controls src="(.*/([^"]+))"></audio>` -}}
|
||||||
|
{{ range findRE $audioRE $content -}}
|
||||||
|
{{ $url := . | replaceRE $audioRE "$1" | replaceRE ` ` "%20" -}}
|
||||||
|
{{ $title := . | replaceRE $audioRE "$2" -}}
|
||||||
|
{{ $content = replace $content . (printf "=> %s %s" $url $title) -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ range findRE `{{<(dither|thumbnail) [^/]+/>}}` $content -}}
|
||||||
|
{{ $rendered := $page.RenderString . -}}
|
||||||
|
{{ $url := $rendered | replaceRE `(?s).*src="([^"]+)".*` "=> $1" -}}
|
||||||
|
{{ $content = replace $content . $url -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ $content | safeHTML -}}
|
||||||
Reference in New Issue
Block a user