Other ahab Features

<!public:label>
<!/public>
These tags are used in the templateHTML to specify a portion of the template that can be replaced on-the-fly by the inputHTML. The default HTML code should go in between these labels. If this code should be different for a specific webpage, the inputHTML can use the:

<!replace:label>
<!/replace>
...tags to specify the HTML code that should replace the default template code that exists in a public block with the corresponding label.

For instance, you may want a default title for your pages, but want to allow any specific page to use its own. The template file would include:

<!public:title>
<TITLE>This is the template title</TITLE>
<!/public>
If a certain page required its own different title, that file would include:

<!replace:title>
<TITLE>This is the replacement title for this particular
page</TITLE>
<!/replace>

<!publicslot:label>
This templateHTML tag works the same as an "empty" public block, in case you want a place in the template where an inputHTML file can add its own HTML code, without requiring any default templateHTML. For example:

<HTML><HEAD>
<TITLE>Template Title</TITLE>
<!publicslot:otherheader>
</HEAD>
Any individual page could include a replace block (as above) to add its own additional header information to the template header. Again, it is functionally equivalent to:

<!public:otherheader>
<!/public>
...but saves some keystrokes and some confusion.

Similarly,

<!remove:label>
...functions like an empty <!replace:label> <!/replace> block in the inputHTML, useful for simply removing public portions of the template.

<!block:label>
<!/block>

<!include:label>
...tag. Any code within block tags will be ignored in the template file unless the input file uses a corresponding include tag. Include tags can only appear in the plainHTML portion of an input file, or within a replace block. If they appear within a non-public area of the template code in the input file, they will be ignored.

Here is an example that shows how all of these features can work together:

templateHTML

<HTML><HEAD>
<!public:title>
<TITLE>Default Title</TITLE>
<!/public>
<!publicslot:otherhead>
</HEAD>
<!public:background>
<BODY BACKGROUND="default.gif">
<!/public>
<!public:topofpage>
<H1>Hi! This is the default top-of-page text!</H1>
<!/public>
<!block:newtop>
<H2>This might be used to replace the default</H2>
<!/block>
<HR>
<!plainHTML>
<HR>
This is the standard footer stuff.
</BODY></HTML>
inputHTML

<!replace:background>
<BODY BACKGROUND="thispage.gif">
<!/replace>
<!replace:topofpage>
<!include:newtop>
<!/replace>

This is some stuff that will appear in the middle of the page.<BR>
outputHTML from ahab

<HTML><HEAD>
<TITLE>Default Title</TITLE>
</HEAD>
<!replace:background>
<BODY BACKGROUND="thispage.gif">
<!/replace:background>
<!replace:topofpage>
<!included:newtop>
<H2>This might be used to replace the default</H2>
<!/included>
<!/replace>
<HR>
<!plainHTMLstart>

This is some stuff that will appear in the middle of the page.<BR>

<!/plainHTMLend>
<HR>
This is the standard footer stuff.
</BODY></HTML>
You'll notice that the original <!include:newtop> tag has turned into the <!included:newtop> and <!/included> tags. This is so if this file is used as an input file to ahab in the future, ahab will know to replace this included block, instead of adding it.

In addition, the replace tags are left in so that if the file is used as inputHTML again, ahab will know to update the blocks again with any new template code that exists.

<!notemplateHTML>
Finally, this tag can be added to the top of an inputFILE to instruct ahab to not process the file at all. This is useful in the case where a directory contains a number of .html files, but a few of them do not use an existing template. Put the notemplateHTML tag at the top of the ones that do not, and you can still use "ahab .html template" without worrying about those few select files being altered.

Back to main ahab page

Pinback's Web Central
This page and the contents therein (except where otherwise attributed) are copyright (c) 1997, 1998, by Ben Parrish.
That was in case any of you devious types were thinking of stealing all my cool stuff. So there.
[ Lynx Now! ] This page is Lynx Enhanced, and here's why.
[ OWL Approved! ] This webpage adheres to the specifications set forth by the Optimal Web Layout (OWL) Committee.