public class Shortcode
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Shortcode.Type
The type (enclosing or self-closing).
|
| Modifier and Type | Field and Description |
|---|---|
com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> |
attributes
The attributes.
|
java.lang.String |
content
The content.
|
java.lang.String |
name
The name.
|
| Constructor and Description |
|---|
Shortcode(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> attributes)
Creates a shortcode without content.
|
Shortcode(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> attributes,
java.lang.String content)
Creates a shortcode with content.
|
| Modifier and Type | Method and Description |
|---|---|
static Shortcode |
parse(java.lang.String shortcode)
Parses a shortcode
|
static void |
parse(java.lang.String str,
ShortcodeParser.Handler handler)
Parse an arbitrary string.
|
java.lang.String |
positionalValue(int pos)
Gets a positional attribute value.
|
java.util.List<java.lang.String> |
positionalValues()
Gets a list of any positional values.
|
java.lang.String |
toString() |
java.lang.String |
value(java.lang.String name)
Gets an attribute value.
|
Shortcode |
withContent(java.lang.String content)
Adds content to a shortcode.
|
public final java.lang.String name
public final com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> attributes
public final java.lang.String content
public Shortcode(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> attributes)
name - The name.attributes - The attributes.public Shortcode(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> attributes,
java.lang.String content)
name - The name.attributes - The attributes.content - The content.public Shortcode withContent(java.lang.String content)
content - The content.public final java.lang.String value(java.lang.String name)
name - The attribute name.null if no value for this attribute.public final java.lang.String positionalValue(int pos)
pos - The position.null if no value at the position.public final java.util.List<java.lang.String> positionalValues()
public final java.lang.String toString()
toString in class java.lang.Objectpublic static Shortcode parse(java.lang.String shortcode) throws java.text.ParseException
shortcode - The shortcode string.java.text.ParseException - on invalid code.public static void parse(java.lang.String str,
ShortcodeParser.Handler handler)
str - The string.handler - The handler for parse events.