]> git.mxchange.org Git - friendica.git/blobdiff - include/bb2diaspora.php
Merge pull request #1703 from rabuzarus/readable_bytes
[friendica.git] / include / bb2diaspora.php
index 866ac26be4a43bdc7912d7b0bd07ebc66d9f9d13..34c932f7457c9306d28e696408ff7a3d320d22cd 100644 (file)
@@ -18,7 +18,7 @@ function diaspora2bb($s) {
        $s = html_entity_decode($s,ENT_COMPAT,'UTF-8');
 
        // Remove CR to avoid problems with following code
-       //$s = str_replace("\r","",$s);
+       $s = str_replace("\r","",$s);
 
        $s = str_replace("\n"," \n",$s);
 
@@ -95,6 +95,9 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
        } else
                $Text = bbcode($Text, $preserve_nl, false, 4);
 
+    // mask some special HTML chars from conversation to markdown
+    $Text = str_replace(array('<','>','&'),array('&_lt_;','&_gt_;','&_amp_;'),$Text);
+
        // If a link is followed by a quote then there should be a newline before it
        // Maybe we should make this newline at every time before a quote.
        $Text = str_replace(array("</a><blockquote>"), array("</a><br><blockquote>"), $Text);
@@ -104,6 +107,9 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
        // Now convert HTML to Markdown
        $Text = new HTML_To_Markdown($Text);
 
+    // unmask the special chars back to HTML
+    $Text = str_replace(array('&_lt_;','&_gt_;','&_amp_;'),array('&lt;','&gt;','&amp;'),$Text);
+
        $a->save_timestamp($stamp1, "parser");
 
        // Libertree has a problem with escaped hashtags.