X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fbabel.php;h=64c9557767d278d7a6122019dbd6016f4c3087d0;hb=41663c7592abe55a958632c3a48265e0a8544d2b;hp=fcd63113e8aa268c75d066590cb495a1b98010db;hpb=87c425e388cca77c1fa54ece7ad0b80764c1f5ff;p=friendica.git
diff --git a/mod/babel.php b/mod/babel.php
index fcd63113e8..64c9557767 100644
--- a/mod/babel.php
+++ b/mod/babel.php
@@ -5,12 +5,13 @@
use Friendica\Content\Text;
use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
function visible_whitespace($s)
{
$s = str_replace(' ', ' ', $s);
- return str_replace("\n", '
', $s);
+ return str_replace(["\r\n", "\n", "\r"], '
', $s);
}
function babel_content()
@@ -114,6 +115,23 @@ function babel_content()
'content' => visible_whitespace($bbcode)
];
+ $html2 = Text\BBCode::convert($bbcode);
+ $results[] = [
+ 'title' => L10n::t('HTML::toBBCode => BBCode::convert'),
+ 'content' => $html2
+ ];
+
+ $results[] = [
+ 'title' => L10n::t('HTML::toBBCode => BBCode::convert (raw HTML)'),
+ 'content' => htmlspecialchars($html2)
+ ];
+
+ $markdown = Text\HTML::toMarkdown($html);
+ $results[] = [
+ 'title' => L10n::t('HTML::toMarkdown'),
+ 'content' => visible_whitespace($markdown)
+ ];
+
$text = Text\HTML::toPlaintext($html);
$results[] = [
'title' => L10n::t('HTML::toPlaintext'),
@@ -122,8 +140,8 @@ function babel_content()
}
}
- $tpl = get_markup_template('babel.tpl');
- $o = replace_macros($tpl, [
+ $tpl = Renderer::getMarkupTemplate('babel.tpl');
+ $o = Renderer::replaceMacros($tpl, [
'$text' => ['text', L10n::t('Source text'), defaults($_REQUEST, 'text', ''), ''],
'$type_bbcode' => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'],
'$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'],