Htmlincl is a preprocessor that generates html files out of “macro” files. The macrofiles contain special instructions for Htmlincl. There are instructions to include other files, if/then conditional html, and macro handling.
|
Download and install
Download htmlincl-5.35.zip for Windows 95/98/NT (76kb) Download htmlincl-5.35.tar.gz for Unix (34kb) The distribution for Windows 95/98/NT contains the htmlincl.exe program. Installing it is very simple: just copy the program to a directory in your path, for example: “c:windows” or “c:winnt”. The distribution for Unix contains all the sources and a Makefile. Run “make” and copy the binary to somewhere in your path. |
How does it work
The first line of the example will include a file called “header.inc”. In this example you have not created such a file yet, so it will generate an error message. Normally you would stuff the header file with html code such as <html>, <title>, and <body> tags. These have no meaning to the htmlincl program, so it will copy them into the output “example.html” file without change.The first line of the example also defines a macro called “title”, containing the string “Test”. It is passed to the included file, where it can be used to customise the title of the page. You can define any macro you like, you are not limited to just the “title”. The second line of the example begins with the text “This page was created on:”. This text has no meaning to htmlincl, so it will copy it without change to the output. Then a pre-defined macro is used, which will insert the date of the macro file into the html. The whole string “<macro MODIFIED>” will be replaced with something like “19 january 2002 17:00:43”. The third line is a bit like the first. It will include a file called “footer.inc”, which could contain html code such as <address>, </body>, and </html>.
|
Macro files
The input for Htmlincl is a “macro” file, which always has extension “.m”. Macro files live in the same directory as their “.html” files. Htmlincl will read the macro file, process all the commands in it, and write the result to the “.html” file. Htmlincl recognises the following tags:
|
Expressions
Htmlincl contains a simple expression evaluator. You can use expressions anywhere, but you will use them most frequently in “if” tags. The expressions can handle simple integer arithmetic and strings. Here are the commands that are recognised:
Precedence:
Strings:
Escaping:
Examples:
|
Pre-defined macros
|
Running htmlincl
|
Tips and tricks
|