shBrushXml.js
上传用户:gdxydsw
上传日期:2019-01-29
资源大小:16721k
文件大小:1k
- /*
- * JsMin
- * Javascript Compressor
- * http://www.crockford.com/
- * http://www.smallsharptools.com/
- */
- dp.sh.Brushes.Xml=function()
- {this.CssClass='dp-xml';this.Style='.dp-xml .cdata { color: #ff1493; }'+'.dp-xml .tag, .dp-xml .tag-name { color: #069; font-weight: bold; }'+'.dp-xml .attribute { color: red; }'+'.dp-xml .attribute-value { color: blue; }';}
- dp.sh.Brushes.Xml.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Xml.Aliases=['xml','xhtml','xslt','html','xhtml'];dp.sh.Brushes.Xml.prototype.ProcessRegexList=function()
- {function push(array,value)
- {array[array.length]=value;}
- var index=0;var match=null;var regex=null;this.GetMatches(new RegExp('(<|<)\!\[[\w\s]*?\[(.|\s)*?\]\](>|>)','gm'),'cdata');this.GetMatches(new RegExp('(<|<)!--\s*.*?\s*--(>|>)','gm'),'comments');regex=new RegExp('([:\w-.]+)\s*=\s*(".*?"|'.*?'|\w+)*|(\w+)','gm');while((match=regex.exec(this.code))!=null)
- {if(match[1]==null)
- {continue;}
- push(this.matches,new dp.sh.Match(match[1],match.index,'attribute'));if(match[2]!=undefined)
- {push(this.matches,new dp.sh.Match(match[2],match.index+match[0].indexOf(match[2]),'attribute-value'));}}
- this.GetMatches(new RegExp('(<|<)/*\?*(?!\!)|/*\?*(>|>)','gm'),'tag');regex=new RegExp('(?:<|<)/*\?*\s*([:\w-.]+)','gm');while((match=regex.exec(this.code))!=null)
- {push(this.matches,new dp.sh.Match(match[1],match.index+match[0].indexOf(match[1]),'tag-name'));}}