X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fbabel.php;h=e5ae96be70489556dd683a3ce3340b469d7a6b6b;hb=c083ae047c4259dcfa1c61a3795679bbf1b08d8c;hp=fcd63113e8aa268c75d066590cb495a1b98010db;hpb=87c425e388cca77c1fa54ece7ad0b80764c1f5ff;p=friendica.git
diff --git a/mod/babel.php b/mod/babel.php
index fcd63113e8..e5ae96be70 100644
--- a/mod/babel.php
+++ b/mod/babel.php
@@ -10,7 +10,7 @@ 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 +114,12 @@ function babel_content()
'content' => visible_whitespace($bbcode)
];
+ $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'),
@@ -124,7 +130,7 @@ function babel_content()
$tpl = get_markup_template('babel.tpl');
$o = replace_macros($tpl, [
- '$text' => ['text', L10n::t('Source text'), defaults($_REQUEST, 'text', ''), ''],
+ '$text' => ['text', L10n::t('Source text'), htmlentities(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'],
'$type_html' => ['type', L10n::t('HTML'), 'html', '', defaults($_REQUEST, 'type', 'bbcode') == 'html'],