/*! * XRegExp v2.0.0 * (c) 2007-2012 Steven Levithan * MIT License */ var XRegExp;XRegExp=XRegExp||(function(undef){"use strict";var self,addToken,add,features={natives:false,extensibility:false},nativ={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},fixed={},cache={},tokens=[],defaultScope="default",classScope="class",nativeTokens={"default":/^(?:\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??)/,"class":/^(?:\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S]))/},replacementToken=/\$(?:{([\w$]+)}|(\d\d?|[\s\S]))/g,duplicateFlags=/([\s\S])(?=[\s\S]*\1)/g,quantifier=/^(?:[?*+]|{\d+(?:,\d*)?})\??/,compliantExecNpcg=nativ.exec.call(/()??/,"")[1]===undef,hasNativeY=RegExp.prototype.sticky!==undef,isInsideConstructor=false,registeredFlags="gim"+(hasNativeY?"y":"");function augment(regex,captureNames,isNative){var p;for(p in self.prototype){if(self.prototype.hasOwnProperty(p)){regex[p]=self.prototype[p];}} regex.xregexp={captureNames:captureNames,isNative:!!isNative};return regex;} function getNativeFlags(regex){return(regex.global?"g":"")+ (regex.ignoreCase?"i":"")+ (regex.multiline?"m":"")+ (regex.extended?"x":"")+ (regex.sticky?"y":"");} function copy(regex,addFlags,removeFlags){if(!self.isRegExp(regex)){throw new TypeError("type RegExp expected");} var flags=nativ.replace.call(getNativeFlags(regex)+(addFlags||""),duplicateFlags,"");if(removeFlags){flags=nativ.replace.call(flags,new RegExp("["+removeFlags+"]+","g"),"");} if(regex.xregexp&&!regex.xregexp.isNative){regex=augment(self(regex.source,flags),regex.xregexp.captureNames?regex.xregexp.captureNames.slice(0):null);}else{regex=augment(new RegExp(regex.source,flags),null,true);} return regex;} function lastIndexOf(array,value){var i=array.length;if(Array.prototype.lastIndexOf){return array.lastIndexOf(value);} while(i--){if(array[i]===value){return i;}} return-1;} function isType(value,type){return Object.prototype.toString.call(value).toLowerCase()==="[object "+type+"]";} function prepareOptions(value){value=value||{};if(value==="all"||value.all){value={natives:true,extensibility:true};}else if(isType(value,"string")){value=self.forEach(value,/[^\s,]+/,function(m){this[m]=true;},{});} return value;} function runTokens(pattern,pos,scope,context){var i=tokens.length,result=null,match,t;isInsideConstructor=true;try{while(i--){t=tokens[i];if((t.scope==="all"||t.scope===scope)&&(!t.trigger||t.trigger.call(context))){t.pattern.lastIndex=pos;match=fixed.exec.call(t.pattern,pattern);if(match&&match.index===pos){result={output:t.handler.call(context,match,scope),match:match};break;}}}}catch(err){throw err;}finally{isInsideConstructor=false;} return result;} function setExtensibility(on){self.addToken=addToken[on?"on":"off"];features.extensibility=on;} function setNatives(on){RegExp.prototype.exec=(on?fixed:nativ).exec;RegExp.prototype.test=(on?fixed:nativ).test;String.prototype.match=(on?fixed:nativ).match;String.prototype.replace=(on?fixed:nativ).replace;String.prototype.split=(on?fixed:nativ).split;features.natives=on;} self=function(pattern,flags){if(self.isRegExp(pattern)){if(flags!==undef){throw new TypeError("can't supply flags when constructing one RegExp from another");} return copy(pattern);} if(isInsideConstructor){throw new Error("can't call the XRegExp constructor within token definition functions");} var output=[],scope=defaultScope,tokenContext={hasNamedCapture:false,captureNames:[],hasFlag:function(flag){return flags.indexOf(flag)>-1;}},pos=0,tokenResult,match,chr;pattern=pattern===undef?"":String(pattern);flags=flags===undef?"":String(flags);if(nativ.match.call(flags,duplicateFlags)){throw new SyntaxError("invalid duplicate regular expression flag");} pattern=nativ.replace.call(pattern,/^\(\?([\w$]+)\)/,function($0,$1){if(nativ.test.call(/[gy]/,$1)){throw new SyntaxError("can't use flag g or y in mode modifier");} flags=nativ.replace.call(flags+$1,duplicateFlags,"");return"";});self.forEach(flags,/[\s\S]/,function(m){if(registeredFlags.indexOf(m[0])<0){throw new SyntaxError("invalid regular expression flag "+m[0]);}});while(pos";}}else if(backref){return"\\"+(+backref+numPriorCaptures);} return match;},output=[],pattern,i;if(!(isType(patterns,"array")&&patterns.length)){throw new TypeError("patterns must be a nonempty array");} for(i=0;i1&&lastIndexOf(match,"")>-1){r2=new RegExp(this.source,nativ.replace.call(getNativeFlags(this),"g",""));nativ.replace.call(String(str).slice(match.index),r2,function(){var i;for(i=1;imatch.index)){this.lastIndex=match.index;}} if(!this.global){this.lastIndex=origLastIndex;} return match;};fixed.test=function(str){return!!fixed.exec.call(this,str);};fixed.match=function(regex){if(!self.isRegExp(regex)){regex=new RegExp(regex);}else if(regex.global){var result=nativ.match.apply(this,arguments);regex.lastIndex=0;return result;} return fixed.exec.call(regex,this);};fixed.replace=function(search,replacement){var isRegex=self.isRegExp(search),captureNames,result,str,origLastIndex;if(isRegex){if(search.xregexp){captureNames=search.xregexp.captureNames;} if(!search.global){origLastIndex=search.lastIndex;}}else{search+="";} if(isType(replacement,"function")){result=nativ.replace.call(String(this),search,function(){var args=arguments,i;if(captureNames){args[0]=new String(args[0]);for(i=0;iargs.length-3){throw new SyntaxError("backreference to undefined group "+$0);} return args[$2]||"";} throw new SyntaxError("invalid token "+$0);});});} if(isRegex){if(search.global){search.lastIndex=0;}else{search.lastIndex=origLastIndex;}} return result;};fixed.split=function(separator,limit){if(!self.isRegExp(separator)){return nativ.split.apply(this,arguments);} var str=String(this),origLastIndex=separator.lastIndex,output=[],lastLastIndex=0,lastLength;limit=(limit===undef?-1:limit)>>>0;self.forEach(str,separator,function(match){if((match.index+match[0].length)>lastLastIndex){output.push(str.slice(lastLastIndex,match.index));if(match.length>1&&match.indexlimit?output.slice(0,limit):output;};add=addToken.on;add(/\\([ABCE-RTUVXYZaeg-mopqyz]|c(?![A-Za-z])|u(?![\dA-Fa-f]{4})|x(?![\dA-Fa-f]{2}))/,function(match,scope){if(match[1]==="B"&&scope===defaultScope){return match[0];} throw new SyntaxError("invalid escape "+match[0]);},{scope:"all"});add(/\[(\^?)]/,function(match){return match[1]?"[\\s\\S]":"\\b\\B";});add(/(?:\(\?#[^)]*\))+/,function(match){return nativ.test.call(quantifier,match.input.slice(match.index+match[0].length))?"":"(?:)";});add(/\\k<([\w$]+)>/,function(match){var index=isNaN(match[1])?(lastIndexOf(this.captureNames,match[1])+1):+match[1],endIndex=match.index+match[0].length;if(!index||index>this.captureNames.length){throw new SyntaxError("backreference to undefined group "+match[0]);} return"\\"+index+(endIndex===match.input.length||isNaN(match.input.charAt(endIndex))?"":"(?:)");});add(/(?:\s+|#.*)+/,function(match){return nativ.test.call(quantifier,match.input.slice(match.index+match[0].length))?"":"(?:)";},{trigger:function(){return this.hasFlag("x");},customFlags:"x"});add(/\./,function(){return"[\\s\\S]";},{trigger:function(){return this.hasFlag("s");},customFlags:"s"});add(/\(\?P?<([\w$]+)>/,function(match){if(!isNaN(match[1])){throw new SyntaxError("can't use integer as capture name "+match[0]);} this.captureNames.push(match[1]);this.hasNamedCapture=true;return"(";});add(/\\(\d+)/,function(match,scope){if(!(scope===defaultScope&&/^[1-9]/.test(match[1])&&+match[1]<=this.captureNames.length)&&match[1]!=="0"){throw new SyntaxError("can't use octal escape or backreference to undefined group "+match[0]);} return match[0];},{scope:"all"});add(/\((?!\?)/,function(){if(this.hasFlag("n")){return"(?:";} this.captureNames.push(null);return"(";},{customFlags:"n"});if(typeof exports!=="undefined"){exports.XRegExp=self;} return self;}());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 SyntaxHighlighter
SyntaxHighlighter
version 3.0.9 (Thu, 04 Dec 2014 12:32:21 GMT)
JavaScript code syntax highlighter.
Copyright 2004-2013 Alex Gorbatchev.
If you like this script, please donate to
keep development active!
'}},vars:{highlighters:{}},brushes:{},regexLib:{multiLineCComments:XRegExp('/\\*.*?\\*/','gs'),singleLineCComments:/\/\/.*$/gm,singleLinePerlComments:/#.*$/gm,doubleQuotedString:/"([^\\"\n]|\\.)*"/g,singleQuotedString:/'([^\\'\n]|\\.)*'/g,multiLineDoubleQuotedString:XRegExp('"([^\\\\"]|\\\\.)*"','gs'),multiLineSingleQuotedString:XRegExp("'([^\\\\']|\\\\.)*'",'gs'),xmlComments:XRegExp('(<|<)!--.*?--(>|>)','gs'),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,l=list.length;i'+escapeHtml(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,l=elements.length;i(.*?))\\]$"),pos=0,regex=XRegExp("(?[\\w-]+)"+"\\s*:\\s*"+"(?"+"[\\w%#-]+|"+"\\[.*?\\]|"+'".*?"|'+"'.*?'"+")\\s*;?","g");while((match=XRegExp.exec(str,regex,pos))!=null) {var value=match.value.replace(/^['"]|['"]$/g,'');if(value!=null&&arrayRegex.test(value)) {var m=XRegExp.exec(value,arrayRegex);value=m.values.length>0?m.values.split(/\s*,\s*/):[];} result[match.name]=value;pos=match.index+match[0].length;} 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,l=lines.length;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,l=lines.length;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 pos=0;while((match=XRegExp.exec(code,regexInfo.regex,pos))!=null) {var resultMatch=func(match,regexInfo);if(typeof(resultMatch)=='string') resultMatch=[new sh.Match(resultMatch,match.index,regexInfo.css)];matches=matches.concat(resultMatch);pos=match.index+match[0].length;} 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,l=tags.length;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?''+escapeHtml(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,l=matches.length;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:XRegExp("(?"+regexGroup.left.source+")"+"(?.*?)"+"(?"+regex.end+")","sgi")};}};return sh;}();typeof(exports)!='undefined'?exports.SyntaxHighlighter=SyntaxHighlighter:null;(function(){var sh=SyntaxHighlighter;sh.autoloader=function() {var list=arguments,elements=sh.findElements(),brushes={},scripts={},all=SyntaxHighlighter.all,allCalled=false,allParams=null,i;SyntaxHighlighter.all=function(params) {allParams=params;allCalled=true;};function addBrush(aliases,url) {for(var i=0;i