Jet (Jaskell Engine for Template) Documentation | |
---|---|
b
| Equivalent to tag "b" |
br
| to generate <br> |
comment
| suppress a string so that it doesn't show up in the result |
escape
| to escape a string for html |
fmt
| to convert a date or a number to the desired pattern |
format
| to convert a date or a number to the desired format |
href
| to generate a hyper link |
html
| Html related Jet functions |
html.b
| Equivalent to tag "b" |
html.br
| to generate <br> |
html.escape
| to escape a string for html |
html.href
| to generate a hyper link |
html.i
| Equivalent to tag "i" |
html.li
| Equivalent to tag "li" |
html.nbsp
| Equivalent to " " |
html.p
| Equivalent to tag "p" |
html.tag
| to spit out a named tag |
html.td
| Equivalent to tag "td" |
html.th
| Equivalent to tag "th" |
html.tr
| to create a html table row. Each column is automatically wrapped by <td> and </td> |
html.ul
| to create a html list. Each list item is automatically wrapped by <li> and </li> |
html.unescape
| to un-escape a string for html |
i
| Equivalent to tag "i" |
if_exists
| Evaluates to empty string when a variable or a method referenced by an expression is not defined or null |
if_na
| Provides a default value when a variable or a method referenced by an expression is not defined or null |
if_null
| Provides a default value when NullPointerException is thrown or the expression evaluates to null. |
if_undefined
| Provides a default value when a variable or a method referenced by an expression is not defined |
include
| to load the content of a text file |
jaskell
| the tuple containing all jaskell predefined functions. |
java
| the java classes whose package names start with "java." and pre-loaded by 'importStandardClasses'. |
javax
| the java classes whose package names start with "javax." and pre-loaded by 'importStandardClasses'. |
jet
| General Jet functions |
jet.comment
| suppress a string so that it doesn't show up in the result |
jet.fmt
| to convert a date or a number to the desired pattern |
jet.format
| to convert a date or a number to the desired format |
jet.if_exists
| Evaluates to empty string when a variable or a method referenced by an expression is not defined or null |
jet.if_na
| Provides a default value when a variable or a method referenced by an expression is not defined or null |
jet.if_null
| Provides a default value when NullPointerException is thrown or the expression evaluates to null. |
jet.if_undefined
| Provides a default value when a variable or a method referenced by an expression is not defined |
jet.include
| to load the content of a text file |
jet.sequence
| create a string by sequentially serialize objects in a list using a serializer function |
jet.unless
| infix modifier function for conditionally spitting out a string. |
jet.when
| infix modifier function for conditionally spitting out a string. |
li
| Equivalent to tag "li" |
nbsp
| Equivalent to " " |
out
| the output object |
p
| Equivalent to tag "p" |
request
| the request object |
response
| the response object |
sequence
| create a string by sequentially serialize objects in a list using a serializer function |
tag
| to spit out a named tag |
td
| Equivalent to tag "td" |
th
| Equivalent to tag "th" |
tr
| to create a html table row. Each column is automatically wrapped by <td> and </td> |
ul
| to create a html list. Each list item is automatically wrapped by <li> and </li> |
unescape
| to un-escape a string for html |
unless
| infix modifier function for conditionally spitting out a string. |
when
| infix modifier function for conditionally spitting out a string. |
API Detail |
---|
String comment(Object commented)
For example:
comment "this is a comment"
String escape(String s)
require Apache Commons-Lang library in the classpath
This function has 2 overloaded versions:
String fmt(String pattern, Date date)
String fmt(String pattern, Number date)
This function has 2 overloaded versions:
String format(Object numberformat, Number num)
String format(Object dateformat, Date date)
The specification of numberformat or dateformat object can be found in jaskell.date.format and jaskell.number.format functions
String href(String link, String title)
For example:
href "http://www.mycompany.com" "My Company"
String escape(String s)
require Apache Commons-Lang library in the classpath
String href(String link, String title)
For example:
href "http://www.mycompany.com" "My Company"
String tag(String name, String content)
The following example is equivalent to <B>hello world</B>
tag "B" "hello world"
String tr(List list)
String ul(List list)
String unescape(String s)
require Apache Commons-Lang library in the classpath
Object if_exists(Expression expr)
Normally called in such syntax: some_expr->if_exists
Object if_na(Object default_value, Expression expr)
Normally called in such syntax: some_expr->if_na def_value
Object if_null(Object default_value, Expression expr)
Normally called in such syntax: some_expr->if_null def_value
Object if_undefined(Object default_value, Expression expr)
Normally called in such syntax: some_expr->if_undefined def_value
StringBuffer include(java.util.Map options)
The options tuple can contain the following members:
file
- the file to be included.resource
- the name of the resource that's gonna be loaded from a ClassLoader.classloader
- the ClassLoader used to load resource.
If omitted, the current ClassLoader used by the Jaskell object is used.
String comment(Object commented)
For example:
comment "this is a comment"
This function has 2 overloaded versions:
String fmt(String pattern, Date date)
String fmt(String pattern, Number date)
This function has 2 overloaded versions:
String format(Object numberformat, Number num)
String format(Object dateformat, Date date)
The specification of numberformat or dateformat object can be found in jaskell.date.format and jaskell.number.format functions
Object if_exists(Expression expr)
Normally called in such syntax: some_expr->if_exists
Object if_na(Object default_value, Expression expr)
Normally called in such syntax: some_expr->if_na def_value
Object if_null(Object default_value, Expression expr)
Normally called in such syntax: some_expr->if_null def_value
Object if_undefined(Object default_value, Expression expr)
Normally called in such syntax: some_expr->if_undefined def_value
StringBuffer include(java.util.Map options)
The options tuple can contain the following members:
file
- the file to be included.resource
- the name of the resource that's gonna be loaded from a ClassLoader.classloader
- the ClassLoader used to load resource.
If omitted, the current ClassLoader used by the Jaskell object is used.
StringBuffer sequence(List list, Function serializer)
The following code evaluates to <li>a</li><li>b</li>
sequence ["a","b"] li
sequence also supports an alternative syntax that's more similar to imperative loop:
"sequence [1,2] li" is equivalent to "sequence {i=[1,2]} $ li i"
Object unless(Object val, boolean cond)
For example:
"hello world" `unless a==b
Object when(Object val, boolean cond)
For example:
"hello world" `when a==b
StringBuffer sequence(List list, Function serializer)
The following code evaluates to <li>a</li><li>b</li>
sequence ["a","b"] li
sequence also supports an alternative syntax that's more similar to imperative loop:
"sequence [1,2] li" is equivalent to "sequence {i=[1,2]} $ li i"
String tag(String name, String content)
The following example is equivalent to <B>hello world</B>
tag "B" "hello world"
String tr(List list)
String ul(List list)
String unescape(String s)
require Apache Commons-Lang library in the classpath
Object unless(Object val, boolean cond)
For example:
"hello world" `unless a==b
Object when(Object val, boolean cond)
For example:
"hello world" `when a==b