From a714a0305f2ac9fdd08c764318b151732ec28fd8 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 18 Mar 2015 15:54:08 +0100 Subject: [PATCH] Improved detection of filenames for code highlighters --- .../files/js/3rdParty/redactor/plugins/wbbcode.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 52a2c1a48f..34e47c29ac 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -1345,7 +1345,7 @@ RedactorPlugins.wbbcode = function() { parameters = parameters.split(','); var $isNumber = function(string) { return string.match(/^\d+$/); }; - var $isFilename = function(string) { return (string.indexOf('.') !== -1); }; + var $isFilename = function(string) { return (string.indexOf('.') !== -1) || (string.match(/^(["']).*\1$/)); }; var $isHighlighter = function(string) { return (__REDACTOR_CODE_HIGHLIGHTERS[parameters[0]] !== undefined); }; var $unquoteFilename = function(filename) { @@ -1369,12 +1369,12 @@ RedactorPlugins.wbbcode = function() { if ($isNumber(parameters[0])) { $lineNumber = (parseInt(parameters[0]) > 1) ? parameters[0] : 0; - if ($isFilename(parameters[1])) { - $filename = $unquoteFilename(parameters[1]); - } - else if ($isHighlighter(parameters[1])) { + if ($isHighlighter(parameters[1])) { $highlighter = parameters[1]; } + else if ($isFilename(parameters[1])) { + $filename = $unquoteFilename(parameters[1]); + } } else { if ($isHighlighter(parameters[0])) $highlighter = parameters[0]; @@ -1412,7 +1412,7 @@ RedactorPlugins.wbbcode = function() { + '' + ''; }).bind(this)); - + console.debug($value); data = data.replace($regex, $value); } } -- 2.20.1