Title : suPerlative: The ht Preprocessor Author : ALR Abstract: ht is a pre-processor for HTML. It facilitates the maintenance of a large site by abstracting out common 'boilerplate' segments of code, e.g. header and footer segments that are similar system-wide. A number of varying styles and macros can also be supported. +++ Content : Central to our operations is 'ht', which takes a simplified HTML file and adds 'boilerplate' stuff such as banner ads and navigation menus. ht files start with a header such as:-
Head
and Foot, which are also used by most of our other scripts.
The benefits of using ht are:-
ht generates all the header, table and footer HTML... Using a preprocessor such as ht provides much more flexibility than typical HTML editors (which anyway tend to generate bloated and unreadable code) - for example I can easily change the site style by changing ht and running source files through it.. (very powerful when combined with style sheets).
You run the file through 'ht' and it sticks on the boilerplate, modified if necessary according to the header parameters and with any macros (abbreviations) expanded. This makes it very easy to create HTML in one of our standard styles, but you can also control the end result as much as you want since the input can contain HTML. And it's also very useful for our mirrors, e.g. there can be small differences automatically introduced such as crediting the host or pointing to CGI programs on the primary site because we don't have CGI access on every mirror. With 1,500 pages to maintain this would hard to do with an editor..
We don't currently use a database but a logical extension of this method would be to put the ht files into a database and then we could generate the pages dynamically, e.g. to account for browser differences. This approach isn't for everyone but anyone who wallows in Perl and HTML should love it..
Finally - ht also allows a small set of abbreviations; e.g.
To use ht, you need: