aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2024-02-07 22:34:13 +0100
committerHarald Eilertsen <haraldei@anduin.net>2024-02-07 22:34:13 +0100
commit86e953f49566a0f4bb2220a8e5f4013044f4a49f (patch)
treecd508fc97a1e5c86783e36c738ed9b36cedae406 /include
parent4f69e02768ac79f81f1a7ef3e7891d2e0f8f06fe (diff)
downloadvolse-hubzilla-86e953f49566a0f4bb2220a8e5f4013044f4a49f.tar.gz
volse-hubzilla-86e953f49566a0f4bb2220a8e5f4013044f4a49f.tar.bz2
volse-hubzilla-86e953f49566a0f4bb2220a8e5f4013044f4a49f.zip
Fix: Preserve hard linebreaks from markdown and html
Diffstat (limited to 'include')
-rw-r--r--include/html2bbcode.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/html2bbcode.php b/include/html2bbcode.php
index cbfbe10ba..71ea68dae 100644
--- a/include/html2bbcode.php
+++ b/include/html2bbcode.php
@@ -192,7 +192,8 @@ function html2bbcode($message)
node2bbcode($doc, 'blockquote', array(), '[quote]', '[/quote]');
- node2bbcode($doc, 'br', array(), "\n", '');
+ // Use a temporary tag to keep line breaks
+ node2bbcode($doc, 'br', array(), '[br]', '');
node2bbcode($doc, 'p', array('class'=>'MsoNormal'), "\n", "");
node2bbcode($doc, 'div', array('class'=>'MsoNormal'), "\r", "");
@@ -302,6 +303,9 @@ function html2bbcode($message)
$message = str_replace(array('[b][b]', '[/b][/b]', '[i][i]', '[/i][/i]'),
array('[b]', '[/b]', '[i]', '[/i]'), $message);
+ // Restore linebreaks from temp tag
+ $message = str_replace('[br] ', "\n", $message);
+
// Handling Yahoo style of mails
// $message = str_replace('[hr][b]From:[/b]', '[quote][b]From:[/b]', $message);