added fil_json_escape filter

master
Tomasz Sowa 1 year ago
parent a327a26bd5
commit d6d5236a03

@ -34,6 +34,9 @@
#include "templates.h"
#include "core/misc.h"
#include "convert/misc.h"
namespace Winix
{
@ -165,6 +168,19 @@ void fil_csv_escape(Info & i)
}
void fil_json_escape(Info & i)
{
pt::WTextStream str;
for(size_t a=0 ; a < i.in.size() ; ++a)
{
wchar_t c = i.in.get_wchar(a);
pt::esc_to_json(c, str);
i.out << R(str);
str.clear();
}
}
void fil_new_line_to_br(Info & i)
{

@ -349,6 +349,7 @@ void Templates::CreateFunctions()
ezc_functions.Insert("fil_firstup", fil_firstup);
ezc_functions.Insert("fil_first_wordup", fil_first_wordup);
ezc_functions.Insert("fil_csv_escape", fil_csv_escape);
ezc_functions.Insert("fil_json_escape", fil_json_escape);
ezc_functions.Insert("fil_new_line_to_br", fil_new_line_to_br);
ezc_functions.Insert("fil_html_quote", fil_html_quote);
ezc_functions.Insert("fil_html_newline", fil_html_newline);

@ -239,6 +239,7 @@ namespace TemplatesFunctions
void fil_firstup(Info & i);
void fil_first_wordup(Info & i);
void fil_csv_escape(Info & i);
void fil_json_escape(Info & i);
void fil_new_line_to_br(Info & i);
void fil_html_quote(Info & i);
void fil_html_newline(Info & i);

Loading…
Cancel
Save