- md5
- 418d27211b0c58f324ad6657ec41a47d
- sha1
- 14d8d0587d63b2e096a685efbf00811dc63846b0
- sha256
- 269e0edf7f711e9f819f2d305d40713530f80680d13cb286afb19fbd60729a42
!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed"],a):a(CodeMirror)})((function(a){"use strict";var b=["template","literal","msg","fallbackmsg","let","if","elseif","else","switch","case","default","foreach","ifempty","for","call","param","deltemplate","delcall","log"];a.defineMode("soy",(function(c){function d(a){return a[a.length-1]}function e(a,b,c){var d=a.string,e=c.exec(d.substr(a.pos));e&&(a.string=d.substr(0,a.pos+e.index));var f=a.hideFirstChars(b.indent,(function(){return b.localMode.token(a,b.localState)}));return a.string=d,f}function f(a,b){for(;a;){if(a.element===b)return!0;a=a.next}return!1}function g(a,b){return{element:b,next:a}}function h(a,b,c){return f(a,b)?"variable-2":c?"variable":"variable-2 error"}function i(a){a.scopes&&(a.variables=a.scopes.element,a.scopes=a.scopes.next)}var j=a.getMode(c,"text/plain"),k={html:a.getMode(c,{name:"text/html",multilineTagIndentFactor:2,multilineTagIndentPastTag:!1}),attributes:j,text:j,uri:j,css:a.getMode(c,"text/css"),js:a.getMode(c,{name:"text/javascript",statementIndent:2*c.indentUnit})};return{startState:function(){return{kind:[],kindTag:[],soyState:[],templates:null,variables:null,scopes:null,indent:0,localMode:k.html,localState:a.startState(k.html)}},copyState:function(b){return{tag:b.tag,kind:b.kind.concat([]),kindTag:b.kindTag.concat([]),soyState:b.soyState.concat([]),templates:b.templates,variables:b.variables,scopes:b.scopes,indent:b.indent,localMode:b.localMode,localState:a.copyState(b.localMode,b.localState)}},token:function(f,j){var l;switch(d(j.soyState)){case"comment":return f.match(/^.*?\*\//)?j.soyState.pop():f.skipToEnd(),"comment";case"templ-def":return(l=f.match(/^\.?([\w]+(?!\.[\w]+)*)/))?(j.templates=g(j.templates,l[1]),j.scopes=g(j.scopes,j.variables),j.soyState.pop(),"def"):(f.next(),null);case"templ-ref":return(l=f.match(/^\.?([\w]+)/))?(j.soyState.pop(),"."==l[0][0]?h(j.templates,l[1],!0):"variable"):(f.next(),null);case"param-def":return(l=f.match(/^([\w]+)(?=:)/))?(j.variables=g(j.variables,l[1]),j.soyState.pop(),j.soyState.push("param-type"),"def"):(f.next(),null);case"param-type":return"}"==f.peek()?(j.soyState.pop(),null):f.eatWhile(/^[\w]+/)?"variable-3":(f.next(),null);case"var-def":return(l=f.match(/^\$([\w]+)/))?(j.variables=g(j.variables,l[1]),j.soyState.pop(),"def"):(f.next(),null);case"tag":if(f.match(/^\/?}/))return"/template"==j.tag||"/deltemplate"==j.tag?(i(j),j.indent=0):("/for"!=j.tag&&"/foreach"!=j.tag||i(j),j.indent-=c.indentUnit*("/}"==f.current()||b.indexOf(j.tag)==-1?2:1)),j.soyState.pop(),"keyword";if(f.match(/^([\w?]+)(?==)/)){if("kind"==f.current()&&(l=f.match(/^="([^"]+)/,!1))){var m=l[1];j.kind.push(m),j.kindTag.push(j.tag),j.localMode=k[m]||k.html,j.localState=a.startState(j.localMode)}return"attribute"}return f.match(/^"/)?(j.soyState.push("string"),"string"):(l=f.match(/^\$([\w]+)/))?h(j.variables,l[1]):(l=f.match(/^\w+/))?/^(?:as|and|or|not|in)$/.test(l[0])?"keyword":null:(f.next(),null);case"literal":return f.match(/^(?=\{\/literal})/)?(j.indent-=c.indentUnit,j.soyState.pop(),this.token(f,j)):e(f,j,/\{\/literal}/);case"string":var l=f.match(/^.*?("|\\[\s\S])/);return l?'"'==l[1]&&j.soyState.pop():f.skipToEnd(),"string"}return f.match(/^\/\*/)?(j.soyState.push("comment"),"comment"):f.match(f.sol()?/^\s*\/\/.*/:/^\s+\/\/.*/)?"comment":f.match(/^\{literal}/)?(j.indent+=c.indentUnit,j.soyState.push("literal"),"keyword"):(l=f.match(/^\{([\/@\\]?[\w?]*)/))?("/switch"!=l[1]&&(j.indent+=(/^(\/|(else|elseif|ifempty|case|default)$)/.test(l[1])&&"switch"!=j.tag?1:2)*c.indentUnit),j.tag=l[1],j.tag=="/"+d(j.kindTag)&&(j.kind.pop(),j.kindTag.pop(),j.localMode=k[d(j.kind)]||k.html,j.localState=a.startState(j.localMode)),j.soyState.push("tag"),"template"!=j.tag&&"deltemplate"!=j.tag||j.soyState.push("templ-def"),"call"!=j.tag&&"delcall"!=j.tag||j.soyState.push("templ-ref"),"let"==j.tag&&j.soyState.push("var-def"),"for"!=j.tag&&"foreach"!=j.tag||(j.scopes=g(j.scopes,j.variables),j.soyState.push("var-def")),j.tag.match(/^@param\??/)&&j.soyState.push("param-def"),"keyword"):e(f,j,/\{|\s+\/\/|\/\*/)},indent:function(b,e){var f=b.indent,g=d(b.soyState);if("comment"==g)return a.Pass;if("literal"==g)/^\{\/literal}/.test(e)&&(f-=c.indentUnit);else{if(/^\s*\{\/(template|deltemplate)\b/.test(e))return 0;/^\{(\/|(fallbackmsg|elseif|else|ifempty)\b)/.test(e)&&(f-=c.indentUnit),"switch"!=b.tag&&/^\{(case|default)\b/.test(e)&&(f-=c.indentUnit),/^\{\/switch\b/.test(e)&&(f-=c.indentUnit)}return f&&b.localMode.indent&&(f+=b.localMode.indent(b.localState,e)),f},innerMode:function(a){return a.soyState.length&&"literal"!=d(a.soyState)?null:{state:a.localState,mode:a.localMode}},electricInput:/^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",fold:"indent"}}),"htmlmixed"),a.registerHelper("hintWords","soy",b.concat(["delpackage","namespace","alias","print","css","debugger"])),a.defineMIME("text/x-soy","soy")}));
The same content is in 7 releases, Joomla 3.7.0-beta3 to 3.7.0. See them all, or every version of this file.