]> git.mxchange.org Git - friendica.git/commitdiff
Improve Diaspora raw text support in /babel module
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 19 May 2019 12:45:54 +0000 (08:45 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 19 May 2019 22:52:01 +0000 (18:52 -0400)
src/Module/Debug/Babel.php

index 899c8033c46b1545de9281d15d3c34b411ac0dab..1ce1ac4c6e92ab5f91db0235244c45c15ca6479a 100644 (file)
@@ -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' => '<pre>' . $markdown . '</pre>'
+                                               'content' => '<pre>' . htmlspecialchars($markdown) . '</pre>'
                                        ];
 
-                                       $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' => '<pre>' . $bbcode . '</pre>'