- Description:
- website
- Last Change:
- Clone URL:
ssh://anonymous@git.rkta.de/www
Commit Briefs
Link gpg key (master)
Fix LINK macro
Rationale: URLs is the important part, description is optional. Not optional in that case, but semantically.
Use m4 prefixes to prevent name clashing
'shift' is both valid shell code and a m4 command. We need to stop m4 from interpreting it as such when writing about shell code. Unfortunately it is not enough to just quote it, as it will be interpreted once when generating the article, but it is interpreted twice when generating the feed.
Branches
Tree
README
MINIMAL STATIC SITE GENERATOR / WEBSITE
#######################################
This repository contains my personal weblog including my own static
site generator.
The static site generator uses m4, make, shell and awk. Everything is kept
POSIX-compliant. It can convert the website to a gemini capsule using h2g[0].
Add a new article:
- Pick one:
+ ./artadd short_name "short description"
+ make new NAME=short_name DESC="short description"
- edit 'short_name.mc'
- put images etc in 'assets'
- make
- cp assets/ feed.xml *.html /var/www/html
- or use 'make tar' to create an archive
Updating an article:
- Edit article and don't forget to update MODIFIED
(Vim users see below)
Working with a draft:
- Pick one:
+ cp article.mc.in drafts/short_name.mc
+ make draft NAME=short_name
- edit 'short_name.mc'
- put images etc in 'assets'
- leave short_name.mc laying around till it's finished
- Replace __TITLE__ in short_name.mc or provide "description" in the next step
- Pick one:
+ ./artimp drafts/short_name.mc ["description"]
+ make import drafts/short_name.mc ["description"]
- make
- cp assets/ feed.xml *.html /var/www/html
See stddef.m4 for macros and usage.
Last modified lines
-------------------
In order to function correctly in every article the MODIFIED macro should be
defined and match the file's mtime. To help with that use the script mtime.
Without any option and a single file as argument, mtime will check that the
mtime and the MODIFIED date in the file do match. Option -r will reset the
file's mtime to the time defined by MODIFIED. Option -s will change MODIFIED
to the file's mtime.
To help not forget this, put the following in the git pre-commit hook:
git diff --cached --name-only | while read fn
do
case "$fn" in *.mc) : ;; *) continue ;; esac
./mtime "$fn" || exit 1
done
Vim users
---------
Put m4html.vim in ~/.vim/syntax.
The below does not work with mtime. It's not recommended anymore.
Add the following autocmd to your .vimrc:
" '*/blog/' is the directory containing this README
" Update timestamps in blog articles
autocmd BufWritePre,FileWritePre */blog/*.mc ks|call LastMod()|'s
fun LastMod()
if line("$") > 5
let l = 5
else
let l = line("$")
endif
exe "1," .. l .. "g/MODIFIED/s/, `.*'/, `" .
\ strftime("%FT%TZ", strptime("%F%T", system('date -u "+%F%T"'))) . "'"
endfun
(The autocmd is an adjusted version of the one found in the vim help,
see ':h autocmd'.)
--
[0]: https://sr.ht/~rkta/h2g/
