Merge pull request #4712 from MrPetovan/task/improve-text-highlight
Improve text highlight
This commit is contained in:
commit
a2b6ff7b25
2 changed files with 11 additions and 3 deletions
|
@ -2030,6 +2030,10 @@ function text_highlight($s, $lang) {
|
|||
$lang = 'javascript';
|
||||
}
|
||||
|
||||
if ($lang === 'bash') {
|
||||
$lang = 'sh';
|
||||
}
|
||||
|
||||
// @TODO: Replace Text_Highlighter_Renderer_Html by scrivo/highlight.php
|
||||
|
||||
// Autoload the library to make constants available
|
||||
|
|
|
@ -1292,13 +1292,17 @@ class BBCode extends BaseObject
|
|||
|
||||
private static function textHighlightCallback($match)
|
||||
{
|
||||
// Fallback in case the language doesn't exist
|
||||
$return = '[code]' . $match[2] . '[/code]';
|
||||
|
||||
if (in_array(strtolower($match[1]),
|
||||
['php', 'css', 'mysql', 'sql', 'abap', 'diff', 'html', 'perl', 'ruby',
|
||||
'vbscript', 'avrc', 'dtd', 'java', 'xml', 'cpp', 'python', 'javascript', 'js', 'sh'])
|
||||
'vbscript', 'avrc', 'dtd', 'java', 'xml', 'cpp', 'python', 'javascript', 'js', 'sh', 'bash'])
|
||||
) {
|
||||
return text_highlight($match[2], strtolower($match[1]));
|
||||
$return = text_highlight($match[2], strtolower($match[1]));
|
||||
}
|
||||
return $match[0];
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue