escape_ once
string | escape_once
returns string
Escapes a string without changing characters that have already been escaped.
# applying the escape filter to already escaped text escapes characters in HTML entities:
{{ "<p>Text to be escaped.</p>" | escape }}
# applying the escape_once filter to already escaped text skips characters in HTML entities:
{{ "<p>Text to be escaped.</p>" | escape_once }}
# use escape_once to escape strings where a combination of HTML entities and non-escaped characters might be present:
{{ "<p>Text to be escaped.</p> & some additional text" | escape_once }}
# applying the escape filter to already escaped text escapes characters in HTML entities:
{{ "<p>Text to be escaped.</p>" | escape }}
# applying the escape_once filter to already escaped text skips characters in HTML entities:
{{ "<p>Text to be escaped.</p>" | escape_once }}
# use escape_once to escape strings where a combination of HTML entities and non-escaped characters might be present:
{{ "<p>Text to be escaped.</p> & some additional text" | escape_once }}
Output
Was this page helpful?