public static interface SoySauce.Renderer
| Modifier and Type | Method and Description |
|---|---|
SoySauce.Continuation<String> |
render()
Renders the template to a string.
|
SoySauce.WriteContinuation |
render(AdvisingAppendable out)
Renders the configured template to the appendable returning a continuation.
|
SoySauce.Continuation<SanitizedContent> |
renderStrict()
Renders the template to a string.
|
SoySauce.Renderer |
setActiveDelegatePackageSelector(com.google.common.base.Predicate<String> active)
Sets the predicate to use for testing whether or not a given
delpackage is active. |
SoySauce.Renderer |
setCssRenamingMap(SoyCssRenamingMap cssRenamingMap)
Configures the
{css ..} renaming map. |
SoySauce.Renderer |
setData(Map<String,?> record)
Configures the data to pass to template.
|
SoySauce.Renderer |
setDebugSoyTemplateInfo(boolean debugSoyTemplateInfo)
When passing a value of true, Soy compiler will render additional HTML comments for runtime
inspection.
|
SoySauce.Renderer |
setExpectedContentKind(SanitizedContent.ContentKind kind)
Sets the expected content kind.
|
SoySauce.Renderer |
setIj(Map<String,?> record)
Configures the
$ij to pass to the template. |
SoySauce.Renderer |
setMsgBundle(SoyMsgBundle msgs)
Configures the bundle of translated messages to use.
|
SoySauce.Renderer |
setSoyLogger(SoyLogger logger)
Configures the
SoyLogger to use. |
SoySauce.Renderer |
setXidRenamingMap(SoyIdRenamingMap xidRenamingMap)
Configures the
{xid ..} renaming map. |
SoySauce.Renderer setData(Map<String,?> record)
SoySauce.Renderer setIj(Map<String,?> record)
$ij to pass to the template.SoySauce.Renderer setCssRenamingMap(SoyCssRenamingMap cssRenamingMap)
{css ..} renaming map.SoySauce.Renderer setXidRenamingMap(SoyIdRenamingMap xidRenamingMap)
{xid ..} renaming map.SoySauce.Renderer setActiveDelegatePackageSelector(com.google.common.base.Predicate<String> active)
delpackage is active.SoySauce.Renderer setMsgBundle(SoyMsgBundle msgs)
SoySauce.Renderer setDebugSoyTemplateInfo(boolean debugSoyTemplateInfo)
SoySauce.Renderer setExpectedContentKind(SanitizedContent.ContentKind kind)
An attempt to render a non-strict template or a strict template with a different kind will fail if this has been called.
SoySauce.Renderer setSoyLogger(SoyLogger logger)
SoyLogger to use.@CheckReturnValue SoySauce.WriteContinuation render(AdvisingAppendable out) throws IOException
All rendering operations performed via this API will return a continuation indicating how
and when to continue rendering. There are 4
possibilities for every rendering operation.
Checks the content kind of the template. Non-strict and kind="html" templates are
allowed, unless setExpectedContentKind(com.google.template.soy.data.SanitizedContent.ContentKind) was called. The goal is to prevent accidental
rendering of unescaped kind="text" in contexts where that could lead to XSS.
continuation.result().isDone() will return true.
output buffer
asked render to stop by returning true from AdvisingAppendable.softLimitReached(). In this case contuation.result().type()
will be RenderResult.Type#LIMITED. The caller can continue rendering when the appendable is ready for
additional data.
Future
parameter. In this case contuation.result().type() will be RenderResult.Type#DETACH and the future in question will be accessible via the RenderResult.future() method. The caller can continue rendering when the future is done.
IOException if the output buffer does. In
this case rendering may not be continued and behavior is undefined if it is.
It is safe to call this method multiple times, but each call will initiate a new render of the configured template. To continue rendering a template you must use the returned continuation.
IOException@CheckReturnValue SoySauce.Continuation<String> render()
The rendering semantics are the same as for render() with the following 2 caveats
RenderResult.Type#LIMITED
IOException
Checks the content kind of the template. Non-strict and kind="html" templates are
allowed, unless setExpectedContentKind(com.google.template.soy.data.SanitizedContent.ContentKind) was called. The goal is to prevent accidental
rendering of unescaped kind="text" in contexts where that could lead to XSS.
It is safe to call this method multiple times, but each call will initiate a new render of the configured template. To continue rendering a template you must use the returned continuation.
@CheckReturnValue SoySauce.Continuation<SanitizedContent> renderStrict()
The rendering semantics are the same as for render() with the following 2 caveats
RenderResult.Type#LIMITED
IOException
Checks the content kind of the template. Non-strict and kind="html" templates are
allowed, unless setExpectedContentKind(com.google.template.soy.data.SanitizedContent.ContentKind) was called. The goal is to prevent accidental
rendering of unescaped kind="text" in contexts where that could lead to XSS.
It is safe to call this method multiple times, but each call will initiate a new render of the configured template. To continue rendering a template you must use the returned continuation.