From 325ba20141dfa4a85411cf24ea692ea0174cf5b2 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 19 May 2019 08:45:54 -0400 Subject: [PATCH] Improve Diaspora raw text support in /babel module --- src/Module/Debug/Babel.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Module/Debug/Babel.php b/src/Module/Debug/Babel.php index 899c8033c4..1ce1ac4c6e 100644 --- a/src/Module/Debug/Babel.php +++ b/src/Module/Debug/Babel.php @@ -7,6 +7,7 @@ use Friendica\Content\Text; use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\Model\Item; +use Friendica\Util\XML; /** * Translates input text into different formats (HTML, BBCode, Markdown) @@ -98,10 +99,10 @@ class Babel extends BaseModule $markdown = trim($_REQUEST['text']); $results[] = [ 'title' => L10n::t('Source input (Diaspora format)'), - 'content' => '
' . $markdown . '
' + 'content' => '
' . htmlspecialchars($markdown) . '
' ]; - $html = Text\Markdown::convert($markdown); + $html = Text\Markdown::convert(html_entity_decode($markdown,ENT_COMPAT, 'UTF-8')); $results[] = [ 'title' => L10n::t('Markdown::convert (raw HTML)'), 'content' => visible_whitespace(htmlspecialchars($html)) @@ -112,7 +113,7 @@ class Babel extends BaseModule 'content' => $html ]; - $bbcode = Text\Markdown::toBBCode($markdown); + $bbcode = Text\Markdown::toBBCode(XML::unescape($markdown)); $results[] = [ 'title' => L10n::t('Markdown::toBBCode'), 'content' => '
' . $bbcode . '
' -- 2.39.5