From 7c48ed60eb6bab2bf4a820bfcdf209a4736a364c Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 20 Jun 2015 14:27:42 +0200 Subject: [PATCH] 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 919bfc331d..34c932f745 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.