public static final class SlicedRawTextNode.RawTextSlice extends Object
This slice is not the entire substring with the same context. Such a thing cannot be statically determined since in a portion of a template that stays in the same context like
foo {if $cond}bar{else}baz{/if} boo
there might be two possible strings with the same context: "foo bar boo" and
"foo baz boo".
| Modifier and Type | Field and Description |
|---|---|
Context |
context
The context of the slice.
|
SlicedRawTextNode |
slicedRawTextNode
The text node containing the slice.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getLength()
The length of the slice in
chars. |
String |
getRawText()
The raw text of the slice.
|
SlicedRawTextNode |
getSlicedRawTextNode() |
int |
getStartOffset()
The start offset (inclusive) into the text node's text.
|
void |
insertText(int offset,
String text)
Mutates the parse tree by replacing the sliced text node with a text node that
includes the given text at the given point within this slice.
|
String |
toString()
For debugging.
|
public final Context context
public final SlicedRawTextNode slicedRawTextNode
public int getStartOffset()
public int getLength()
chars.public SlicedRawTextNode getSlicedRawTextNode()
public void insertText(int offset,
String text)
throws SoyAutoescapeException
text - A string in context context.offset - An offset between 0 (inclusive) and getLength() (exclusive).context - the context of text.SoyAutoescapeException - if inserting text would violate context assumptions made by
the contextual autoescaper.public String getRawText()