Some simple htm4l examples

I am working on a collection of illustrative simple examples of htm4l use.

But before you start, if you do not see differently-sloping accents around the XXX in the next line

then your browser has a problem you need to know about before looking at htm4l code. Please take a minute to read this warning.

Here's what I have so far. These examples are in rough order of increasing complexity. The first gives an overview of the big picture. Then there are some truly simple examples. Finally there are some that get a bit hairy and may require some thought. Nothing as difficult as understanding the example on the man page for dc(1) though.

*A simple but complete htm4l document.
*Using m4's file inclusion macro.
*A simple example for referring to other people.
*How to trivially arrange for consistent footer information on all your pages.
*An htm4l macro for getting the date in a form.
*A simple example of conditional output.
*Building a table with automatically created and numbered rows.
*Improving the last example with a caption before the table that includes the number of rows.
*How to easily create and switch between 1xn, nx1 tables, and ordered and unordered lists.
*How htm4l saved my butt when I needed to change over 600 URLS fast so that someone with a PC and no net access could view some pages.
*How to maintain one htm4l file that makes a number of different html files. Great for maintaining pages in several languages.

There's a lot more to m4 than I've had time to talk about in these few examples. Your best source of further examples is the html-macros file supplied with htm4l. If you've managed to understand all the examples above, you shouldn't have any trouble working out just about anything. Bear in mind though that m4 is not without traps for younger players. These can make life interesting until you get a feel for what might be going on. Look at my page of information on m4 for hints on finding out more about m4.

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