[ The Sunny Spot ] WPP v2.10 - The Web Preprocessor
Author : Marco Lamberto
Preprocessed by WPP
   Index < Previous    Next >   

  Macro expansion [ ^ ]

@MACRO MNAME(arg1, arg2, ...)@
   ...
@ENDMACRO@
Declare MNAME as a new macro. Notice that the valid charset for the name and the arguments is the same of the variables (A-Z,0-9,_).

@MNAME("arg1", "arg2", ...)@

Calls MNAME. Notice that the " are required only if you are using string constants as argument, you can omit them if you use a variable (with the @ included). If you use " into a macro argument you should excape it with a \.

Source file
<!-- macro declaration -->
@MACRO MY_MACRO(NAME, HREF)@
<A HREF="@HREF@">@NAME@</A>
@ENDMACRO@

<!-- macro called with args containing string constants -->
@MY_MACRO("Test", "test.html")@

<!-- macro called with args containing variables -->
@MY_MACRO(@FILENAME@, "@FILENAME@.html")@

<!-- example of splitted macro call -->
@MY_MACRO("\"@FILENAME@\" is the source",\
    "@FILENAME@.html")@

Notes

  • You cannot declare a macro from inside another macro.
  • Macros can be called within other macros (pay attention to recursive calls!), variables assignments or macro aguments.

  Built-in macros [ ^ ]

Built-in macros are predefined macros allowing particular operations, you can use them as normal macros.
Usually if a built-in macro reads data from a file, this file will be included into the dependencies list (see the --depend switch).

Macros working on images

Allowed file formats are GIF, JPEG and PNG.

Macro Expanded to
@HTML_IMAGE(img)@ <IMG SRC="img" WIDTH="img_width" HEIGHT="img_height">
@HTML_IMAGE(img, alt)@ <IMG SRC="img" WIDTH="img_width" HEIGHT="img_height" ALT="alt" >
@HTML_IMAGE(img, alt, extra)@ <IMG SRC="img" WIDTH="img_width" HEIGHT="img_height" ALT="alt" extra>
@HTML_IMAGE_SIZE(img)@ SRC="img" WIDTH="img_width" HEIGHT="img_height"
@HTML_IMAGE_SIZEO(img)@ WIDTH="img_width" HEIGHT="img_height"
@HTML_IMAGE_WIDTH(img)@ WIDTH="img_width"
@HTML_IMAGE_HEIGHT(img)@ HEIGHT="img_height"
@IMAGE_WIDTH(img)@ img_width
@IMAGE_HEIGHT(img)@ img_height

Example:

Source file
@HTML_IMAGE("index.jpg", "my logo",\
    "BORDER=0 HSPACE=10")@
HTML file
<IMG SRC="index.jpg" WIDTH=100 HEIGHT=200 ALT="my logo" BORDER=0 HSPACE=10 >

Macros working on image maps

These macros read a server side imagemap and are expanded into a converted HTML client side version.
In the map files the ALT field is taken from the comment line before the area definition.

Macro Expanded to
@CERN2HTML(mapfile)@
@NCSA2HTML(mapfile)@
<MAP NAME="mapfile">
<AREA SHAPE="..." HREF="..." COORDS="..." ALT="...">
</MAP>
@CERN2HTML(mapfile, mapname)@
@NCSA2HTML(mapfile, mapname)@
<MAP NAME="mapname">
<AREA SHAPE="..." HREF="..." COORDS="..." ALT="...">
</MAP>

Example:

Source file
@NCSA2HTML("index.map", "myindex")@

<A HREF="index.map"><IMG SRC="menu.gif" WIDTH=600 HEIGHT=50
    ISMAP USEMAP="#myindex"></A>


   ^ Top < Previous    Next >   
Marco (LM) Lamberto lm@geocities.com
Revised: 1998/09/23 11:26:51
http://www.geocities.com/Tokyo/1474/wpp/manual_6.html
Preprocessed by WPP Graphics by GIMP