Sunday, August 20, 2006

Programmatic Authoring

I needed to create a bunch of HTML documents for an NVCC course I'm going to be teaching. As usual, I was left scratching my head as to the best way to do this. Should I use plain o'l HTML? If I do, then I can't build up any abstractions and am left cutting and pasting tons of code. Sure, CSS helps, but it's still not enough.

I could use LaTeX and simply convert the documents to PDF and HTML. But that seemed overly clunky. And besides, I really wanted to be able to develop my own short cuts for writing these documents - and while LaTeX has a sophisticated macro language, it can get unwieldy pretty quickly.

I could just treat these documents like any other web application, and simply use JSP, PHP or of course SISCweb. However, the School's web server only offers ASP which means that my language choices were too restricted. Besides, I wanted an approach that would be oriented towards documents, not programs.

For a long while, I've been keeping my eye on LAML, a system for writing HTML documents in (surprise!) Scheme. The LAML system coins the phrase programmatic authoring to describe the process of writing a static document in a programming language, instead of simply a markup language. This sounded like exactly what I was looking for, so I decided to take the plunge and use it.

What's always kept me from using LAML in the past is that the setup seemed tricky. But this time I toughed it out and got the package installed. The actual install turned out to be quite easy - what through me off was all the different combinations of OS types and implementations of Schemes to account for.

Sure enough, LAML worked just like it promised right out of the box.

What makes LAML a better choice than say rolling my own solution is how much thought the author has put into making documents easy to write in LAML. Little things like how attributes are specified, or how whitespace is handled, or even how you can create functions that produce markup, have all been really well thought out. So writing a document, and creating new concepts to represent that document, are really easy to do.

LAML even provides a level of safety that I'm not used to having. I referenced a document that didn't exist yet in an a tag, and I got a warning about the fact that it was missing. That could have saved me a huge headache if I had actually thought that document was correctly linked.

Now, if only LAML could also generate the content of the documents...that would be perfect!

No comments:

Post a Comment