October 3, 2014

My blog's Static HTML has now been replaced with a python generation script. I shall now pontificate on escaping, Python vs Javascript, and lament how to handle more articles.

On adding the 4th article, it of course becomes clear that manually copying a static HTML template will never do. I knew this before, but deferred the issue. I migrated by chopping up the articles I have into multi-line python strings embedded in a JSON-y list of articles. While I originally considered putting each article in a separate file, this seemed simpler. Also I hold a long-standing speculation that the right way to deal with complexity isn't to chop up things into lots of little files, but to fix your editor (insert clever idea). Though in practice I hate big files, so we'll see how long this lasts.

Having everything in one big structure lets me also generate an index. While I currently have so few articles that dumping them in reverse order works, that won't scale. I start by duplicating what I have, and generating it on top of the existing static files. With git that lets me check that nothing has changed too drastically.

To plan ahead for lots of articles (you never know), I've added a subjects fields to each article. This way I can generate a title only subject index. I think I'll do two, one by just date, the other by subject.

For templates I've used Python's % operator. This works surprisingly well as HTML + Javascript generally don't make much use of %. Mod-ing is apparently unpopular :-(.

Python's multi-line quotes shine for this use case, as they allow me nice chunks of text for summaries and articles. Javascript lacks the equivalent, unless I've missed it.

Of course all of this is folly. It's just more escaping to allow a text document to stand in for something that's really a more complex entity. Escaping is the root of all evil.

Programming Languages, Blogging
blog comments powered by Disqus