first commit

This commit is contained in:
Abdullah Islam 2023-04-30 12:16:05 +06:00
commit f1b9800675
27 changed files with 1038 additions and 0 deletions

2
Makefile Normal file
View File

@ -0,0 +1,2 @@
SHELL = "execlineb"
SOURCES = $(find src/ -type f)

6
src/feed.ass Normal file
View File

@ -0,0 +1,6 @@
# feed.ass
# Actually Simple Syndication: gemini://zvava.org/wiki/ass.gmi
2023-04-24 /notes/on-personal-websites.gmi New Article: On personal websites
2023-04-24 /howto/website-generation.gmi New Tutorial: One way to generate a website, I guess
2023-04-25 /notes/software-freedom.gmi New Article: On software freedom
2023-04-26 /notes/software-freedom.gmi Expanded Article: On software freedom

2
src/howto/index.gmi Normal file
View File

@ -0,0 +1,2 @@
# Tutorials
=> ./website-generation.gmi One way to build a website, I guess

View File

@ -0,0 +1,169 @@
# One way to build a website, I guess
Let's talk how this website is generated. Basically it's a mashup of pp as a pre-processor, make as a build system, and common utilities you can find on most UNIX systems.
The base structure of my system is as follows. There are 4 directories: src/, tmpl/, html/, and gmi/. src/ contains the naked files that make up this website - what I refer to as "source files" - without the navigation bars or any fancy shenanigans. tmpl/ contains template files for pp, html/ contains the generated HTML, and gmi/ contains the generated gemtext.
Earlier, I mentioned how I use make. The good thing is that since I have configured my Makefile to not automatically execute the 'clean' rule as a part of 'all', only the source files that were changed get processed.
```
SHELL = '/bin/sh'
SOURCES = $(shell find src -type f)
all: subdirs $(SOURCES:src/%.gmi=html/%.html) $(SOURCES:src/%.gmi=gmi/%.gmi) gmi/sitemap.gmi html/sitemap.html
clean:
rm -rf html/* gmi/*
subdirs:
find src/ -type d -printf '%P\0' | xargs -0 -I{} mkdir -p gmi/{} html/{}
gmi/%.gmi: src/%.gmi tmpl/gmi.uppgmi
pp tmpl/gmi.uppgmi $< > $@
html/%.html: src/%.gmi tmpl/html.upphtml
pp tmpl/html.upphtml $< > $@
gmi/sitemap.gmi: $(shell find src -mindepth 2 -maxdepth 2 -path '*/index.gmi') tmpl/sitemap.uppgmi
pp tmpl/sitemap.uppgmi src/ > $@
html/sitemap.html: $(shell find src -mindepth 2 -maxdepth 2 -path '*/index.gmi') tmpl/sitemap.upphtml
pp tmpl/sitemap.upphtml src/ > $@
.PHONY: clean subdirs
```
Now let's talk about the processing. pp - the pre-processor - works by taking a template file and some other command-line arguments, processing them, and generating output which you can use for whatever you want.
```
pp [options] [template-file] [args...]
```
HTML generation:
```
<title>
#!
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
#!
</title>
<meta name='referrer' content='no-referrer' />
<meta name='author' content='techn0path' />
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
<header>
<nav>
<div id='navbar'>
#!
printf '<a href="%s">codeAI</a> |
<a href="%s">notes</a> |
<a href="%s">howto</a> |
<a href="%s">useful</a>' \
`realpath --relative-to="$(dirname $1)" "$PWD/src/index.html"` \
`realpath --relative-to="$(dirname $1)" "$PWD/src/notes/index.html"` \
`realpath --relative-to="$(dirname $1)" "$PWD/src/howto/index.html"` \
`realpath --relative-to="$(dirname $1)" "$PWD/src/useful/index.html"`
#!
</div>
</nav>
</header>
<main>
<div id='content'>
#!
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
awk -F " " '/^=>/ {
if (NF < 2) next;
sub("^([ ]*)", "", $2);
sub("([ ]*)$", "", $2);
if (match($2, "^\\.(\\.?)\\/") || ! match($2, "^(.*):\\/\\/"))
sub("\\.gmi$", ".html", $2)
} { print $0 }' $1 | gemini2html
#!
</div>
</main>
```
Sitemap generation
```
# Sitemap
This document is automatically generated. See also:
=> howto/website-generation.gmi One way to generate a website, I guess
#!
export DIRECTORY="$1"
awk '
/^#[^#]/ { sub("^#([ ]*)", ""); printf "## %s\n", $0 }
/^=>/ {
if (NF < 2) next
link = $2
$1 = ""
$2 = ""
description = $0
sub("^([ ]*)", "", description)
sprintf("dirname %s", FILENAME) | getline dirname
sprintf("realpath %s/%s", dirname, link) | getline tmp
sprintf("realpath --relative-to=%s %s", ENVIRON["DIRECTORY"], tmp) | getline tmp2
link = tmp2
printf "=> %s %s\n", link, description
}' `find $DIRECTORY -mindepth 2 -maxdepth 2 -path "*/index.gmi"`
#!
```
HTML version:
```
# Note how the navigation bar generation is different.
#!
export DIRECTORY="$1"
printf '<a href="%s">codeAI</a> |
<a href="%s">notes</a> |
<a href="%s">howto</a> |
<a href="%s">useful</a> |
<a href="%s">sitemap</a>' \
`realpath --relative-to="$DIRECTORY" "$PWD/src/index.html"` \
`realpath --relative-to="$DIRECTORY" "$PWD/src/notes/index.html"` \
`realpath --relative-to="$DIRECTORY" "$PWD/src/howto/index.html"` \
`realpath --relative-to="$DIRECTORY" "$PWD/src/useful/index.html"` \
`realpath --relative-to="$DIRECTORY" "$PWD/src/sitemap.html"`
#!
<div id='content'>
#!
awk '
/^#[^#]/ { sub("^#([ ]*)", ""); printf "<h2>%s</h2>", $0 }
/^=>/ {
if (NF < 2) next
link = $2
$1 = ""
$2 = ""
description = $0
sub("^([ ]*)", "", description)
sprintf("dirname %s", FILENAME) | getline dirname
sprintf("realpath %s/%s", dirname, link) | getline tmp
sprintf("realpath --relative-to=%s %s", ENVIRON["DIRECTORY"], tmp) | getline tmp2
link = tmp2
if (match(link, "^\\.(\\.?)\\/") || ! match(link, "^(.*):\\/\\/"))
sub("\\.gmi$", ".html", link)
printf "<a href=\"%s\">%s</a><br>", link, description
}' `find $DIRECTORY -mindepth 2 -maxdepth 2 -path "*/index.gmi"`
#!
</div>
```
## Related
=> ../notes/on-personal-websites.gmi On personal websites
=> https://www.karl.berlin/static-site.html Karl Bartel - 'make' as a static site generator
=> https://shadowm00n.neocities.org/tech/how_this_site_is_built ShadowM00N - How this site is built

7
src/index.gmi Normal file
View File

@ -0,0 +1,7 @@
# techn0path's website
On this personal website of mine, I talk about stuff.
## Highlights
=> howto/website-generation.gmi One way to generate a website, I guess
=> notes/on-personal-websites.gmi On personal websites
=> useful/addons.gmi Useful addons

5
src/notes/index.gmi Normal file
View File

@ -0,0 +1,5 @@
# Notes
An ever-growing collection of information.
=> on-personal-websites.gmi On personal websites
=> software-freedom On software freedom

View File

@ -0,0 +1,11 @@
# On Personal Websites
You are currently on my personal website. :) On my personal website, I talk about basically whatever I want. Reviews, tutorials, articles, you name it. I want to talk about some of the reasons for building it.
I am mostly doing it for fun; designing, writing, and structure are all enjoyable, and part and parcel of website-building. But there are of course other reasons too. Others could learn from me and my experiences; people could query the internet and use my website to solve a problem.. People can give me feedback that allows me to improve my skills, ya know? (Also known as learning in public.)
Of course, people may have many reasons to build a website. They may make one for personal branding, restoring the Old/Personal web, or, again, having fun like I aim to do with this website.
## Related
=> ../howto/website-generation.gmi One way to build a website, I guess
=> https://ijver.me/blog/internet-tenancy/ Internet tenancy is a major problem
=> https://www.jvt.me/posts/2019/07/22/why-website/ Jamie Tanna: Why I have a website and why you should too

View File

@ -0,0 +1,10 @@
# On software freedom
I am a big advocate for libre/free software. If you didn't know, it is software which allows you to use it for whatever end goal you desire, modify it, distribute it, and distribute modified versions of it. This is important since it lets people collaborate on libre software, change it to suit their needs, add new features, or remove anti-features added by the developer, which you can't do with proprietary software.
But I do understand that these benefits may seem too vague. I think that showing some practical examples will help.
First of all, there is NewPipe. It's an alternative YouTube app you can download on FDroid.In many ways, NewPipe represents the best of FOSS: it is functionally superior to the official ThemTube App, there's a fork called NewPipexSponsorBlock with added features, which I'll get to in a moment, and generally it shows the benefits of FOSS in a practical example.
Here are some ways that NewPipe is superior to the official YouTube app: It has no advertisements, it allows you to play videos even when your phone screen is off, it allows you to download videos locally to wherever you want (unlike YouTube's official app, which heavily restricts on your downloads), it saves battery, it has a dark mode setting for OLED (which means that it's completely black, not just gray), it even supports PeerTube, and so on. I could continue listing benefits, but the lesson is clear: NewPipe is better then the official YouTube app. It is designed by the users, for the users (since it's users can also contribute to it as well), rather then being a trashy piece of vendorware that serves to line the wallets of it's developers.
Let me continue with NewPipexSponsorblock, which I briefly mentioned earlier. Some people decided they wanted to add features into the NewPipe app, so they forked the project and added features such as a dislike counter on videos (powered by Return Youtube Dislike), SponsorBlock, and so on.

3
src/todo.gmi Normal file
View File

@ -0,0 +1,3 @@
# Todo
* Add a feed to this site.
* Also add a search-engine targeted sitemap document

15
src/useful/addons.gmi Normal file
View File

@ -0,0 +1,15 @@
# Useful Addons For Palemoon
Here are some addons for Pale Moon which will significantly improve your experience.
* Classic Add-ons Archive - An addon which allows you to install old XUL Firefox addons, that were made before Firefox switched to Web Extensions. Useful if you can't find certain types of addon at addons.palemoon.org.
* Decentraleyes - It downloads CDN content locally and redirects CDN requests to those local downloads.
* HTTPS Always - Makes it so that HTTPS is used by default.
* HTTPS Inquirer - Some helper addon for HTTPS Always.
* Proxy Privacy Ruler
* Secret Agent - Shuffles certain properties of HTTP requests.
* Stylem - A custom stylesheet manager.
* URL Rewriter - Rewrites URLS.
* Vimperator - Gives you a VIM-like interface for using your browser.
* eMatrix - Gives you granular control over what content is accepted or blocked by your browser. A fork of uMatrix.
Personally, I think that redirectors, stylesheet managers, HTTPs by default addons, and content blockers should be built into the browser itself.

5
src/useful/index.gmi Normal file
View File

@ -0,0 +1,5 @@
# Useful Things
Welcome to this page! Here I'll list things that I've found worth sharing with others.
=> ./links.gmi Useful Web Links
=> ./addons.gmi Useful Addons for Pale Moon

71
src/useful/links.gmi Normal file
View File

@ -0,0 +1,71 @@
# Useful Web Links
Basically a one-man one-page web directory for sharing cool stuff on the web.
## People
=> https://drewdevault.com Drew DeVault
A brilliant pro-libre programmer that designed many of the tools that I use myself. Makes articles on programming, tech in general, although he occasionaly veers into other areas.
=> https://lukesmith.xyz Luke Smith
A pro-libre traditionalist. He focuses less on tech, and more on general real life things. He also tries to live in real life more, rather then being chronically online. Has a channel on PeerTube as well.
=> https://seirdy.one Seirdy
A pro-libre FOSS enthusiast who writes on a variety of topics concerning tech.
=> https://atthis.link Marc
A PhD student who mainly talks about artifical intelligence, libre software, and technology in general.
## Technology
### Unix/Linux
=> https://wiki.archlinux.org Arch Linux Wiki
A helpful resource for managing an Arch Linux system; it may even be helpful for Linux in general, since it also covers IN DETAIL things that aren't specific to Arch, such as GRUB, and partitioning.
=> http://www.catb.org/~esr/halloween/index.html The Halloween Documents
A series of leaked Microsoft memos that clearly show that Microsoft wanted to destroy Linux, and that Linux presented a real threat against them.
### Programming
=> https://ewontfix.com EWONTFIX
A blog about bugs in software. It is written by Rich Felker, the founder of musl libc, and it serves to teach young programmers about mistakes in software, so that they aren't repeated. As they say: those who don't know history are doomed to repeat it.
### Email
=> https://useplaintext.email Use Plaintext Email
A great website about why you should use Plaintext email.
### Internet
=> http://searchingspot.com Searching Spot
A guide for using search engines more effectively.
=> https://landchad.net LandChad
A self-hosting guide for various services, such as websites, Peertube instances, Plemora instances, the list goes on. One of the problems with the internet nowadays is that most people aren't independent from their walled gardens yet, and especially don't host their own websites, which means that they are at the whims of a few people at the top of Facebook, Twitter, e.t.c.
=> https://jeffhuang.com/designed_to_last Jeff Huang's Manifesto "This Page Is Designed To Last"
A manifesto on how to increase the maintainability of your webpages. Many webpages die simply because it was too much of a hassle for the author, which could have been avoided if they followed these principles.
=> https://anybrowser.org/campaign The Any Browser Campaign
A campaign about designing for all browsers.
=> https://tante.cc/the-third-web Tante: Web3
An article covering why Web3 is A Bad Idea.
### Privacy
=> https://spyware.neocities.org Spyware Watchdog
This website shows unsolicited/spyware connections of software, and even has mitigation guides for some software, that mostly or completely removes those connections.
=> https://mitmproxy.org mitmproxy
mitmproxy monitors and displays all connections sent through it and can be used to discover unsolicited connections made by software that connects to the internet.
### Services
=> https://wttr.in wttr.in
The best weather service I've seen so far with a minimal and quality interface. Best viewed with cURL.
## Humanities
### Writing
=> https://paulgraham.com/talk.html Paul Graham: Write like you talk
An excellent article by Paul Graham detailing why you should use a conversational tone in your writings.
### Languages
=> https://lukesmith.xyz/articles/notes-on-learning-languages/ Luke Smith's notes on learning languages
Some tips for learning languages.
## Media
=> https://yewtu.be/channel/UCECl4aNz5hvuRzW5fgCOHKQ Jerobeam Fendorson
This guy makes oscilloscope music, which is a unique type of music where the sound in his videos can also be plugged into an oscilloscope, to generate the images shown in his videos. This is really unique and interesting, and I highly recommend you go and listen (or watch!).

14
src/useful/software.gmi Normal file
View File

@ -0,0 +1,14 @@
# Great Software
* Password Store
* Vis
* AWK
* make
* execline
* zathura
* qemu
So yeah today we are going to be talking about pieces of software that vastly outcompete their competitors.
First of all, there's execline, a non-interactive scripting language. It's better then shell because it's way less complex, and therefore has less things that could go wrong. The UNIX philosophy is about making things less complex, after all.
Then there's make

40
tmpl/feed.uppatom Normal file
View File

@ -0,0 +1,40 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<feed xmlns='http://www.w3.org/2005/Atom' >
<title>techn0path</title>
<link rel='self' href='' />
<author>
<name>techn0path</name>
</author>
#!
if test "$2" = "yes" ; then
export CONVERT_GMI_LINKS="YES"
fi
printf '<updated>%s</updated>
<id>urn:uuid:%s</id>\n' "$(date -u -r $1 '+%Y-%m-%dT%TZ')" "$(uuidgen -s --namespace @x500 --name \'techn0path\')"
awk -F "\t" '/^#/ { next }
{
if (NF < 2) next
date = $1
url = $2
if (NF > 2) title = $3
else title = "Content update at " url
sprintf("uuidgen -s --namespace @url --name \"%s-%s\"", title, date) | getline uuid
sprintf("date -d %s \"%s\"", date, "+%Y-%m-%dT%TZ") | getline tmp
date = tmp
if (ENVIRON["CONVERT_GMI_LINKS"] == "YES" && ! match(url, "^(.*):\\/\\/"))
sub("\\.gmi$", ".html", url)
printf "<entry> \n\
<title>%s</title> \n\
<link href=\"%s\" /> \n\
<id>urn:uuid:%s</id> \n\
<updated>%s</updated> \n\
<summary>%s</summary> \n\
</entry>\n", title, url, uuid, date, title
}' $1
#!
</feed>

14
tmpl/gmi.uppgmi Normal file
View File

@ -0,0 +1,14 @@
Navigation:
#!
printf '
=> %s home
=> %s notes
=> %s howto
=> %s useful things
=> %s sitemap\n\n' \
`realpath --relative-to "$(dirname $1)" "$(pwd)/src/index.gmi" "$(pwd)/src/notes/index.gmi" "$(pwd)/src/howto/index.gmi" "$(pwd)/src/useful/index.gmi" "$(pwd)/src/sitemap.gmi" `
printf 'Last modified on %s.\n\n' `date -u -r $1 '+%Y/%m/%d'`
cat $1
#!

50
tmpl/html.upphtml Normal file
View File

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<title>
#!
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
#!
</title>
<meta name='referrer' content='no-referrer' />
<meta name='author' content='techn0path' />
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
<style>
body { margin: 15px; }
#content { max-width: 70ch; }
</style>
</head>
<body>
<header>
<nav>
<div id='navbar'>
#!
printf '<a href="%s">codeAI</a> |
<a href="%s">notes</a> |
<a href="%s">howto</a> |
<a href="%s">useful</a> |
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
#!
</div>
</nav>
</header>
<main>
<div id='content'>
#!
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
awk -F " " '/^=>/ {
if (NF < 2) next
sub("^([ ]*)", "", $2)
if (!match($2, "^(.*):"))
sub("\\.gmi$", ".html", $2)
} { print $0 }' $1 | gemini2html
#!
</div>
</main>
</body>
</html>

View File

@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<title>
#!
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
#!
</title>
<meta name='referrer' content='no-referrer' />
<meta name='author' content='techn0path' />
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
<style>
body { background: black; color: white; margin: 40px; }
#content { max-width: 100ch; }
a { color: cadetblue; }
a :visited { color: chartreuse; }
h1, h2, h3 { color: burlywood; }
</style>
</head>
<body>
<header>
<nav>
<div id='navbar'>
#!
printf '<a href="%s">codeAI</a> |
<a href="%s">notes</a> |
<a href="%s">howto</a> |
<a href="%s">useful</a> |
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
#!
</div>
</nav>
</header>
<main>
<div id='content'>
#!
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
awk -F " " '/^=>/ {
if (NF < 2) next
sub("^([ ]*)", "", $2)
if (!match($2, "^(.*):"))
sub("\\.gmi$", ".html", $2)
} { print $0 }' $1 | gemini2html
#!
</div>
</main>
</body>
</html>

View File

@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<title>
#!
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
#!
</title>
<meta name='referrer' content='no-referrer' />
<meta name='author' content='techn0path' />
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
<style>
body { background: black; color: white; margin: 40px; }
#content { max-width: 100ch; }
a { color: cadetblue; }
a :visited { color: chartreuse; }
h1, h2, h3 { color: burlywood; }
</style>
</head>
<body>
<header>
<nav>
<div id='navbar'>
#!
printf '<a href="%s">codeAI</a> |
<a href="%s">notes</a> |
<a href="%s">howto</a> |
<a href="%s">useful</a> |
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
#!
</div>
</nav>
</header>
<main>
<div id='content'>
#!
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
awk -F " " '/^=>/ {
if (NF < 2) next
sub("^([ ]*)", "", $2)
if (!match($2, "^(.*):"))
sub("\\.gmi$", ".html", $2)
} { print $0 }' $1 | gemini2html
#!
</div>
</main>
</body>
</html>

View File

@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<title>
#!
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
#!
</title>
<meta name='referrer' content='no-referrer' />
<meta name='author' content='techn0path' />
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
<style>
body { background: black; color: white; margin: 40px; }
#content { max-width: 100ch; }
a { color: cadetblue; }
a :visited { color: chartreuse; }
h1, h2, h3 { color: burlywood; }
</style>
</head>
<body>
<header>
<nav>
<div id='navbar'>
#!
printf '<a href="%s">codeAI</a> |
<a href="%s">notes</a> |
<a href="%s">howto</a> |
<a href="%s">useful</a> |
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
#!
</div>
</nav>
</header>
<main>
<div id='content'>
#!
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
awk -F " " '/^=>/ {
if (NF < 2) next
sub("^([ ]*)", "", $2)
if (!match($2, "^(.*):"))
sub("\\.gmi$", ".html", $2)
} { print $0 }' $1 | gemini2html
#!
</div>
</main>
</body>
</html>

View File

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<title>
#!
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
#!
</title>
<meta name='referrer' content='no-referrer' />
<meta name='author' content='techn0path' />
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
<style>
body { margin: 15px; }
#content { max-width: 70ch; }
</style>
</head>
<body>
<header>
<nav>
<div id='navbar'>
#!
printf '<a href="%s">codeAI</a> |
<a href="%s">notes</a> |
<a href="%s">howto</a> |
<a href="%s">useful</a> |
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
#!
</div>
</nav>
</header>
<main>
<div id='content'>
#!
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
awk -F " " '/^=>/ {
if (NF < 2) next
sub("^([ ]*)", "", $2)
if (!match($2, "^(.*):"))
sub("\\.gmi$", ".html", $2)
} { print $0 }' $1 | gemini2html
#!
</div>
</main>
</body>
</html>

View File

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<title>
#!
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
#!
</title>
<meta name='referrer' content='no-referrer' />
<meta name='author' content='techn0path' />
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
<style>
body { margin: 15px; }
#content { max-width: 70ch; }
</style>
</head>
<body>
<header>
<nav>
<div id='navbar'>
#!
printf '<a href="%s">codeAI</a> |
<a href="%s">notes</a> |
<a href="%s">howto</a> |
<a href="%s">useful</a> |
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
#!
</div>
</nav>
</header>
<main>
<div id='content'>
#!
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
awk -F " " '/^=>/ {
if (NF < 2) next
sub("^([ ]*)", "", $2)
if (!match($2, "^(.*):"))
sub("\\.gmi$", ".html", $2)
} { print $0 }' $1 | gemini2html
#!
</div>
</main>
</body>
</html>

View File

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<title>
#!
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
#!
</title>
<meta name='referrer' content='no-referrer' />
<meta name='author' content='techn0path' />
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
<style>
body { margin: 15px; }
#content { max-width: 70ch; }
</style>
</head>
<body>
<header>
<nav>
<div id='navbar'>
#!
printf '<a href="%s">codeAI</a> |
<a href="%s">notes</a> |
<a href="%s">howto</a> |
<a href="%s">useful</a> |
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
#!
</div>
</nav>
</header>
<main>
<div id='content'>
#!
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
awk -F " " '/^=>/ {
if (NF < 2) next
sub("^([ ]*)", "", $2)
if (!match($2, "^(.*):"))
sub("\\.gmi$", ".html", $2)
} { print $0 }' $1 | gemini2html
#!
</div>
</main>
</body>
</html>

View File

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html>
<head>
#!
gawk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "<title>%s</title>", $0; exit } { print "<title>techn0path</title>" }' $1
#!
<meta name='referrer' content='no-referrer' />
<meta name='author' content='techn0path' />
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
<style>
#content { max-width: 100ch; margin: auto; }
#navbar { max-width: 100ch; margin: auto; }
</style>
</head>
<body>
<header>
<nav id='navbar'>
#!
printf '<a href="%s">codeAI</a> |
<a href="%s">notes</a> |
<a href="%s">howto</a> |
<a href="%s">useful</a> |
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
#!
</nav>
</header><br>
<article id='content'>
#!
gawk -F " " '
BEGIN {
subHeadings[0] = ""
arrayLen = 0
}
/^##[^#]/ {
sub("^##([ ]*)", "")
subHeadings[arrayLen] = sprintf("%s", $0)
arrLen += 1
}
END {
if (arrLen == 0) exit
printf "<details> \n\
<summary>Table of contents</summary>\n\
<nav id=\"toc\">\n\
<h1>Table of contents</h1>\n\
<ol>"
for (i = 0; i < arrLen; i += 1)
printf "<li>%s</li>", subHeadings[i]
printf "</ol></nav></details>\n"
}
' $1
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
gawk -F " " '/^=>[ ][^ ]/ {
sub("^([ ]*)", "", $2)
if (!match($2, "^(.*):")) sub("\\.gmi$", ".html", $2)
} { print $0 }' $1 | gemini2html
#!
</article>
</body>
</html>

View File

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html>
<head>
#!
gawk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "<title>%s</title>", $0; exit } { print "<title>techn0path</title>" }' $1
#!
<meta name='referrer' content='no-referrer' />
<meta name='author' content='techn0path' />
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
<style>
#content { max-width: 100ch; margin: auto; }
#navbar { max-width: 100ch; margin: auto; }
</style>
</head>
<body>
<header>
<nav id='navbar'>
#!
printf '<a href="%s">codeAI</a> |
<a href="%s">notes</a> |
<a href="%s">howto</a> |
<a href="%s">useful</a> |
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
#!
</nav>
</header><br>
<article id='content'>
#!
gawk -F " " '
BEGIN {
subHeadings[0] = ""
arrayLen = 0
}
/^##[^#]/ {
sub("^##([ ]*)", "")
subHeadings[arrayLen] = sprintf("%s", $0)
arrLen += 1
}
END {
if (arrLen == 0) exit
printf "<details> \n\
<summary>Table of contents</summary>\n\
<nav id=\"toc\">\n\
<h1>Table of contents</h1>\n\
<ol>"
for (i = 0; i < arrLen; i += 1)
printf "<li>%s</li>", subHeadings[i]
printf "</ol></nav></details>\n"
}
' $1
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
gawk -F " " '/^=>[ ][^ ]/ {
sub("^([ ]*)", "", $2)
if (!match($2, "^(.*):")) sub("\\.gmi$", ".html", $2)
} { print $0 }' $1 | gemini2html
#!
</article>
</body>
</html>

View File

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html>
<head>
#!
gawk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "<title>%s</title>", $0; exit } { print "<title>techn0path</title>" }' $1
#!
<meta name='referrer' content='no-referrer' />
<meta name='author' content='techn0path' />
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
<style>
#content { max-width: 100ch; margin: auto; }
#navbar { max-width: 100ch; margin: auto; }
</style>
</head>
<body>
<header>
<nav id='navbar'>
#!
printf '<a href="%s">codeAI</a> |
<a href="%s">notes</a> |
<a href="%s">howto</a> |
<a href="%s">useful</a> |
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
#!
</nav>
</header><br>
<article id='content'>
#!
gawk -F " " '
BEGIN {
subHeadings[0] = ""
arrayLen = 0
}
/^##[^#]/ {
sub("^##([ ]*)", "")
subHeadings[arrayLen] = sprintf("%s", $0)
arrLen += 1
}
END {
if (arrLen == 0) exit
printf "<details> \n\
<summary>Table of contents</summary>\n\
<nav id=\"toc\">\n\
<h1>Table of contents</h1>\n\
<ol>"
for (i = 0; i < arrLen; i += 1)
printf "<li>%s</li>", subHeadings[i]
printf "</ol></nav></details>\n"
}
' $1
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
gawk -F " " '/^=>[ ][^ ]/ {
sub("^([ ]*)", "", $2)
if (!match($2, "^(.*):")) sub("\\.gmi$", ".html", $2)
} { print $0 }' $1 | gemini2html
#!
</article>
</body>
</html>

38
tmpl/sitemap.uppgmi Normal file
View File

@ -0,0 +1,38 @@
Navigation:
#!
printf '
=> %s home
=> %s notes
=> %s howto
=> %s useful things
=> %s sitemap\n\n' \
`realpath --relative-to "$(dirname $1)" "$(pwd)/src/index.gmi"` \
`realpath --relative-to "$(dirname $1)" "$(pwd)/src/notes/index.gmi"` \
`realpath --relative-to "$(dirname $1)" "$(pwd)/src/howto/index.gmi"` \
`realpath --relative-to "$(dirname $1)" "$(pwd)/src/useful/index.gmi"` \
`realpath --relative-to "$(dirname $1)" "$(pwd)/src/sitemap.gmi"`
#!
# Sitemap
#!
export DIRECTORY="$1"
awk '
/^#[^#]/ { sub("^#([ ]*)", ""); printf "## %s\n", $0 }
/^=>[ ][^ ]/ {
link = $2
$1 = ""
$2 = ""
description = $0
sub("\\<", "", description)
sprintf("dirname %s", FILENAME) | getline dirname
sprintf("realpath %s/%s", dirname, link) | getline absolutePath
sprintf("realpath --relative-to=%s %s", ENVIRON["DIRECTORY"], absolutePath) | getline url
printf "=> %s %s\n", link, description
}' `find $DIRECTORY -mindepth 2 -maxdepth 2 -path "*/index.gmi"`
#!

60
tmpl/sitemap.upphtml Normal file
View File

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<title>Sitemap</title>
<meta name='referrer' content='no-referrer' />
<meta name='author' content='techn0path' />
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
<style>
body { margin: 15px; }
#content { max-width: 70ch; }
</style>
</head>
<body>
<header>
<nav>
<div id='navbar'>
#!
export DIRECTORY="$1"
printf '<a href="%s">codeAI</a> |
<a href="%s">notes</a> |
<a href="%s">howto</a> |
<a href="%s">useful</a> |
<a href="%s">sitemap</a>' \
`realpath --relative-to="${DIRECTORY}" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
#!
</div>
</nav>
</header>
<main>
<div id='content'>
<h1>Sitemap</h1>
#!
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "<h2>%s</h2>", $0 }
/^=>[ ][^ ]/ {
url = $2
$1 = ""
$2 = ""
description = $0
sub("\\<", "", description)
sprintf("dirname %s", FILENAME) | getline dirname
sprintf("realpath %s/%s", dirname, url) | getline absolutePath
sprintf("realpath --relative-to=%s %s", ENVIRON["DIRECTORY"], absolutePath) | getline url
if (!match(url, "^([a-zA-Z0-9_]*):")) sub("\\.gmi$", ".html", url)
printf "<a href=\"%s\">%s</a><br>", url, description
}' `find ${DIRECTORY} -mindepth 2 -maxdepth 2 -path "*/index.gmi"`
#!
</div>
</main>
</body>
</html>