Moved newline_to_br helper from Utils to String.

This commit is contained in:
Relintai 2022-02-05 15:12:37 +01:00
parent b9afc6f201
commit d1e8def48d
4 changed files with 6 additions and 8 deletions

View File

@ -6,11 +6,6 @@
#include <sstream>
#include <string>
void Utils::newline_to_br(String *str) {
str->replace("\r\n", "<br>");
str->replace("\n", "<br>");
}
void Utils::markdown_to_html(String *str) {
std::shared_ptr<maddy::ParserConfig> config = std::make_shared<maddy::ParserConfig>();
config->isEmphasizedParserEnabled = false;

View File

@ -6,9 +6,6 @@
class Utils {
public:
static void newline_to_br(String *str);
//htmlspecialchars
static void markdown_to_html(String *str);
static String get_pagination(const String &base_url, const uint32_t max, const uint32_t current_index, const uint32_t max_visible_links = 10);

View File

@ -1059,6 +1059,11 @@ void String::from_html_special_chars() {
replace("&gt;", ">");
}
void String::newline_to_br() {
replace("\r\n", "<br>");
replace("\n", "<br>");
}
bool String::to_bool() const {
if (_size == 0) {
return 0;

View File

@ -112,6 +112,7 @@ public:
void to_html_special_chars();
void from_html_special_chars();
void newline_to_br();
bool to_bool() const;
float to_float() const;