java.lang.Object
io.jstach.jstachio.escapers.Html
Provides a mustache spec based HTML escaper which is the default in normal mustache.
N.B. Unlike many XML escapers this escaper does not differentiate attribute and element content. Furthermore Mustache unlike many other templating languages is content agnostic. If more flexibile attribute escaping is needed a custom lambda could be used to preserve the whitespace in attributes.
The escaper simply escapes:
Character | Escaped String |
---|---|
'" ' |
""" |
'& ' |
"&" |
'' ' |
"'" |
'< ' |
"<" |
'= ' |
"=" |
'> ' |
">" |
'` ' |
"`" |
N.B. Unlike many XML escapers this escaper does not differentiate attribute and element content. Furthermore Mustache unlike many other templating languages is content agnostic. If more flexibile attribute escaping is needed a custom lambda could be used to preserve the whitespace in attributes.
This escaper assumes UTF-8 which is the predominate encoding of HTML these days
and thus will not encode characters other then the ones mentioned above. Thus
if you intend escape for example StandardCharsets.US_ASCII
a different HTML
escaper should be used to properly escape non ascii characters as HTML entities.
- Author:
- agentgt, Victor Nazarov
- See Also:
-
Method Summary
-
Method Details
-
provider
Provides the escaper.- Returns:
- HTML escaper.
-
of
Provides the escaper.- Returns:
- HTML escaper.
-