From 8fa2030023864976079e3f953cec60c7b6b2ad10 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 20 Jun 2015 12:31:34 +0200 Subject: [PATCH 1/2] <3 causes troubles in D* --- include/text.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/text.php b/include/text.php index f8bbfcee2..2d265e6ee 100644 --- a/include/text.php +++ b/include/text.php @@ -1138,9 +1138,9 @@ function smilies($s, $sample = false) { ); $icons = array( - '<3', - '</3', - '<\\3', + '<3', + '</3', + '<\\3', ':-)', ';-)', ':-(', @@ -1217,7 +1217,7 @@ function preg_heart($x) { return $x[0]; $t = ''; for($cnt = 0; $cnt < strlen($x[1]); $cnt ++) - $t .= '<3'; + $t .= '<3'; $r = str_replace($x[0],$t,$x[0]); return $r; } From 7c48ed60eb6bab2bf4a820bfcdf209a4736a364c Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 20 Jun 2015 14:27:42 +0200 Subject: [PATCH 2/2] hide some HTML coded chars from markdownification --- include/bb2diaspora.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 919bfc331..34c932f74 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -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("
"), array("
"), $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('<','>','&'),$Text); + $a->save_timestamp($stamp1, "parser"); // Libertree has a problem with escaped hashtags.