Αρχική υλοποίηση Gemini
Όλοι οι έλεγχοι ήταν επιτυχείς
Hellug/www/pipeline/head This commit looks good

Αυτό το commit περιλαμβάνεται σε:
infl00p 2021-10-06 14:10:10 +03:00
γονέας b3e62f9a1c
commit 8546dd28b0
4 αρχεία άλλαξαν με 117 προσθήκες και 0 διαγραφές

@ -3,6 +3,22 @@ languageCode = "en-us"
title = "HELLUG" title = "HELLUG"
disableHugoGeneratorInject = true 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] [taxonomies]
draseis = "draseis" draseis = "draseis"
linux = "linux" linux = "linux"

32
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 `<br/??>` "\n" -}}
{{ $content := $content | replaceRE `<a .*href="(.+?)".*>(.+?)</a>` "[$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

36
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 `<br/??>` "\n" -}}
{{ $content := $content | replaceRE `<a .*href="(.+?)".*>(.+?)</a>` "[$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

33
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 }}