Enhancing htm4l

It shouldn't take you long before you start to write your own m4 macros for producing html. The macros provided in the html-macros file should just be regarded as a taking-off point for specialization and enhancement. They will be useful of course, but you'll get much more out of htm4l (i.e., using m4 to produce html) if you write specialized macros for your own purposes. For example, I very often define one-off macros in the middle of an htm4l file to handle some specail need (usually the repetitve entry of formatted table rows).

It's probably not a good idea to try to completely replace html with m4 macros. For instance, it wont save you much (if anything) to write a macro called 'h1' which produces a level 1 heading from its argument. Not only will you end up typing more, you'll probably make your file harder to read. On the other hand, it probably is a good idea to make macros for different kinds of headings so that you can maintain a consistent style amongst many web pages.

My personal macro collection (most of which are specializations of the macros in html-macros) contains, for instance, macros that produce URLs for files and gifs in my directory on my machine. I also have a macro that sets up the background color on all my pages. If you think I edit a hundred odd files whenever I feel like changing the background on my pages, you're wrong. Instead, I make a five second change in a macro file and type 'make'. I also have a specialized version of m4_nx1_table that puts a gif of a red star at the start of each table row. These kinds of macros save me a ton of typing but are not generally useful to the rest of the world.

Back to the htm4l home page.
© Terry Jones (terry <AT> jon.es). Last modified: Mon Oct 2 02:22:02 CEST 2006