@DefaultKey(value="mark") public class MarkupTool extends SafeConfig implements Serializable
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>
Modifier and Type | Class and Description |
---|---|
static class |
MarkupTool.Tag |
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DELIMITER |
static String |
DEFAULT_TAB |
LOCK_CONFIG_KEY, log, LOGGER_NAME_KEY, SAFE_MODE_KEY, USE_CLASS_LOGGER_KEY
Constructor and Description |
---|
MarkupTool() |
Modifier and Type | Method and Description |
---|---|
MarkupTool.Tag |
get(String tag) |
String |
getTab() |
protected MarkupTool.Tag |
parse(String definition) |
void |
setTab(String tab)
Configuration
|
protected String[] |
split(String me) |
MarkupTool.Tag |
tag(String definition) |
configure, configure, getLog, initLogger, isConfigLocked, isSafeMode, setLockConfig, setSafeMode
public static final String DEFAULT_TAB
public static final String DEFAULT_DELIMITER
public void setTab(String tab)
tab
- tab stringpublic String getTab()
public MarkupTool.Tag get(String tag)
public MarkupTool.Tag tag(String definition)
protected MarkupTool.Tag parse(String definition)
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.