Add support for htmlEscape and htmlUnescape in hurlfmt

This commit is contained in:
Luke Mondy 2022-12-06 09:30:55 +11:00
parent db486f9695
commit e6028f390a
No known key found for this signature in database
2 changed files with 13 additions and 0 deletions

View File

@ -535,6 +535,15 @@ impl ToJson for FilterValue {
FilterValue::UrlDecode { .. } => {
attributes.push(("type".to_string(), JValue::String("urlDecode".to_string())));
}
FilterValue::HtmlEscape { .. } => {
attributes.push(("type".to_string(), JValue::String("htmlEscape".to_string())));
}
FilterValue::HtmlUnescape { .. } => {
attributes.push((
"type".to_string(),
JValue::String("htmlUnescape".to_string()),
));
}
FilterValue::ToInt { .. } => {
attributes.push(("type".to_string(), JValue::String("toInt".to_string())));
}

View File

@ -1152,6 +1152,10 @@ impl Tokenizable for Filter {
FilterValue::Count { .. } => vec![Token::FilterType(String::from("count"))],
FilterValue::UrlEncode { .. } => vec![Token::FilterType(String::from("urlEncode"))],
FilterValue::UrlDecode { .. } => vec![Token::FilterType(String::from("urlDecode"))],
FilterValue::HtmlEscape { .. } => vec![Token::FilterType(String::from("htmlEscape"))],
FilterValue::HtmlUnescape { .. } => {
vec![Token::FilterType(String::from("htmlUnescape"))]
}
FilterValue::ToInt { .. } => vec![Token::FilterType(String::from("toInt"))],
}
}