initial commit

This commit is contained in:
Michael Clemens 2021-07-21 17:16:12 +02:00
parent 39865c084e
commit cf056b729b
20 changed files with 465 additions and 10 deletions

View File

@ -1,9 +0,0 @@
MIT License
Copyright (c) <year> <copyright holders>
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.

24
LICENSE.md Normal file
View File

@ -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.

View File

@ -1,3 +1,81 @@
# amberterm
A minimal, monospaced, terminal style theme for Hugo.
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 `<figcaption>` 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).

4
archetypes/default.md Normal file
View File

@ -0,0 +1,4 @@
+++
title = "{{ replace .Name "-" " " | title }}"
date = {{ .Date }}
+++

BIN
images/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

View File

@ -0,0 +1,11 @@
{{ if .Title }}
<figure>
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" />
<figcaption>{{ .Title }}</figcaption>
</figure>
{{ else }}
<figure>
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" />
</figure>
{{ end }}

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode | default "en-us" }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<style type=text/css>body{font-family:monospace;}</style>
<title>{{ .Site.Title }}</title>
{{ with .Site.Params.description }}<meta name="description" content="{{ . }}">{{ end }}
{{ with .Site.Params.author }}<meta name="author" content="{{ . }}">{{ end }}
<link rel="stylesheet" href="{{ "css/style.css?15" | relURL }}">
{{ range .Site.Params.customCSS -}}
<link rel="stylesheet" href="{{ . | relURL }}?rnd={{ now.Unix }}">
{{- end }}
{{ with .OutputFormats.Get "RSS" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s">` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }}
{{- end }}
</head>
<body>
{{ partial "header" . }}
{{ block "main" . }}{{ end }}
{{ partial "footer" . }}
</body>
</html>

View File

@ -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 "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title>{{ .Site.Title }}</title>
{{- $perm := replace .Permalink "/gemini" "" 1 -}}
{{- $alt := .Site.BaseURL | replaceRE `https?://(.+?)` "gemini://$1" -}}
{{ printf "<link rel=\"self\" type=\"application/atom+xml\" href=\"%s\"/>" $perm | safeHTML }}
{{ printf "<link rel=\"alternate\" type=\"text/html\" href=\"%s\"/>" $alt | safeHTML }}
<updated>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated>
<author>
<name>{{ .Site.Author.name }}</name>
<uri>{{ .Site.BaseURL | replaceRE `https?://(.+?)` "gemini://$1" }}</uri>
</author>
<id>{{ $perm }}</id>
{{ range $pages }}
{{ if in $allowedRssSections .Section }}
<entry>
<title>{{ .Title }}</title>
{{- $entryperm := .Permalink | replaceRE `https?://(.+?)` "gemini://$1" -}}
{{ printf "<link rel=\"alternate\" href=\"%s\"/>" $entryperm | safeHTML }}
<id>{{ $entryperm }}</id>
<published>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</published>
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05-0700" | safeHTML }}</updated>
<summary>{{ if isset .Params "subtitle" }}{{ .Params.subtitle }}{{ else }}{{ .Summary | html }}{{ end }}</summary>
</entry>
{{ end }}
{{ end }}
</feed>

View File

@ -0,0 +1,26 @@
{{ define "main" }}
<main>
{{ $listtitle := .Title }}
{{ if or .Title .Content }}
<div>
{{ with .Title }}<h1>{{ . }}</h1>{{ end }}
{{ with .Content }}<div>{{ . }}</div>{{ end }}
</div>
{{ end }}
<ul>
{{ range .Paginator.Pages }}
<li>
<div class="post-title">
{{ if eq $listtitle "Posts" }}
{{ .Date.Format "2006-01-02" }} <a href="{{ .RelPermalink }}">{{.Title }}</a>
{{ else }}
<a href="{{ .RelPermalink }}">{{.Title }}</a>
{{ end }}
</div>
</li>
{{ end }}
</ul>
{{ partial "pagination.html" . }}
</main>
{{ end }}

View File

@ -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 `<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 }}
---
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

View File

@ -0,0 +1,16 @@
{{ define "main" }}
<main>
<article>
<h1>{{ .Title }}</h1>
<b><time>{{ .Date.Format (default "2006-01-02 15:04:05" .Site.Params.dateFmt) }}</time></b>
{{ range .Params.tags }}
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
<div>
{{ .Content }}
</div>
</article>
</main>
{{ partial "sidebar.html" . }}
{{ end }}

View File

@ -0,0 +1,13 @@
<article>
<h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
<b><time>{{ .Date.Format (default "2006-01-02 15:04:05" .Site.Params.dateFmt) }}</time></b>
{{ range .Params.tags }}
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
<div>
{{ .Summary }}
{{ if .Truncated }}
<a href="{{ .Permalink }}">Read more...</a>
{{ end }}
</div>
</article>

27
layouts/index.gmi Normal file
View File

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

9
layouts/index.html Normal file
View File

@ -0,0 +1,9 @@
{{ define "main" }}
<main>
{{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
{{ range $paginator.Pages }}
{{ .Render "summary" }}
{{ end }}
{{ partial "pagination.html" . }}
</main>
{{ end }}

View File

@ -0,0 +1,10 @@
<footer>
<hr>
<nav>
<p>&copy; {{ now.Year }} <a href="{{ .Site.BaseURL }}"><b>{{ if .Site.Copyright }}{{ .Site.Copyright }}{{ else }}{{ .Site.Title }}{{ end }}</b></a>
{{- range .Site.Menus.footer }}
- <a rel="me" href="{{ .URL }}"><b>{{ .Name }}</b></a>
{{- end }}
</p>
</nav>
</footer>

View File

@ -0,0 +1,22 @@
<header>
<div class="ascii-art">
<a href="/">
██████╗ ██████╗ ███████╗ ██╗ ██████╗
██╔═══██╗██╔══██╗╚════██║ ██║██╔════╝
██║██╗██║██████╔╝ ███╔═╝ ██║╚█████╗
╚██████╔╝██╔══██╗██╔══╝ ██║ ╚═══██╗
╚═██╔═╝ ██║ ██║███████╗██╗██║██████╔╝
╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝╚═╝╚═════╝
</a>
</div>
<hr>
<nav>
<a href="/"><b>Home</b></a>
{{ with .Site.Menus.main }}
{{ range . }} - <a href="{{ .URL | relURL }}"><b>{{ .Name }}</b></a> {{ end }}
</nav>
{{ end }}
</header>
<hr>
</p>

View File

@ -0,0 +1,9 @@
<div>
{{ if .Paginator.HasPrev }}
<a href="{{ .Paginator.Prev.URL }}">Previous Page</a>
{{ end }}
{{ .Paginator.PageNumber }} of {{ .Paginator.TotalPages }}
{{ if .Paginator.HasNext }}
<a href="{{ .Paginator.Next.URL }}">Next Page</a>
{{ end }}
</div>

View File

87
static/css/style.css Normal file
View File

@ -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;
}

17
theme.toml Normal file
View File

@ -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"