public final class ContextualAutoescaper extends Object
rewrite
Hello, {$world}!
{/template}Hello, {$world |escapeHtml}!
{/template}| Constructor and Description |
|---|
ContextualAutoescaper(Iterable<? extends String> autoescapeCancellingDirectives,
Map<? extends String,? extends SanitizedContent.ContentKind> sanitizedContentOperators,
ErrorReporter errorReporter) |
| Modifier and Type | Method and Description |
|---|---|
List<SlicedRawTextNode> |
getSlicedRawTextNodes()
Maps ranges of text-nodes to contexts so that later parse passes can add attributes or
elements.
|
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)
Rewrites the given Soy files so that dynamic output is properly escaped according to the
context in which it appears.
|
public ContextualAutoescaper(Iterable<? extends String> autoescapeCancellingDirectives, Map<? extends String,? extends SanitizedContent.ContentKind> sanitizedContentOperators, ErrorReporter errorReporter)
autoescapeCancellingDirectives - The Soy directives that cancel autoescaping (see
SoyPrintDirective.shouldCancelAutoescape()).sanitizedContentOperators - Maps print directive names to the content kinds they
consume and produce.public List<TemplateNode> rewrite(SoyFileSetNode fileSet) throws SoyAutoescapeException
fileSet - Modified in place.DerivedTemplateUtils for an
explanation of these.SoyAutoescapeException - If it is impossible to statically determine the context of
portions of templates.
It is not possible to decide what to do with $x in:
public Context getTemplateEndContext(String templateName)
templateName - A qualified template name.public List<SlicedRawTextNode> getSlicedRawTextNodes()