diff --git a/mod/babel.php b/mod/babel.php index a2d197599..4550a8efb 100644 --- a/mod/babel.php +++ b/mod/babel.php @@ -13,64 +13,104 @@ function visible_lf($s) function babel_content() { - $o = '
' . $markdown . '' + ]; - $bbcode = Text\HTML::toBBCode($html); - $o .= '
' . $bbcode . '' + ]; + break; + case 'html' : + $html = trim($_REQUEST['text']); + $results[] = [ + 'title' => L10n::t("Raw HTML input"), + 'content' => htmlspecialchars($html) + ]; - $diaspora = Text\BBCode::toMarkdown($text); - $o .= '
' . $text . '' + ]; + } } - if (x($_REQUEST, 'd2bbtext')) { - $d2bbtext = trim($_REQUEST['d2bbtext']); - $o .= '
' . $d2bbtext . '' . EOL . EOL; - - $bb = Text\Markdown::toBBCode($d2bbtext); - $o .= '
' . $bb . '' . EOL . EOL; - } + $tpl = get_markup_template('babel.tpl'); + $o = replace_macros($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'], + '$type_html' => ['type', L10n::t('HTML'), 'html', '', defaults($_REQUEST, 'type', 'bbcode') == 'html'], + '$results' => $results + ]); return $o; } diff --git a/view/templates/babel.tpl b/view/templates/babel.tpl new file mode 100644 index 000000000..659864af3 --- /dev/null +++ b/view/templates/babel.tpl @@ -0,0 +1,29 @@ +