Improve html2bbcode
- trim code blocks - Add <code> conversion to <code> (from Diaspora)
This commit is contained in:
parent
f828afde83
commit
503e5847f9
1 changed files with 2 additions and 1 deletions
|
@ -95,7 +95,7 @@ function html2bbcode($message, $basepath = '')
|
|||
if ($matches[1] != '') {
|
||||
$prefix = '[code=' . $matches[1] . ']';
|
||||
}
|
||||
$codeblocks[] = $prefix . $matches[2] . '[/code]';
|
||||
$codeblocks[] = $prefix . trim($matches[2]) . '[/code]';
|
||||
return $return;
|
||||
},
|
||||
$message
|
||||
|
@ -247,6 +247,7 @@ function html2bbcode($message, $basepath = '')
|
|||
node2bbcode($doc, 'iframe', array('src'=>'/(.+)/'), '[iframe]$1', '[/iframe]');
|
||||
|
||||
node2bbcode($doc, 'key', array(), '[code]', '[/code]');
|
||||
node2bbcode($doc, 'code', array(), '[code]', '[/code]');
|
||||
|
||||
$message = $doc->saveHTML();
|
||||
|
||||
|
|
Loading…
Reference in a new issue