parent
6de34f2d06
commit
f37d258a8e
|
@ -343,6 +343,12 @@ static Element serialize_post(const httplib::Request& req, const std::string& se
|
||||||
blankie::html::HTMLString preprocessed_html = preprocess_html(req, server, post.emojis, post.content);
|
blankie::html::HTMLString preprocessed_html = preprocess_html(req, server, post.emojis, post.content);
|
||||||
// Workaround for https://vt.social/@a1ba@suya.place/110552480243348878#m
|
// Workaround for https://vt.social/@a1ba@suya.place/110552480243348878#m
|
||||||
if (preprocessed_html.str.find("<p>") == std::string::npos) {
|
if (preprocessed_html.str.find("<p>") == std::string::npos) {
|
||||||
|
size_t offset = 0;
|
||||||
|
while ((offset = preprocessed_html.str.find('\n', offset)) != std::string::npos) {
|
||||||
|
preprocessed_html.str.replace(offset, 1, "<br>");
|
||||||
|
offset += 4;
|
||||||
|
}
|
||||||
|
|
||||||
preprocessed_html.str.reserve(preprocessed_html.str.size() + 3 + 4);
|
preprocessed_html.str.reserve(preprocessed_html.str.size() + 3 + 4);
|
||||||
preprocessed_html.str.insert(0, "<p>");
|
preprocessed_html.str.insert(0, "<p>");
|
||||||
preprocessed_html.str.append("</p>");
|
preprocessed_html.str.append("</p>");
|
||||||
|
|
|
@ -88,6 +88,12 @@ static inline Element user_header(const httplib::Request& req, const std::string
|
||||||
blankie::html::HTMLString preprocessed_bio = preprocess_html(req, account.server, account.emojis, account.note_html);
|
blankie::html::HTMLString preprocessed_bio = preprocess_html(req, account.server, account.emojis, account.note_html);
|
||||||
// Workaround for https://social.kernel.org/@monsieuricon
|
// Workaround for https://social.kernel.org/@monsieuricon
|
||||||
if (preprocessed_bio.str.find("<p>") == std::string::npos) {
|
if (preprocessed_bio.str.find("<p>") == std::string::npos) {
|
||||||
|
size_t offset = 0;
|
||||||
|
while ((offset = preprocessed_bio.str.find('\n', offset)) != std::string::npos) {
|
||||||
|
preprocessed_bio.str.replace(offset, 1, "<br>");
|
||||||
|
offset += 4;
|
||||||
|
}
|
||||||
|
|
||||||
preprocessed_bio.str.reserve(preprocessed_bio.str.size() + 3 + 4);
|
preprocessed_bio.str.reserve(preprocessed_bio.str.size() + 3 + 4);
|
||||||
preprocessed_bio.str.insert(0, "<p>");
|
preprocessed_bio.str.insert(0, "<p>");
|
||||||
preprocessed_bio.str.append("</p>");
|
preprocessed_bio.str.append("</p>");
|
||||||
|
|
Loading…
Reference in New Issue