Class MarkupTool
- java.lang.Object
-
- org.apache.velocity.tools.generic.SafeConfig
-
- org.apache.velocity.tools.generic.MarkupTool
-
- All Implemented Interfaces:
java.io.Serializable
@DefaultKey("mark") public class MarkupTool extends SafeConfig implements java.io.Serializable
NOTE: This tools is considered "alpha" quality due to lack of testing and a generally unpolished API. Feel free to use but expect changes. Also, this is not automatically provided via the default tools.xml file.A tool to make it easy to generate XML or HTML on the fly. It uses a CSS-type syntax with a vaguely jQuery-ish API to help you generate the markup you need.
Example uses in a template: #set( $foospan = $markup.span.id($foo.id).body($foo) ) $markup.tag('table tr.bar td').body("This is $foospan") Output: <table> <tr class="bar"> <td>This is <span id="foo1">my first foo.</span></td> </tr> </table> Example tools.xml config: <tools> <toolbox scope="application"> <tool class="org.apache.velocity.tools.generic.alpha.MarkupTool"/> </toolbox> </tools>- Since:
- VelocityTools 2.0
- Version:
- $Id$
- Author:
- Nathan Bubna
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMarkupTool.Tag
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_DELIMITERstatic java.lang.StringDEFAULT_TAB-
Fields inherited from class org.apache.velocity.tools.generic.SafeConfig
LOCK_CONFIG_KEY, log, LOGGER_NAME_KEY, SAFE_MODE_KEY, USE_CLASS_LOGGER_KEY
-
-
Constructor Summary
Constructors Constructor Description MarkupTool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MarkupTool.Tagget(java.lang.String tag)java.lang.StringgetTab()protected MarkupTool.Tagparse(java.lang.String definition)voidsetTab(java.lang.String tab)Configurationprotected java.lang.String[]split(java.lang.String me)MarkupTool.Tagtag(java.lang.String definition)-
Methods inherited from class org.apache.velocity.tools.generic.SafeConfig
configure, configure, getLog, initLogger, isConfigLocked, isSafeMode, setLockConfig, setSafeMode
-
-
-
-
Field Detail
-
DEFAULT_TAB
public static final java.lang.String DEFAULT_TAB
- See Also:
- Constant Field Values
-
DEFAULT_DELIMITER
public static final java.lang.String DEFAULT_DELIMITER
- See Also:
- Constant Field Values
-
-
Method Detail
-
setTab
public void setTab(java.lang.String tab)
Configuration- Parameters:
tab- tab string
-
getTab
public java.lang.String getTab()
-
get
public MarkupTool.Tag get(java.lang.String tag)
-
tag
public MarkupTool.Tag tag(java.lang.String definition)
-
split
protected java.lang.String[] split(java.lang.String me)
-
parse
protected MarkupTool.Tag parse(java.lang.String definition)
-
-