+++ /dev/null
- /*EditArea.prototype.comment_or_quotes= function(v0, v1, v2, v3, v4,v5,v6,v7,v8,v9, v10){\r
- new_class="quotes";\r
- if(v6 && v6 != undefined && v6!="")\r
- new_class="comments";\r
- return "µ__"+ new_class +"__µ"+v0+"µ_END_µ";\r
-\r
- };*/\r
- \r
-/* EditArea.prototype.htmlTag= function(v0, v1, v2, v3, v4,v5,v6,v7,v8,v9, v10){\r
- res="<span class=htmlTag>"+v2;\r
- alert("v2: "+v2+" v3: "+v3);\r
- tab=v3.split("=");\r
- attributes="";\r
- if(tab.length>1){\r
- attributes="<span class=attribute>"+tab[0]+"</span>=";\r
- for(i=1; i<tab.length-1; i++){\r
- cut=tab[i].lastIndexOf(" "); \r
- attributes+="<span class=attributeVal>"+tab[i].substr(0,cut)+"</span>";\r
- attributes+="<span class=attribute>"+tab[i].substr(cut)+"</span>=";\r
- }\r
- attributes+="<span class=attributeVal>"+tab[tab.length-1]+"</span>";\r
- } \r
- res+=attributes+v5+"</span>";\r
- return res; \r
- };*/\r
- \r
- // determine if the selected text if a comment or a quoted text\r
- EditArea.prototype.comment_or_quote= function(){\r
- var new_class="", close_tag="", sy, arg, i;\r
- sy = parent.editAreaLoader.syntax[editArea.current_code_lang];\r
- arg = EditArea.prototype.comment_or_quote.arguments[0];\r
- \r
- for( i in sy["quotes"] ){\r
- if(arg.indexOf(i)==0){\r
- new_class="quotesmarks";\r
- close_tag=sy["quotes"][i];\r
- }\r
- }\r
- if(new_class.length==0)\r
- {\r
- for(var i in sy["comments"]){\r
- if( arg.indexOf(i)==0 ){\r
- new_class="comments";\r
- close_tag=sy["comments"][i];\r
- }\r
- }\r
- }\r
- // for single line comment the \n must not be included in the span tags\r
- if(close_tag=="\n"){\r
- return "µ__"+ new_class +"__µ"+ arg.replace(/(\r?\n)?$/m, "µ_END_µ$1");\r
- }else{\r
- // the closing tag must be set only if the comment or quotes is closed \r
- reg= new RegExp(parent.editAreaLoader.get_escaped_regexp(close_tag)+"$", "m");\r
- if( arg.search(reg)!=-1 )\r
- return "µ__"+ new_class +"__µ"+ arg +"µ_END_µ";\r
- else\r
- return "µ__"+ new_class +"__µ"+ arg;\r
- }\r
- };\r
- \r
-/*\r
- // apply special tags arround text to highlight\r
- EditArea.prototype.custom_highlight= function(){\r
- res= EditArea.prototype.custom_highlight.arguments[1]+"µ__"+ editArea.reg_exp_span_tag +"__µ" + EditArea.prototype.custom_highlight.arguments[2]+"µ_END_µ";\r
- if(EditArea.prototype.custom_highlight.arguments.length>5)\r
- res+= EditArea.prototype.custom_highlight.arguments[ EditArea.prototype.custom_highlight.arguments.length-3 ];\r
- return res;\r
- };\r
- */\r
- \r
- // return identication that allow to know if revalidating only the text line won't make the syntax go mad\r
- EditArea.prototype.get_syntax_trace= function(text){\r
- if(this.settings["syntax"].length>0 && parent.editAreaLoader.syntax[this.settings["syntax"]]["syntax_trace_regexp"])\r
- return text.replace(parent.editAreaLoader.syntax[this.settings["syntax"]]["syntax_trace_regexp"], "$3");\r
- };\r
- \r
- \r
- EditArea.prototype.colorize_text= function(text){\r
- //text="<div id='result' class='area' style='position: relative; z-index: 4; height: 500px; overflow: scroll;border: solid black 1px;'> ";\r
- /* \r
- if(this.isOpera){ \r
- // opera can't use pre element tabulation cause a tab=6 chars in the textarea and 8 chars in the pre \r
- text= this.replace_tab(text);\r
- }*/\r
- \r
- text= " "+text; // for easier regExp\r
- \r
- /*if(this.do_html_tags)\r
- text= text.replace(/(<[a-z]+ [^>]*>)/gi, '[__htmlTag__]$1[_END_]');*/\r
- if(this.settings["syntax"].length>0)\r
- text= this.apply_syntax(text, this.settings["syntax"]);\r
-\r
- // remove the first space added\r
- return text.substr(1).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/µ_END_µ/g,"</span>").replace(/µ__([a-zA-Z0-9]+)__µ/g,"<span class='$1'>");\r
- };\r
- \r
- EditArea.prototype.apply_syntax= function(text, lang){\r
- var sy;\r
- this.current_code_lang=lang;\r
- \r
- if(!parent.editAreaLoader.syntax[lang])\r
- return text;\r
- \r
- sy = parent.editAreaLoader.syntax[lang];\r
- if(sy["custom_regexp"]['before']){\r
- for( var i in sy["custom_regexp"]['before']){\r
- var convert="$1µ__"+ sy["custom_regexp"]['before'][i]['class'] +"__µ$2µ_END_µ$3";\r
- text= text.replace(sy["custom_regexp"]['before'][i]['regexp'], convert);\r
- }\r
- }\r
- \r
- if(sy["comment_or_quote_reg_exp"]){\r
- //setTimeout("_$('debug_area').value=editArea.comment_or_quote_reg_exp;", 500);\r
- text= text.replace(sy["comment_or_quote_reg_exp"], this.comment_or_quote);\r
- }\r
- \r
- if(sy["keywords_reg_exp"]){\r
- for(var i in sy["keywords_reg_exp"]){ \r
- text= text.replace(sy["keywords_reg_exp"][i], 'µ__'+i+'__µ$2µ_END_µ');\r
- } \r
- }\r
- \r
- if(sy["delimiters_reg_exp"]){\r
- text= text.replace(sy["delimiters_reg_exp"], 'µ__delimiters__µ$1µ_END_µ');\r
- } \r
- \r
- if(sy["operators_reg_exp"]){\r
- text= text.replace(sy["operators_reg_exp"], 'µ__operators__µ$1µ_END_µ');\r
- }\r
- \r
- if(sy["custom_regexp"]['after']){\r
- for( var i in sy["custom_regexp"]['after']){\r
- var convert="$1µ__"+ sy["custom_regexp"]['after'][i]['class'] +"__µ$2µ_END_µ$3";\r
- text= text.replace(sy["custom_regexp"]['after'][i]['regexp'], convert); \r
- }\r
- }\r
- \r
- return text;\r
- };\r