diff --git a/config.toml b/config.toml index 82280f2..28d86c9 100644 --- a/config.toml +++ b/config.toml @@ -3,6 +3,22 @@ languageCode = "en-us" title = "HELLUG" disableHugoGeneratorInject = true +[mediaTypes."text/gemini"] +suffixes = [ "gmi" ] + +[outputFormats.Gemini] +name = "GEMINI" +isPlainText = true +isHTML = false +mediaType = "text/gemini" +protocol = "gemini://" +permalinkable = true +path = "gemini/" + +[outputs] +home = [ "HTML", "RSS", "GEMINI" ] +page = [ "HTML", "GEMINI" ] + [taxonomies] draseis = "draseis" linux = "linux" diff --git a/layouts/_default/pages.gmi b/layouts/_default/pages.gmi new file mode 100644 index 0000000..35e894f --- /dev/null +++ b/layouts/_default/pages.gmi @@ -0,0 +1,32 @@ +# {{ .Title }}{{ $scratch := newScratch }} +{{ $content := .RawContent -}} +{{ $content := $content | replaceRE `#### ` "### " -}} +{{ $content := $content | replaceRE `\n- (.+?)` "\n* $1" -}} +{{ $content := $content | replaceRE `\n(\d+). (.+?)` "\n* $2" -}} +{{ $content := $content | replaceRE `\[\^(.+?)\]:?` "" -}} +{{ $content := $content | replaceRE `
` "\n" -}} +{{ $content := $content | replaceRE `(.+?)` "[$2]($1)" -}} +{{ $content := $content | replaceRE `\sgemini://(\S*)` " [gemini://$1](gemini://$1)" -}} +{{ $content := $content | replaceRE `{{ < audio "(.+?)" >}}` "=> https://brainbaking.com/$1 Embedded Audio link - $1" -}} +{{ $content := $content | replaceRE `{{ < video "(.+?)" >}}` "=> https://brainbaking.com/$1 Embedded Video link - $1" -}} +{{ $content := $content | replaceRE `{{ < youtube (.+?) >}}` "=> https://www.youtube.com/watch?v=$1 YouTube Video link to $1" -}} +{{ $content := $content | replaceRE `{{ < vimeo (.+?) >}}` "=> https://vimeo.com/$1 Vimeo Video link to $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 }} + +--- + +## Αναφορές +{{ $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) }} +--- + +=> / Αρχική +=> https://www.hellug.gr{{ replace (replace .RelPermalink "/gemini" "" 1) "index.gmi" "" }} Έκδοση HTML - Web Page diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi new file mode 100644 index 0000000..cb41532 --- /dev/null +++ b/layouts/_default/single.gmi @@ -0,0 +1,36 @@ +# {{ .Title }}{{ $scratch := newScratch }} +{{ $content := .RawContent -}} +{{ $content := $content | replaceRE `#### ` "### " -}} +{{ $content := $content | replaceRE `\n- (.+?)` "\n* $1" -}} +{{ $content := $content | replaceRE `\n(\d+). (.+?)` "\n* $2" -}} +{{ $content := $content | replaceRE `\[\^(.+?)\]:?` "" -}} +{{ $content := $content | replaceRE `
` "\n" -}} +{{ $content := $content | replaceRE `(.+?)` "[$2]($1)" -}} +{{ $content := $content | replaceRE `\sgemini://(\S*)` " [gemini://$1](gemini://$1)" -}} +{{ $content := $content | replaceRE `{{ < audio "(.+?)" >}}` "=> https://brainbaking.com/$1 Embedded Audio link - $1" -}} +{{ $content := $content | replaceRE `{{ < video "(.+?)" >}}` "=> https://brainbaking.com/$1 Embedded Video link - $1" -}} +{{ $content := $content | replaceRE `{{ < youtube (.+?) >}}` "=> https://www.youtube.com/watch?v=$1 YouTube Video link to $1" -}} +{{ $content := $content | replaceRE `{{ < vimeo (.+?) >}}` "=> https://vimeo.com/$1 Vimeo Video link to $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 }} + +--- + +## Αναφορές +{{ $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 .Next }}=> {{ replace .Next.RelPermalink "/gemini" "" 1}} ← Νεότερο: {{ .Next.Title }}{{ end }} +{{ if .Prev -}}=> {{ replace .Prev.RelPermalink "/gemini" "" 1}} → Παλαιότερο: {{ .Prev.Title }}{{- end }} + +=> / Αρχική +=> https://www.hellug.gr{{ replace (replace .RelPermalink "/gemini" "" 1) "index.gmi" "" }} Έκδοση HTML - Web Page + diff --git a/layouts/index.gmi b/layouts/index.gmi new file mode 100644 index 0000000..a638a77 --- /dev/null +++ b/layouts/index.gmi @@ -0,0 +1,33 @@ +# Hellenic Linux User Group + +## Καλως Ήλθατε + +Η Ένωση Ελλήνων Χρηστών και Φίλων του Λίνουξ σας καλωσορίζει στη +κάπσουλα της στη σφαίρα του προτοκόλλου Gemini. + +## Welcome + +This is the Gemini Capsule of the Hellenic Linux User Group. + +## Σύνδεσμοι - Links + +=> https://www.hellug.gr Hellug WebSite +=> https://forum.hellug.gr Hellug Forum +=> https://wiki.hellug.gr Hellug Wiki +=> https://dev.hellug.gr Hellug Git Repositoris + +## Σελίδες +{{ $currentPage := . }}{{ range .Site.Menus.main }}{{ if .HasChildren }} +### {{ .Name }} +{{ range .Children }} +=> {{ replace .URL "/gemini" "" 1}} {{ .Name }}{{ end }} +{{ else }} +### {{ .Name }} +{{ end }}{{ end }} + +## Νέα Άρθρα - New Posts + +{{ $counter := 0 }}{{ $pages := .Site.RegularPages }}{{ $recentpostlimit := (sub now.Unix 2592000 ) }}{{ range first 5 $pages }}{{ $counter = add $counter 1 }}{{ if eq $counter 1 }}=> {{ replace .URL "/gemini" "" 1}} {{ .Title }} +{{ else }}=> {{ replace .URL "/gemini" "" 1}} {{ .Title }} +{{ end }}{{ end }} +