Class MarkupTool
java.lang.Object
org.apache.velocity.tools.generic.SafeConfig
org.apache.velocity.tools.generic.MarkupTool
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.
Example tools.xml config:
<tools>
<toolbox scope="application">
<tool class="org.apache.velocity.tools.generic.alpha.MarkupTool"/>
</toolbox>
</tools>
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:
| This is my first foo. |
- Since:
- VelocityTools 2.0
- Version:
- $Id$
- Author:
- Nathan Bubna
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprivate Stringprivate StringFields inherited from class org.apache.velocity.tools.generic.SafeConfig
LOCK_CONFIG_KEY, OLD_LOCK_CONFIG_KEY, SAFE_MODE_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringBuilderclear(MarkupTool.Mode mode, MarkupTool.Tag tag, StringBuilder val, boolean emptyStore) getTab()protected MarkupTool.Tagvoidprotected String[]Methods inherited from class org.apache.velocity.tools.generic.SafeConfig
configure, configure, isConfigLocked, isSafeMode, setLockConfig, setSafeMode
-
Field Details
-
DEFAULT_TAB
- See Also:
-
DEFAULT_DELIMITER
- See Also:
-
tab
-
delim
-
-
Constructor Details
-
MarkupTool
public MarkupTool()
-
-
Method Details
-
setTab
-
getTab
-
get
-
tag
-
split
-
parse
-
clear
private StringBuilder clear(MarkupTool.Mode mode, MarkupTool.Tag tag, StringBuilder val, boolean emptyStore)
-