Improve Diaspora raw text support in /babel module
This commit is contained in:
parent
3395f56036
commit
325ba20141
1 changed files with 4 additions and 3 deletions
|
@ -7,6 +7,7 @@ use Friendica\Content\Text;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates input text into different formats (HTML, BBCode, Markdown)
|
* Translates input text into different formats (HTML, BBCode, Markdown)
|
||||||
|
@ -98,10 +99,10 @@ class Babel extends BaseModule
|
||||||
$markdown = trim($_REQUEST['text']);
|
$markdown = trim($_REQUEST['text']);
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t('Source input (Diaspora format)'),
|
'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[] = [
|
$results[] = [
|
||||||
'title' => L10n::t('Markdown::convert (raw HTML)'),
|
'title' => L10n::t('Markdown::convert (raw HTML)'),
|
||||||
'content' => visible_whitespace(htmlspecialchars($html))
|
'content' => visible_whitespace(htmlspecialchars($html))
|
||||||
|
@ -112,7 +113,7 @@ class Babel extends BaseModule
|
||||||
'content' => $html
|
'content' => $html
|
||||||
];
|
];
|
||||||
|
|
||||||
$bbcode = Text\Markdown::toBBCode($markdown);
|
$bbcode = Text\Markdown::toBBCode(XML::unescape($markdown));
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t('Markdown::toBBCode'),
|
'title' => L10n::t('Markdown::toBBCode'),
|
||||||
'content' => '<pre>' . $bbcode . '</pre>'
|
'content' => '<pre>' . $bbcode . '</pre>'
|
||||||
|
|
Loading…
Reference in a new issue