if(typeof(SyntaxHighlighter)=='undefined')var SyntaxHighlighter=function(){if(typeof(require)!='undefined'&&typeof(XRegExp)=='undefined') {XRegExp=require('XRegExp').XRegExp;} var sh={defaults:{'class-name':'','first-line':1,'pad-line-numbers':false,'highlight':null,'title':null,'smart-tabs':true,'tab-size':4,'gutter':true,'toolbar':true,'quick-code':true,'collapse':false,'auto-links':true,'light':false,'unindent':true,'html-script':false},config:{space:' ',useScriptTags:true,bloggerMode:false,stripBrs:false,tagName:'pre',strings:{expandSource:'expand source',help:'?',alert:'SyntaxHighlighter\n\n',noBrush:'Can\'t find brush for: ',brushNotHtmlScript:'Brush wasn\'t configured for html-script option: ',aboutDialog:'@ABOUT@'}},vars:{discoveredBrushes:null,highlighters:{}},brushes:{},regexLib:{multiLineCComments:/\/\*[\s\S]*?\*\//gm,singleLineCComments:/\/\/.*$/gm,singleLinePerlComments:/#.*$/gm,doubleQuotedString:/"([^\\"\n]|\\.)*"/g,singleQuotedString:/'([^\\'\n]|\\.)*'/g,multiLineDoubleQuotedString:new XRegExp('"([^\\\\"]|\\\\.)*"','gs'),multiLineSingleQuotedString:new XRegExp("'([^\\\\']|\\\\.)*'",'gs'),xmlComments:/(<|<)!--[\s\S]*?--(>|>)/gm,url:/\w+:\/\/[\w-.\/?%&=:@;#]*/g,phpScriptTags:{left:/(<|<)\?(?:=|php)?/g,right:/\?(>|>)/g,'eof':true},aspScriptTags:{left:/(<|<)%=?/g,right:/%(>|>)/g},scriptScriptTags:{left:/(<|<)\s*script.*?(>|>)/gi,right:/(<|<)\/\s*script\s*(>|>)/gi}},toolbar:{getHtml:function(highlighter) {var html='
',items=sh.toolbar.items,list=items.list;function defaultGetHtml(highlighter,name) {return sh.toolbar.getButtonHtml(highlighter,name,sh.config.strings[name]);};for(var i=0;i';return html;},getButtonHtml:function(highlighter,commandName,label) {return ''+label+'';},handler:function(e) {var target=e.target,className=target.className||'';function getValue(name) {var r=new RegExp(name+'_(\\w+)'),match=r.exec(className);return match?match[1]:null;};var highlighter=getHighlighterById(findParentElement(target,'.syntaxhighlighter').id),commandName=getValue('command');if(highlighter&&commandName) sh.toolbar.items[commandName].execute(highlighter);e.preventDefault();},items:{list:['expandSource','help'],expandSource:{getHtml:function(highlighter) {if(highlighter.getParam('collapse')!=true) return '';var title=highlighter.getParam('title');return sh.toolbar.getButtonHtml(highlighter,'expandSource',title?title:sh.config.strings.expandSource);},execute:function(highlighter) {var div=getHighlighterDivById(highlighter.id);removeClass(div,'collapsed');}},help:{execute:function(highlighter) {var wnd=popup('','_blank',500,250,'scrollbars=0'),doc=wnd.document;doc.write(sh.config.strings.aboutDialog);doc.close();wnd.focus();}}}},findElements:function(globalParams,element) {var elements=element?[element]:toArray(document.getElementsByTagName(sh.config.tagName)),conf=sh.config,result=[];if(conf.useScriptTags) elements=elements.concat(getSyntaxHighlighterScriptTags());if(elements.length===0) return result;for(var i=0;i(.*?))\\]$"),regex=new XRegExp("(?[\\w-]+)"+ "\\s*:\\s*"+ "(?"+ "[\\w-%#]+|"+ "\\[.*?\\]|"+ '".*?"|'+ "'.*?'"+ ")\\s*;?","g");while((match=regex.exec(str))!=null) {var value=match.value.replace(/^['"]|['"]$/g,'');if(value!=null&&arrayRegex.test(value)) {var m=arrayRegex.exec(value);value=m.values.length>0?m.values.split(/\s*,\s*/):[];} result[match.name]=value;} return result;};function wrapLinesWithCode(str,css) {if(str==null||str.length==0||str=='\n') return str;str=str.replace(/'+line+'';});return str;};function padNumber(number,length) {var result=number.toString();while(result.length|<br\s*\/?>/gi;if(sh.config.bloggerMode==true) str=str.replace(br,'\n');if(sh.config.stripBrs==true) str=str.replace(br,'');return str;};function trim(str) {return str.replace(/^\s+|\s+$/g,'');};function unindent(str) {var lines=splitLines(fixInputString(str)),indents=new Array(),regex=/^\s*/,min=1000;for(var i=0;i0;i++) {var line=lines[i];if(trim(line).length==0) continue;var matches=regex.exec(line);if(matches==null) return str;min=Math.min(matches[0].length,min);} if(min>0) for(var i=0;im2.index) return 1;else {if(m1.lengthm2.length) return 1;} return 0;};function getMatches(code,regexInfo) {function defaultAdd(match,regexInfo) {return match[0];};var index=0,match=null,matches=[],func=regexInfo.func?regexInfo.func:defaultAdd;while((match=regexInfo.regex.exec(code))!=null) {var resultMatch=func(match,regexInfo);if(typeof(resultMatch)=='string') resultMatch=[new sh.Match(resultMatch,match.index,regexInfo.css)];matches=matches.concat(resultMatch);} return matches;};function processUrls(code) {var gt=/(.*)((>|<).*)/;return code.replace(sh.regexLib.url,function(m) {var suffix='',match=null;if(match=gt.exec(m)) {m=match[1];suffix=match[2];} return ''+m+''+suffix;});};function getSyntaxHighlighterScriptTags() {var tags=document.getElementsByTagName('script'),result=[];for(var i=0;iitemIEndPos) break;else if(itemJ.index==itemI.index&&itemJ.length>itemI.length) matches[i]=null;else if(itemJ.index>=itemI.index&&itemJ.index'+code+'
';},getLineNumbersHtml:function(code,lineNumbers) {var html='',count=splitLines(code).length,firstLine=parseInt(this.getParam('first-line')),pad=this.getParam('pad-line-numbers');if(pad==true) pad=(firstLine+count-1).toString().length;else if(isNaN(pad)==true) pad=0;for(var i=0;i'+spaces+'':'')+line);} return html;},getTitleHtml:function(title) {return title?''+title+'':'';},getMatchesHtml:function(code,matches) {var pos=0,result='',brushName=this.getParam('brush','');function getBrushNameCss(match) {var result=match?(match.brushName||brushName):brushName;return result?result+' ':'';};for(var i=0;i' +(this.getParam('toolbar')?sh.toolbar.getHtml(this):'') +'' +this.getTitleHtml(this.getParam('title')) +'' +'' +(gutter?'':'') +'' +'' +'' +'
'+this.getLineNumbersHtml(code)+'' +'
' +html +'
' +'
' +'';return html;},getDiv:function(code) {if(code===null) code='';this.code=code;var div=this.create('div');div.innerHTML=this.getHtml(code);if(this.getParam('toolbar')) attachEvent(findElement(div,'.toolbar'),'click',sh.toolbar.handler);if(this.getParam('quick-code')) attachEvent(findElement(div,'.code'),'dblclick',quickCodeHandler);return div;},init:function(params) {this.id=guid();storeHighlighter(this);this.params=merge(sh.defaults,params||{}) if(this.getParam('light')==true) this.params.toolbar=this.params.gutter=false;},getKeywords:function(str) {str=str.replace(/^\s+|\s+$/g,'').replace(/\s+/g,'|');return '\\b(?:'+str+')\\b';},forHtmlScript:function(regexGroup) {var regex={'end':regexGroup.right.source};if(regexGroup.eof) regex.end="(?:(?:"+regex.end+")|$)";this.htmlScript={left:{regex:regexGroup.left,css:'script'},right:{regex:regexGroup.right,css:'script'},code:new XRegExp("(?"+regexGroup.left.source+")"+ "(?.*?)"+ "(?"+regex.end+")","sgi")};}};return sh;}();typeof(exports)!='undefined'?exports.SyntaxHighlighter=SyntaxHighlighter:null;