- md5
- a5f0ad4caa0cc71884802774cbaa0eb0
- sha1
- f44abb2025884d376543c0d0f7d25cab0b3dc4c5
- sha256
- b5d759ae00b1d720daf9bfe2c0405b0e0f2058f694a2a7373205322b7f4e6346
!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed"],t):t(CodeMirror)}(function(t){"use strict";var e={noEndTag:!0,soyState:"param-def"},a={alias:{noEndTag:!0},delpackage:{noEndTag:!0},namespace:{noEndTag:!0,soyState:"namespace-def"},"@param":e,"@param?":e,"@inject":e,"@inject?":e,"@state":e,template:{soyState:"templ-def",variableScope:!0},literal:{},msg:{},fallbackmsg:{noEndTag:!0,reduceIndent:!0},select:{},plural:{},let:{soyState:"var-def"},if:{},elseif:{noEndTag:!0,reduceIndent:!0},else:{noEndTag:!0,reduceIndent:!0},switch:{},case:{noEndTag:!0,reduceIndent:!0},default:{noEndTag:!0,reduceIndent:!0},foreach:{variableScope:!0,soyState:"var-def"},ifempty:{noEndTag:!0,reduceIndent:!0},for:{variableScope:!0,soyState:"var-def"},call:{soyState:"templ-ref"},param:{soyState:"param-ref"},print:{noEndTag:!0},deltemplate:{soyState:"templ-def",variableScope:!0},delcall:{soyState:"templ-ref"},log:{},element:{variableScope:!0}},n=Object.keys(a).filter(function(t){return!a[t].noEndTag||a[t].reduceIndent});t.defineMode("soy",function(e){var r=t.getMode(e,"text/plain"),o={html:t.getMode(e,{name:"text/html",multilineTagIndentFactor:2,multilineTagIndentPastTag:!1}),attributes:r,text:r,uri:r,trusted_resource_uri:r,css:t.getMode(e,"text/css"),js:t.getMode(e,{name:"text/javascript",statementIndent:2*e.indentUnit})};function l(t){return t[t.length-1]}function s(t,e,a){if(t.sol()){for(var n=0;n<e.indent&&t.eat(/\s/);n++);if(n)return null}var r=t.string,o=a.exec(r.substr(t.pos));o&&(t.string=r.substr(0,t.pos+o.index));var s=t.hideFirstChars(e.indent,function(){var a=l(e.localStates);return a.mode.token(t,a.state)});return t.string=r,s}function i(t,e){return{element:e,next:t}}function c(t){t.context&&(t.context.scope&&(t.variables=t.context.scope),t.context=t.context.previousContext)}function u(t,e,a){this.previousContext=t,this.tag=e,this.kind=null,this.scope=a}function p(t,e){var a,n,r,o;return t.match(/[[]/)?(e.soyState.push("list-literal"),e.lookupVariables=!1,null):t.match(/map\b/)?(e.soyState.push("map-literal"),"keyword"):t.match(/record\b/)?(e.soyState.push("record-literal"),"keyword"):t.match(/([\w]+)(?=\()/)?"variable callee":(a=t.match(/^["']/))?(e.soyState.push("string"),e.quoteKind=a[0],"string"):t.match(/^[(]/)?(e.soyState.push("open-parentheses"),null):t.match(/(null|true|false)(?!\w)/)||t.match(/0x([0-9a-fA-F]{2,})/)||t.match(/-?([0-9]*[.])?[0-9]+(e[0-9]*)?/)?"atom":t.match(/(\||[+\-*\/%]|[=!]=|\?:|[<>]=?)/)?"operator":(a=t.match(/^\$([\w]+)/))?(n=e.variables,r=a[1],o=!e.lookupVariables,function(t,e){for(;t;){if(t.element===e)return!0;t=t.next}return!1}(n,r)?"variable-2":o?"variable":"variable-2 error"):(a=t.match(/^\w+/))?/^(?:as|and|or|not|in|if)$/.test(a[0])?"keyword":null:(t.next(),null)}return{startState:function(){return{soyState:[],variables:i(null,"ij"),scopes:null,indent:0,quoteKind:null,context:null,lookupVariables:!0,localStates:[{mode:o.html,state:t.startState(o.html)}]}},copyState:function(e){return{tag:e.tag,soyState:e.soyState.concat([]),variables:e.variables,context:e.context,indent:e.indent,quoteKind:e.quoteKind,lookupVariables:e.lookupVariables,localStates:e.localStates.map(function(e){return{mode:e.mode,state:t.copyState(e.mode,e.state)}})}},token:function(r,d){switch(l(d.soyState)){case"comment":if(r.match(/^.*?\*\//)?d.soyState.pop():r.skipToEnd(),!d.context||!d.context.scope)for(var m=/@param\??\s+(\S+)/g,y=r.current();h=m.exec(y);)d.variables=i(d.variables,h[1]);return"comment";case"string":var h;return(h=r.match(/^.*?(["']|\\[\s\S])/))?h[1]==d.quoteKind&&(d.quoteKind=null,d.soyState.pop()):r.skipToEnd(),"string"}if(!d.soyState.length||"literal"!=l(d.soyState)){if(r.match(/^\/\*/))return d.soyState.push("comment"),"comment";if(r.match(r.sol()?/^\s*\/\/.*/:/^\s+\/\/.*/))return"comment"}switch(l(d.soyState)){case"templ-def":return(h=r.match(/^\.?([\w]+(?!\.[\w]+)*)/))?(d.soyState.pop(),"def"):(r.next(),null);case"templ-ref":return(h=r.match(/(\.?[a-zA-Z_][a-zA-Z_0-9]+)+/))?(d.soyState.pop(),"."==h[0][0]?"variable-2":"variable"):(r.next(),null);case"namespace-def":return(h=r.match(/^\.?([\w\.]+)/))?(d.soyState.pop(),"variable"):(r.next(),null);case"param-def":return(h=r.match(/^\w+/))?(d.variables=i(d.variables,h[0]),d.soyState.pop(),d.soyState.push("param-type"),"def"):(r.next(),null);case"param-ref":return(h=r.match(/^\w+/))?(d.soyState.pop(),"property"):(r.next(),null);case"open-parentheses":return r.match(/[)]/)?(d.soyState.pop(),null):p(r,d);case"param-type":var f=r.peek();return-1!="}]=>,".indexOf(f)?(d.soyState.pop(),null):"["==f?(d.soyState.push("param-type-record"),null):"<"==f?(d.soyState.push("param-type-parameter"),null):(h=r.match(/^([\w]+|[?])/))?"type":(r.next(),null);case"param-type-record":return"]"==(f=r.peek())?(d.soyState.pop(),null):r.match(/^\w+/)?(d.soyState.push("param-type"),"property"):(r.next(),null);case"param-type-parameter":return r.match(/^[>]/)?(d.soyState.pop(),null):r.match(/^[<,]/)?(d.soyState.push("param-type"),null):(r.next(),null);case"var-def":return(h=r.match(/^\$([\w]+)/))?(d.variables=i(d.variables,h[1]),d.soyState.pop(),"def"):(r.next(),null);case"record-literal":return r.match(/^[)]/)?(d.soyState.pop(),null):r.match(/[(,]/)?(d.soyState.push("map-value"),d.soyState.push("record-key"),null):(r.next(),null);case"map-literal":return r.match(/^[)]/)?(d.soyState.pop(),null):r.match(/[(,]/)?(d.soyState.push("map-value"),d.soyState.push("map-value"),null):(r.next(),null);case"list-literal":return r.match(/\]/)?(d.soyState.pop(),d.lookupVariables=!0,null):r.match(/for\b/)?(d.soyState.push("var-def"),"keyword"):r.match(/in\b/)?(d.lookupVariables=!0,"keyword"):p(r,d);case"record-key":return r.match(/[\w]+/)?"property":r.match(/^[:]/)?(d.soyState.pop(),null):(r.next(),null);case"map-value":return")"==r.peek()||","==r.peek()||r.match(/^[:)]/)?(d.soyState.pop(),null):p(r,d);case"tag":var S=(w="/"==d.tag[0])?d.tag.substring(1):d.tag,g=a[S];if(r.match(/^\/?}/)){var b="/}"==r.current();return b&&!w&&c(d),"/template"==d.tag||"/deltemplate"==d.tag?(d.variables=i(null,"ij"),d.indent=0):d.indent-=e.indentUnit*(b||-1==n.indexOf(d.tag)?2:1),d.soyState.pop(),"keyword"}if(r.match(/^([\w?]+)(?==)/)){if(d.context&&d.context.tag==S&&"kind"==r.current()&&(h=r.match(/^="([^"]+)/,!1))){var v=h[1];d.context.kind=v;var x=o[v]||o.html;(I=l(d.localStates)).mode.indent&&(d.indent+=I.mode.indent(I.state,"","")),d.localStates.push({mode:x,state:t.startState(x)})}return"attribute"}return p(r,d);case"literal":return r.match(/^(?=\{\/literal})/)?(d.soyState.pop(),this.token(r,d)):s(r,d,/\{\/literal}/)}if(r.match(/^\{literal}/))return d.indent+=e.indentUnit,d.soyState.push("literal"),d.context=new u(d.context,"literal",d.variables),"keyword";if(h=r.match(/^\{([/@\\]?\w+\??)(?=$|[\s}]|\/[/*])/)){var k=d.tag;d.tag=h[1];var w="/"==d.tag[0],T=!!a[d.tag];S=w?d.tag.substring(1):d.tag,g=a[S];"/switch"!=d.tag&&(d.indent+=((w||g&&g.reduceIndent)&&"switch"!=k?1:2)*e.indentUnit),d.soyState.push("tag");var E=!1;if(g)if(w||g.soyState&&d.soyState.push(g.soyState),g.noEndTag||!T&&w){if(w)if(d.context&&d.context.tag==S){if(d.context){var I;if(d.context.kind)d.localStates.pop(),(I=l(d.localStates)).mode.indent&&(d.indent-=I.mode.indent(I.state,"",""));c(d)}}else E=!0}else d.context=new u(d.context,d.tag,g.variableScope?d.variables:null);else w&&(E=!0);return(E?"error ":"")+"keyword"}return r.eat("{")?(d.tag="print",d.indent+=2*e.indentUnit,d.soyState.push("tag"),"keyword"):s(r,d,/\{|\s+\/\/|\/\*/)},indent:function(a,n,r){var o=a.indent,s=l(a.soyState);if("comment"==s)return t.Pass;if("literal"==s)/^\{\/literal}/.test(n)&&(o-=e.indentUnit);else{if(/^\s*\{\/(template|deltemplate)\b/.test(n))return 0;/^\{(\/|(fallbackmsg|elseif|else|ifempty)\b)/.test(n)&&(o-=e.indentUnit),"switch"!=a.tag&&/^\{(case|default)\b/.test(n)&&(o-=e.indentUnit),/^\{\/switch\b/.test(n)&&(o-=e.indentUnit)}var i=l(a.localStates);return o&&i.mode.indent&&(o+=i.mode.indent(i.state,n,r)),o},innerMode:function(t){return t.soyState.length&&"literal"!=l(t.soyState)?null:l(t.localStates)},electricInput:/^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",useInnerComments:!1,fold:"indent"}},"htmlmixed"),t.registerHelper("wordChars","soy",/[\w$]/),t.registerHelper("hintWords","soy",Object.keys(a).concat(["css","debugger"])),t.defineMIME("text/x-soy","soy")});
The same content is in 3 releases, Joomla 4.0.0-beta to 4.0.0-beta3. See them all, or every version of this file.