ignore case in language names and add 'js' as an alias for 'javascript'

This commit is contained in:
redmatrix 2016-06-15 20:25:19 -07:00
parent 427badcae9
commit 1dc35db1fe
2 changed files with 6 additions and 4 deletions

View File

@ -492,9 +492,9 @@ function bb_code($match) {
}
function bb_highlight($match) {
if(in_array($match[1],['php','css','mysql','sql','abap','diff','html','perl','ruby',
'vbscript','avrc','dtd','java','xml','cpp','python','javascript','sh']))
return text_highlight($match[2],$match[1]);
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']))
return text_highlight($match[2],strtolower($match[1]));
}

View File

@ -2884,9 +2884,11 @@ function flatten_array_recursive($arr) {
function text_highlight($s,$lang) {
if($lang === 'js')
$lang = 'javascript';
if(! strpos('Text_Highlighter',get_include_path())) {
set_include_path(get_include_path() . PATH_SEPARATOR . 'library/Text_Highlighter');
head_add_css('/library/Text_Highlighter/sample.css');
}
require_once('library/Text_Highlighter/Text/Highlighter.php');
require_once('library/Text_Highlighter/Text/Highlighter/Renderer/Html.php');