1#include "include/pw.h"
 2#include "include/pwlib/html.h"
 3
 4[[nodiscard]] bool html_escape(PwValuePtr str)
 5{
 6    if (!pw_string_replace_all(str, "&", "&")) {
 7        return false;
 8    }
 9    if (!pw_string_replace_all(str, "<", "&lt;")) {
10        return false;
11    }
12    if (!pw_string_replace_all(str, ">", "&gt;")) {
13        return false;
14    }
15    if (!pw_string_replace_all(str, "\n", "<br/>")) {
16        return false;
17    }
18    return true;
19}