announcing ... awktober !

For some reason, October is like, the Month of Things. Just look at all the online streaks October contains:

As well as these, which I wish would exist:

and of course, ......

AWKTOBER

AWKTOBER

AWKTOBER

AWKTOBER

AWKTOBER

....... which is why I'm announcing AWKTOBER, right here, right now.

Do something awk(1)-tastic every day in October! It's that simple!!!!

I'll start: TEMPLATING WITH AWK

Awk actually works okay for templating! A template is basically a string that has bits that are replaced by other bits, which is a thing awk is really good at. Here's a basic templating thing:

BEGIN {
	TV["title"] = title ? title : "[untitled]"
	TV["autor"] = author ? author : ENVIRON["USER"]
	if (!date) {
		cmd = "date"
		getline date < cmd
		close(cmd)
	}
	TV["date"] = date
}

{
	for (t in TV) {
		gsub("{{"t"}}", TV[t])
	}
}

Basically you can call it like, `awk -vtitle="My cool title"` to set the `title` variable, then let er rip on a template file. Of course this example doesn't do anything with the page's content, or other so-called "niceties." You can see more of that kind of stuff in chum, my source code viewer thing.

That's it for today! See yall tomorrow with the ol' awktober thing there.