|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ccg.macros.at.Base
com.ccg.macros.at.Html
public class Html
Macros related to the generation of HTML documents.
Set of @macros which provide handy functions when generating HTML output. Developers don't typically make use of these methods, but end users who write HTML documents will.
| Constructor Summary | |
|---|---|
Html()
Constructs the object and readies it for installation. |
|
| Method Summary | |
|---|---|
void |
encodeFormParam(Output out,
Vector args)
@encodeFormParam(TEXT) - escape paramters passed as form values in a URL string. |
void |
htmlEscape(Output out,
Vector args)
@htmlEscape(TEXT) - escape special HTML characters '<', '>' and '&'. |
static void |
main(String[] args)
Main entry point into the application. |
void |
tableRow(Output out,
Vector args)
@tableRow(COL0,COL1,...) generate single row in HTML table. |
void |
urlJoin(Output out,
Vector args)
@urlJoin(ROOT[,SUB0[,SUB1 ...]) - do a "smart" join of strings when forming URL(s). |
| Methods inherited from class com.ccg.macros.at.Base |
|---|
getAtMacros, getDoubleParameter, getIntParameter, getLongParameter, getStringParameter, install |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Html()
installation.
Base.install(com.ccg.macros.AtMacros)| Method Detail |
|---|
public void htmlEscape(Output out,
Vector args)
throws IOException,
InterpretException
This should probably be relocated to a special HTML version of
the At class. However, I needed something that would
translate '<' into "<", '>' into ">" and '&' into "&"
so that HTML examples would appear as the expected when viewed by
a browser.
This macro simply replaces HTML special characters, with the HTML escape codes.
out - The output device to write the results of
processing the argument to.args - A vector of arguments which were passed to the macro.
IOException - If there is a problem writing to the output device
InterpretException - If a problem is encountered interpretting the arguments passed.
public void encodeFormParam(Output out,
Vector args)
throws IOException,
InterpretException
This macro simply replaces some characters that might need special escaping to be included in a URL. For example:
@link("http://mysite.com/post.py?name=@encodeFormParam("Paul Blankenbaker")")
out - The output device to write the results of
processing the argument to.args - A vector of arguments which were passed to the macro.
IOException - If there is a problem writing to the output device
InterpretException - If a problem is encountered interpretting the arguments passed.
public void urlJoin(Output out,
Vector args)
throws IOException,
InterpretException
It is common to form URLs by "joining" together one or more strings. For example, consider the following:
@define("rootUrl","http://joe.com/")
@define("subDir","local/")
@define("fileName","joe.html")
@rootUrl()@subDir()@fileName
The above would work, and result in the string
"http://joe.com/local/joe.html".
However, the above form requires the user to worry about
slashes ("/"), at the start or end. If the "rootUrl" had been
defined as "http://joe.com", it would have come out as
"http://joe.comlocal/joe.html" which is probably not what you
want.
This takes the "worry" out of this situation, it sticks a
slash ("/") between strings (or removes an extra one). So, using
this makes life much easier. As an example ALL of the following
will expand to the same URL ("http://joe.comlocal/joe.html").
@urlJoin("http://joe.com/local","joe.html")
@urlJoin("http://joe.com","local","joe.html")
@urlJoin("http://joe.com/","/local/","/joe.html")
@urlJoin("http://joe.com","/local","joe.html")
You can pass as many (or as few parameters) as you wish, we
just keep joining them all together for you.
out - The output device to write the results of
processing the argument to.args - A vector of arguments which were passed to the macro.
IOException - If there is a problem writing to the output device
InterpretException - If a problem is encountered interpretting the arguments passed.
public void tableRow(Output out,
Vector args)
throws IOException,
InterpretException
This macro looks at all of the parameters, evaluates them and then puts them insides the proper HTML tags for the purpose of buiding a table. Here is an example usage:
@tableBegin(2,"My Table")
@tableRow("Paul","Blankenbaker")
@tableRow("Megan","Brown")
@tableRow("Erik","Blankenbaker")
@tableRow("Scott",Blankenbaker")
@tableEnd()
out - The output device to write the results of
processing the argument to.args - A vector of arguments which were passed to the macro.
IOException - If there is a problem writing to the output device
InterpretException - If a problem is encountered interpretting the arguments passed.public static void main(String[] args)
args - Array of command line arguments.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||