C style macros in HTML

It seems to me that C style macros in HTML could dramatically reduce the
size of many web pages.  For instance, when a graphic is used over and
over again with particular alignment and size attributes, a "macro" tag
could help enormously.  Or think of all the huge tables where every row
is 95% the same.  Just look at the output of a search of the w3c mailing
list archives for an example.  I can't imagine that a macro expansion
facility would be very hard for browsers to implement.  It might be a
bit tricky for some of the WYSIWYG editors but even there it could prove
a boon.  And I believe it would actually simplify the coding of the
"back end" of most CGIs.

Below are some examples that I've cooked up.  I'm sure there are all
sorts of problems with the particulars of the syntax I've chosen but
this is really just for illustration.  In this example the <XM> tag
loosely stands for "expand macro".

A simple example (without parameters):

<HEAD>
 <MACRO name=bullet>
  <img border=0 height=12 width=15
src="/home/rice/catalog/images/star3.gif" alt="78%">
 </MACRO>
</HEAD>
.
.
.
<TD>
 <XM name=bullet>
</TD>
.
.
.

Or a more complicated example (which represents a single row generated
by a search engine I sometimes use):

<HEAD>
 <MACRO name=row attrs=pColor,pName,pEmail,pCity>
    <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH=100%>
    <TR BGCOLOR=pColor><TD WIDTH=4%><A HREF="mailto:pEmail">
       <IMG VALIGN=ABSMIDDLE BORDER=0
SRC="images/mail.gif"></A>&nbsp;</TD>
       <TD WIDTH=32%><A HREF="display.cgi?ee=pEmployeeNum"
           onMouseOver="window.status='View detailed information';
return true;">
          <B>pName</B></A>&nbsp;<IMG VALIGN=ABSMIDDLE BORDER=0
SRC="images/redcross.gif"></TD>
    <TD WIDTH=22%>555 555-1212</B></TD>
    <TD WIDTH=22%>&nbsp;</TD>
    <TD WIDTH=20%>pCity</TD>
    </TR>
    </TABLE>
 </MACRO>
</HEAD>
.
.
.

<XM name=row pColor=#d2d2d2 pEmail="bill_clinton@wh.com" pName="Clinton,
Bill" pCity=Washington>
<XM name=row pColor=#aaaaaa pEmail="hillary_clinton@wh.com"
pName="Clinton, Hillary" pCity=Washington>
<XM name=row pColor=#d2d2d2 pEmail="newt_gingrich@us.ga.com"
pName="Gingrich, Newt" pCity=Atlanta>
<XM name=row pColor=#aaaaaa pEmail="fred_flintstone@stone.com"
pName="Flintstone, Fred" pCity=Bedrock>
.
.
.


Joe Rice
joe_rice@avid.com

Received on Friday, 19 December 1997 15:09:04 UTC