public final class ContextualAutoescaper extends Object
E.g. it will rewrite
Hello, {$world}! {/template}
Hello, {$world |escapeHtml}! {/template}
| Constructor and Description |
|---|
ContextualAutoescaper(com.google.common.collect.ImmutableMap<String,? extends SoyPrintDirective> soyDirectivesMap)
This injected ctor provides a blank constructor that is filled, in normal compiler operation,
with the core and basic directives defined in com.google.template.soy.{basic,core}directives,
and any custom directives supplied on the command line.
|
| Modifier and Type | Method and Description |
|---|---|
Context |
getTemplateEndContext(String templateName)
Null if no typing has been done for the named template, or otherwise the context after a call
to the named template.
|
List<TemplateNode> |
rewrite(SoyFileSetNode fileSet,
ErrorReporter errorReporter)
Rewrites the given Soy files so that dynamic output is properly escaped according to the
context in which it appears.
|
public ContextualAutoescaper(com.google.common.collect.ImmutableMap<String,? extends SoyPrintDirective> soyDirectivesMap)
soyDirectivesMap - Map of all SoyPrintDirectives (name to directive) such that soyDirectivesMap.get(key).getName().equals(key) for all key in soyDirectivesMap.keySet().public List<TemplateNode> rewrite(SoyFileSetNode fileSet, ErrorReporter errorReporter)
fileSet - Modified in place.DerivedTemplateUtils for an
explanation of these.public Context getTemplateEndContext(String templateName)
templateName - A qualified template name.