I was wrong, html escape filter is appended even if an html escape filter is already there.

This commit is contained in:
Tom Alexander
2020-05-23 18:18:59 -04:00
parent e22bffd2ba
commit f3fef17d4b
3 changed files with 3 additions and 5 deletions

View File

@@ -4,5 +4,5 @@ HTML Escaping
Dust automatically applies the `|h` filter to html escape unless `|s` is applied to disable automatic html escaping. It seems that if you manually specify `|h` and `|s` in the same filter, then it still html escapes, so my theory on the logic is:
Iterate over all filters
If `|s` or `|h` is not present append `|h`, otherwise, leave filters as-in
If `|s` is not present append `|h`, otherwise, leave filters as-in
During render, `|s` does nothing, so we can just remove it on the dust side to prevent confusion.

View File

@@ -2,6 +2,7 @@ Special characters: {special_characters}{~n}
Special characters html escaping disabled: {special_characters|s}{~n}
Special characters html escaping disabled and enabled: {special_characters|s|h}{~n}
Special characters html escaping enabled and disabled: {special_characters|h|s}{~n}
Special characters html escaped once: {special_characters|h}{~n}
Special characters html escaped twice: {special_characters|h|h}{~n}