summaryrefslogtreecommitdiff
path: root/format.c
diff options
context:
space:
mode:
authorGravatar default2023-10-04 18:19:38 +0200
committerGravatar default2023-10-04 18:19:38 +0200
commitb1868d85bbd9a707c487c9d2e277c6c038478db6 (patch)
treeb6b7a1348b571dcbf2e5e8b6fca02d53ae92239e /format.c
parentUpdated RELEASE_NOTES. (diff)
downloadpenes-snac2-b1868d85bbd9a707c487c9d2e277c6c038478db6.tar.gz
penes-snac2-b1868d85bbd9a707c487c9d2e277c6c038478db6.tar.xz
penes-snac2-b1868d85bbd9a707c487c9d2e277c6c038478db6.zip
New function encode_html_strict().
Diffstat (limited to '')
-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