hide some HTML coded chars from markdownification

This commit is contained in:
Tobias Diekershoff 2015-06-20 14:27:42 +02:00
parent 8fa2030023
commit 7c48ed60eb

View file

@ -95,6 +95,9 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
} else } else
$Text = bbcode($Text, $preserve_nl, false, 4); $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 // 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. // Maybe we should make this newline at every time before a quote.
$Text = str_replace(array("</a><blockquote>"), array("</a><br><blockquote>"), $Text); $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 // Now convert HTML to Markdown
$Text = new HTML_To_Markdown($Text); $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"); $a->save_timestamp($stamp1, "parser");
// Libertree has a problem with escaped hashtags. // Libertree has a problem with escaped hashtags.