mirror of
https://github.com/jbowdre/runtimeterror.git
synced 2024-11-26 00:42:18 +00:00
initial rework on building a gemini capsule
This commit is contained in:
parent
217e4cb2b0
commit
fe29a0bf1a
7 changed files with 67 additions and 6 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -6,4 +6,4 @@
|
||||||
/resources/
|
/resources/
|
||||||
/.env
|
/.env
|
||||||
/.direnv/
|
/.direnv/
|
||||||
|
/.certificates/
|
||||||
|
|
|
@ -7,20 +7,32 @@ languageCode = "en"
|
||||||
DefaultContentLanguage = "en"
|
DefaultContentLanguage = "en"
|
||||||
enableInlineShortcodes = true
|
enableInlineShortcodes = true
|
||||||
|
|
||||||
|
# define gemini media type
|
||||||
|
[mediaTypes]
|
||||||
|
[mediaTypes.'text/gemini']
|
||||||
|
suffixes = ["gmi"]
|
||||||
|
|
||||||
# Automatically add content sections to main menu
|
# Automatically add content sections to main menu
|
||||||
# sectionPagesMenu = "main"
|
# sectionPagesMenu = "main"
|
||||||
|
|
||||||
[outputs]
|
[outputs]
|
||||||
home = ['html', 'rss']
|
home = ['html', 'rss', 'gemini']
|
||||||
section = ['html']
|
section = ['html']
|
||||||
taxonomy = ['html',]
|
taxonomy = ['html']
|
||||||
term = ['html', 'rss']
|
term = ['html', 'rss']
|
||||||
|
page = ['html', 'rss', 'gemini']
|
||||||
|
|
||||||
# rename rss output from index.xml to feed.xml
|
# rename rss output from index.xml to feed.xml
|
||||||
[outputFormats]
|
[outputFormats]
|
||||||
[outputFormats.rss]
|
[outputFormats.rss]
|
||||||
mediatype = "application/rss"
|
mediatype = "application/rss"
|
||||||
baseName = "feed"
|
baseName = "feed"
|
||||||
|
[outputFormats.gemini]
|
||||||
|
mediatype = "text/gemini"
|
||||||
|
isPlainText = true
|
||||||
|
isHTML = false
|
||||||
|
protocol = "gemini://"
|
||||||
|
permalinkable = true
|
||||||
|
|
||||||
[permalinks]
|
[permalinks]
|
||||||
posts = ":filename"
|
posts = ":filename"
|
||||||
|
|
|
@ -7,6 +7,7 @@ kudos = false
|
||||||
+++
|
+++
|
||||||
|
|
||||||
We're not sure what you were looking for but it's not here.
|
We're not sure what you were looking for but it's not here.
|
||||||
|
|
||||||
![Animated GIF from the movie "The Naked Gun". A man in the foreground proclaims "Please disperse. Nothing to see here." while a building explodes in the background.](/images/nothing-to-see-here.gif)
|
![Animated GIF from the movie "The Naked Gun". A man in the foreground proclaims "Please disperse. Nothing to see here." while a building explodes in the background.](/images/nothing-to-see-here.gif)
|
||||||
|
|
||||||
Maybe head back [home](/)?
|
Maybe head back [home](/)?
|
||||||
|
|
|
@ -5,6 +5,7 @@ timeless = true
|
||||||
comments = false
|
comments = false
|
||||||
aliases = ["tldr", "bio"]
|
aliases = ["tldr", "bio"]
|
||||||
+++
|
+++
|
||||||
|
|
||||||
![Me, +/- a few decades](/images/john.jpg)
|
![Me, +/- a few decades](/images/john.jpg)
|
||||||
|
|
||||||
You've (somehow) managed to stumble upon my dark corner of the internet[^1].
|
You've (somehow) managed to stumble upon my dark corner of the internet[^1].
|
||||||
|
@ -36,7 +37,5 @@ Connect with me via:
|
||||||
- [XMPP](https://conversations.im/i/jbowdre@omg.lol?omemo-sid-1374125881=a620f3c57733601a6646f6f13a71c86fc9be8dd4126fd158ef3e0a26beb0b434)
|
- [XMPP](https://conversations.im/i/jbowdre@omg.lol?omemo-sid-1374125881=a620f3c57733601a6646f6f13a71c86fc9be8dd4126fd158ef3e0a26beb0b434)
|
||||||
- [Electronic Mail](mailto:jbowdre@omg.lol)
|
- [Electronic Mail](mailto:jbowdre@omg.lol)
|
||||||
- [PGP: 613F B70C 4FA7 A077](https://l.runtimeterror.dev/pgp)
|
- [PGP: 613F B70C 4FA7 A077](https://l.runtimeterror.dev/pgp)
|
||||||
|
|
||||||
|
|
||||||
[^1]: Congrats? And also, *thank you.*
|
[^1]: Congrats? And also, *thank you.*
|
||||||
[^2]: A bit. I'm still in the "fake it until you make" it phase of adulthood.
|
[^2]: A bit. I'm still in the "fake it until you make" it phase of adulthood.
|
|
@ -12,6 +12,7 @@
|
||||||
{
|
{
|
||||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
|
agate
|
||||||
go
|
go
|
||||||
hugo
|
hugo
|
||||||
nodePackages.npm
|
nodePackages.npm
|
||||||
|
|
7
layouts/_default/index.gmi
Normal file
7
layouts/_default/index.gmi
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
## [runtimeterror $]
|
||||||
|
{{ $pages := .Pages -}}
|
||||||
|
{{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections -}}
|
||||||
|
|
||||||
|
{{ range $pages }}
|
||||||
|
=> {{ .RelPermalink }} [{{ .Date.Format "2006-01-02" }}] {{ .Title }}
|
||||||
|
{{- end }}
|
41
layouts/_default/single.gmi
Normal file
41
layouts/_default/single.gmi
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
=> / 🏡 [runtimeterror $]
|
||||||
|
|
||||||
|
# {{ .Title }}{{ $scratch := newScratch }}
|
||||||
|
{{ $content := .RawContent -}}
|
||||||
|
{{ $content := $content | replaceRE `#### ` "### " -}}
|
||||||
|
{{ $content := $content | replaceRE `\n- (.+?)` "\n* $1" -}}
|
||||||
|
{{ $content := $content | replaceRE `\n(\d+). (.+?)` "\n* $2" -}}
|
||||||
|
{{ $content := $content | replaceRE `\[\^(.+?)\]:.*\n?\n` "" -}}
|
||||||
|
{{ $content := $content | replaceRE `\[\^(.+?)\]` "" -}}
|
||||||
|
{{ $content := $content | replaceRE `<br/??>` "\n" -}}
|
||||||
|
{{ $content := $content | replaceRE `\{\{%\s\/?notice.*%\}\}` "***" -}}
|
||||||
|
{{ $content := $content | replaceRE `((\/\/)|#)\s*torchlight!.*` "" -}}
|
||||||
|
{{ $content := $content | replaceRE `<!--\s*\[tl!.*\]\s*-->` "" -}}
|
||||||
|
{{ $content := $content | replaceRE `\/\/\s*\[tl!.*\]` "" -}}
|
||||||
|
{{ $content := $content | replaceRE `#\s*\[tl!.*\]` "" -}}
|
||||||
|
{{ $content := $content | replaceRE `<a .*href="(.+?)".*>(.+?)</a>` "[$2]($1)" -}}
|
||||||
|
{{ $content := $content | replaceRE `\sgemini://(\S*)` " [gemini://$1](gemini://$1)" -}}
|
||||||
|
{{/* $content := $content | replaceRE "([^`])<.*?>([^`])" "$1$2" -*/}}
|
||||||
|
{{ $content := $content | replaceRE `\n?\n!\[.*\]\((.+?) \"(.+?)\"\)` "\n\n=> $1 Image: $2" -}}
|
||||||
|
{{ $content := $content | replaceRE `\n?\n!\[.*\]\((.+?)\)` "\n\n=> $1 Embedded Image: $1" -}}
|
||||||
|
{{ $links := findRE `\n=> ` $content }}{{ $scratch.Set "ref" (add (len $links) 1) }}
|
||||||
|
{{ $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]" -}}
|
||||||
|
{{ $content | safeHTML }}
|
||||||
|
|
||||||
|
---
|
||||||
|
Written by John Bowdre {{ if .Params.Date }} on {{ .Lastmod.Format "2006-01-02" }}.{{ end}}
|
||||||
|
|
||||||
|
## Links
|
||||||
|
{{ $scratch.Set "ref" (add (len $links) 1) }}{{ range $refs }}{{ $ref := $scratch.Get "ref" }}{{ $url := (printf "%s #%d" . $ref) }}
|
||||||
|
=> {{ $url | replaceRE `\[(.+?)\]\((.+?)\) #(\d+)` "$2 [$3] $1 ($2)" -}}
|
||||||
|
{{ $scratch.Set "ref" (add $ref 1) }}{{ end}}
|
||||||
|
{{ $related := first 3 (where (where .Site.RegularPages.ByDate.Reverse ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
|
||||||
|
{{ if $related }}
|
||||||
|
## Related articles
|
||||||
|
{{ range $related }}
|
||||||
|
=> {{ replace .RelPermalink "/gemini" "" 1}} {{ .Title }}{{ end }}{{ end }}
|
||||||
|
---
|
||||||
|
|
||||||
|
=> / Back to the Index
|
||||||
|
=> https://runtimeterror.dev{{ replace (replace .RelPermalink "/gemini" "" 1) "index.gmi" "" }} View this article on the WWW
|
Loading…
Reference in a new issue