1;(function() 2{ 3 // CommonJS 4 SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); 5 6 function Brush() 7 { 8 function process(match, regexInfo) 9 { 10 var constructor = SyntaxHighlighter.Match, 11 code = match[0], 12 tag = XRegExp.exec(code, XRegExp('(<|<)[\\s\\/\\?!]*(?<name>[:\\w-\\.]+)', 'xg')), 13 result = [] 14 ; 15 16 if (match.attributes != null) 17 { 18 var attributes, 19 pos = 0, 20 regex = XRegExp('(?<name> [\\w:.-]+)' + 21 '\\s*=\\s*' + 22 '(?<value> ".*?"|\'.*?\'|\\w+)', 23 'xg'); 24 25 while ((attributes = XRegExp.exec(code, regex, pos)) != null) 26 { 27 result.push(new constructor(attributes.name, match.index + attributes.index, 'color1')); 28 result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string')); 29 pos = attributes.index + attributes[0].length; 30 } 31 } 32 33 if (tag != null) 34 result.push( 35 new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword') 36 ); 37 38 return result; 39 } 40 41 this.regexList = [ 42 { regex: XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // <![ ... [ ... ]]> 43 { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // <!-- ... --> 44 { regex: XRegExp('(<|<)[\\s\\/\\?!]*(\\w+)(?<attributes>.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process } 45 ]; 46 }; 47 48 Brush.prototype = new SyntaxHighlighter.Highlighter(); 49 Brush.aliases = ['xml', 'xhtml', 'xslt', 'html', 'plist']; 50 51 SyntaxHighlighter.brushes.Xml = Brush; 52 53 // CommonJS 54 typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 55})(); 56