| 
 |   | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
  |
  +--sunlabs.brazil.template.Template
        |
        +--sunlabs.brazil.template.MacroTemplate
Template class for defining macros. Macros are defined by:
<definemacro name=macro-name [global=true|false]> .... </definemacro>The text (.....) has any leading and trailing whitespace removed.
 To expand a macro: <macro-name name1=value1 ...>.
 All ${...} constructs in The previously saved macro body 
 are processed, and the result replaces the macro-name
 tag.  Attributes provided in the macro name override any variables
 that exist in the request properties.
 
 Templates are processed by reading the input "document" a tag
 at a time to generate the output document.
 By default, the macro body is pushed onto the not-yet-processed
 input stream; any tags contained in the macro body will be processed.
 If the defer attribute is present,
 the macro body is placed onto the output stream instead.
 This is more efficient, but requires an additional filter pass
 if the body of the macro contains tags that need to be processed
 in the current context.
 
This is an experiment. The current implementation is flawed, although it is less flawed than the previous one.
 NOTE:
 The init files in previous releases used java properties format
 files to define macros;  This version uses xml templates.  See "main"
 below for a utility to convert the old properties format files to
 the new format.
| Field Summary | |
|  Properties | macroTable | 
| Fields inherited from class sunlabs.brazil.template.Template | 
| debug | 
| Constructor Summary | |
| MacroTemplate() | |
| Method Summary | |
|  void | defaultTag(RewriteContext hr)Run the macro, push formal parameters on the stack first. | 
|  boolean | init(RewriteContext hr)Read in the inital macros, if needed. | 
| static void | main(String[] args)Convert stdin properties format macro definition files to the new template style. | 
| static String | snarfTillClose(LexML lex,
               String tag)Grab all the markup starting from the current tag until the matching closing tag, and return as a string. | 
|  void | tag_definemacro(RewriteContext hr)Define a new macro. | 
| Methods inherited from class sunlabs.brazil.template.Template | 
| done | 
| Methods inherited from class java.lang.Object | 
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
public Properties macroTable
| Constructor Detail | 
public MacroTemplate()
| Method Detail | 
public boolean init(RewriteContext hr)
init in interface TemplateInterfaceinit in class Template
public static String snarfTillClose(LexML lex,
                                    String tag)
public void tag_definemacro(RewriteContext hr)
<name ...> will be replaced by the contents of the macro
 named "name".
 <definemacro name=nnn [global=true|false]>...</definemacro>
<definemacro nnn> is a shortcut for
     <definemacro name=nnn>
 
public void defaultTag(RewriteContext hr)
 If the parameter defer=true is present, the text of the macro is output
 directly, with only ${..} substitutions performed.  Otherwise, the markup in the macro
 body is rescanned and processed.
public static void main(String[] args)
                 throws IOException
IOException| 
 | Version 2.1, Generated 12/30/04 Copyright (c) 2001-2004, Sun Microsystems. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||