a static blog generator using Plan9's rc

I have always wanted a simple way to (b)log
entries and publish them. With the arrival 
of the gemini protocol, i thought it would
be cool to make an simple set of scripts to 
achieve that. This post discusses parts of the
static blog generator called shite.

Shite is written in rc. It expects you to provide
a ndb(6) styled file with entries like
type=post 
	id=1 
	title="sometitle" 
	date=2021-04-15 
	tag=tag1 tag=tag2
	content="content/post1"
It then creates associations of tags, titles, content files and
ids and generates very basic HTML to render a top site
navigation bar. For now these "index" files are just
one association per line separated by whitespace, but it might
be interesting to actually create another ndb(6) styled file with
the other association.
First of all ndb/query is an amazing general purpose tool.
In the above example
ndb/query -a -f postdb type post title
would return all the titles, one result per title.
Evidently the program needs to sometimes break results by newlines
or others by spaces. For that i discovered a very (unintuitive in the
beginning, coming from a UNIX world) interesting fact of the IFS 
characters in Plan9. The man page says that we generally split the output
of a command by issuing
`{command}
That would return all the splits by the default ifs separators which as 
the man page says it is ' \t\n' so. As it also says you can respecify these
by a form like 
`split {command} 
sometimes i wanted to just split by newline so naturally i was trying to write
`'\n' {command}
After some confusion, i realized what the manual page said. It should be
`'
' {command}
Having there literally the newline character. 
Things like that and generally the thought that the interfaces have in the 
Plan9 side of computing, end up making way more sense. Learning the rc
syntax to do things is way simpler than any other shell i have attempted to
learn and it's a pity that its approach to escape the quotation hell that 
you end up in other shells hasn't been picked up by other shells.

The code for shite can be found at
our git

- - - - - - - - -
This content is also hosted over gemini