bb_highlight: if somebody enters an unsupported language for code syntax highlighting (like fortran or cobol or whatever) use 'php' instead of returning a completely unformatted code block. This choice was somewhat arbitrary. It could be difficult to analyse the intention which could be literally anything and provide the closest match.

This commit is contained in:
zotlabs 2016-12-01 19:04:29 -08:00
parent 97f9dedaa6
commit 59aae20aea

View File

@ -512,10 +512,10 @@ function bb_code($match) {
}
function bb_highlight($match) {
if(in_array(strtolower($match[1]),['php','css','mysql','sql','abap','diff','html','perl','ruby',
$lang = ((in_array(strtolower($match[1]),['php','css','mysql','sql','abap','diff','html','perl','ruby',
'vbscript','avrc','dtd','java','xml','cpp','python','javascript','js','json','sh']))
return text_highlight($match[2],strtolower($match[1]));
return $match[0];
? strtolower($match[1]) : 'php' );
return text_highlight($match[2],$lang);
}
function bb_fixtable_lf($match) {