summaryrefslogtreecommitdiff
path: root/format.c
diff options
context:
space:
mode:
Diffstat (limited to 'format.c')
-rw-r--r--format.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/format.c b/format.c
index 7117e48..cfe2294 100644
--- a/format.c
+++ b/format.c
@@ -260,7 +260,7 @@ xs_str *sanitize(const char *content)
260} 260}
261 261
262 262
263xs_str *encode_html(const char *str) 263xs_str *encode_html_strict(const char *str)
264/* escapes html characters */ 264/* escapes html characters */
265{ 265{
266 xs_str *encoded = xs_replace(str, "&", "&"); 266 xs_str *encoded = xs_replace(str, "&", "&");
@@ -269,6 +269,15 @@ xs_str *encode_html(const char *str)
269 encoded = xs_replace_i(encoded, "\"", """); 269 encoded = xs_replace_i(encoded, "\"", """);
270 encoded = xs_replace_i(encoded, "'", "'"); 270 encoded = xs_replace_i(encoded, "'", "'");
271 271
272 return encoded;
273}
274
275
276xs_str *encode_html(const char *str)
277/* escapes html characters */
278{
279 xs_str *encoded = encode_html_strict(str);
280
272 /* Restore only <br>. Probably safe. Let's hope nothing goes wrong with this. */ 281 /* Restore only <br>. Probably safe. Let's hope nothing goes wrong with this. */
273 encoded = xs_replace_i(encoded, "&lt;br&gt;", "<br>"); 282 encoded = xs_replace_i(encoded, "&lt;br&gt;", "<br>");
274 283