diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 2071b23..0000000 --- a/LICENSE +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..e0aa8e2 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,24 @@ +The MIT License (MIT) + +Copyright (c) 2016 Vimux + +Copyright (c) 2020 colorchestra + +Copyright (c) 2021 Michael Clemens + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 85203bb..bb7b187 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,81 @@ # amberterm -A minimal, monospaced, terminal style theme for Hugo. \ No newline at end of file +A minimal, monospaced, terminal style theme for Hugo. + +amberterm is based on [smol](https://github.com/colorchestra/smol) which is based on [Blank](https://github.com/Vimux/Blank) created by [Vimux](https://github.com/Vimux). + + +![Screenshot](/images/screenshot.png) + +## Installation + +In your Hugo site `themes` directory, run: + +``` +git submodule add https://git.qrz.is/clemens/amberterm +``` + +Next, open `config.toml` in the base of the Hugo site and ensure the theme option is set to `amberterm`. + +``` +theme = "amberterm" +``` + +Lastly, add the following lines to your `config.toml` to set site parameters and make use of all the menu entries in the header and footer sections if you need them. + +``` +# Parameters +[params] + subtitle = "Your blog subtitle goes here!" + dateFmt = "02.01.2006 15:04" + +# Header +[menu] + [[menu.main]] + identifier = "posts" + name = "Posts" + url = "/posts/" + weight = 1 + + [[menu.main]] + identifier = "categories" + name = "Categories" + url = "/categories/" + weight = 2 + + [[menu.main]] + identifier = "tags" + name = "Tags" + url = "/tags/" + weight = 3 + +# Footer + [[menu.footer]] + name = "Github" + url = "https://github.com/example" + weight = 1 + + [[menu.footer]] + name = "Mastodon" + url = "https://example.com/@user" + weight = 2 + + [[menu.footer]] + name = "Imprint" + url = "/imprint" + weight = 3 + +``` + +For more information read the official [quick start guide](https://gohugo.io/getting-started/quick-start/) of Hugo. + +## Optional features +### Custom copyright text +Add `copyright = "Your text here"` - in the config.toml to change the copyright notice in the footer. + +### Image captions +You can add captions to images (technically using `
` HTML tags) by adding titles, like so: `![Alt text here](/path/to/image.png "Put your caption here!")` + +## License + +This theme is released under the [MIT license](https://git.qrz.is/clemens/amberterm/blob/master/LICENSE). diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..ef75f76 --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,4 @@ ++++ +title = "{{ replace .Name "-" " " | title }}" +date = {{ .Date }} ++++ diff --git a/images/screenshot.png b/images/screenshot.png new file mode 100644 index 0000000..6a888ba Binary files /dev/null and b/images/screenshot.png differ diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html new file mode 100644 index 0000000..41008ca --- /dev/null +++ b/layouts/_default/_markup/render-image.html @@ -0,0 +1,11 @@ +{{ if .Title }} +
+ {{ .Text }} +
{{ .Title }}
+
+{{ else }} +
+ {{ .Text }} +
+{{ end }} + diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..24df4ba --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,24 @@ + + + + + + + + {{ .Site.Title }} + {{ with .Site.Params.description }}{{ end }} + {{ with .Site.Params.author }}{{ end }} + + {{ range .Site.Params.customCSS -}} + + {{- end }} + {{ with .OutputFormats.Get "RSS" -}} + {{ printf `` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }} + {{- end }} + + + {{ partial "header" . }} + {{ block "main" . }}{{ end }} + {{ partial "footer" . }} + + diff --git a/layouts/_default/index.gemini_atom.xml b/layouts/_default/index.gemini_atom.xml new file mode 100644 index 0000000..852344f --- /dev/null +++ b/layouts/_default/index.gemini_atom.xml @@ -0,0 +1,41 @@ +{{- $allowedRssSections := (slice "post") -}} +{{- $baseurl := .Site.BaseURL -}} +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if or $.IsHome $.IsSection -}} +{{- $pages = $pctx.RegularPages -}} +{{- else -}} +{{- $pages = $pctx.Pages -}} +{{- end -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- printf "" | safeHTML }} + + {{ .Site.Title }} + {{- $perm := replace .Permalink "/gemini" "" 1 -}} + {{- $alt := .Site.BaseURL | replaceRE `https?://(.+?)` "gemini://$1" -}} + {{ printf "" $perm | safeHTML }} + {{ printf "" $alt | safeHTML }} + {{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }} + + {{ .Site.Author.name }} + {{ .Site.BaseURL | replaceRE `https?://(.+?)` "gemini://$1" }} + + {{ $perm }} + {{ range $pages }} + {{ if in $allowedRssSections .Section }} + + {{ .Title }} + {{- $entryperm := .Permalink | replaceRE `https?://(.+?)` "gemini://$1" -}} + {{ printf "" $entryperm | safeHTML }} + {{ $entryperm }} + {{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }} + {{ .Lastmod.Format "2006-01-02T15:04:05-0700" | safeHTML }} + {{ if isset .Params "subtitle" }}{{ .Params.subtitle }}{{ else }}{{ .Summary | html }}{{ end }} + + {{ end }} + {{ end }} + diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..1a1abce --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,26 @@ +{{ define "main" }} +
+ {{ $listtitle := .Title }} + {{ if or .Title .Content }} +
+ {{ with .Title }}

{{ . }}

{{ end }} + {{ with .Content }}
{{ . }}
{{ end }} +
+ {{ end }} + +
    + {{ range .Paginator.Pages }} +
  • +
    + {{ if eq $listtitle "Posts" }} + {{ .Date.Format "2006-01-02" }} {{.Title }} + {{ else }} + {{.Title }} + {{ end }} +
    +
  • + {{ end }} +
+ {{ partial "pagination.html" . }} +
+{{ end }} diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi new file mode 100644 index 0000000..dde9049 --- /dev/null +++ b/layouts/_default/single.gmi @@ -0,0 +1,46 @@ +``` + ██████╗ ██████╗ ███████╗ ██╗ ██████╗ +██╔═══██╗██╔══██╗╚════██║ ██║██╔════╝ +██║██╗██║██████╔╝ ███╔═╝ ██║╚█████╗ +╚██████╔╝██╔══██╗██╔══╝ ██║ ╚═══██╗ + ╚═██╔═╝ ██║ ██║███████╗██╗██║██████╔╝ + ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝╚═╝╚═════╝ +``` + +# {{ .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 }} + +--- +Written by Michael Clemens on {{ .Lastmod.Format (.Site.Params.dateFormat | default "2 January 2006") }}. + +## References +{{ $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 }}: {{ .Params.Subtitle }}{{ end }}{{ end }} +--- + +=> / Back to the Index +=> https://qrz.is{{ replace (replace .RelPermalink "/gemini" "" 1) "index.gmi" "" }} View this article on the WWW diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..b334487 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,16 @@ +{{ define "main" }} +
+
+

{{ .Title }}

+ + {{ range .Params.tags }} + {{ . }} + {{ end }} + +
+ {{ .Content }} +
+
+
+{{ partial "sidebar.html" . }} +{{ end }} diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html new file mode 100644 index 0000000..a347932 --- /dev/null +++ b/layouts/_default/summary.html @@ -0,0 +1,13 @@ +
+

{{ .Title }}

+ + {{ range .Params.tags }} + {{ . }} + {{ end }} +
+ {{ .Summary }} + {{ if .Truncated }} + Read more... + {{ end }} +
+
diff --git a/layouts/index.gmi b/layouts/index.gmi new file mode 100644 index 0000000..b25b467 --- /dev/null +++ b/layouts/index.gmi @@ -0,0 +1,27 @@ +``` + ██████╗ ██████╗ ███████╗ ██╗ ██████╗ +██╔═══██╗██╔══██╗╚════██║ ██║██╔════╝ +██║██╗██║██████╔╝ ███╔═╝ ██║╚█████╗ +╚██████╔╝██╔══██╗██╔══╝ ██║ ╚═══██╗ + ╚═██╔═╝ ██║ ██║███████╗██╗██║██████╔╝ + ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝╚═╝╚═════╝ +``` + +# QRZ.is + +This is the personal gemini capsule of Michael Clemens. Most of what you will find here is related to amateur radio, software development and hardware projects. + +## Pages + +=> gemini://qrz.is/projects/index.gmi Software/Hardware Projects +=> gemini://qrz.is/about/index.gmi About me + +## Posts + +{{ range (where (where (where .Site.Pages "Section" "in" (slice "post")) ".Params.type" "eq" "post") ".Params.concept" "ne" "true").GroupByDate "2006" "desc" }}{{ $year := .Key -}} +### {{ .Key }} +{{ range .Pages.ByDate.Reverse }} +=> {{ replace .Permalink "/gemini" "" 1}} {{ .Date.Format ("2006/01/02") }} - {{ .Title }} +{{- end }} + +{{ end }} diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..cd86013 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,9 @@ +{{ define "main" }} +
+ {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }} + {{ range $paginator.Pages }} + {{ .Render "summary" }} + {{ end }} + {{ partial "pagination.html" . }} +
+{{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..b716a76 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,10 @@ + diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..b7964da --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,22 @@ +
+ +
+ + {{ end }} +
+
+

diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html new file mode 100644 index 0000000..79f8053 --- /dev/null +++ b/layouts/partials/pagination.html @@ -0,0 +1,9 @@ +
+{{ if .Paginator.HasPrev }} + Previous Page +{{ end }} +{{ .Paginator.PageNumber }} of {{ .Paginator.TotalPages }} +{{ if .Paginator.HasNext }} + Next Page +{{ end }} +
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html new file mode 100644 index 0000000..e69de29 diff --git a/static/css/style.css b/static/css/style.css new file mode 100644 index 0000000..839cda8 --- /dev/null +++ b/static/css/style.css @@ -0,0 +1,87 @@ +html { + overflow-y: scroll; +} +:root { + --bgcolor: #222; + --fontcolor: orange; + --linkcolor: orange; + --visitedcolor: orange; + --precolor: orange; + --prebgcolor: #222; +} +body{ + max-width:800px; + margin:40px auto; + padding:0 10px; + font:14px/1.5 monospace; + color:var(--fontcolor); background: var(--bgcolor) +} +a:link{ + color: var(--linkcolor) +} +a:visited{ + color: var(--visitedcolor) +} +a:active{ + color: var(--visitedcolor) +} +h1,h2,h3{ + line-height:1.2; +} +nav a{ + text-decoration: none; +} +h1 a,h2 a,h3 a{ + text-decoration: none; +} +h1 a:hover,h2 a:hover,h3 a:hover,nav a:hover{ + text-decoration: underline; +} +hr { + border-style: solid; size: 1px; border-color: orange; +} +p > code{ + color: var(--precolor); background: var(--prebgcolor); + padding:2px; + border: 1px solid orange; +} +pre{ + color: var(--precolor); + background: var(--prebgcolor); + padding:24px; + overflow-x: auto; + border: 1px solid orange; +} +article{ + padding:24px 0 +} +.center { + display: block; + margin-left: auto; + margin-right: auto; + width: 100%; +} +img { + display: block; + max-width: 100%; + height: auto; +} +figcaption { + color: #888; + font: 12px/1.5 monospace; + text-align: center; +} +figure { + margin: auto +} +.ascii-art { + font-family: monospace; + white-space: pre; + line-height: 1; +} +div.ascii-art a{ + text-decoration: none; +} +div.nav a { + text-decoration: none; +} diff --git a/theme.toml b/theme.toml new file mode 100644 index 0000000..477c317 --- /dev/null +++ b/theme.toml @@ -0,0 +1,17 @@ +name = "amberterm" +license = "MIT" +licenselink = "https://git.qrz.is/clemens/amberterm/blob/master/LICENSE.md" +description = "A minimal, monospaced, terminal style theme for Hugo." +homepage = "https://git.qrz.is/clemens/amberterm" +tags = ["blog", "minimal", "monospace", "dark mode", "simple", "clean", "responsive", "fast", "no-js", "no-tracking", "privacy"] +features = ["blog", "privacy", "responsive", "fast"] +min_version = "0.20" + +[author] + name = "Michael Clemens" + homepage = "qrz.is" + +[original] + author = "Morph" + homepage = "morph.sh" + repo = "https://github.com/colorchestra/smol"