Commit Briefs

197fb4c1b7 Rene Kita

Link gpg key (master)


794bd3036b Rene Kita

Replace borked link


7130e5593a Rene Kita

Drop link, add another one


9b8b32d4e6 Rene Kita

Add key


ad5641baea Rene Kita

Add dayjob-pr-review post


e00a386203 Rene Kita

Fix LINK macro

Rationale: URLs is the important part, description is optional. Not optional in that case, but semantically.


721ce22b30 Rene Kita

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.


0cec036c10 Rene Kita

Allow passing arguments in mtime target


bf36f746a5 Rene Kita

Use INSTALLDIR in install target


7b148d9d52 Rene Kita

Fix mtime usage info


Branches

Tags

This repository contains no tags

Tree

.disabled.builds/
.fsan*commits | blame
.genlst*commits | blame
.gitattributescommits | blame
.gitignorecommits | blame
.up-date*commits | blame
Makefilecommits | blame
READMEcommits | blame
about.mccommits | blame
anti-cf.mccommits | blame
artadd*commits | blame
artfoot.mccommits | blame
article.mc.incommits | blame
artimp*commits | blame
assets/
current-borked.mccommits | blame
dayjob-pr-review.mccommits | blame
debbug-subscribe.mccommits | blame
feed.mccommits | blame
footer.mccommits | blame
gpg.asccommits | blame
header.mccommits | blame
index.mccommits | blame
irssi-awl.mccommits | blame
irssi-openurl-ssh.mccommits | blame
jekyll-perms.mccommits | blame
keyscommits | blame
ksudbf.mccommits | blame
links.mccommits | blame
m4fnmacro.mccommits | blame
m4html.vimcommits | blame
mtime*commits | blame
post-receive*commits | blame
robots.txtcommits | blame
selfhost.mccommits | blame
ssh-tmux-reattach.mccommits | blame
stddef.m4commits | blame
submodule-ctags.mccommits | blame
ts-bench.mccommits | blame
w3m-gemini.mccommits | blame
zsh-globs.mccommits | blame

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/