C style macros in HTML

Joe Rice (joe_rice@avid.com)
Fri, 19 Dec 1997 15:08:57 -0500

Message-Id: <349AD459.FE23CDE9@avid.com>
Date: Fri, 19 Dec 1997 15:08:57 -0500
From: Joe Rice <joe_rice@avid.com>
To: www-html@w3.org
Subject: 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):

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

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

 <MACRO name=row attrs=pColor,pName,pEmail,pCity>
    <TR BGCOLOR=pColor><TD WIDTH=4%><A HREF="mailto:pEmail">
       <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
    <TD WIDTH=22%>555 555-1212</B></TD>
    <TD WIDTH=22%>&nbsp;</TD>
    <TD WIDTH=20%>pCity</TD>

<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