diff --git a/src/Spe/sitecore modules/PowerShell/Scripts/ace/emmet-core/emmet.js b/src/Spe/sitecore modules/PowerShell/Scripts/ace/emmet-core/emmet.js index d6dacd53..2ed7ea5e 100644 --- a/src/Spe/sitecore modules/PowerShell/Scripts/ace/emmet-core/emmet.js +++ b/src/Spe/sitecore modules/PowerShell/Scripts/ace/emmet-core/emmet.js @@ -1,15 +1,15 @@ /** - * Underscore.js 1.13.6 - * source: https://github.com/jashkenas/underscore/blob/1.13.6/underscore-min.js - * updated: 2024-07-18 - * reference: SXA-7411 + * Underscore.js 1.13.8 + * source: https://github.com/jashkenas/underscore/blob/1.13.8/underscore-min.js + * updated: 2026-03-15 + * reference: SXA-xxxx */ !function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define("underscore",r):(n="undefined"!=typeof globalThis?globalThis:n||self,function(){var t=n._,e=n._=r();e.noConflict=function(){return n._=t,e}}())}(this,(function(){ -// Underscore.js 1.13.7 +// Underscore.js 1.13.8 // https://underscorejs.org -// (c) 2009-2024 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors +// (c) 2009-2026 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors // Underscore may be freely distributed under the MIT license. -var n="1.13.7",r="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||Function("return this")()||{},t=Array.prototype,e=Object.prototype,u="undefined"!=typeof Symbol?Symbol.prototype:null,i=t.push,o=t.slice,a=e.toString,f=e.hasOwnProperty,c="undefined"!=typeof ArrayBuffer,l="undefined"!=typeof DataView,s=Array.isArray,p=Object.keys,v=Object.create,h=c&&ArrayBuffer.isView,y=isNaN,d=isFinite,g=!{toString:null}.propertyIsEnumerable("toString"),b=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],m=Math.pow(2,53)-1;function j(n,r){return r=null==r?n.length-1:+r,function(){for(var t=Math.max(arguments.length-r,0),e=Array(t),u=0;u=0&&t<=m}}function J(n){return function(r){return null==r?void 0:r[n]}}var G=J("byteLength"),H=K(G),Q=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;var X=c?function(n){return h?h(n)&&!q(n):H(n)&&Q.test(a.call(n))}:C(!1),Y=J("length");function Z(n,r){r=function(n){for(var r={},t=n.length,e=0;e":">",'"':""","'":"'","`":"`"},$n=zn(Ln),Cn=zn(wn(Ln)),Kn=tn.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},Jn=/(.)^/,Gn={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Hn=/\\|'|\r|\n|\u2028|\u2029/g;function Qn(n){return"\\"+Gn[n]}var Xn=/^\s*(\w|\$)+\s*$/;var Yn=0;function Zn(n,r,t,e,u){if(!(e instanceof r))return n.apply(t,u);var i=Mn(n.prototype),o=n.apply(i,u);return w(o)?o:i}var nr=j((function(n,r){var t=nr.placeholder,e=function(){for(var u=0,i=r.length,o=Array(i),a=0;a1)er(a,r-1,t,e),u=e.length;else for(var f=0,c=a.length;f0&&(t=r.apply(this,arguments)),n<=1&&(r=null),t}}var cr=nr(fr,2);function lr(n,r,t){r=Pn(r,t);for(var e,u=nn(n),i=0,o=u.length;i0?0:u-1;i>=0&&i0?a=i>=0?i:Math.max(i+f,a):f=i>=0?Math.min(i+1,f):i+f+1;else if(t&&i&&f)return e[i=t(e,u)]===u?i:-1;if(u!=u)return(i=r(o.call(e,a,f),$))>=0?i+a:-1;for(i=n>0?a:f-1;i>=0&&i0?0:o-1;for(u||(e=r[i?i[a]:a],a+=n);a>=0&&a=3;return r(n,Rn(t,u,4),e,i)}}var _r=wr(1),Ar=wr(-1);function xr(n,r,t){var e=[];return r=Pn(r,t),mr(n,(function(n,t,u){r(n,t,u)&&e.push(n)})),e}function Sr(n,r,t){r=Pn(r,t);for(var e=!tr(n)&&nn(n),u=(e||n).length,i=0;i=0}var Er=j((function(n,r,t){var e,u;return D(r)?u=r:(r=Bn(r),e=r.slice(0,-1),r=r[r.length-1]),jr(n,(function(n){var i=u;if(!i){if(e&&e.length&&(n=Nn(n,e)),null==n)return;i=n[r]}return null==i?i:i.apply(n,t)}))}));function Br(n,r){return jr(n,Dn(r))}function Nr(n,r,t){var e,u,i=-1/0,o=-1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=tr(n)?n:jn(n)).length;ai&&(i=e);else r=Pn(r,t),mr(n,(function(n,t,e){((u=r(n,t,e))>o||u===-1/0&&i===-1/0)&&(i=n,o=u)}));return i}var Ir=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;function Tr(n){return n?U(n)?o.call(n):S(n)?n.match(Ir):tr(n)?jr(n,Tn):jn(n):[]}function kr(n,r,t){if(null==r||t)return tr(n)||(n=jn(n)),n[Un(n.length-1)];var e=Tr(n),u=Y(e);r=Math.max(Math.min(r,u),0);for(var i=u-1,o=0;o1&&(e=Rn(e,r[1])),r=an(n)):(e=qr,r=er(r,!1,!1),n=Object(n));for(var u=0,i=r.length;u1&&(t=r[1])):(r=jr(er(r,!1,!1),String),e=function(n,t){return!Mr(r,t)}),Ur(n,e,t)}));function zr(n,r,t){return o.call(n,0,Math.max(0,n.length-(null==r||t?1:r)))}function Lr(n,r,t){return null==n||n.length<1?null==r||t?void 0:[]:null==r||t?n[0]:zr(n,n.length-r)}function $r(n,r,t){return o.call(n,null==r||t?1:r)}var Cr=j((function(n,r){return r=er(r,!0,!0),xr(n,(function(n){return!Mr(r,n)}))})),Kr=j((function(n,r){return Cr(n,r)}));function Jr(n,r,t,e){A(r)||(e=t,t=r,r=!1),null!=t&&(t=Pn(t,e));for(var u=[],i=[],o=0,a=Y(n);or?(e&&(clearTimeout(e),e=null),a=c,o=n.apply(u,i),e||(u=i=null)):e||!1===t.trailing||(e=setTimeout(f,l)),o};return c.cancel=function(){clearTimeout(e),a=0,e=u=i=null},c},debounce:function(n,r,t){var e,u,i,o,a,f=function(){var c=Wn()-u;r>c?e=setTimeout(f,r-c):(e=null,t||(o=n.apply(a,i)),e||(i=a=null))},c=j((function(c){return a=this,i=c,u=Wn(),e||(e=setTimeout(f,r),t&&(o=n.apply(a,i))),o}));return c.cancel=function(){clearTimeout(e),e=i=a=null},c},wrap:function(n,r){return nr(r,n)},negate:ar,compose:function(){var n=arguments,r=n.length-1;return function(){for(var t=r,e=n[r].apply(this,arguments);t--;)e=n[t].call(this,e);return e}},after:function(n,r){return function(){if(--n<1)return r.apply(this,arguments)}},before:fr,once:cr,findKey:lr,findIndex:pr,findLastIndex:vr,sortedIndex:hr,indexOf:dr,lastIndexOf:gr,find:br,detect:br,findWhere:function(n,r){return br(n,kn(r))},each:mr,forEach:mr,map:jr,collect:jr,reduce:_r,foldl:_r,inject:_r,reduceRight:Ar,foldr:Ar,filter:xr,select:xr,reject:function(n,r,t){return xr(n,ar(Pn(r)),t)},every:Sr,all:Sr,some:Or,any:Or,contains:Mr,includes:Mr,include:Mr,invoke:Er,pluck:Br,where:function(n,r){return xr(n,kn(r))},max:Nr,min:function(n,r,t){var e,u,i=1/0,o=1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=tr(n)?n:jn(n)).length;ae||void 0===t)return 1;if(t=0&&t<=m}}function J(n){return function(r){return null==r?void 0:r[n]}}var G=J("byteLength"),H=K(G),Q=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;var X=c?function(n){return h?h(n)&&!q(n):H(n)&&Q.test(a.call(n))}:C(!1),Y=J("length");function Z(n,r){r=function(n){for(var r={},t=n.length,e=0;e":">",'"':""","'":"'","`":"`"},Ln=Wn(zn),$n=Wn(jn(zn)),Cn=tn.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},Kn=/(.)^/,Jn={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Gn=/\\|'|\r|\n|\u2028|\u2029/g;function Hn(n){return"\\"+Jn[n]}var Qn=/^\s*(\w|\$)+\s*$/;var Xn=0;function Yn(n,r,t,e,u){if(!(e instanceof r))return n.apply(t,u);var i=On(n.prototype),o=n.apply(i,u);return w(o)?o:i}var Zn=j((function(n,r){var t=Zn.placeholder,e=function(){for(var u=0,i=r.length,o=Array(i),a=0;a=o){if(!a.length)break;var f=a.pop();i=f.i,n=f.v,o=Y(n)}else{var c=n[i++];a.length>=r?e[u++]=c:rr(c)&&(U(c)||L(c))?(a.push({i:i,v:n}),i=0,o=Y(n=c)):t||(e[u++]=c)}return e}var er=j((function(n,r){var t=(r=tr(r,!1,!1)).length;if(t<1)throw new Error("bindAll must be passed function names");for(;t--;){var e=r[t];n[e]=nr(n[e],n)}return n}));var ur=j((function(n,r,t){return setTimeout((function(){return n.apply(null,t)}),r)})),ir=Zn(ur,tn,1);function or(n){return function(){return!n.apply(this,arguments)}}function ar(n,r){var t;return function(){return--n>0&&(t=r.apply(this,arguments)),n<=1&&(r=null),t}}var fr=Zn(ar,2);function cr(n,r,t){r=Fn(r,t);for(var e,u=nn(n),i=0,o=u.length;i0?0:u-1;i>=0&&i0?a=i>=0?i:Math.max(i+f,a):f=i>=0?Math.min(i+1,f):i+f+1;else if(t&&i&&f)return e[i=t(e,u)]===u?i:-1;if(u!=u)return(i=r(o.call(e,a,f),$))>=0?i+a:-1;for(i=n>0?a:f-1;i>=0&&i0?0:o-1;for(u||(e=r[i?i[a]:a],a+=n);a>=0&&a=3;return r(n,Dn(t,u,4),e,i)}}var wr=jr(1),_r=jr(-1);function Ar(n,r,t){var e=[];return r=Fn(r,t),br(n,(function(n,t,u){r(n,t,u)&&e.push(n)})),e}function xr(n,r,t){r=Fn(r,t);for(var e=!rr(n)&&nn(n),u=(e||n).length,i=0;i=0}var Mr=j((function(n,r,t){var e,u;return D(r)?u=r:(r=En(r),e=r.slice(0,-1),r=r[r.length-1]),mr(n,(function(n){var i=u;if(!i){if(e&&e.length&&(n=Bn(n,e)),null==n)return;i=n[r]}return null==i?i:i.apply(n,t)}))}));function Er(n,r){return mr(n,Tn(r))}function Br(n,r,t){var e,u,i=-1/0,o=-1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=rr(n)?n:mn(n)).length;ai&&(i=e);else r=Fn(r,t),br(n,(function(n,t,e){((u=r(n,t,e))>o||u===-1/0&&i===-1/0)&&(i=n,o=u)}));return i}var Nr=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;function kr(n){return n?U(n)?o.call(n):S(n)?n.match(Nr):rr(n)?mr(n,kn):mn(n):[]}function Ir(n,r,t){if(null==r||t)return rr(n)||(n=mn(n)),n[qn(n.length-1)];var e=kr(n),u=Y(e);r=Math.max(Math.min(r,u),0);for(var i=u-1,o=0;o1&&(e=Dn(e,r[1])),r=on(n)):(e=Pr,r=tr(r,!1,!1),n=Object(n));for(var u=0,i=r.length;u1&&(t=r[1])):(r=mr(tr(r,!1,!1),String),e=function(n,t){return!Or(r,t)}),qr(n,e,t)}));function Wr(n,r,t){return o.call(n,0,Math.max(0,n.length-(null==r||t?1:r)))}function zr(n,r,t){return null==n||n.length<1?null==r||t?void 0:[]:null==r||t?n[0]:Wr(n,n.length-r)}function Lr(n,r,t){return o.call(n,null==r||t?1:r)}var $r=j((function(n,r){return r=tr(r,!0,!0),Ar(n,(function(n){return!Or(r,n)}))})),Cr=j((function(n,r){return $r(n,r)}));function Kr(n,r,t,e){A(r)||(e=t,t=r,r=!1),null!=t&&(t=Fn(t,e));for(var u=[],i=[],o=0,a=Y(n);o=0))if(e.push(n),i.push(r),t.push(!0),l){if((v=n.length)!==r.length)return!1;for(;v--;)t.push({a:n[v],b:r[v]})}else{var h,y=nn(n);if(v=y.length,nn(r).length!==v)return!1;for(;v--;){if(!W(r,h=y[v]))return!1;t.push({a:n[h],b:r[h]})}}}else e.pop(),i.pop()}return!0},isMap:yn,isWeakMap:dn,isSet:gn,isWeakSet:bn,keys:nn,allKeys:on,values:mn,pairs:function(n){for(var r=nn(n),t=r.length,e=Array(t),u=0;ur?(e&&(clearTimeout(e),e=null),a=c,o=n.apply(u,i),e||(u=i=null)):e||!1===t.trailing||(e=setTimeout(f,l)),o};return c.cancel=function(){clearTimeout(e),a=0,e=u=i=null},c},debounce:function(n,r,t){var e,u,i,o,a,f=function(){var c=Un()-u;r>c?e=setTimeout(f,r-c):(e=null,t||(o=n.apply(a,i)),e||(i=a=null))},c=j((function(c){return a=this,i=c,u=Un(),e||(e=setTimeout(f,r),t&&(o=n.apply(a,i))),o}));return c.cancel=function(){clearTimeout(e),e=i=a=null},c},wrap:function(n,r){return Zn(r,n)},negate:or,compose:function(){var n=arguments,r=n.length-1;return function(){for(var t=r,e=n[r].apply(this,arguments);t--;)e=n[t].call(this,e);return e}},after:function(n,r){return function(){if(--n<1)return r.apply(this,arguments)}},before:ar,once:fr,findKey:cr,findIndex:sr,findLastIndex:pr,sortedIndex:vr,indexOf:yr,lastIndexOf:dr,find:gr,detect:gr,findWhere:function(n,r){return gr(n,In(r))},each:br,forEach:br,map:mr,collect:mr,reduce:wr,foldl:wr,inject:wr,reduceRight:_r,foldr:_r,filter:Ar,select:Ar,reject:function(n,r,t){return Ar(n,or(Fn(r)),t)},every:xr,all:xr,some:Sr,any:Sr,contains:Or,includes:Or,include:Or,invoke:Mr,pluck:Er,where:function(n,r){return Ar(n,In(r))},max:Br,min:function(n,r,t){var e,u,i=1/0,o=1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=rr(n)?n:mn(n)).length;ae||void 0===t)return 1;if(temmet object and will be available via - * emmet.require(name) or emmet[name] - * @param {String} name - * @param {Function} factory - * @memberOf emmet - */ + * Simple, AMD-like module definition. The module will be added into + * emmet object and will be available via + * emmet.require(name) or emmet[name] + * @param {String} name + * @param {Function} factory + * @memberOf emmet + */ define: function(name, factory) { // do not let redefine existing properties if (!(name in modules)) { @@ -128,28 +128,28 @@ var emmet = (function(global) { }, /** - * Returns reference to Emmet module - * @param {String} name Module name - */ + * Returns reference to Emmet module + * @param {String} name Module name + */ require: r, /** - * Helper method that just executes passed function but with all - * important arguments like 'require' and '_' - * @param {Function} fn - * @param {Object} context Execution context - */ + * Helper method that just executes passed function but with all + * important arguments like 'require' and '_' + * @param {Function} fn + * @param {Object} context Execution context + */ exec: function(fn, context) { return fn.call(context || global, _.bind(r, this), _, this); }, /** - * The self-propagating extend function for classes. - * Took it from Backbone - * @param {Object} protoProps - * @param {Object} classProps - * @returns {Object} - */ + * The self-propagating extend function for classes. + * Took it from Backbone + * @param {Object} protoProps + * @param {Object} classProps + * @returns {Object} + */ extend: function(protoProps, classProps) { var child = inherits(this, protoProps, classProps); child.extend = this.extend; @@ -160,14 +160,14 @@ var emmet = (function(global) { }, /** - * The essential function that expands Emmet abbreviation - * @param {String} abbr Abbreviation to parse - * @param {String} syntax Abbreviation's context syntax - * @param {String} profile Output profile (or its name) - * @param {Object} contextNode Contextual node where abbreviation is - * written - * @return {String} - */ + * The essential function that expands Emmet abbreviation + * @param {String} abbr Abbreviation to parse + * @param {String} syntax Abbreviation's context syntax + * @param {String} profile Output profile (or its name) + * @param {Object} contextNode Contextual node where abbreviation is + * written + * @return {String} + */ expandAbbreviation: function(abbr, syntax, profile, contextNode) { if (!abbr) return ""; @@ -192,33 +192,33 @@ var emmet = (function(global) { }, /** - * Returns default syntax name used in abbreviation engine - * @returns {String} - */ + * Returns default syntax name used in abbreviation engine + * @returns {String} + */ defaultSyntax: function() { return defaultSyntax; }, /** - * Returns default profile name used in abbreviation engine - * @returns {String} - */ + * Returns default profile name used in abbreviation engine + * @returns {String} + */ defaultProfile: function() { return defaultProfile; }, /** - * Log message into console if it exists - */ + * Log message into console if it exists + */ log: function() { if (global.console && global.console.log) global.console.log.apply(global.console, arguments); }, /** - * Setups function that should synchronously load undefined modules - * @param {Function} fn - */ + * Setups function that should synchronously load undefined modules + * @param {Function} fn + */ setModuleLoader: function(fn) { moduleLoader = fn; } @@ -273,8 +273,8 @@ emmet.define("abbreviationParser", function(require, _) { var outputProcessors = []; /** - * @type AbbreviationNode - */ + * @type AbbreviationNode + */ function AbbreviationNode(parent) { /** @type AbbreviationNode */ this.parent = null; @@ -301,12 +301,12 @@ emmet.define("abbreviationParser", function(require, _) { AbbreviationNode.prototype = { /** - * Adds passed node as child or creates new child - * @param {AbbreviationNode} child - * @param {Number} position Index in children array where child should - * be inserted - * @return {AbbreviationNode} - */ + * Adds passed node as child or creates new child + * @param {AbbreviationNode} child + * @param {Number} position Index in children array where child should + * be inserted + * @return {AbbreviationNode} + */ addChild: function(child, position) { child = child || new AbbreviationNode; child.parent = this; @@ -321,9 +321,9 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Creates a deep copy of current node - * @returns {AbbreviationNode} - */ + * Creates a deep copy of current node + * @returns {AbbreviationNode} + */ clone: function() { var node = new AbbreviationNode(); var attrs = ["abbreviation", "counter", "_name", "_text", "repeatCount", "hasImplicitRepeat", "start", "end", "content", "padding"]; @@ -349,9 +349,9 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Removes current node from parent‘s child list - * @returns {AbbreviationNode} Current node itself - */ + * Removes current node from parent‘s child list + * @returns {AbbreviationNode} Current node itself + */ remove: function() { if (this.parent) { this.parent.children = _.without(this.parent.children, this); @@ -361,9 +361,9 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Replaces current node in parent‘s children list with passed nodes - * @param {AbbreviationNode} node Replacement node or array of nodes - */ + * Replaces current node in parent‘s children list with passed nodes + * @param {AbbreviationNode} node Replacement node or array of nodes + */ replace: function() { var parent = this.parent; var ix = _.indexOf(parent.children, this); @@ -377,11 +377,11 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Recursively sets property to value of current - * node and its children - * @param {String} name Property to update - * @param {Object} value New property value - */ + * Recursively sets property to value of current + * node and its children + * @param {String} name Property to update + * @param {Object} value New property value + */ updateProperty: function(name, value) { this[name] = value; _.each(this.children, function(child) { @@ -392,11 +392,11 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Finds first child node that matches truth test for passed - * fn function - * @param {Function} fn - * @returns {AbbreviationNode} - */ + * Finds first child node that matches truth test for passed + * fn function + * @param {Function} fn + * @returns {AbbreviationNode} + */ find: function(fn) { return this.findAll(fn)[0]; // if (!_.isFunction(fn)) { @@ -417,11 +417,11 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Finds all child nodes that matches truth test for passed - * fn function - * @param {Function} fn - * @returns {Array} - */ + * Finds all child nodes that matches truth test for passed + * fn function + * @param {Function} fn + * @returns {Array} + */ findAll: function(fn) { if (!_.isFunction(fn)) { var elemName = fn.toLowerCase(); @@ -440,11 +440,11 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Sets/gets custom data - * @param {String} name - * @param {Object} value - * @returns {Object} - */ + * Sets/gets custom data + * @param {String} name + * @param {Object} value + * @returns {Object} + */ data: function(name, value) { if (arguments.length == 2) { this._data[name] = value; @@ -464,9 +464,9 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Returns name of current node - * @returns {String} - */ + * Returns name of current node + * @returns {String} + */ name: function() { var res = this.matchedResource(); if (require("elements").is(res, "element")) { @@ -477,9 +477,9 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Returns list of attributes for current node - * @returns {Array} - */ + * Returns list of attributes for current node + * @returns {Array} + */ attributeList: function() { var attrs = []; @@ -492,11 +492,11 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Returns or sets attribute value - * @param {String} name Attribute name - * @param {String} value New attribute value - * @returns {String} - */ + * Returns or sets attribute value + * @param {String} name Attribute name + * @param {String} value New attribute value + * @returns {String} + */ attribute: function(name, value) { if (arguments.length == 2) { // modifying attribute @@ -517,26 +517,26 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Returns reference to the matched element, if any. - * See {@link elements} module for a list of available elements - * @returns {Object} - */ + * Returns reference to the matched element, if any. + * See {@link elements} module for a list of available elements + * @returns {Object} + */ matchedResource: function() { return this.data("resource"); }, /** - * Returns index of current node in parent‘s children list - * @returns {Number} - */ + * Returns index of current node in parent‘s children list + * @returns {Number} + */ index: function() { return this.parent ? _.indexOf(this.parent.children, this) : -1; }, /** - * Sets how many times current element should be repeated - * @private - */ + * Sets how many times current element should be repeated + * @private + */ _setRepeat: function(count) { if (count) { this.repeatCount = parseInt(count, 10) || 1; @@ -546,9 +546,9 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Sets abbreviation that belongs to current node - * @param {String} abbr - */ + * Sets abbreviation that belongs to current node + * @param {String} abbr + */ setAbbreviation: function(abbr) { abbr = abbr || ""; @@ -583,9 +583,9 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Returns string representation of current node - * @return {String} - */ + * Returns string representation of current node + * @return {String} + */ toString: function() { var utils = require("utils"); @@ -614,10 +614,10 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Check if current node contains children with empty expr - * property - * @return {Boolean} - */ + * Check if current node contains children with empty expr + * property + * @return {Boolean} + */ hasEmptyChildren: function() { return !!_.find(this.children, function(child) { return child.isEmpty(); @@ -625,59 +625,59 @@ emmet.define("abbreviationParser", function(require, _) { }, /** - * Check if current node has implied name that should be resolved - * @returns {Boolean} - */ + * Check if current node has implied name that should be resolved + * @returns {Boolean} + */ hasImplicitName: function() { return !this._name && !this.isTextNode(); }, /** - * Indicates that current element is a grouping one, e.g. has no - * representation but serves as a container for other nodes - * @returns {Boolean} - */ + * Indicates that current element is a grouping one, e.g. has no + * representation but serves as a container for other nodes + * @returns {Boolean} + */ isGroup: function() { return !this.abbreviation; }, /** - * Indicates empty node (i.e. without abbreviation). It may be a - * grouping node and should not be outputted - * @return {Boolean} - */ + * Indicates empty node (i.e. without abbreviation). It may be a + * grouping node and should not be outputted + * @return {Boolean} + */ isEmpty: function() { return !this.abbreviation && !this.children.length; }, /** - * Indicates that current node should be repeated - * @returns {Boolean} - */ + * Indicates that current node should be repeated + * @returns {Boolean} + */ isRepeating: function() { return this.repeatCount > 1 || this.hasImplicitRepeat; }, /** - * Check if current node is a text-only node - * @return {Boolean} - */ + * Check if current node is a text-only node + * @return {Boolean} + */ isTextNode: function() { return !this.name() && !this.attributeList().length; }, /** - * Indicates whether this node may be used to build elements or snippets - * @returns {Boolean} - */ + * Indicates whether this node may be used to build elements or snippets + * @returns {Boolean} + */ isElement: function() { return !this.isEmpty() && !this.isTextNode(); }, /** - * Returns latest and deepest child of current tree - * @returns {AbbreviationNode} - */ + * Returns latest and deepest child of current tree + * @returns {AbbreviationNode} + */ deepestChild: function() { if (!this.children.length) return null; @@ -692,11 +692,11 @@ emmet.define("abbreviationParser", function(require, _) { }; /** - * Returns stripped string: a string without first and last character. - * Used for “unquoting” strings - * @param {String} str - * @returns {String} - */ + * Returns stripped string: a string without first and last character. + * Used for “unquoting” strings + * @param {String} str + * @returns {String} + */ function stripped(str) { return str.substring(1, str.length - 1); } @@ -715,10 +715,10 @@ emmet.define("abbreviationParser", function(require, _) { } /** - * Parses abbreviation into a tree - * @param {String} abbr - * @returns {AbbreviationNode} - */ + * Parses abbreviation into a tree + * @param {String} abbr + * @returns {AbbreviationNode} + */ function parseAbbreviation(abbr) { abbr = require("utils").trim(abbr); @@ -800,11 +800,11 @@ emmet.define("abbreviationParser", function(require, _) { } /** - * Extract attributes and their values from attribute set: - * [attr col=3 title="Quoted string"] - * @param {String} attrSet - * @returns {Array} - */ + * Extract attributes and their values from attribute set: + * [attr col=3 title="Quoted string"] + * @param {String} attrSet + * @returns {Array} + */ function extractAttributes(attrSet, attrs) { attrSet = require("utils").trim(attrSet); var result = []; @@ -853,22 +853,22 @@ emmet.define("abbreviationParser", function(require, _) { } /** - * Parses tag attributes extracted from abbreviation. If attributes found, - * returns object with element and attributes - * properties - * @param {String} abbr - * @returns {Object} Returns null if no attributes found in - * abbreviation - */ + * Parses tag attributes extracted from abbreviation. If attributes found, + * returns object with element and attributes + * properties + * @param {String} abbr + * @returns {Object} Returns null if no attributes found in + * abbreviation + */ function parseAttributes(abbr) { /* - * Example of incoming data: - * #header - * .some.data - * .some.data#header - * [attr] - * #item[attr=Hello other="World"].class - */ + * Example of incoming data: + * #header + * .some.data + * .some.data#header + * [attr] + * #item[attr=Hello other="World"].class + */ var result = []; var attrMap = { '#': "id", '.': "class" }; var nameEnd = null; @@ -919,9 +919,9 @@ emmet.define("abbreviationParser", function(require, _) { } /** - * Optimize attribute set: remove duplicates and merge class attributes - * @param attrs - */ + * Optimize attribute set: remove duplicates and merge class attributes + * @param attrs + */ function optimizeAttributes(attrs) { // clone all attributes to make sure that original objects are // not modified @@ -948,12 +948,12 @@ emmet.define("abbreviationParser", function(require, _) { } /** - * Extract text data from abbreviation: if a{hello} abbreviation - * is passed, returns object {element: 'a', text: 'hello'}. - * If nothing found, returns null - * @param {String} abbr - * - */ + * Extract text data from abbreviation: if a{hello} abbreviation + * is passed, returns object {element: 'a', text: 'hello'}. + * If nothing found, returns null + * @param {String} abbr + * + */ function extractText(abbr) { if (!~abbr.indexOf("{")) return null; @@ -982,11 +982,11 @@ emmet.define("abbreviationParser", function(require, _) { } /** - * “Un-rolls“ contents of current node: recursively replaces all repeating - * children with their repeated clones - * @param {AbbreviationNode} node - * @returns {AbbreviationNode} - */ + * “Un-rolls“ contents of current node: recursively replaces all repeating + * children with their repeated clones + * @param {AbbreviationNode} node + * @returns {AbbreviationNode} + */ function unroll(node) { for (var i = node.children.length - 1, j, child, maxCount; i >= 0; i--) { child = node.children[i]; @@ -1012,10 +1012,10 @@ emmet.define("abbreviationParser", function(require, _) { } /** - * Optimizes tree node: replaces empty nodes with their children - * @param {AbbreviationNode} node - * @return {AbbreviationNode} - */ + * Optimizes tree node: replaces empty nodes with their children + * @param {AbbreviationNode} node + * @return {AbbreviationNode} + */ function squash(node) { for (var i = node.children.length - 1; i >= 0; i--) { /** @type AbbreviationNode */ @@ -1049,16 +1049,16 @@ emmet.define("abbreviationParser", function(require, _) { return { /** - * Parses abbreviation into tree with respect of groups, - * text nodes and attributes. Each node of the tree is a single - * abbreviation. Tree represents actual structure of the outputted - * result - * @memberOf abbreviationParser - * @param {String} abbr Abbreviation to parse - * @param {Object} options Additional options for parser and processors - * - * @return {AbbreviationNode} - */ + * Parses abbreviation into tree with respect of groups, + * text nodes and attributes. Each node of the tree is a single + * abbreviation. Tree represents actual structure of the outputted + * result + * @memberOf abbreviationParser + * @param {String} abbr Abbreviation to parse + * @param {Object} options Additional options for parser and processors + * + * @return {AbbreviationNode} + */ parse: function(abbr, options) { options = options || {}; @@ -1104,70 +1104,70 @@ emmet.define("abbreviationParser", function(require, _) { AbbreviationNode: AbbreviationNode, /** - * Add new abbreviation preprocessor. Preprocessor is a function - * that applies to a parsed abbreviation tree right after it get parsed. - * The passed tree is in unoptimized state. - * @param {Function} fn Preprocessor function. This function receives - * two arguments: parsed abbreviation tree (AbbreviationNode) - * and options hash that was passed to parse - * method - */ + * Add new abbreviation preprocessor. Preprocessor is a function + * that applies to a parsed abbreviation tree right after it get parsed. + * The passed tree is in unoptimized state. + * @param {Function} fn Preprocessor function. This function receives + * two arguments: parsed abbreviation tree (AbbreviationNode) + * and options hash that was passed to parse + * method + */ addPreprocessor: function(fn) { if (!_.include(preprocessors, fn)) preprocessors.push(fn); }, /** - * Removes registered preprocessor - */ + * Removes registered preprocessor + */ removeFilter: function(fn) { preprocessor = _.without(preprocessors, fn); }, /** - * Adds new abbreviation postprocessor. Postprocessor is a - * functinon that applies to optimized parsed abbreviation tree - * right before it returns from parse() method - * @param {Function} fn Postprocessor function. This function receives - * two arguments: parsed abbreviation tree (AbbreviationNode) - * and options hash that was passed to parse - * method - */ + * Adds new abbreviation postprocessor. Postprocessor is a + * functinon that applies to optimized parsed abbreviation tree + * right before it returns from parse() method + * @param {Function} fn Postprocessor function. This function receives + * two arguments: parsed abbreviation tree (AbbreviationNode) + * and options hash that was passed to parse + * method + */ addPostprocessor: function(fn) { if (!_.include(postprocessors, fn)) postprocessors.push(fn); }, /** - * Removes registered postprocessor function - */ + * Removes registered postprocessor function + */ removePostprocessor: function(fn) { postprocessors = _.without(postprocessors, fn); }, /** - * Registers output postprocessor. Output processor is a - * function that applies to output part (start, - * end and content) when - * AbbreviationNode.toString() method is called - */ + * Registers output postprocessor. Output processor is a + * function that applies to output part (start, + * end and content) when + * AbbreviationNode.toString() method is called + */ addOutputProcessor: function(fn) { if (!_.include(outputProcessors, fn)) outputProcessors.push(fn); }, /** - * Removes registered output processor - */ + * Removes registered output processor + */ removeOutputProcessor: function(fn) { outputProcessors = _.without(outputProcessors, fn); }, /** - * Check if passed symbol is valid symbol for abbreviation expression - * @param {String} ch - * @return {Boolean} - */ + * Check if passed symbol is valid symbol for abbreviation expression + * @param {String} ch + * @return {Boolean} + */ isAllowedChar: function(ch) { ch = String(ch); // convert Java object to JS return isAllowedChar(ch) || ~">+^[](){}".indexOf(ch); @@ -1181,12 +1181,12 @@ emmet.define("abbreviationParser", function(require, _) { */ emmet.exec(function(require, _) { /** - * Finds matched resources for child nodes of passed node - * element. A matched resource is a reference to snippets.json entry - * that describes output of parsed node - * @param {AbbreviationNode} node - * @param {String} syntax - */ + * Finds matched resources for child nodes of passed node + * element. A matched resource is a reference to snippets.json entry + * that describes output of parsed node + * @param {AbbreviationNode} node + * @param {String} syntax + */ function matchResources(node, syntax) { var resources = require("resources"); var elements = require("elements"); @@ -1246,8 +1246,8 @@ emmet.exec(function(require, _) { // XXX register abbreviation filter that creates references to resources // on abbreviation nodes /** - * @param {AbbreviationNode} tree - */ + * @param {AbbreviationNode} tree + */ require("abbreviationParser").addPreprocessor(function(tree, options) { var syntax = options.syntax || emmet.defaultSyntax(); matchResources(tree, syntax); @@ -1265,10 +1265,10 @@ emmet.exec(function(require, _) { var outputPlaceholder = "$#"; /** - * Locates output placeholders inside text - * @param {String} text - * @returns {Array} Array of ranges of output placeholder in text - */ + * Locates output placeholders inside text + * @param {String} text + * @returns {Array} Array of ranges of output placeholder in text + */ function locateOutputPlaceholder(text) { var range = require("range"); var result = []; @@ -1293,12 +1293,12 @@ emmet.exec(function(require, _) { } /** - * Replaces output placeholders inside source with - * value - * @param {String} source - * @param {String} value - * @returns {String} - */ + * Replaces output placeholders inside source with + * value + * @param {String} source + * @param {String} value + * @returns {String} + */ function replaceOutputPlaceholders(source, value) { var utils = require("utils"); var ranges = locateOutputPlaceholder(source); @@ -1312,11 +1312,11 @@ emmet.exec(function(require, _) { } /** - * Check if parsed node contains output placeholder – a target where - * pasted content should be inserted - * @param {AbbreviationNode} node - * @returns {Boolean} - */ + * Check if parsed node contains output placeholder – a target where + * pasted content should be inserted + * @param {AbbreviationNode} node + * @returns {Boolean} + */ function hasOutputPlaceholder(node) { if (locateOutputPlaceholder(node.content).length) return true; @@ -1328,12 +1328,12 @@ emmet.exec(function(require, _) { } /** - * Insert pasted content into correct positions of parsed node - * @param {AbbreviationNode} node - * @param {String} content - * @param {Boolean} overwrite Overwrite node content if no value placeholders - * found instead of appending to existing content - */ + * Insert pasted content into correct positions of parsed node + * @param {AbbreviationNode} node + * @param {String} content + * @param {Boolean} overwrite Overwrite node content if no value placeholders + * found instead of appending to existing content + */ function insertPastedContent(node, content, overwrite) { var nodesWithPlaceholders = node.findAll(function(item) { return hasOutputPlaceholder(item); @@ -1362,9 +1362,9 @@ emmet.exec(function(require, _) { } /** - * @param {AbbreviationNode} tree - * @param {Object} options - */ + * @param {AbbreviationNode} tree + * @param {Object} options + */ parser.addPreprocessor(function(tree, options) { if (options.pastedContent) { var utils = require("utils"); @@ -1382,9 +1382,9 @@ emmet.exec(function(require, _) { }); /** - * @param {AbbreviationNode} tree - * @param {Object} options - */ + * @param {AbbreviationNode} tree + * @param {Object} options + */ parser.addPostprocessor(function(tree, options) { // for each node with pasted content, update text data var targets = tree.findAll(function(item) { @@ -1417,9 +1417,9 @@ emmet.exec(function(require, _) { */ emmet.exec(function(require, _) { /** - * Resolves implicit node names in parsed tree - * @param {AbbreviationNode} tree - */ + * Resolves implicit node names in parsed tree + * @param {AbbreviationNode} tree + */ function resolveNodeNames(tree) { var tagName = require("tagName"); _.each(tree.children, function(node) { @@ -1810,11 +1810,11 @@ emmet.define("cssParser", function(require, _) { } /** - * Returns newline character at specified position in content - * @param {String} content - * @param {Number} pos - * @return {String} - */ + * Returns newline character at specified position in content + * @param {String} content + * @param {Number} pos + * @return {String} + */ function getNewline(content, pos) { return content.charAt(pos) == "\r" && content.charAt(pos + 1) == "\n" ? "\r\n" @@ -1823,10 +1823,10 @@ emmet.define("cssParser", function(require, _) { return { /** - * @param source - * @returns - * @memberOf emmet.cssParser - */ + * @param source + * @returns + * @memberOf emmet.cssParser + */ lex: function(source) { walker.init(source); tokens = []; @@ -2183,9 +2183,9 @@ emmet.define("xmlParser", function(require, _) { return { /** - * @memberOf emmet.xmlParser - * @returns - */ + * @memberOf emmet.xmlParser + * @returns + */ parse: function(data, offset) { offset = offset || 0; var state = startState(); @@ -2332,15 +2332,15 @@ emmet.define("string-score", function(require, _) { */ emmet.define("utils", function(require, _) { /** - * Special token used as a placeholder for caret positions inside - * generated output - */ + * Special token used as a placeholder for caret positions inside + * generated output + */ var caretPlaceholder = "${0}"; /** - * A simple string builder, optimized for faster text concatenation - * @param {String} value Initial value - */ + * A simple string builder, optimized for faster text concatenation + * @param {String} value Initial value + */ function StringBuilder(value) { this._data = []; this.length = 0; @@ -2351,24 +2351,24 @@ emmet.define("utils", function(require, _) { StringBuilder.prototype = { /** - * Append string - * @param {String} text - */ + * Append string + * @param {String} text + */ append: function(text) { this._data.push(text); this.length += text.length; }, /** - * @returns {String} - */ + * @returns {String} + */ toString: function() { return this._data.join(""); }, /** - * @returns {String} - */ + * @returns {String} + */ valueOf: function() { return this.toString(); } @@ -2379,20 +2379,20 @@ emmet.define("utils", function(require, _) { reTag: /<\/?[\w:\-]+(?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*\s*(\/?)>$/, /** - * Test if passed string ends with XHTML tag. This method is used for testing - * '>' character: it belongs to tag or it's a part of abbreviation? - * @param {String} str - * @return {Boolean} - */ + * Test if passed string ends with XHTML tag. This method is used for testing + * '>' character: it belongs to tag or it's a part of abbreviation? + * @param {String} str + * @return {Boolean} + */ endsWithTag: function(str) { return this.reTag.test(str); }, /** - * Check if passed symbol is a number - * @param {String} ch - * @returns {Boolean} - */ + * Check if passed symbol is a number + * @param {String} ch + * @returns {Boolean} + */ isNumeric: function(ch) { if (typeof(ch) == "string") ch = ch.charCodeAt(0); @@ -2401,18 +2401,18 @@ emmet.define("utils", function(require, _) { }, /** - * Trim whitespace from string - * @param {String} text - * @return {String} - */ + * Trim whitespace from string + * @param {String} text + * @return {String} + */ trim: function(text) { return (text || "").replace(/^\s+|\s+$/g, ""); }, /** - * Returns newline character - * @returns {String} - */ + * Returns newline character + * @returns {String} + */ getNewline: function() { var res = require("resources"); if (!res) { @@ -2424,9 +2424,9 @@ emmet.define("utils", function(require, _) { }, /** - * Sets new newline character that will be used in output - * @param {String} str - */ + * Sets new newline character that will be used in output + * @param {String} str + */ setNewline: function(str) { var res = require("resources"); res.setVariable("newline", str); @@ -2434,12 +2434,12 @@ emmet.define("utils", function(require, _) { }, /** - * Split text into lines. Set remove_empty to true to filter - * empty lines - * @param {String} text Text to split - * @param {Boolean} removeEmpty Remove empty lines from result - * @return {Array} - */ + * Split text into lines. Set remove_empty to true to filter + * empty lines + * @param {String} text Text to split + * @param {Boolean} removeEmpty Remove empty lines from result + * @return {Array} + */ splitByLines: function(text, removeEmpty) { // IE fails to split string by regexp, // need to normalize newlines first @@ -2462,21 +2462,21 @@ emmet.define("utils", function(require, _) { }, /** - * Normalizes newline character: replaces newlines in text - * with newline defined in preferences - * @param {String} text - * @returns {String} - */ + * Normalizes newline character: replaces newlines in text + * with newline defined in preferences + * @param {String} text + * @returns {String} + */ normalizeNewline: function(text) { return this.splitByLines(text).join(this.getNewline()); }, /** - * Repeats string howMany times - * @param {String} str - * @param {Number} how_many - * @return {String} - */ + * Repeats string howMany times + * @param {String} str + * @param {Number} how_many + * @return {String} + */ repeatString: function(str, howMany) { var result = []; @@ -2487,10 +2487,10 @@ emmet.define("utils", function(require, _) { }, /** - * Returns list of paddings that should be used to align passed string - * @param {Array} strings - * @returns {Array} - */ + * Returns list of paddings that should be used to align passed string + * @param {Array} strings + * @returns {Array} + */ getStringsPads: function(strings) { var lengths = _.map(strings, function(s) { return _.isString(s) ? s.length : +s; @@ -2504,11 +2504,11 @@ emmet.define("utils", function(require, _) { }, /** - * Indents text with padding - * @param {String} text Text to indent - * @param {String} pad Padding size (number) or padding itself (string) - * @return {String} - */ + * Indents text with padding + * @param {String} text Text to indent + * @param {String} pad Padding size (number) or padding itself (string) + * @return {String} + */ padString: function(text, pad) { var padStr = (_.isNumber(pad)) ? this.repeatString(require("resources").getVariable("indentation") || "\t", pad) @@ -2527,11 +2527,11 @@ emmet.define("utils", function(require, _) { }, /** - * Pad string with zeroes - * @param {String} str String to pad - * @param {Number} pad Desired string length - * @return {String} - */ + * Pad string with zeroes + * @param {String} str String to pad + * @param {Number} pad Desired string length + * @return {String} + */ zeroPadString: function(str, pad) { var padding = ""; var il = str.length; @@ -2541,10 +2541,10 @@ emmet.define("utils", function(require, _) { }, /** - * Removes padding at the beginning of each text's line - * @param {String} text - * @param {String} pad - */ + * Removes padding at the beginning of each text's line + * @param {String} text + * @param {String} pad + */ unindentString: function(text, pad) { var lines = this.splitByLines(text); for (var i = 0; i < lines.length; i++) { @@ -2556,14 +2556,14 @@ emmet.define("utils", function(require, _) { }, /** - * Replaces unescaped symbols in str. For example, the '$' symbol - * will be replaced in 'item$count', but not in 'item\$count'. - * @param {String} str Original string - * @param {String} symbol Symbol to replace - * @param {String} replace Symbol replacement. Might be a function that - * returns new value - * @return {String} - */ + * Replaces unescaped symbols in str. For example, the '$' symbol + * will be replaced in 'item$count', but not in 'item\$count'. + * @param {String} str Original string + * @param {String} symbol Symbol to replace + * @param {String} replace Symbol replacement. Might be a function that + * returns new value + * @return {String} + */ replaceUnescapedSymbol: function(str, symbol, replace) { var i = 0; var il = str.length; @@ -2607,12 +2607,12 @@ emmet.define("utils", function(require, _) { }, /** - * Replace variables like ${var} in string - * @param {String} str - * @param {Object} vars Variable set (defaults to variables defined in - * snippets.json) or variable resolver (Function) - * @return {String} - */ + * Replace variables like ${var} in string + * @param {String} str + * @param {Object} vars Variable set (defaults to variables defined in + * snippets.json) or variable resolver (Function) + * @return {String} + */ replaceVariables: function(str, vars) { vars = vars || {}; var resolver = _.isFunction(vars) ? vars : function(str, p1) { @@ -2637,11 +2637,11 @@ emmet.define("utils", function(require, _) { }, /** - * Replaces '$' character in string assuming it might be escaped with '\' - * @param {String} str String where character should be replaced - * @param {String} value New value - * @return {String} - */ + * Replaces '$' character in string assuming it might be escaped with '\' + * @param {String} str String where character should be replaced + * @param {String} value New value + * @return {String} + */ replaceCounter: function(str, value, total) { var symbol = "$"; // in case we received strings from Java, convert the to native strings @@ -2688,39 +2688,39 @@ emmet.define("utils", function(require, _) { }, /** - * Check if string matches against reTag regexp. This - * function may be used to test if provided string contains HTML tags - * @param {String} str - * @returns {Boolean} - */ + * Check if string matches against reTag regexp. This + * function may be used to test if provided string contains HTML tags + * @param {String} str + * @returns {Boolean} + */ matchesTag: function(str) { return this.reTag.test(str || ""); }, /** - * Escapes special characters used in Emmet, like '$', '|', etc. - * Use this method before passing to actions like "Wrap with Abbreviation" - * to make sure that existing special characters won't be altered - * @param {String} text - * @return {String} - */ + * Escapes special characters used in Emmet, like '$', '|', etc. + * Use this method before passing to actions like "Wrap with Abbreviation" + * to make sure that existing special characters won't be altered + * @param {String} text + * @return {String} + */ escapeText: function(text) { return text.replace(/([\$\\])/g, "\\$1"); }, /** - * Unescapes special characters used in Emmet, like '$', '|', etc. - * @param {String} text - * @return {String} - */ + * Unescapes special characters used in Emmet, like '$', '|', etc. + * @param {String} text + * @return {String} + */ unescapeText: function(text) { return text.replace(/\\(.)/g, "$1"); }, /** - * Returns caret placeholder - * @returns {String} - */ + * Returns caret placeholder + * @returns {String} + */ getCaretPlaceholder: function() { return _.isFunction(caretPlaceholder) ? caretPlaceholder.apply(this, arguments) @@ -2728,76 +2728,76 @@ emmet.define("utils", function(require, _) { }, /** - * Sets new representation for carets in generated output - * @param {String} value New caret placeholder. Might be a - * Function - */ + * Sets new representation for carets in generated output + * @param {String} value New caret placeholder. Might be a + * Function + */ setCaretPlaceholder: function(value) { caretPlaceholder = value; }, /** - * Returns line padding - * @param {String} line - * @return {String} - */ + * Returns line padding + * @param {String} line + * @return {String} + */ getLinePadding: function(line) { return (line.match(/^(\s+)/) || [""])[0]; }, /** - * Helper function that returns padding of line of pos - * position in content - * @param {String} content - * @param {Number} pos - * @returns {String} - */ + * Helper function that returns padding of line of pos + * position in content + * @param {String} content + * @param {Number} pos + * @returns {String} + */ getLinePaddingFromPosition: function(content, pos) { var lineRange = this.findNewlineBounds(content, pos); return this.getLinePadding(lineRange.substring(content)); }, /** - * Escape special regexp chars in string, making it usable for creating dynamic - * regular expressions - * @param {String} str - * @return {String} - */ + * Escape special regexp chars in string, making it usable for creating dynamic + * regular expressions + * @param {String} str + * @return {String} + */ escapeForRegexp: function(str) { var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\ return str.replace(specials, "\\$&"); }, /** - * Make decimal number look good: convert it to fixed precision end remove - * traling zeroes - * @param {Number} num - * @param {Number} fracion Fraction numbers (default is 2) - * @return {String} - */ + * Make decimal number look good: convert it to fixed precision end remove + * traling zeroes + * @param {Number} num + * @param {Number} fracion Fraction numbers (default is 2) + * @return {String} + */ prettifyNumber: function(num, fraction) { return num.toFixed(typeof fraction == "undefined" ? 2 : fraction).replace(/\.?0+$/, ""); }, /** - * A simple mutable string shim, optimized for faster text concatenation - * @param {String} value Initial value - * @returns {StringBuilder} - */ + * A simple mutable string shim, optimized for faster text concatenation + * @param {String} value Initial value + * @returns {StringBuilder} + */ stringBuilder: function(value) { return new StringBuilder(value); }, /** - * Replace substring of str with value - * @param {String} str String where to replace substring - * @param {String} value New substring value - * @param {Number} start Start index of substring to replace. May also - * be a Range object: in this case, the end - * argument is not required - * @param {Number} end End index of substring to replace. If ommited, - * start argument is used - */ + * Replace substring of str with value + * @param {String} str String where to replace substring + * @param {String} value New substring value + * @param {Number} start Start index of substring to replace. May also + * be a Range object: in this case, the end + * argument is not required + * @param {Number} end End index of substring to replace. If ommited, + * start argument is used + */ replaceSubstring: function(str, value, start, end) { if (_.isObject(start) && "end" in start) { end = start.end; @@ -2817,13 +2817,13 @@ emmet.define("utils", function(require, _) { }, /** - * Narrows down text range, adjusting selection to non-space characters - * @param {String} text - * @param {Number} start Starting range in text where - * slection should be adjusted. Can also be any object that is accepted - * by Range class - * @return {Range} - */ + * Narrows down text range, adjusting selection to non-space characters + * @param {String} text + * @param {Number} start Starting range in text where + * slection should be adjusted. Can also be any object that is accepted + * by Range class + * @return {Range} + */ narrowToNonSpace: function(text, start, end) { var range = require("range").create(start, end); @@ -2848,10 +2848,10 @@ emmet.define("utils", function(require, _) { }, /** - * Find start and end index of text line for from index - * @param {String} text - * @param {Number} from - */ + * Find start and end index of text line for from index + * @param {String} text + * @param {Number} from + */ findNewlineBounds: function(text, from) { var len = text.length, start = 0, @@ -2878,8 +2878,8 @@ emmet.define("utils", function(require, _) { }, /** - * Deep merge of two or more objects. Taken from jQuery.extend() - */ + * Deep merge of two or more objects. Taken from jQuery.extend() + */ deepMerge: function() { var options, name, @@ -2966,11 +2966,11 @@ emmet.define("range", function(require, _) { /** - * @type Range - * @constructor - * @param {Object} start - * @param {Number} len - */ + * @type Range + * @constructor + * @param {Object} start + * @param {Number} len + */ function Range(start, len) { if (_.isObject(start) && "start" in start) { // create range from object stub @@ -2992,20 +2992,20 @@ emmet.define("range", function(require, _) { }, /** - * Returns true if passed range is equals to current one - * @param {Range} range - * @returns {Boolean} - */ + * Returns true if passed range is equals to current one + * @param {Range} range + * @returns {Boolean} + */ equal: function(range) { return this.cmp(range, "eq", "eq"); // return this.start === range.start && this.end === range.end; }, /** - * Shifts indexes position with passed delat - * @param {Number} delta - * @returns {Range} range itself - */ + * Shifts indexes position with passed delat + * @param {Number} delta + * @returns {Range} range itself + */ shift: function(delta) { this.start += delta; this.end += delta; @@ -3013,19 +3013,19 @@ emmet.define("range", function(require, _) { }, /** - * Check if two ranges are overlapped - * @param {Range} range - * @returns {Boolean} - */ + * Check if two ranges are overlapped + * @param {Range} range + * @returns {Boolean} + */ overlap: function(range) { return range.start <= this.end && range.end >= this.start; }, /** - * Finds intersection of two ranges - * @param {Range} range - * @returns {Range} null if ranges does not overlap - */ + * Finds intersection of two ranges + * @param {Range} range + * @returns {Range} null if ranges does not overlap + */ intersection: function(range) { if (this.overlap(range)) { var start = Math.max(range.start, this.start); @@ -3037,10 +3037,10 @@ emmet.define("range", function(require, _) { }, /** - * Returns the union of the thow ranges. - * @param {Range} range - * @returns {Range} null if ranges are not overlapped - */ + * Returns the union of the thow ranges. + * @param {Range} range + * @returns {Range} null if ranges are not overlapped + */ union: function(range) { if (this.overlap(range)) { var start = Math.min(range.start, this.start); @@ -3052,40 +3052,40 @@ emmet.define("range", function(require, _) { }, /** - * Returns a Boolean value that indicates whether a specified position - * is in a given range. - * @param {Number} loc - */ + * Returns a Boolean value that indicates whether a specified position + * is in a given range. + * @param {Number} loc + */ inside: function(loc) { return this.cmp(loc, "lte", "gt"); // return this.start <= loc && this.end > loc; }, /** - * Returns a Boolean value that indicates whether a specified position - * is in a given range, but not equals bounds. - * @param {Number} loc - */ + * Returns a Boolean value that indicates whether a specified position + * is in a given range, but not equals bounds. + * @param {Number} loc + */ contains: function(loc) { return this.cmp(loc, "lt", "gt"); }, /** - * Check if current range completely includes specified one - * @param {Range} r - * @returns {Boolean} - */ + * Check if current range completely includes specified one + * @param {Range} r + * @returns {Boolean} + */ include: function(r) { return this.cmp(loc, "lte", "gte"); // return this.start <= r.start && this.end >= r.end; }, /** - * Low-level comparision method - * @param {Number} loc - * @param {String} left Left comparison operator - * @param {String} right Right comaprison operator - */ + * Low-level comparision method + * @param {Number} loc + * @param {String} left Left comparison operator + * @param {String} right Right comaprison operator + */ cmp: function(loc, left, right) { var a, b; if (loc instanceof Range) { @@ -3099,10 +3099,10 @@ emmet.define("range", function(require, _) { }, /** - * Returns substring of specified str for current range - * @param {String} str - * @returns {String} - */ + * Returns substring of specified str for current range + * @param {String} str + * @returns {String} + */ substring: function(str) { return this.length() > 0 ? str.substring(this.start, this.end) @@ -3110,16 +3110,16 @@ emmet.define("range", function(require, _) { }, /** - * Creates copy of current range - * @returns {Range} - */ + * Creates copy of current range + * @returns {Range} + */ clone: function() { return new Range(this.start, this.length()); }, /** - * @returns {Array} - */ + * @returns {Array} + */ toArray: function() { return [this.start, this.end]; }, @@ -3131,13 +3131,13 @@ emmet.define("range", function(require, _) { return { /** - * Creates new range object instance - * @param {Object} start Range start or array with 'start' and 'end' - * as two first indexes or object with 'start' and 'end' properties - * @param {Number} len Range length or string to produce range from - * @returns {Range} - * @memberOf emmet.range - */ + * Creates new range object instance + * @param {Object} start Range start or array with 'start' and 'end' + * as two first indexes or object with 'start' and 'end' properties + * @param {Number} len Range length or string to produce range from + * @returns {Range} + * @memberOf emmet.range + */ create: function(start, len) { if (_.isUndefined(start) || start === null) return null; @@ -3154,10 +3154,10 @@ emmet.define("range", function(require, _) { }, /** - * Range object factory, the same as this.create() - * but last argument represents end of range, not length - * @returns {Range} - */ + * Range object factory, the same as this.create() + * but last argument represents end of range, not length + * @returns {Range} + */ create2: function(start, end) { if (_.isNumber(start) && _.isNumber(end)) { end -= start; @@ -3179,29 +3179,29 @@ emmet.define("range", function(require, _) { */ emmet.define("handlerList", function(require, _) { /** - * @type HandlerList - * @constructor - */ + * @type HandlerList + * @constructor + */ function HandlerList() { this._list = []; } HandlerList.prototype = { /** - * Adds function handler - * @param {Function} fn Handler - * @param {Object} options Handler options. Possible values are:

- * order : (Number) – order in handler list. Handlers - * with higher order value will be executed earlier. - */ + * Adds function handler + * @param {Function} fn Handler + * @param {Object} options Handler options. Possible values are:

+ * order : (Number) – order in handler list. Handlers + * with higher order value will be executed earlier. + */ add: function(fn, options) { this._list.push(_.extend({ order: 0 }, options || {}, { fn: fn })); }, /** - * Removes handler from list - * @param {Function} fn - */ + * Removes handler from list + * @param {Function} fn + */ remove: function(fn) { this._list = _.without(this._list, _.find(this._list, function(item) { return item.fn === fn; @@ -3209,35 +3209,35 @@ emmet.define("handlerList", function(require, _) { }, /** - * Returns ordered list of handlers. By default, handlers - * with the same order option returned in reverse order, - * i.e. the latter function was added into the handlers list, the higher - * it will be in the returned array - * @returns {Array} - */ + * Returns ordered list of handlers. By default, handlers + * with the same order option returned in reverse order, + * i.e. the latter function was added into the handlers list, the higher + * it will be in the returned array + * @returns {Array} + */ list: function() { return _.sortBy(this._list, "order").reverse(); }, /** - * Returns ordered list of handler functions - * @returns {Array} - */ + * Returns ordered list of handler functions + * @returns {Array} + */ listFn: function() { return _.pluck(this.list(), "fn"); }, /** - * Executes handler functions in their designated order. If function - * returns skipVal, meaning that function was unable to - * handle passed args, the next function will be executed - * and so on. - * @param {Object} skipValue If function returns this value, execute - * next handler. - * @param {Array} args Arguments to pass to handler function - * @returns {Boolean} Whether any of registered handlers performed - * successfully - */ + * Executes handler functions in their designated order. If function + * returns skipVal, meaning that function was unable to + * handle passed args, the next function will be executed + * and so on. + * @param {Object} skipValue If function returns this value, execute + * next handler. + * @param {Array} args Arguments to pass to handler function + * @returns {Boolean} Whether any of registered handlers performed + * successfully + */ exec: function(skipValue, args) { args = args || []; var result = null; @@ -3253,10 +3253,10 @@ emmet.define("handlerList", function(require, _) { return { /** - * Factory method that produces HandlerList instance - * @returns {HandlerList} - * @memberOf handlerList - */ + * Factory method that produces HandlerList instance + * @returns {HandlerList} + * @memberOf handlerList + */ create: function() { return new HandlerList(); } @@ -3266,11 +3266,11 @@ emmet.define("handlerList", function(require, _) { */ emmet.define("tokenIterator", function(require, _) { /** - * @type TokenIterator - * @param {Array} tokens - * @type TokenIterator - * @constructor - */ + * @type TokenIterator + * @param {Array} tokens + * @type TokenIterator + * @constructor + */ function TokenIterator(tokens) { /** @type Array */ this.tokens = tokens; @@ -3343,10 +3343,10 @@ emmet.define("tokenIterator", function(require, _) { */ emmet.define("stringStream", function(require, _) { /** - * @type StringStream - * @constructor - * @param {String} string - */ + * @type StringStream + * @constructor + * @param {String} string + */ function StringStream(string) { this.pos = this.start = 0; this.string = string; @@ -3354,48 +3354,48 @@ emmet.define("stringStream", function(require, _) { StringStream.prototype = { /** - * Returns true only if the stream is at the end of the line. - * @returns {Boolean} - */ + * Returns true only if the stream is at the end of the line. + * @returns {Boolean} + */ eol: function() { return this.pos >= this.string.length; }, /** - * Returns true only if the stream is at the start of the line - * @returns {Boolean} - */ + * Returns true only if the stream is at the start of the line + * @returns {Boolean} + */ sol: function() { return this.pos == 0; }, /** - * Returns the next character in the stream without advancing it. - * Will return undefined at the end of the line. - * @returns {String} - */ + * Returns the next character in the stream without advancing it. + * Will return undefined at the end of the line. + * @returns {String} + */ peek: function() { return this.string.charAt(this.pos); }, /** - * Returns the next character in the stream and advances it. - * Also returns undefined when no more characters are available. - * @returns {String} - */ + * Returns the next character in the stream and advances it. + * Also returns undefined when no more characters are available. + * @returns {String} + */ next: function() { if (this.pos < this.string.length) return this.string.charAt(this.pos++); }, /** - * match can be a character, a regular expression, or a function that - * takes a character and returns a boolean. If the next character in the - * stream 'matches' the given argument, it is consumed and returned. - * Otherwise, undefined is returned. - * @param {Object} match - * @returns {String} - */ + * match can be a character, a regular expression, or a function that + * takes a character and returns a boolean. If the next character in the + * stream 'matches' the given argument, it is consumed and returned. + * Otherwise, undefined is returned. + * @param {Object} match + * @returns {String} + */ eat: function(match) { var ch = this.string.charAt(this.pos), ok; if (typeof match == "string") @@ -3410,11 +3410,11 @@ emmet.define("stringStream", function(require, _) { }, /** - * Repeatedly calls eat with the given argument, until it - * fails. Returns true if any characters were eaten. - * @param {Object} match - * @returns {Boolean} - */ + * Repeatedly calls eat with the given argument, until it + * fails. Returns true if any characters were eaten. + * @param {Object} match + * @returns {Boolean} + */ eatWhile: function(match) { var start = this.pos; while (this.eat(match)) { @@ -3423,9 +3423,9 @@ emmet.define("stringStream", function(require, _) { }, /** - * Shortcut for eatWhile when matching white-space. - * @returns {Boolean} - */ + * Shortcut for eatWhile when matching white-space. + * @returns {Boolean} + */ eatSpace: function() { var start = this.pos; while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) @@ -3434,19 +3434,19 @@ emmet.define("stringStream", function(require, _) { }, /** - * Moves the position to the end of the line. - */ + * Moves the position to the end of the line. + */ skipToEnd: function() { this.pos = this.string.length; }, /** - * Skips to the next occurrence of the given character, if found on the - * current line (doesn't advance the stream if the character does not - * occur on the line). Returns true if the character was found. - * @param {String} ch - * @returns {Boolean} - */ + * Skips to the next occurrence of the given character, if found on the + * current line (doesn't advance the stream if the character does not + * occur on the line). Returns true if the character was found. + * @param {String} ch + * @returns {Boolean} + */ skipTo: function(ch) { var found = this.string.indexOf(ch, this.pos); if (found > -1) { @@ -3456,14 +3456,14 @@ emmet.define("stringStream", function(require, _) { }, /** - * Skips to close character which is pair to open - * character, considering possible pair nesting. This function is used - * to consume pair of characters, like opening and closing braces - * @param {String} open - * @param {String} close - * @returns {Boolean} Returns true if pair was successfully - * consumed - */ + * Skips to close character which is pair to open + * character, considering possible pair nesting. This function is used + * to consume pair of characters, like opening and closing braces + * @param {String} open + * @param {String} close + * @returns {Boolean} Returns true if pair was successfully + * consumed + */ skipToPair: function(open, close) { var braceCount = 0, ch; var pos = this.pos, len = this.string.length; @@ -3484,29 +3484,29 @@ emmet.define("stringStream", function(require, _) { }, /** - * Backs up the stream n characters. Backing it up further than the - * start of the current token will cause things to break, so be careful. - * @param {Number} n - */ + * Backs up the stream n characters. Backing it up further than the + * start of the current token will cause things to break, so be careful. + * @param {Number} n + */ backUp: function(n) { this.pos -= n; }, /** - * Act like a multi-character eat—if consume is true or - * not given—or a look-ahead that doesn't update the stream position—if - * it is false. pattern can be either a string or a - * regular expression starting with ^. When it is a string, - * caseInsensitive can be set to true to make the match - * case-insensitive. When successfully matching a regular expression, - * the returned value will be the array returned by match, - * in case you need to extract matched groups. - * - * @param {RegExp} pattern - * @param {Boolean} consume - * @param {Boolean} caseInsensitive - * @returns - */ + * Act like a multi-character eat—if consume is true or + * not given—or a look-ahead that doesn't update the stream position—if + * it is false. pattern can be either a string or a + * regular expression starting with ^. When it is a string, + * caseInsensitive can be set to true to make the match + * case-insensitive. When successfully matching a regular expression, + * the returned value will be the array returned by match, + * in case you need to extract matched groups. + * + * @param {RegExp} pattern + * @param {Boolean} consume + * @param {Boolean} caseInsensitive + * @returns + */ match: function(pattern, consume, caseInsensitive) { if (typeof pattern == "string") { var cased = caseInsensitive @@ -3527,10 +3527,10 @@ emmet.define("stringStream", function(require, _) { }, /** - * Get the string between the start of the current token and the - * current stream position. - * @returns {String} - */ + * Get the string between the start of the current token and the + * current stream position. + * @returns {String} + */ current: function() { return this.string.slice(this.start, this.pos); } @@ -3568,11 +3568,11 @@ emmet.define("resources", function(require, _) { var resolvers = require("handlerList").create(); /** - * Normalizes caret plceholder in passed text: replaces | character with - * default caret placeholder - * @param {String} text - * @returns {String} - */ + * Normalizes caret plceholder in passed text: replaces | character with + * default caret placeholder + * @param {String} text + * @returns {String} + */ function normalizeCaretPlaceholder(text) { var utils = require("utils"); return utils.replaceUnescapedSymbol(text, "|", utils.getCaretPlaceholder()); @@ -3591,11 +3591,11 @@ emmet.define("resources", function(require, _) { } /** - * Parses single abbreviation - * @param {String} key Abbreviation name - * @param {String} value Abbreviation value - * @return {Object} - */ + * Parses single abbreviation + * @param {String} key Abbreviation name + * @param {String} value Abbreviation value + * @return {Object} + */ function parseAbbreviation(key, value) { key = require("utils").trim(key); var elements = require("elements"); @@ -3609,21 +3609,21 @@ emmet.define("resources", function(require, _) { } /** - * Normalizes snippet key name for better fuzzy search - * @param {String} str - * @returns {String} - */ + * Normalizes snippet key name for better fuzzy search + * @param {String} str + * @returns {String} + */ function normalizeName(str) { return str.replace(/:$/, "").replace(/:/g, "-"); } return { /** - * Sets new unparsed data for specified settings vocabulary - * @param {Object} data - * @param {String} type Vocabulary type ('system' or 'user') - * @memberOf resources - */ + * Sets new unparsed data for specified settings vocabulary + * @param {Object} data + * @param {String} type Vocabulary type ('system' or 'user') + * @memberOf resources + */ setVocabulary: function(data, type) { cache = {}; if (type == VOC_SYSTEM) @@ -3633,39 +3633,39 @@ emmet.define("resources", function(require, _) { }, /** - * Returns resource vocabulary by its name - * @param {String} name Vocabulary name ('system' or 'user') - * @return {Object} - */ + * Returns resource vocabulary by its name + * @param {String} name Vocabulary name ('system' or 'user') + * @return {Object} + */ getVocabulary: function(name) { return name == VOC_SYSTEM ? systemSettings : userSettings; }, /** - * Returns resource (abbreviation, snippet, etc.) matched for passed - * abbreviation - * @param {AbbreviationNode} node - * @param {String} syntax - * @returns {Object} - */ + * Returns resource (abbreviation, snippet, etc.) matched for passed + * abbreviation + * @param {AbbreviationNode} node + * @param {String} syntax + * @returns {Object} + */ getMatchedResource: function(node, syntax) { return resolvers.exec(null, _.toArray(arguments)) || this.findSnippet(syntax, node.name()); }, /** - * Returns variable value - * @return {String} - */ + * Returns variable value + * @return {String} + */ getVariable: function(name) { return (this.getSection("variables") || {})[name]; }, /** - * Store runtime variable in user storage - * @param {String} name Variable name - * @param {String} value Variable value - */ + * Store runtime variable in user storage + * @param {String} name Variable name + * @param {String} value Variable value + */ setVariable: function(name, value) { var voc = this.getVocabulary("user") || {}; if (!("variables" in voc)) @@ -3676,24 +3676,24 @@ emmet.define("resources", function(require, _) { }, /** - * Check if there are resources for specified syntax - * @param {String} syntax - * @return {Boolean} - */ + * Check if there are resources for specified syntax + * @param {String} syntax + * @return {Boolean} + */ hasSyntax: function(syntax) { return syntax in this.getVocabulary(VOC_USER) || syntax in this.getVocabulary(VOC_SYSTEM); }, /** - * Registers new abbreviation resolver. - * @param {Function} fn Abbreviation resolver which will receive - * abbreviation as first argument and should return parsed abbreviation - * object if abbreviation has handled successfully, null - * otherwise - * @param {Object} options Options list as described in - * {@link HandlerList#add()} method - */ + * Registers new abbreviation resolver. + * @param {Function} fn Abbreviation resolver which will receive + * abbreviation as first argument and should return parsed abbreviation + * object if abbreviation has handled successfully, null + * otherwise + * @param {Object} options Options list as described in + * {@link HandlerList#add()} method + */ addResolver: function(fn, options) { resolvers.add(fn, options); }, @@ -3703,12 +3703,12 @@ emmet.define("resources", function(require, _) { }, /** - * Returns actual section data, merged from both - * system and user data - * @param {String} name Section name (syntax) - * @param {String} ...args Subsections - * @returns - */ + * Returns actual section data, merged from both + * system and user data + * @param {String} name Section name (syntax) + * @param {String} ...args Subsections + * @returns + */ getSection: function(name) { if (!name) return null; @@ -3730,12 +3730,12 @@ emmet.define("resources", function(require, _) { }, /** - * Recursively searches for a item inside top level sections (syntaxes) - * with respect of `extends` attribute - * @param {String} topSection Top section name (syntax) - * @param {String} subsection Inner section name - * @returns {Object} - */ + * Recursively searches for a item inside top level sections (syntaxes) + * with respect of `extends` attribute + * @param {String} topSection Top section name (syntax) + * @param {String} subsection Inner section name + * @returns {Object} + */ findItem: function(topSection, subsection) { var data = this.getSection(topSection); while (data) { @@ -3747,13 +3747,13 @@ emmet.define("resources", function(require, _) { }, /** - * Recursively searches for a snippet definition inside syntax section. - * Definition is searched inside `snippets` and `abbreviations` - * subsections - * @param {String} syntax Top-level section name (syntax) - * @param {String} name Snippet name - * @returns {Object} - */ + * Recursively searches for a snippet definition inside syntax section. + * Definition is searched inside `snippets` and `abbreviations` + * subsections + * @param {String} syntax Top-level section name (syntax) + * @param {String} name Snippet name + * @returns {Object} + */ findSnippet: function(syntax, name, memo) { if (!syntax || !name) return null; @@ -3787,11 +3787,11 @@ emmet.define("resources", function(require, _) { }, /** - * Performs fuzzy search of snippet definition - * @param {String} syntax Top-level section name (syntax) - * @param {String} name Snippet name - * @returns - */ + * Performs fuzzy search of snippet definition + * @param {String} syntax Top-level section name (syntax) + * @param {String} name Snippet name + * @returns + */ fuzzyFindSnippet: function(syntax, name, minScore) { minScore = minScore || 0.3; @@ -3815,11 +3815,11 @@ emmet.define("resources", function(require, _) { }, /** - * Returns plain dictionary of all available abbreviations and snippets - * for specified syntax with respect of inheritance - * @param {String} syntax - * @returns {Object} - */ + * Returns plain dictionary of all available abbreviations and snippets + * for specified syntax with respect of inheritance + * @param {String} syntax + * @returns {Object} + */ getAllSnippets: function(syntax) { var cacheKey = "all-" + syntax; if (!cache[cacheKey]) { @@ -3866,10 +3866,10 @@ emmet.define("actions", function(require, _, zc) { var actions = {}; /** - * “Humanizes” action name, makes it more readable for people - * @param {String} name Action name (like 'expand_abbreviation') - * @return Humanized name (like 'Expand Abbreviation') - */ + * “Humanizes” action name, makes it more readable for people + * @param {String} name Action name (like 'expand_abbreviation') + * @return Humanized name (like 'Expand Abbreviation') + */ function humanizeActionName(name) { return require("utils").trim(name.charAt(0).toUpperCase() + name.substring(1).replace(/_[a-z]/g, function(str) { @@ -3879,17 +3879,17 @@ emmet.define("actions", function(require, _, zc) { return { /** - * Registers new action - * @param {String} name Action name - * @param {Function} fn Action function - * @param {Object} options Custom action options:
- * label : (String) – Human-readable action name. - * May contain '/' symbols as submenu separators
- * hidden : (Boolean) – Indicates whether action - * should be displayed in menu (getMenu() method) - * - * @memberOf actions - */ + * Registers new action + * @param {String} name Action name + * @param {Function} fn Action function + * @param {Object} options Custom action options:
+ * label : (String) – Human-readable action name. + * May contain '/' symbols as submenu separators
+ * hidden : (Boolean) – Indicates whether action + * should be displayed in menu (getMenu() method) + * + * @memberOf actions + */ add: function(name, fn, options) { name = name.toLowerCase(); options = options || {}; @@ -3905,26 +3905,26 @@ emmet.define("actions", function(require, _, zc) { }, /** - * Returns action object - * @param {String} name Action name - * @returns {Object} - */ + * Returns action object + * @param {String} name Action name + * @returns {Object} + */ get: function(name) { return actions[name.toLowerCase()]; }, /** - * Runs Emmet action. For list of available actions and their - * arguments see actions folder. - * @param {String} name Action name - * @param {Array} args Additional arguments. It may be array of arguments - * or inline arguments. The first argument should be IEmmetEditor instance - * @returns {Boolean} Status of performed operation, true - * means action was performed successfully. - * @example - * emmet.require('actions').run('expand_abbreviation', editor); - * emmet.require('actions').run('wrap_with_abbreviation', [editor, 'div']); - */ + * Runs Emmet action. For list of available actions and their + * arguments see actions folder. + * @param {String} name Action name + * @param {Array} args Additional arguments. It may be array of arguments + * or inline arguments. The first argument should be IEmmetEditor instance + * @returns {Boolean} Status of performed operation, true + * means action was performed successfully. + * @example + * emmet.require('actions').run('expand_abbreviation', editor); + * emmet.require('actions').run('wrap_with_abbreviation', [editor, 'div']); + */ run: function(name, args) { if (!_.isArray(args)) { args = _.rest(arguments); @@ -3940,29 +3940,29 @@ emmet.define("actions", function(require, _, zc) { }, /** - * Returns all registered actions as object - * @returns {Object} - */ + * Returns all registered actions as object + * @returns {Object} + */ getAll: function() { return actions; }, /** - * Returns all registered actions as array - * @returns {Array} - */ + * Returns all registered actions as array + * @returns {Array} + */ getList: function() { return _.values(this.getAll()); }, /** - * Returns actions list as structured menu. If action has label, - * it will be splitted by '/' symbol into submenus (for example: - * CSS/Reflect Value) and grouped with other items - * @param {Array} skipActions List of action identifiers that should be - * skipped from menu - * @returns {Array} - */ + * Returns actions list as structured menu. If action has label, + * it will be splitted by '/' symbol into submenus (for example: + * CSS/Reflect Value) and grouped with other items + * @param {Array} skipActions List of action identifiers that should be + * skipped from menu + * @returns {Array} + */ getMenu: function(skipActions) { var result = []; skipActions = skipActions || []; @@ -4007,10 +4007,10 @@ emmet.define("actions", function(require, _, zc) { }, /** - * Returns action name associated with menu item title - * @param {String} title - * @returns {String} - */ + * Returns action name associated with menu item title + * @param {String} title + * @returns {String} + */ getActionNameForMenuTitle: function(title, menu) { var item = null; _.find(menu || this.getMenu(), function(val) { @@ -4069,46 +4069,46 @@ emmet.define("profile", function(require, _) { }; /** - * @constructor - * @type OutputProfile - * @param {Object} options - */ + * @constructor + * @type OutputProfile + * @param {Object} options + */ function OutputProfile(options) { _.extend(this, defaultProfile, options); } OutputProfile.prototype = { /** - * Transforms tag name case depending on current profile settings - * @param {String} name String to transform - * @returns {String} - */ + * Transforms tag name case depending on current profile settings + * @param {String} name String to transform + * @returns {String} + */ tagName: function(name) { return stringCase(name, this.tag_case); }, /** - * Transforms attribute name case depending on current profile settings - * @param {String} name String to transform - * @returns {String} - */ + * Transforms attribute name case depending on current profile settings + * @param {String} name String to transform + * @returns {String} + */ attributeName: function(name) { return stringCase(name, this.attr_case); }, /** - * Returns quote character for current profile - * @returns {String} - */ + * Returns quote character for current profile + * @returns {String} + */ attributeQuote: function() { return this.attr_quotes == "single" ? "'" : "\""; }, /** - * Returns self-closing tag symbol for current profile - * @param {String} param - * @returns {String} - */ + * Returns self-closing tag symbol for current profile + * @param {String} param + * @returns {String} + */ selfClosing: function(param) { if (this.self_closing_tag == "xhtml") return " /"; @@ -4120,22 +4120,22 @@ emmet.define("profile", function(require, _) { }, /** - * Returns cursor token based on current profile settings - * @returns {String} - */ + * Returns cursor token based on current profile settings + * @returns {String} + */ cursor: function() { return this.place_cursor ? require("utils").getCaretPlaceholder() : ""; } }; /** - * Helper function that converts string case depending on - * caseValue - * @param {String} str String to transform - * @param {String} caseValue Case value: can be lower, - * upper and leave - * @returns {String} - */ + * Helper function that converts string case depending on + * caseValue + * @param {String} str String to transform + * @param {String} caseValue Case value: can be lower, + * upper and leave + * @returns {String} + */ function stringCase(str, caseValue) { switch (String(caseValue || "").toLowerCase()) { case "lower": @@ -4148,10 +4148,10 @@ emmet.define("profile", function(require, _) { } /** - * Creates new output profile - * @param {String} name Profile name - * @param {Object} options Profile options - */ + * Creates new output profile + * @param {String} name Profile name + * @param {Object} options Profile options + */ function createProfile(name, options) { return profiles[name.toLowerCase()] = new OutputProfile(options); } @@ -4168,12 +4168,12 @@ emmet.define("profile", function(require, _) { return { /** - * Creates new output profile and adds it into internal dictionary - * @param {String} name Profile name - * @param {Object} options Profile options - * @memberOf emmet.profile - * @returns {Object} New profile - */ + * Creates new output profile and adds it into internal dictionary + * @param {String} name Profile name + * @param {Object} options Profile options + * @memberOf emmet.profile + * @returns {Object} New profile + */ create: function(name, options) { if (arguments.length == 2) return createProfile(name, options); @@ -4183,13 +4183,13 @@ emmet.define("profile", function(require, _) { }, /** - * Returns profile by its name. If profile wasn't found, returns - * 'plain' profile - * @param {String} name Profile name. Might be profile itself - * @param {String} syntax. Optional. Current editor syntax. If defined, - * profile is searched in resources first, then in predefined profiles - * @returns {Object} - */ + * Returns profile by its name. If profile wasn't found, returns + * 'plain' profile + * @param {String} name Profile name. Might be profile itself + * @param {String} syntax. Optional. Current editor syntax. If defined, + * profile is searched in resources first, then in predefined profiles + * @returns {Object} + */ get: function(name, syntax) { if (!name && syntax) { // search in user resources first @@ -4215,9 +4215,9 @@ emmet.define("profile", function(require, _) { }, /** - * Deletes profile with specified name - * @param {String} name Profile name - */ + * Deletes profile with specified name + * @param {String} name Profile name + */ remove: function(name) { name = (name || "").toLowerCase(); if (name in profiles) @@ -4225,21 +4225,21 @@ emmet.define("profile", function(require, _) { }, /** - * Resets all user-defined profiles - */ + * Resets all user-defined profiles + */ reset: function() { profiles = {}; createDefaultProfiles(); }, /** - * Helper function that converts string case depending on - * caseValue - * @param {String} str String to transform - * @param {String} caseValue Case value: can be lower, - * upper and leave - * @returns {String} - */ + * Helper function that converts string case depending on + * caseValue + * @param {String} str String to transform + * @param {String} caseValue Case value: can be lower, + * upper and leave + * @returns {String} + */ stringCase: stringCase }; }); /** @@ -4251,11 +4251,11 @@ emmet.define("profile", function(require, _) { emmet.define("editorUtils", function(require, _) { return { /** - * Check if cursor is placed inside XHTML tag - * @param {String} html Contents of the document - * @param {Number} caretPos Current caret position inside tag - * @return {Boolean} - */ + * Check if cursor is placed inside XHTML tag + * @param {String} html Contents of the document + * @param {Number} caretPos Current caret position inside tag + * @return {Boolean} + */ isInsideTag: function(html, caretPos) { var reTag = /^<\/?\w[\w\:\-]*.*?>/; @@ -4277,12 +4277,12 @@ emmet.define("editorUtils", function(require, _) { }, /** - * Sanitizes incoming editor data and provides default values for - * output-specific info - * @param {IEmmetEditor} editor - * @param {String} syntax - * @param {String} profile - */ + * Sanitizes incoming editor data and provides default values for + * output-specific info + * @param {IEmmetEditor} editor + * @param {String} syntax + * @param {String} profile + */ outputInfo: function(editor, syntax, profile) { // most of this code makes sense for Java/Rhino environment // because string that comes from Java are not actually JS string @@ -4298,20 +4298,20 @@ emmet.define("editorUtils", function(require, _) { }, /** - * Unindent content, thus preparing text for tag wrapping - * @param {IEmmetEditor} editor Editor instance - * @param {String} text - * @return {String} - */ + * Unindent content, thus preparing text for tag wrapping + * @param {IEmmetEditor} editor Editor instance + * @param {String} text + * @return {String} + */ unindent: function(editor, text) { return require("utils").unindentString(text, this.getCurrentLinePadding(editor)); }, /** - * Returns padding of current editor's line - * @param {IEmmetEditor} Editor instance - * @return {String} - */ + * Returns padding of current editor's line + * @param {IEmmetEditor} Editor instance + * @return {String} + */ getCurrentLinePadding: function(editor) { return require("utils").getLinePadding(editor.getCurrentLine()); } @@ -4336,11 +4336,11 @@ emmet.define("actionUtils", function(require, _) { }, /** - * Extracts abbreviations from text stream, starting from the end - * @param {String} str - * @return {String} Abbreviation or empty string - * @memberOf emmet.actionUtils - */ + * Extracts abbreviations from text stream, starting from the end + * @param {String} str + * @return {String} Abbreviation or empty string + * @memberOf emmet.actionUtils + */ extractAbbreviation: function(str) { var curOffset = str.length; var startIndex = -1; @@ -4406,11 +4406,11 @@ emmet.define("actionUtils", function(require, _) { }, /** - * Gets image size from image byte stream. - * @author http://romeda.org/rePublish/ - * @param {String} stream Image byte stream (use IEmmetFile.read()) - * @return {Object} Object with width and height properties - */ + * Gets image size from image byte stream. + * @author http://romeda.org/rePublish/ + * @param {String} stream Image byte stream (use IEmmetFile.read()) + * @return {Object} Object with width and height properties + */ getImageSize: function(stream) { var pngMagicNum = "\211PNG\r\n\032\n", jpgMagicNum = "\377\330", @@ -4465,11 +4465,11 @@ emmet.define("actionUtils", function(require, _) { }, /** - * Captures context XHTML element from editor under current caret position. - * This node can be used as a helper for abbreviation extraction - * @param {IEmmetEditor} editor - * @returns {Object} - */ + * Captures context XHTML element from editor under current caret position. + * This node can be used as a helper for abbreviation extraction + * @param {IEmmetEditor} editor + * @returns {Object} + */ captureContext: function(editor) { var allowedSyntaxes = { 'html': 1, 'xml': 1, 'xsl': 1 }; var syntax = String(editor.getSyntax()); @@ -4503,14 +4503,14 @@ emmet.define("actionUtils", function(require, _) { }, /** - * Find expression bounds in current editor at caret position. - * On each character a fn function will be called and must - * return true if current character meets requirements, - * false otherwise - * @param {IEmmetEditor} editor - * @param {Function} fn Function to test each character of expression - * @return {Range} - */ + * Find expression bounds in current editor at caret position. + * On each character a fn function will be called and must + * return true if current character meets requirements, + * false otherwise + * @param {IEmmetEditor} editor + * @param {Function} fn Function to test each character of expression + * @return {Range} + */ findExpressionBounds: function(editor, fn) { var content = String(editor.getContent()); var il = content.length; @@ -4529,10 +4529,10 @@ emmet.define("actionUtils", function(require, _) { }, /** - * @param {IEmmetEditor} editor - * @param {Object} data - * @returns {Boolean} - */ + * @param {IEmmetEditor} editor + * @param {Object} data + * @returns {Boolean} + */ compoundUpdate: function(editor, data) { if (data) { var sel = editor.getSelectionRange(); @@ -4545,13 +4545,13 @@ emmet.define("actionUtils", function(require, _) { }, /** - * Common syntax detection method for editors that doesn’t provide any - * info about current syntax scope. - * @param {IEmmetEditor} editor Current editor - * @param {String} hint Any syntax hint that editor can provide - * for syntax detection. Default is 'html' - * @returns {String} - */ + * Common syntax detection method for editors that doesn’t provide any + * info about current syntax scope. + * @param {IEmmetEditor} editor Current editor + * @param {String} hint Any syntax hint that editor can provide + * for syntax detection. Default is 'html' + * @returns {String} + */ detectSyntax: function(editor, hint) { var syntax = hint || "html"; @@ -4567,10 +4567,10 @@ emmet.define("actionUtils", function(require, _) { }, /** - * Common method for detecting output profile - * @param {IEmmetEditor} editor - * @returns {String} - */ + * Common method for detecting output profile + * @param {IEmmetEditor} editor + * @returns {String} + */ detectProfile: function(editor) { var syntax = editor.getSyntax(); @@ -4603,19 +4603,19 @@ emmet.define("actionUtils", function(require, _) { }, /** - * Tries to detect if current document is XHTML one. - * @param {IEmmetEditor} editor - * @returns {Boolean} - */ + * Tries to detect if current document is XHTML one. + * @param {IEmmetEditor} editor + * @returns {Boolean} + */ isXHTML: function(editor) { return editor.getContent().search(/]+XHTML/i) != -1; }, /** - * Check if current caret position is inside <style> tag - * @param {IEmmetEditor} editor - * @returns - */ + * Check if current caret position is inside <style> tag + * @param {IEmmetEditor} editor + * @returns + */ isStyle: function(editor) { var content = String(editor.getContent()); var caretPos = editor.getCaretPos(); @@ -4625,11 +4625,11 @@ emmet.define("actionUtils", function(require, _) { }, /** - * Check if current caret position is inside "style" attribute of HTML - * element - * @param {IEmmetEditor} editor - * @returns {Boolean} - */ + * Check if current caret position is inside "style" attribute of HTML + * element + * @param {IEmmetEditor} editor + * @returns {Boolean} + */ isInlineCSS: function(editor) { var content = String(editor.getContent()); var caretPos = editor.getCaretPos(); @@ -4651,20 +4651,20 @@ emmet.define("actionUtils", function(require, _) { emmet.define("abbreviationUtils", function(require, _) { return { /** - * Check if passed abbreviation node has matched snippet resource - * @param {AbbreviationNode} node - * @returns {Boolean} - * @memberOf abbreviationUtils - */ + * Check if passed abbreviation node has matched snippet resource + * @param {AbbreviationNode} node + * @returns {Boolean} + * @memberOf abbreviationUtils + */ isSnippet: function(node) { return require("elements").is(node.matchedResource(), "snippet"); }, /** - * Test if passed node is unary (no closing tag) - * @param {AbbreviationNode} node - * @return {Boolean} - */ + * Test if passed node is unary (no closing tag) + * @param {AbbreviationNode} node + * @return {Boolean} + */ isUnary: function(node) { if (node.children.length || node._text || this.isSnippet(node)) { return false; @@ -4675,10 +4675,10 @@ emmet.define("abbreviationUtils", function(require, _) { }, /** - * Test if passed node is inline-level (like <strong>, <img>) - * @param {AbbreviationNode} node - * @return {Boolean} - */ + * Test if passed node is inline-level (like <strong>, <img>) + * @param {AbbreviationNode} node + * @return {Boolean} + */ isInline: function(node) { return node.isTextNode() || !node.name() @@ -4686,38 +4686,38 @@ emmet.define("abbreviationUtils", function(require, _) { }, /** - * Test if passed node is block-level - * @param {AbbreviationNode} node - * @return {Boolean} - */ + * Test if passed node is block-level + * @param {AbbreviationNode} node + * @return {Boolean} + */ isBlock: function(node) { return this.isSnippet(node) || !this.isInline(node); }, /** - * Test if given node is a snippet - * @param {AbbreviationNode} node - * @return {Boolean} - */ + * Test if given node is a snippet + * @param {AbbreviationNode} node + * @return {Boolean} + */ isSnippet: function(node) { return require("elements").is(node.matchedResource(), "snippet"); }, /** - * This function tests if passed node content contains HTML tags. - * This function is mostly used for output formatting - * @param {AbbreviationNode} node - * @returns {Boolean} - */ + * This function tests if passed node content contains HTML tags. + * This function is mostly used for output formatting + * @param {AbbreviationNode} node + * @returns {Boolean} + */ hasTagsInContent: function(node) { return require("utils").matchesTag(node.content); }, /** - * Test if current element contains block-level children - * @param {AbbreviationNode} node - * @return {Boolean} - */ + * Test if current element contains block-level children + * @param {AbbreviationNode} node + * @return {Boolean} + */ hasBlockChildren: function(node) { return (this.hasTagsInContent(node) && this.isBlock(node)) || _.any(node.children, function(child) { @@ -4726,13 +4726,13 @@ emmet.define("abbreviationUtils", function(require, _) { }, /** - * Utility function that inserts content instead of ${child} - * variables on text - * @param {String} text Text where child content should be inserted - * @param {String} childContent Content to insert - * @param {Object} options - * @returns {String - */ + * Utility function that inserts content instead of ${child} + * variables on text + * @param {String} text Text where child content should be inserted + * @param {String} childContent Content to insert + * @param {Object} options + * @returns {String + */ insertChildContent: function(text, childContent, options) { options = _.extend({ keepVariable: true, @@ -4770,12 +4770,12 @@ emmet.define("base64", function(require, _) { return { /** - * Encodes data using base64 algorithm - * @author Tyler Akins (http://rumkin.com) - * @param {String} input - * @returns {String} - * @memberOf emmet.base64 - */ + * Encodes data using base64 algorithm + * @author Tyler Akins (http://rumkin.com) + * @param {String} input + * @returns {String} + * @memberOf emmet.base64 + */ encode: function(input) { var output = []; var chr1, chr2, chr3, enc1, enc2, enc3, enc4, cdp1, cdp2, cdp3; @@ -4809,12 +4809,12 @@ emmet.define("base64", function(require, _) { }, /** - * Decodes string using MIME base64 algorithm - * - * @author Tyler Akins (http://rumkin.com) - * @param {String} data - * @return {String} - */ + * Decodes string using MIME base64 algorithm + * + * @author Tyler Akins (http://rumkin.com) + * @param {String} data + * @return {String} + */ decode: function(data) { var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, tmpArr = []; var b64 = chars, il = data.length; @@ -4892,37 +4892,37 @@ emmet.define("htmlMatcher", function(require, _) { } /** - * Creates new tag matcher session - * @param {String} text - */ + * Creates new tag matcher session + * @param {String} text + */ function createMatcher(text) { var memo = {}, m; return { /** - * Test if given position matches opening tag - * @param {Number} i - * @returns {Object} Matched tag object - */ + * Test if given position matches opening tag + * @param {Number} i + * @returns {Object} Matched tag object + */ open: function(i) { var m = this.matches(i); return m && m.type == "open" ? m : null; }, /** - * Test if given position matches closing tag - * @param {Number} i - * @returns {Object} Matched tag object - */ + * Test if given position matches closing tag + * @param {Number} i + * @returns {Object} Matched tag object + */ close: function(i) { var m = this.matches(i); return m && m.type == "close" ? m : null; }, /** - * Matches either opening or closing tag for given position - * @param i - * @returns - */ + * Matches either opening or closing tag for given position + * @param i + * @returns + */ matches: function(i) { var key = "p" + i; @@ -4944,9 +4944,9 @@ emmet.define("htmlMatcher", function(require, _) { }, /** - * Returns original text - * @returns {String} - */ + * Returns original text + * @returns {String} + */ text: function() { return text; } @@ -4958,10 +4958,10 @@ emmet.define("htmlMatcher", function(require, _) { } /** - * Search for closing pair of opening tag - * @param {Object} open Open tag instance - * @param {Object} matcher Matcher instance - */ + * Search for closing pair of opening tag + * @param {Object} open Open tag instance + * @param {Object} matcher Matcher instance + */ function findClosingPair(open, matcher) { var stack = [], tag = null; var text = matcher.text(); @@ -5009,13 +5009,13 @@ emmet.define("htmlMatcher", function(require, _) { return { /** - * Main function: search for tag pair in text for given - * position - * @memberOf htmlMatcher - * @param {String} text - * @param {Number} pos - * @returns {Object} - */ + * Main function: search for tag pair in text for given + * position + * @memberOf htmlMatcher + * @param {String} text + * @param {Number} pos + * @returns {Object} + */ find: function(text, pos) { var range = require("range"); var matcher = createMatcher(text); @@ -5113,12 +5113,12 @@ emmet.define("htmlMatcher", function(require, _) { }, /** - * The same as find() method, but restricts matched result - * to tag type - * @param {String} text - * @param {Number} pos - * @returns {Object} - */ + * The same as find() method, but restricts matched result + * to tag type + * @param {String} text + * @param {Number} pos + * @returns {Object} + */ tag: function(text, pos) { var result = this.find(text, pos); if (result && result.type == "tag") { @@ -5141,9 +5141,9 @@ emmet.define("htmlMatcher", function(require, _) { */ emmet.define("tabStops", function(require, _) { /** - * Global placeholder value, automatically incremented by - * variablesResolver() function - */ + * Global placeholder value, automatically incremented by + * variablesResolver() function + */ var startPlaceholderNum = 100; var tabstopIndex = 0; @@ -5198,36 +5198,36 @@ emmet.define("tabStops", function(require, _) { return { /** - * Main function that looks for a tabstops in provided text - * and returns a processed version of text with expanded - * placeholders and list of tabstops found. - * @param {String} text Text to process - * @param {Object} options List of processor options:
- * - * replaceCarets : Boolean — replace all default - * caret placeholders (like {%::emmet-caret::%}) with ${0:caret}
- * - * escape : Function — function that handle escaped - * characters (mostly '$'). By default, it returns the character itself - * to be displayed as is in output, but sometimes you will use - * extract method as intermediate solution for further - * processing and want to keep character escaped. Thus, you should override - * escape method to return escaped symbol (e.g. '\\$')
- * - * tabstop : Function – a tabstop handler. Receives - * a single argument – an object describing token: its position, number - * group, placeholder and token itself. Should return a replacement - * string that will appear in final output - * - * variable : Function – variable handler. Receives - * a single argument – an object describing token: its position, name - * and original token itself. Should return a replacement - * string that will appear in final output - * - * @returns {Object} Object with processed text property - * and array of tabstops found - * @memberOf tabStops - */ + * Main function that looks for a tabstops in provided text + * and returns a processed version of text with expanded + * placeholders and list of tabstops found. + * @param {String} text Text to process + * @param {Object} options List of processor options:
+ * + * replaceCarets : Boolean — replace all default + * caret placeholders (like {%::emmet-caret::%}) with ${0:caret}
+ * + * escape : Function — function that handle escaped + * characters (mostly '$'). By default, it returns the character itself + * to be displayed as is in output, but sometimes you will use + * extract method as intermediate solution for further + * processing and want to keep character escaped. Thus, you should override + * escape method to return escaped symbol (e.g. '\\$')
+ * + * tabstop : Function – a tabstop handler. Receives + * a single argument – an object describing token: its position, number + * group, placeholder and token itself. Should return a replacement + * string that will appear in final output + * + * variable : Function – variable handler. Receives + * a single argument – an object describing token: its position, name + * and original token itself. Should return a replacement + * string that will appear in final output + * + * @returns {Object} Object with processed text property + * and array of tabstops found + * @memberOf tabStops + */ extract: function(text, options) { // prepare defaults var utils = require("utils"); @@ -5299,14 +5299,14 @@ emmet.define("tabStops", function(require, _) { }, /** - * Text processing routine. Locates escaped characters and tabstops and - * replaces them with values returned by handlers defined in - * options - * @param {String} text - * @param {Object} options See extract method options - * description - * @returns {String} - */ + * Text processing routine. Locates escaped characters and tabstops and + * replaces them with values returned by handlers defined in + * options + * @param {String} text + * @param {Object} options See extract method options + * description + * @returns {String} + */ processText: function(text, options) { options = _.extend({}, defaultOptions, options); @@ -5370,11 +5370,11 @@ emmet.define("tabStops", function(require, _) { }, /** - * Upgrades tabstops in output node in order to prevent naming conflicts - * @param {AbbreviationNode} node - * @param {Number} offset Tab index offset - * @returns {Number} Maximum tabstop index in element - */ + * Upgrades tabstops in output node in order to prevent naming conflicts + * @param {AbbreviationNode} node + * @param {Number} offset Tab index offset + * @returns {Number} Maximum tabstop index in element + */ upgrade: function(node, offset) { var maxNum = 0; var options = { @@ -5397,14 +5397,14 @@ emmet.define("tabStops", function(require, _) { }, /** - * Helper function that produces a callback function for - * replaceVariables() method from {@link utils} - * module. This callback will replace variable definitions (like - * ${var_name}) with their value defined in resource module, - * or outputs tabstop with variable name otherwise. - * @param {AbbreviationNode} node Context node - * @returns {Function} - */ + * Helper function that produces a callback function for + * replaceVariables() method from {@link utils} + * module. This callback will replace variable definitions (like + * ${var_name}) with their value defined in resource module, + * or outputs tabstop with variable name otherwise. + * @param {AbbreviationNode} node Context node + * @returns {Function} + */ variablesResolver: function(node) { var placeholderMemo = {}; var res = require("resources"); @@ -5435,18 +5435,18 @@ emmet.define("tabStops", function(require, _) { }, /** - * Resets global tabstop index. When parsed tree is converted to output - * string (AbbreviationNode.toString()), all tabstops - * defined in snippets and elements are upgraded in order to prevent - * naming conflicts of nested. For example, ${1} of a node - * should not be linked with the same placehilder of the child node. - * By default, AbbreviationNode.toString() automatically - * upgrades tabstops of the same index for each node and writes maximum - * tabstop index into the tabstopIndex variable. To keep - * this variable at reasonable value, it is recommended to call - * resetTabstopIndex() method each time you expand variable - * @returns - */ + * Resets global tabstop index. When parsed tree is converted to output + * string (AbbreviationNode.toString()), all tabstops + * defined in snippets and elements are upgraded in order to prevent + * naming conflicts of nested. For example, ${1} of a node + * should not be linked with the same placehilder of the child node. + * By default, AbbreviationNode.toString() automatically + * upgrades tabstops of the same index for each node and writes maximum + * tabstop index into the tabstopIndex variable. To keep + * this variable at reasonable value, it is recommended to call + * resetTabstopIndex() method each time you expand variable + * @returns + */ resetTabstopIndex: function() { tabstopIndex = 0; startPlaceholderNum = 100; @@ -5488,13 +5488,13 @@ emmet.define("preferences", function(require, _) { return { /** - * Creates new preference item with default value - * @param {String} name Preference name. You can also pass object - * with many options - * @param {Object} value Preference default value - * @param {String} description Item textual description - * @memberOf preferences - */ + * Creates new preference item with default value + * @param {String} name Preference name. You can also pass object + * with many options + * @param {Object} value Preference default value + * @param {String} description Item textual description + * @memberOf preferences + */ define: function(name, value, description) { var prefs = name; if (_.isString(name)) { @@ -5511,13 +5511,13 @@ emmet.define("preferences", function(require, _) { }, /** - * Updates preference item value. Preference value should be defined - * first with define method. - * @param {String} name Preference name. You can also pass object - * with many options - * @param {Object} value Preference default value - * @memberOf preferences - */ + * Updates preference item value. Preference value should be defined + * first with define method. + * @param {String} name Preference name. You can also pass object + * with many options + * @param {Object} value Preference default value + * @memberOf preferences + */ set: function(name, value) { var prefs = name; if (_.isString(name)) { @@ -5554,11 +5554,11 @@ emmet.define("preferences", function(require, _) { }, /** - * Returns preference value - * @param {String} name - * @returns {String} Returns undefined if preference is - * not defined - */ + * Returns preference value + * @param {String} name + * @returns {String} Returns undefined if preference is + * not defined + */ get: function(name) { if (name in preferences) return preferences[name]; @@ -5570,11 +5570,11 @@ emmet.define("preferences", function(require, _) { }, /** - * Returns comma-separated preference value as array of values - * @param {String} name - * @returns {Array} Returns undefined if preference is - * not defined, null if string cannot be converted to array - */ + * Returns comma-separated preference value as array of values + * @param {String} name + * @returns {Array} Returns undefined if preference is + * not defined, null if string cannot be converted to array + */ getArray: function(name) { var val = this.get(name); if (_.isUndefined(val) || val === null || val === "") { @@ -5590,10 +5590,10 @@ emmet.define("preferences", function(require, _) { }, /** - * Returns comma and colon-separated preference value as dictionary - * @param {String} name - * @returns {Object} - */ + * Returns comma and colon-separated preference value as dictionary + * @param {String} name + * @returns {Object} + */ getDict: function(name) { var result = {}; _.each(this.getArray(name), function(val) { @@ -5605,18 +5605,18 @@ emmet.define("preferences", function(require, _) { }, /** - * Returns description of preference item - * @param {String} name Preference name - * @returns {Object} - */ + * Returns description of preference item + * @param {String} name Preference name + * @returns {Object} + */ description: function(name) { return name in defaults ? defaults[name].description : void 0; }, /** - * Completely removes specified preference(s) - * @param {String} name Preference name (or array of names) - */ + * Completely removes specified preference(s) + * @param {String} name Preference name (or array of names) + */ remove: function(name) { if (!_.isArray(name)) name = [name]; @@ -5631,9 +5631,9 @@ emmet.define("preferences", function(require, _) { }, /** - * Returns sorted list of all available properties - * @returns {Array} - */ + * Returns sorted list of all available properties + * @returns {Array} + */ list: function() { return _.map(_.keys(defaults).sort(), function(key) { return { @@ -5646,10 +5646,10 @@ emmet.define("preferences", function(require, _) { }, /** - * Loads user-defined preferences from JSON - * @param {Object} json - * @returns - */ + * Loads user-defined preferences from JSON + * @param {Object} json + * @returns + */ load: function(json) { _.each(json, function(value, key) { this.set(key, value); @@ -5657,24 +5657,24 @@ emmet.define("preferences", function(require, _) { }, /** - * Returns hash of user-modified preferences - * @returns {Object} - */ + * Returns hash of user-modified preferences + * @returns {Object} + */ exportModified: function() { return _.clone(preferences); }, /** - * Reset to defaults - * @returns - */ + * Reset to defaults + * @returns + */ reset: function() { preferences = {}; }, /** - * For unit testing: use empty storage - */ + * For unit testing: use empty storage + */ _startTest: function() { _dbgDefaults = defaults; _dbgPreferences = preferences; @@ -5683,8 +5683,8 @@ emmet.define("preferences", function(require, _) { }, /** - * For unit testing: restore original storage - */ + * For unit testing: restore original storage + */ _stopTest: function() { defaults = _dbgDefaults; preferences = _dbgPreferences; @@ -5715,25 +5715,25 @@ emmet.define("filters", function(require, _) { return { /** - * Register new filter - * @param {String} name Filter name - * @param {Function} fn Filter function - */ + * Register new filter + * @param {String} name Filter name + * @param {Function} fn Filter function + */ add: function(name, fn) { registeredFilters[name] = fn; }, /** - * Apply filters for final output tree - * @param {AbbreviationNode} tree Output tree - * @param {Array} filters List of filters to apply. Might be a - * String - * @param {Object} profile Output profile, defined in profile - * module. Filters defined it profile are not used, profile - * is passed to filter function - * @memberOf emmet.filters - * @returns {AbbreviationNode} - */ + * Apply filters for final output tree + * @param {AbbreviationNode} tree Output tree + * @param {Array} filters List of filters to apply. Might be a + * String + * @param {Object} profile Output profile, defined in profile + * module. Filters defined it profile are not used, profile + * is passed to filter function + * @memberOf emmet.filters + * @returns {AbbreviationNode} + */ apply: function(tree, filters, profile) { var utils = require("utils"); profile = require("profile").get(profile); @@ -5749,14 +5749,14 @@ emmet.define("filters", function(require, _) { }, /** - * Composes list of filters that should be applied to a tree, based on - * passed data - * @param {String} syntax Syntax name ('html', 'css', etc.) - * @param {Object} profile Output profile - * @param {String} additionalFilters List or pipe-separated - * string of additional filters to apply - * @returns {Array} - */ + * Composes list of filters that should be applied to a tree, based on + * passed data + * @param {String} syntax Syntax name ('html', 'css', etc.) + * @param {Object} profile Output profile + * @param {String} additionalFilters List or pipe-separated + * string of additional filters to apply + * @returns {Array} + */ composeList: function(syntax, profile, additionalFilters) { profile = require("profile").get(profile); var filters = list(profile.filters || require("resources").findItem(syntax, "filters") || basicFilters); @@ -5778,11 +5778,11 @@ emmet.define("filters", function(require, _) { }, /** - * Extracts filter list from abbreviation - * @param {String} abbr - * @returns {Array} Array with cleaned abbreviation and list of - * extracted filters - */ + * Extracts filter list from abbreviation + * @param {String} abbr + * @returns {Array} Array with cleaned abbreviation and list of + * extracted filters + */ extractFromAbbreviation: function(abbr) { var filters = ""; abbr = abbr.replace(/\|([\w\|\-]+)$/, function(str, p1) { @@ -5804,14 +5804,14 @@ emmet.define("elements", function(require, _) { var result = { /** - * Create new element factory - * @param {String} name Element identifier - * @param {Function} factory Function that produces element of specified - * type. The object generated by this factory is automatically - * augmented with type property pointing to element - * name - * @memberOf elements - */ + * Create new element factory + * @param {String} name Element identifier + * @param {Function} factory Function that produces element of specified + * type. The object generated by this factory is automatically + * augmented with type property pointing to element + * name + * @memberOf elements + */ add: function(name, factory) { var that = this; factories[name] = function() { @@ -5824,19 +5824,19 @@ emmet.define("elements", function(require, _) { }, /** - * Returns factory for specified name - * @param {String} name - * @returns {Function} - */ + * Returns factory for specified name + * @param {String} name + * @returns {Function} + */ get: function(name) { return factories[name]; }, /** - * Creates new element with specified type - * @param {String} name - * @returns {Object} - */ + * Creates new element with specified type + * @param {String} name + * @returns {Object} + */ create: function(name) { var args = [].slice.call(arguments, 1); var factory = this.get(name); @@ -5844,11 +5844,11 @@ emmet.define("elements", function(require, _) { }, /** - * Check if passed element is of specified type - * @param {Object} elem - * @param {String} type - * @returns {Boolean} - */ + * Check if passed element is of specified type + * @param {Object} elem + * @param {String} type + * @returns {Boolean} + */ is: function(elem, type) { return elem && elem.type === type; } @@ -5860,13 +5860,13 @@ emmet.define("elements", function(require, _) { } /** - * Element factory - * @param {String} elementName Name of output element - * @param {String} attrs Attributes definition. You may also pass - * Array where each contains object with name - * and value properties, or Object - * @param {Boolean} isEmpty Is expanded element should be empty - */ + * Element factory + * @param {String} elementName Name of output element + * @param {String} attrs Attributes definition. You may also pass + * Array where each contains object with name + * and value properties, or Object + * @param {Boolean} isEmpty Is expanded element should be empty + */ result.add("element", function(elementName, attrs, isEmpty) { var ret = { /** @memberOf __emmetDataElement */ @@ -5942,29 +5942,29 @@ emmet.define("editTree", function(require, _, core) { var range = require("range").create; /** - * Named container of edited source - * @type EditContainer - * @param {String} source - * @param {Object} options - */ + * Named container of edited source + * @type EditContainer + * @param {String} source + * @param {Object} options + */ function EditContainer(source, options) { this.options = _.extend({ offset: 0 }, options); /** - * Source code of edited structure. All changes in the structure are - * immediately reflected into this property - */ + * Source code of edited structure. All changes in the structure are + * immediately reflected into this property + */ this.source = source; /** - * List of all editable children - * @private - */ + * List of all editable children + * @private + */ this._children = []; /** - * Hash of all positions of container - * @private - */ + * Hash of all positions of container + * @private + */ this._positions = { name: 0 }; @@ -5973,24 +5973,24 @@ emmet.define("editTree", function(require, _, core) { } /** - * The self-propagating extend function for classes. - * @type Function - */ + * The self-propagating extend function for classes. + * @type Function + */ EditContainer.extend = core.extend; EditContainer.prototype = { /** - * Child class constructor - */ + * Child class constructor + */ initialize: function() {}, /** - * Replace substring of tag's source - * @param {String} value - * @param {Number} start - * @param {Number} end - * @private - */ + * Replace substring of tag's source + * @param {String} value + * @param {Number} start + * @param {Number} end + * @private + */ _updateSource: function(value, start, end) { // create modification range var r = range(start, _.isUndefined(end) ? 0 : end - start); @@ -6016,13 +6016,13 @@ emmet.define("editTree", function(require, _, core) { /** - * Adds new attribute - * @param {String} name Property name - * @param {String} value Property value - * @param {Number} pos Position at which to insert new property. By - * default the property is inserted at the end of rule - * @returns {EditElement} Newly created element - */ + * Adds new attribute + * @param {String} name Property name + * @param {String} value Property value + * @param {Number} pos Position at which to insert new property. By + * default the property is inserted at the end of rule + * @returns {EditElement} Newly created element + */ add: function(name, value, pos) { // this is abstract implementation var item = new EditElement(name, value); @@ -6031,10 +6031,10 @@ emmet.define("editTree", function(require, _, core) { }, /** - * Returns attribute object - * @param {String} name Attribute name or its index - * @returns {EditElement} - */ + * Returns attribute object + * @param {String} name Attribute name or its index + * @returns {EditElement} + */ get: function(name) { if (_.isNumber(name)) return this.list()[name]; @@ -6048,11 +6048,11 @@ emmet.define("editTree", function(require, _, core) { }, /** - * Returns all children by name or indexes - * @param {Object} name Element name(s) or indexes (String, - * Array, Number) - * @returns {Array} - */ + * Returns all children by name or indexes + * @param {Object} name Element name(s) or indexes (String, + * Array, Number) + * @returns {Array} + */ getAll: function(name) { if (!_.isArray(name)) name = [name]; @@ -6072,12 +6072,12 @@ emmet.define("editTree", function(require, _, core) { }, /** - * Returns or updates element value. If such element doesn't exists, - * it will be created automatically and added at the end of child list. - * @param {String} name Element name or its index - * @param {String} value New element value - * @returns {String} - */ + * Returns or updates element value. If such element doesn't exists, + * it will be created automatically and added at the end of child list. + * @param {String} name Element name or its index + * @param {String} value New element value + * @returns {String} + */ value: function(name, value, pos) { var element = this.get(name); if (element) @@ -6090,12 +6090,12 @@ emmet.define("editTree", function(require, _, core) { }, /** - * Returns all values of child elements found by getAll() - * method - * @param {Object} name Element name(s) or indexes (String, - * Array, Number) - * @returns {Array} - */ + * Returns all values of child elements found by getAll() + * method + * @param {Object} name Element name(s) or indexes (String, + * Array, Number) + * @returns {Array} + */ values: function(name) { return _.map(this.getAll(name), function(element) { return element.value(); @@ -6103,9 +6103,9 @@ emmet.define("editTree", function(require, _, core) { }, /** - * Remove child element - * @param {String} name Property name or its index - */ + * Remove child element + * @param {String} name Property name or its index + */ remove: function(name) { var element = this.get(name); if (element) { @@ -6115,28 +6115,28 @@ emmet.define("editTree", function(require, _, core) { }, /** - * Returns list of all editable child elements - * @returns {Array} - */ + * Returns list of all editable child elements + * @returns {Array} + */ list: function() { return this._children; }, /** - * Returns index of editble child in list - * @param {Object} item - * @returns {Number} - */ + * Returns index of editble child in list + * @param {Object} item + * @returns {Number} + */ indexOf: function(item) { return _.indexOf(this.list(), this.get(item)); }, /** - * Sets or gets container name - * @param {String} val New name. If not passed, current - * name is returned - * @return {String} - */ + * Sets or gets container name + * @param {String} val New name. If not passed, current + * name is returned + * @return {String} + */ name: function(val) { if (!_.isUndefined(val) && this._name !== (val = String(val))) { this._updateSource(val, this._positions.name, this._positions.name + this._name.length); @@ -6147,29 +6147,29 @@ emmet.define("editTree", function(require, _, core) { }, /** - * Returns name range object - * @param {Boolean} isAbsolute Return absolute range (with respect of - * rule offset) - * @returns {Range} - */ + * Returns name range object + * @param {Boolean} isAbsolute Return absolute range (with respect of + * rule offset) + * @returns {Range} + */ nameRange: function(isAbsolute) { return range(this._positions.name + (isAbsolute ? this.options.offset : 0), this.name()); }, /** - * Returns range of current source - * @param {Boolean} isAbsolute - */ + * Returns range of current source + * @param {Boolean} isAbsolute + */ range: function(isAbsolute) { return range(isAbsolute ? this.options.offset : 0, this.toString()); }, /** - * Returns element that belongs to specified position - * @param {Number} pos - * @param {Boolean} isAbsolute - * @returns {EditElement} - */ + * Returns element that belongs to specified position + * @param {Number} pos + * @param {Boolean} isAbsolute + * @returns {EditElement} + */ itemFromPosition: function(pos, isAbsolute) { return _.find(this.list(), function(elem) { return elem.range(isAbsolute).inside(pos); @@ -6177,19 +6177,19 @@ emmet.define("editTree", function(require, _, core) { }, /** - * Returns source code of current container - * @returns {String} - */ + * Returns source code of current container + * @returns {String} + */ toString: function() { return this.source; } }; /** - * @param {EditContainer} parent - * @param {Object} nameToken - * @param {Object} valueToken - */ + * @param {EditContainer} parent + * @param {Object} nameToken + * @param {Object} valueToken + */ function EditElement(parent, nameToken, valueToken) { /** @type EditContainer */ this.parent = parent; @@ -6206,34 +6206,34 @@ emmet.define("editTree", function(require, _, core) { } /** - * The self-propagating extend function for classes. - * @type Function - */ + * The self-propagating extend function for classes. + * @type Function + */ EditElement.extend = core.extend; EditElement.prototype = { /** - * Child class constructor - */ + * Child class constructor + */ initialize: function() {}, /** - * Make position absolute - * @private - * @param {Number} num - * @param {Boolean} isAbsolute - * @returns {Boolean} - */ + * Make position absolute + * @private + * @param {Number} num + * @param {Boolean} isAbsolute + * @returns {Boolean} + */ _pos: function(num, isAbsolute) { return num + (isAbsolute ? this.parent.options.offset : 0); }, /** - * Sets of gets element value - * @param {String} val New element value. If not passed, current - * value is returned - * @returns {String} - */ + * Sets of gets element value + * @param {String} val New element value. If not passed, current + * value is returned + * @returns {String} + */ value: function(val) { if (!_.isUndefined(val) && this._value !== (val = String(val))) { this.parent._updateSource(val, this.valueRange()); @@ -6244,11 +6244,11 @@ emmet.define("editTree", function(require, _, core) { }, /** - * Sets of gets element name - * @param {String} val New element name. If not passed, current - * name is returned - * @returns {String} - */ + * Sets of gets element name + * @param {String} val New element name. If not passed, current + * name is returned + * @returns {String} + */ name: function(val) { if (!_.isUndefined(val) && this._name !== (val = String(val))) { this.parent._updateSource(val, this.nameRange()); @@ -6259,63 +6259,63 @@ emmet.define("editTree", function(require, _, core) { }, /** - * Returns position of element name token - * @param {Boolean} isAbsolute Return absolute position - * @returns {Number} - */ + * Returns position of element name token + * @param {Boolean} isAbsolute Return absolute position + * @returns {Number} + */ namePosition: function(isAbsolute) { return this._pos(this._positions.name, isAbsolute); }, /** - * Returns position of element value token - * @param {Boolean} isAbsolute Return absolute position - * @returns {Number} - */ + * Returns position of element value token + * @param {Boolean} isAbsolute Return absolute position + * @returns {Number} + */ valuePosition: function(isAbsolute) { return this._pos(this._positions.value, isAbsolute); }, /** - * Returns element name - * @param {Boolean} isAbsolute Return absolute range - * @returns {Range} - */ + * Returns element name + * @param {Boolean} isAbsolute Return absolute range + * @returns {Range} + */ range: function(isAbsolute) { return range(this.namePosition(isAbsolute), this.toString()); }, /** - * Returns full element range, including possible indentation - * @param {Boolean} isAbsolute Return absolute range - * @returns {Range} - */ + * Returns full element range, including possible indentation + * @param {Boolean} isAbsolute Return absolute range + * @returns {Range} + */ fullRange: function(isAbsolute) { return this.range(isAbsolute); }, /** - * Returns element name range - * @param {Boolean} isAbsolute Return absolute range - * @returns {Range} - */ + * Returns element name range + * @param {Boolean} isAbsolute Return absolute range + * @returns {Range} + */ nameRange: function(isAbsolute) { return range(this.namePosition(isAbsolute), this.name()); }, /** - * Returns element value range - * @param {Boolean} isAbsolute Return absolute range - * @returns {Range} - */ + * Returns element value range + * @param {Boolean} isAbsolute Return absolute range + * @returns {Range} + */ valueRange: function(isAbsolute) { return range(this.valuePosition(isAbsolute), this.value()); }, /** - * Returns current element string representation - * @returns {String} - */ + * Returns current element string representation + * @returns {String} + */ toString: function() { return this.name() + this.value(); }, @@ -6330,12 +6330,12 @@ emmet.define("editTree", function(require, _, core) { EditElement: EditElement, /** - * Creates token that can be fed to EditElement - * @param {Number} start - * @param {String} value - * @param {String} type - * @returns - */ + * Creates token that can be fed to EditElement + * @param {Number} start + * @param {String} value + * @param {String} type + * @returns + */ createToken: function(start, value, type) { var obj = { start: start || 0, @@ -6368,22 +6368,22 @@ emmet.define("cssEditTree", function(require, _) { var WHITESPACE_REMOVE_FROM_END = 2; /** - * Returns range object - * @param {Number} start - * @param {Number} len - * @returns {Range} - */ + * Returns range object + * @param {Number} start + * @param {Number} len + * @returns {Range} + */ function range(start, len) { return require("range").create(start, len); } /** - * Removes whitespace tokens from the array ends - * @param {Array} tokens - * @param {Number} mask Mask indicating from which end whitespace should be - * removed - * @returns {Array} - */ + * Removes whitespace tokens from the array ends + * @param {Array} tokens + * @param {Number} mask Mask indicating from which end whitespace should be + * removed + * @returns {Array} + */ function trimWhitespaceTokens(tokens, mask) { mask = mask || (WHITESPACE_REMOVE_FROM_START | WHITESPACE_REMOVE_FROM_END); var whitespace = ["white", "line"]; @@ -6402,10 +6402,10 @@ emmet.define("cssEditTree", function(require, _) { } /** - * Helper function that searches for selector range for CSSEditRule - * @param {TokenIterator} it - * @returns {Range} - */ + * Helper function that searches for selector range for CSSEditRule + * @param {TokenIterator} it + * @returns {Range} + */ function findSelectorRange(it) { var tokens = [], token; var start = it.position(), end; @@ -6429,11 +6429,11 @@ emmet.define("cssEditTree", function(require, _) { } /** - * Helper function that searches for CSS property value range next to - * iterator's current position - * @param {TokenIterator} it - * @returns {Range} - */ + * Helper function that searches for CSS property value range next to + * iterator's current position + * @param {TokenIterator} it + * @returns {Range} + */ function findValueRange(it) { // find value start position var skipTokens = ["white", "line", ":"]; @@ -6471,10 +6471,10 @@ emmet.define("cssEditTree", function(require, _) { } /** - * Finds parts of complex CSS value - * @param {String} str - * @returns {Array} Returns list of Range's - */ + * Finds parts of complex CSS value + * @param {String} str + * @returns {Array} Returns list of Range's + */ function findParts(str) { /** @type StringStream */ var stream = require("stringStream").create(str); @@ -6525,12 +6525,12 @@ emmet.define("cssEditTree", function(require, _) { } /** - * A bit hacky way to identify invalid CSS property definition: when user - * starts writing new abbreviation in CSS rule, he actually creates invalid - * CSS property definition and this method tries to identify such abbreviation - * and prevent it from being added to CSS edit tree - * @param {TokenIterator} it - */ + * A bit hacky way to identify invalid CSS property definition: when user + * starts writing new abbreviation in CSS rule, he actually creates invalid + * CSS property definition and this method tries to identify such abbreviation + * and prevent it from being added to CSS edit tree + * @param {TokenIterator} it + */ function isValidIdentifier(it) { // return true; var tokens = it.tokens; @@ -6546,9 +6546,9 @@ emmet.define("cssEditTree", function(require, _) { } /** - * @class - * @extends EditContainer - */ + * @class + * @extends EditContainer + */ var CSSEditContainer = require("editTree").EditContainer.extend({ initialize: function(source, options) { _.defaults(this.options, defaultOptions); @@ -6588,9 +6588,9 @@ emmet.define("cssEditTree", function(require, _) { }, /** - * Remembers all styles of properties - * @private - */ + * Remembers all styles of properties + * @private + */ _saveStyle: function() { var start = this._positions.contentStart; var source = this.source; @@ -6621,13 +6621,13 @@ emmet.define("cssEditTree", function(require, _) { }, /** - * Adds new CSS property - * @param {String} name Property name - * @param {String} value Property value - * @param {Number} pos Position at which to insert new property. By - * default the property is inserted at the end of rule - * @returns {CSSEditProperty} - */ + * Adds new CSS property + * @param {String} name Property name + * @param {String} value Property value + * @param {Number} pos Position at which to insert new property. By + * default the property is inserted at the end of rule + * @returns {CSSEditProperty} + */ add: function(name, value, pos) { var list = this.list(); var start = this._positions.contentStart; @@ -6669,10 +6669,10 @@ emmet.define("cssEditTree", function(require, _) { }); /** - * @class - * @type CSSEditElement - * @constructor - */ + * @class + * @type CSSEditElement + * @constructor + */ var CSSEditElement = require("editTree").EditElement.extend({ initialize: function(rule, name, value, end) { this.styleBefore = rule.options.styleBefore; @@ -6683,9 +6683,9 @@ emmet.define("cssEditTree", function(require, _) { }, /** - * Returns ranges of complex value parts - * @returns {Array} Returns null if value is not complex - */ + * Returns ranges of complex value parts + * @returns {Array} Returns null if value is not complex + */ valueParts: function(isAbsolute) { var parts = findParts(this.value()); if (isAbsolute) { @@ -6699,10 +6699,10 @@ emmet.define("cssEditTree", function(require, _) { }, /** - * Sets of gets property end value (basically, it's a semicolon) - * @param {String} val New end value. If not passed, current - * value is returned - */ + * Sets of gets property end value (basically, it's a semicolon) + * @param {String} val New end value. If not passed, current + * value is returned + */ end: function(val) { if (!_.isUndefined(val) && this._end !== val) { this.parent._updateSource(val, this._positions.end, this._positions.end + this._end.length); @@ -6713,11 +6713,11 @@ emmet.define("cssEditTree", function(require, _) { }, /** - * Returns full rule range, with indentation - * @param {Boolean} isAbsolute Return absolute range (with respect of - * rule offset) - * @returns {Range} - */ + * Returns full rule range, with indentation + * @param {Boolean} isAbsolute Return absolute range (with respect of + * rule offset) + * @returns {Range} + */ fullRange: function(isAbsolute) { var r = this.range(isAbsolute); r.start -= this.styleBefore.length; @@ -6725,9 +6725,9 @@ emmet.define("cssEditTree", function(require, _) { }, /** - * Returns item string representation - * @returns {String} - */ + * Returns item string representation + * @returns {String} + */ toString: function() { return this.name() + this.styleSeparator + this.value() + this.end(); } @@ -6735,22 +6735,22 @@ emmet.define("cssEditTree", function(require, _) { return { /** - * Parses CSS rule into editable tree - * @param {String} source - * @param {Object} options - * @memberOf emmet.cssEditTree - * @returns {EditContainer} - */ + * Parses CSS rule into editable tree + * @param {String} source + * @param {Object} options + * @memberOf emmet.cssEditTree + * @returns {EditContainer} + */ parse: function(source, options) { return new CSSEditContainer(source, options); }, /** - * Extract and parse CSS rule from specified position in content - * @param {String} content CSS source code - * @param {Number} pos Character position where to start source code extraction - * @returns {EditContainer} - */ + * Extract and parse CSS rule from specified position in content + * @param {String} content CSS source code + * @param {Number} pos Character position where to start source code extraction + * @returns {EditContainer} + */ parseFromPosition: function(content, pos, isBackward) { var bounds = this.extractRule(content, pos, isBackward); if (!bounds || !bounds.inside(pos)) @@ -6763,11 +6763,11 @@ emmet.define("cssEditTree", function(require, _) { }, /** - * Extracts single CSS selector definition from source code - * @param {String} content CSS source code - * @param {Number} pos Character position where to start source code extraction - * @returns {Range} - */ + * Extracts single CSS selector definition from source code + * @param {String} content CSS source code + * @param {Number} pos Character position where to start source code extraction + * @returns {Range} + */ extractRule: function(content, pos, isBackward) { var result = ""; var len = content.length; @@ -6822,19 +6822,19 @@ emmet.define("cssEditTree", function(require, _) { }, /** - * Removes vendor prefix from CSS property - * @param {String} name CSS property - * @return {String} - */ + * Removes vendor prefix from CSS property + * @param {String} name CSS property + * @return {String} + */ baseName: function(name) { return name.replace(/^\s*\-\w+\-/, ""); }, /** - * Finds parts of complex CSS value - * @param {String} str - * @returns {Array} - */ + * Finds parts of complex CSS value + * @param {String} str + * @returns {Array} + */ findParts: findParts }; }); /** @@ -6899,9 +6899,9 @@ emmet.define("xmlEditTree", function(require, _) { }, /** - * Remembers all styles of properties - * @private - */ + * Remembers all styles of properties + * @private + */ _saveStyle: function() { var start = this.nameRange().end; var source = this.source; @@ -6918,12 +6918,12 @@ emmet.define("xmlEditTree", function(require, _) { }, /** - * Adds new attribute - * @param {String} name Property name - * @param {String} value Property value - * @param {Number} pos Position at which to insert new property. By - * default the property is inserted at the end of rule - */ + * Adds new attribute + * @param {String} name Property name + * @param {String} value Property value + * @param {Number} pos Position at which to insert new property. By + * default the property is inserted at the end of rule + */ add: function(name, value, pos) { var list = this.list(); var start = this.nameRange().end; @@ -6992,11 +6992,11 @@ emmet.define("xmlEditTree", function(require, _) { }, /** - * Returns full rule range, with indentation - * @param {Boolean} isAbsolute Return absolute range (with respect of - * rule offset) - * @returns {Range} - */ + * Returns full rule range, with indentation + * @param {Boolean} isAbsolute Return absolute range (with respect of + * rule offset) + * @returns {Range} + */ fullRange: function(isAbsolute) { var r = this.range(isAbsolute); r.start -= this.styleBefore.length; @@ -7011,22 +7011,22 @@ emmet.define("xmlEditTree", function(require, _) { return { /** - * Parses HTML element into editable tree - * @param {String} source - * @param {Object} options - * @memberOf emmet.htmlEditTree - * @returns {EditContainer} - */ + * Parses HTML element into editable tree + * @param {String} source + * @param {Object} options + * @memberOf emmet.htmlEditTree + * @returns {EditContainer} + */ parse: function(source, options) { return new XMLEditContainer(source, options); }, /** - * Extract and parse HTML from specified position in content - * @param {String} content CSS source code - * @param {Number} pos Character position where to start source code extraction - * @returns {XMLEditElement} - */ + * Extract and parse HTML from specified position in content + * @param {String} content CSS source code + * @param {Number} pos Character position where to start source code extraction + * @returns {XMLEditElement} + */ parseFromPosition: function(content, pos, isBackward) { var bounds = this.extractTag(content, pos, isBackward); if (!bounds || !bounds.inside(pos)) @@ -7039,13 +7039,13 @@ emmet.define("xmlEditTree", function(require, _) { }, /** - * Extracts nearest HTML tag range from content, starting at - * pos position - * @param {String} content - * @param {Number} pos - * @param {Boolean} isBackward - * @returns {Range} - */ + * Extracts nearest HTML tag range from content, starting at + * pos position + * @param {String} content + * @param {Number} pos + * @param {Boolean} isBackward + * @returns {Range} + */ extractTag: function(content, pos, isBackward) { var len = content.length, i; var range = require("range"); @@ -7097,8 +7097,8 @@ emmet.define("xmlEditTree", function(require, _) { */ emmet.define("expandAbbreviation", function(require, _) { /** - * @type HandlerList List of registered handlers - */ + * @type HandlerList List of registered handlers + */ var handlers = require("handlerList").create(); /** Back-reference to module */ @@ -7106,13 +7106,13 @@ emmet.define("expandAbbreviation", function(require, _) { var actions = require("actions"); /** - * 'Expand abbreviation' editor action - * @param {IEmmetEditor} editor Editor instance - * @param {String} syntax Syntax type (html, css, etc.) - * @param {String} profile Output profile name (html, xml, xhtml) - * @return {Boolean} Returns true if abbreviation was expanded - * successfully - */ + * 'Expand abbreviation' editor action + * @param {IEmmetEditor} editor Editor instance + * @param {String} syntax Syntax type (html, css, etc.) + * @param {String} profile Output profile name (html, xml, xhtml) + * @return {Boolean} Returns true if abbreviation was expanded + * successfully + */ actions.add("expand_abbreviation", function(editor, syntax, profile) { var args = _.toArray(arguments); @@ -7125,12 +7125,12 @@ emmet.define("expandAbbreviation", function(require, _) { }); /** - * A special version of expandAbbreviation function: if it can't - * find abbreviation, it will place Tab character at caret position - * @param {IEmmetEditor} editor Editor instance - * @param {String} syntax Syntax type (html, css, etc.) - * @param {String} profile Output profile name (html, xml, xhtml) - */ + * A special version of expandAbbreviation function: if it can't + * find abbreviation, it will place Tab character at caret position + * @param {IEmmetEditor} editor Editor instance + * @param {String} syntax Syntax type (html, css, etc.) + * @param {String} profile Output profile name (html, xml, xhtml) + */ actions.add("expand_abbreviation_with_tab", function(editor, syntax, profile) { var sel = editor.getSelection(); var indent = require("resources").getVariable("indentation"); @@ -7156,14 +7156,14 @@ emmet.define("expandAbbreviation", function(require, _) { // XXX setup default handler /** - * Extracts abbreviation from current caret - * position and replaces it with formatted output - * @param {IEmmetEditor} editor Editor instance - * @param {String} syntax Syntax type (html, css, etc.) - * @param {String} profile Output profile name (html, xml, xhtml) - * @return {Boolean} Returns true if abbreviation was expanded - * successfully - */ + * Extracts abbreviation from current caret + * position and replaces it with formatted output + * @param {IEmmetEditor} editor Editor instance + * @param {String} syntax Syntax type (html, css, etc.) + * @param {String} profile Output profile name (html, xml, xhtml) + * @return {Boolean} Returns true if abbreviation was expanded + * successfully + */ handlers.add(function(editor, syntax, profile) { var caretPos = editor.getSelectionRange().end; var abbr = module.findAbbreviation(editor); @@ -7182,33 +7182,33 @@ emmet.define("expandAbbreviation", function(require, _) { return module = { /** - * Adds custom expand abbreviation handler. The passed function should - * return true if it was performed successfully, - * false otherwise. - * - * Added handlers will be called when 'Expand Abbreviation' is called - * in order they were added - * @memberOf expandAbbreviation - * @param {Function} fn - * @param {Object} options - */ + * Adds custom expand abbreviation handler. The passed function should + * return true if it was performed successfully, + * false otherwise. + * + * Added handlers will be called when 'Expand Abbreviation' is called + * in order they were added + * @memberOf expandAbbreviation + * @param {Function} fn + * @param {Object} options + */ addHandler: function(fn, options) { handlers.add(fn, options); }, /** - * Removes registered handler - * @returns - */ + * Removes registered handler + * @returns + */ removeHandler: function(fn) { handlers.remove(fn, options); }, /** - * Search for abbreviation in editor from current caret position - * @param {IEmmetEditor} editor Editor instance - * @return {String} - */ + * Search for abbreviation in editor from current caret position + * @param {IEmmetEditor} editor Editor instance + * @return {String} + */ findAbbreviation: function(editor) { /** @type Range */ var range = require("range").create(editor.getSelectionRange()); @@ -7234,12 +7234,12 @@ emmet.define("wrapWithAbbreviation", function(require, _) { var module = null; /** - * Wraps content with abbreviation - * @param {IEmmetEditor} Editor instance - * @param {String} abbr Abbreviation to wrap with - * @param {String} syntax Syntax type (html, css, etc.) - * @param {String} profile Output profile name (html, xml, xhtml) - */ + * Wraps content with abbreviation + * @param {IEmmetEditor} Editor instance + * @param {String} abbr Abbreviation to wrap with + * @param {String} syntax Syntax type (html, css, etc.) + * @param {String} profile Output profile name (html, xml, xhtml) + */ require("actions").add("wrap_with_abbreviation", function(editor, abbr, syntax, profile) { var info = require("editorUtils").outputInfo(editor, syntax, profile); var utils = require("utils"); @@ -7279,17 +7279,17 @@ emmet.define("wrapWithAbbreviation", function(require, _) { return module = { /** - * Wraps passed text with abbreviation. Text will be placed inside last - * expanded element - * @memberOf wrapWithAbbreviation - * @param {String} abbr Abbreviation - * @param {String} text Text to wrap - * @param {String} syntax Document type (html, xml, etc.). Default is 'html' - * @param {String} profile Output profile's name. Default is 'plain' - * @param {Object} contextNode Context node inside which abbreviation - * is wrapped. It will be used as a reference for node name resolvers - * @return {String} - */ + * Wraps passed text with abbreviation. Text will be placed inside last + * expanded element + * @memberOf wrapWithAbbreviation + * @param {String} abbr Abbreviation + * @param {String} text Text to wrap + * @param {String} syntax Document type (html, xml, etc.). Default is 'html' + * @param {String} profile Output profile's name. Default is 'plain' + * @param {Object} contextNode Context node inside which abbreviation + * is wrapped. It will be used as a reference for node name resolvers + * @return {String} + */ wrap: function(abbr, text, syntax, profile, contextNode) { /** @type emmet.filters */ var filters = require("filters"); @@ -7328,10 +7328,10 @@ emmet.define("wrapWithAbbreviation", function(require, _) { */ emmet.exec(function(require, _) { /** - * Toggle HTML comment on current selection or tag - * @param {IEmmetEditor} editor - * @return {Boolean} Returns true if comment was toggled - */ + * Toggle HTML comment on current selection or tag + * @param {IEmmetEditor} editor + * @return {Boolean} Returns true if comment was toggled + */ function toggleHTMLComment(editor) { /** @type Range */ var range = require("range").create(editor.getSelectionRange()); @@ -7349,10 +7349,10 @@ emmet.exec(function(require, _) { } /** - * Simple CSS commenting - * @param {IEmmetEditor} editor - * @return {Boolean} Returns true if comment was toggled - */ + * Simple CSS commenting + * @param {IEmmetEditor} editor + * @return {Boolean} Returns true if comment was toggled + */ function toggleCSSComment(editor) { /** @type Range */ var range = require("range").create(editor.getSelectionRange()); @@ -7380,11 +7380,11 @@ emmet.exec(function(require, _) { } /** - * Returns CSS property from rule that matches passed position - * @param {EditContainer} rule - * @param {Number} absPos - * @returns {EditElement} - */ + * Returns CSS property from rule that matches passed position + * @param {EditContainer} rule + * @param {Number} absPos + * @returns {EditElement} + */ function cssItemFromPosition(rule, absPos) { // do not use default EditContainer.itemFromPosition() here, because // we need to make a few assumptions to make CSS commenting more reliable @@ -7403,13 +7403,13 @@ emmet.exec(function(require, _) { } /** - * Search for nearest comment in str, starting from index from - * @param {String} text Where to search - * @param {Number} from Search start index - * @param {String} start_token Comment start string - * @param {String} end_token Comment end string - * @return {Range} Returns null if comment wasn't found - */ + * Search for nearest comment in str, starting from index from + * @param {String} text Where to search + * @param {Number} from Search start index + * @param {String} start_token Comment start string + * @param {String} end_token Comment end string + * @return {Range} Returns null if comment wasn't found + */ function searchComment(text, from, startToken, endToken) { var commentStart = -1; var commentEnd = -1; @@ -7444,13 +7444,13 @@ emmet.exec(function(require, _) { } /** - * Generic comment toggling routine - * @param {IEmmetEditor} editor - * @param {String} commentStart Comment start token - * @param {String} commentEnd Comment end token - * @param {Range} range Selection range - * @return {Boolean} - */ + * Generic comment toggling routine + * @param {IEmmetEditor} editor + * @param {String} commentStart Comment start token + * @param {String} commentEnd Comment end token + * @param {Range} range Selection range + * @return {Boolean} + */ function genericCommentToggle(editor, commentStart, commentEnd, range) { var editorUtils = require("editorUtils"); var content = editorUtils.outputInfo(editor).content; @@ -7460,10 +7460,10 @@ emmet.exec(function(require, _) { var utils = require("utils"); /** - * Remove comment markers from string - * @param {Sting} str - * @return {String} - */ + * Remove comment markers from string + * @param {Sting} str + * @return {String} + */ function removeComment(str) { return str .replace(new RegExp("^" + utils.escapeForRegexp(commentStart) + "\\s*"), function(str) { @@ -7504,9 +7504,9 @@ emmet.exec(function(require, _) { } /** - * Toggle comment on current editor's selection or HTML tag/CSS rule - * @param {IEmmetEditor} editor - */ + * Toggle comment on current editor's selection or HTML tag/CSS rule + * @param {IEmmetEditor} editor + */ require("actions").add("toggle_comment", function(editor) { var info = require("editorUtils").outputInfo(editor); if (info.syntax == "css") { @@ -7536,12 +7536,12 @@ emmet.exec(function(require, _) { */ emmet.exec(function(require, _) { /** - * Search for new caret insertion point - * @param {IEmmetEditor} editor Editor instance - * @param {Number} inc Search increment: -1 — search left, 1 — search right - * @param {Number} offset Initial offset relative to current caret position - * @return {Number} Returns -1 if insertion point wasn't found - */ + * Search for new caret insertion point + * @param {IEmmetEditor} editor Editor instance + * @param {Number} inc Search increment: -1 — search left, 1 — search right + * @param {Number} offset Initial offset relative to current caret position + * @return {Number} Returns -1 if insertion point wasn't found + */ function findNewEditPoint(editor, inc, offset) { inc = inc || 1; offset = offset || 0; @@ -7604,9 +7604,9 @@ emmet.exec(function(require, _) { var actions = require("actions"); /** - * Move caret to previous edit point - * @param {IEmmetEditor} editor Editor instance - */ + * Move caret to previous edit point + * @param {IEmmetEditor} editor Editor instance + */ actions.add("prev_edit_point", function(editor) { var curPos = editor.getCaretPos(); var newPoint = findNewEditPoint(editor, -1); @@ -7624,9 +7624,9 @@ emmet.exec(function(require, _) { }, { label: "Previous Edit Point" }); /** - * Move caret to next edit point - * @param {IEmmetEditor} editor Editor instance - */ + * Move caret to next edit point + * @param {IEmmetEditor} editor Editor instance + */ actions.add("next_edit_point", function(editor) { var newPoint = findNewEditPoint(editor, 1); if (newPoint != -1) { @@ -7649,12 +7649,12 @@ emmet.exec(function(require, _) { var startTag = /^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/; /** - * Generic function for searching for items to select - * @param {IEmmetEditor} editor - * @param {Boolean} isBackward Search backward (search forward otherwise) - * @param {Function} extractFn Function that extracts item content - * @param {Function} rangeFn Function that search for next token range - */ + * Generic function for searching for items to select + * @param {IEmmetEditor} editor + * @param {Boolean} isBackward Search backward (search forward otherwise) + * @param {Function} extractFn Function that extracts item content + * @param {Function} rangeFn Function that search for next token range + */ function findItem(editor, isBackward, extractFn, rangeFn) { var range = require("range"); var content = require("editorUtils").outputInfo(editor).content; @@ -7693,9 +7693,9 @@ emmet.exec(function(require, _) { // XXX HTML section /** - * Find next HTML item - * @param {IEmmetEditor} editor - */ + * Find next HTML item + * @param {IEmmetEditor} editor + */ function findNextHTMLItem(editor) { var isFirst = true; return findItem(editor, false, function(content, searchPos) { @@ -7711,9 +7711,9 @@ emmet.exec(function(require, _) { } /** - * Find previous HTML item - * @param {IEmmetEditor} editor - */ + * Find previous HTML item + * @param {IEmmetEditor} editor + */ function findPrevHTMLItem(editor) { return findItem(editor, true, getOpeningTagFromPosition, function(tag, offset, selRange) { return getRangeForHTMLItem(tag, offset, selRange, true); @@ -7721,11 +7721,11 @@ emmet.exec(function(require, _) { } /** - * Creates possible selection ranges for HTML tag - * @param {String} source Original HTML source for tokens - * @param {Array} tokens List of HTML tokens - * @returns {Array} - */ + * Creates possible selection ranges for HTML tag + * @param {String} source Original HTML source for tokens + * @param {Array} tokens List of HTML tokens + * @returns {Array} + */ function makePossibleRangesHTML(source, tokens, offset) { offset = offset || 0; var range = require("range"); @@ -7789,10 +7789,10 @@ emmet.exec(function(require, _) { } /** - * Returns ranges of class names in "class" attribute value - * @param {String} className - * @returns {Array} - */ + * Returns ranges of class names in "class" attribute value + * @param {String} className + * @returns {Array} + */ function classNameRanges(className, offset) { offset = offset || 0; var result = []; @@ -7818,12 +7818,12 @@ emmet.exec(function(require, _) { } /** - * Returns best HTML tag range match for current selection - * @param {String} tag Tag declaration - * @param {Number} offset Tag's position index inside content - * @param {Range} selRange Selection range - * @return {Range} Returns range if next item was found, null otherwise - */ + * Returns best HTML tag range match for current selection + * @param {String} tag Tag declaration + * @param {Number} offset Tag's position index inside content + * @param {Range} selRange Selection range + * @return {Range} Returns range if next item was found, null otherwise + */ function getRangeForHTMLItem(tag, offset, selRange, isBackward) { var ranges = makePossibleRangesHTML(tag, require("xmlParser").parse(tag), offset); @@ -7869,12 +7869,12 @@ emmet.exec(function(require, _) { } /** - * Search for opening tag in content, starting at specified position - * @param {String} html Where to search tag - * @param {Number} pos Character index where to start searching - * @return {Range} Returns range if valid opening tag was found, - * null otherwise - */ + * Search for opening tag in content, starting at specified position + * @param {String} html Where to search tag + * @param {Number} pos Character index where to start searching + * @return {Range} Returns range if valid opening tag was found, + * null otherwise + */ function findOpeningTagFromPosition(html, pos) { var tag; while (pos >= 0) { @@ -7887,11 +7887,11 @@ emmet.exec(function(require, _) { } /** - * @param {String} html Where to search tag - * @param {Number} pos Character index where to start searching - * @return {Range} Returns range if valid opening tag was found, - * null otherwise - */ + * @param {String} html Where to search tag + * @param {Number} pos Character index where to start searching + * @return {Range} Returns range if valid opening tag was found, + * null otherwise + */ function getOpeningTagFromPosition(html, pos) { var m; if (html.charAt(pos) == "<" && (m = html.substring(pos, html.length).match(startTag))) { @@ -7904,10 +7904,10 @@ emmet.exec(function(require, _) { } /** - * Makes all possible selection ranges for specified CSS property - * @param {CSSProperty} property - * @returns {Array} - */ + * Makes all possible selection ranges for specified CSS property + * @param {CSSProperty} property + * @returns {Array} + */ function makePossibleRangesCSS(property) { // find all possible ranges, sorted by position and size var valueRange = property.valueRange(true); @@ -7956,12 +7956,12 @@ emmet.exec(function(require, _) { } /** - * Tries to find matched CSS property and nearest range for selection - * @param {CSSRule} rule - * @param {Range} selRange - * @param {Boolean} isBackward - * @returns {Range} - */ + * Tries to find matched CSS property and nearest range for selection + * @param {CSSRule} rule + * @param {Range} selRange + * @param {Boolean} isBackward + * @returns {Range} + */ function matchedRangeForCSSProperty(rule, selRange, isBackward) { /** @type CSSProperty */ var property = null; @@ -8036,13 +8036,13 @@ emmet.exec(function(require, _) { } /** - * Returns range for item to be selected in CSS after current caret - * (selection) position - * @param {String} rule CSS rule declaration - * @param {Number} offset Rule's position index inside content - * @param {Range} selRange Selection range - * @return {Range} Returns range if next item was found, null otherwise - */ + * Returns range for item to be selected in CSS after current caret + * (selection) position + * @param {String} rule CSS rule declaration + * @param {Number} offset Rule's position index inside content + * @param {Range} selRange Selection range + * @return {Range} Returns range if next item was found, null otherwise + */ function getRangeForNextItemInCSS(rule, offset, selRange) { var tree = require("cssEditTree").parse(rule, { offset: offset @@ -8058,13 +8058,13 @@ emmet.exec(function(require, _) { } /** - * Returns range for item to be selected in CSS before current caret - * (selection) position - * @param {String} rule CSS rule declaration - * @param {Number} offset Rule's position index inside content - * @param {Range} selRange Selection range - * @return {Range} Returns range if previous item was found, null otherwise - */ + * Returns range for item to be selected in CSS before current caret + * (selection) position + * @param {String} rule CSS rule declaration + * @param {Number} offset Rule's position index inside content + * @param {Range} selRange Selection range + * @return {Range} Returns range if previous item was found, null otherwise + */ function getRangeForPrevItemInCSS(rule, offset, selRange) { var tree = require("cssEditTree").parse(rule, { offset: offset @@ -8112,11 +8112,11 @@ emmet.exec(function(require, _) { var lastMatch = null; /** - * Find and select HTML tag pair - * @param {IEmmetEditor} editor Editor instance - * @param {String} direction Direction of pair matching: 'in' or 'out'. - * Default is 'out' - */ + * Find and select HTML tag pair + * @param {IEmmetEditor} editor Editor instance + * @param {String} direction Direction of pair matching: 'in' or 'out'. + * Default is 'out' + */ function matchPair(editor, direction) { direction = String((direction || "out").toLowerCase()); var info = require("editorUtils").outputInfo(editor); @@ -8184,9 +8184,9 @@ emmet.exec(function(require, _) { }, { label: "HTML/Match Pair Tag (outward)" }); /** - * Moves caret to matching opening or closing tag - * @param {IEmmetEditor} editor - */ + * Moves caret to matching opening or closing tag + * @param {IEmmetEditor} editor + */ actions.add("matching_pair", function(editor) { var content = String(editor.getContent()); var caretPos = editor.getCaretPos(); @@ -8255,10 +8255,10 @@ emmet.exec(function(require, _) { */ emmet.exec(function(require, _) { /** - * @param {IEmmetEditor} editor - * @param {Object} profile - * @param {Object} tag - */ + * @param {IEmmetEditor} editor + * @param {Object} profile + * @param {Object} tag + */ function joinTag(editor, profile, tag) { /** @type emmet.utils */ var utils = require("utils"); @@ -8326,8 +8326,8 @@ emmet.exec(function(require, _) { */ emmet.define("reflectCSSValue", function(require, _) { /** - * @type HandlerList List of registered handlers - */ + * @type HandlerList List of registered handlers + */ var handlers = require("handlerList").create(); require("actions").add("reflect_css_value", function(editor) { @@ -8366,10 +8366,10 @@ emmet.define("reflectCSSValue", function(require, _) { } /** - * Returns regexp that should match reflected CSS property names - * @param {String} name Current CSS property name - * @return {RegExp} - */ + * Returns regexp that should match reflected CSS property names + * @param {String} name Current CSS property name + * @return {RegExp} + */ function getReflectedCSSName(name) { name = require("cssEditTree").baseName(name); var vendorPrefix = "^(?:\\-\\w+\\-)?", m; @@ -8387,12 +8387,12 @@ emmet.define("reflectCSSValue", function(require, _) { } /** - * Reflects value from donor into receiver - * @param {CSSProperty} donor Donor CSS property from which value should - * be reflected - * @param {CSSProperty} receiver Property that should receive reflected - * value from donor - */ + * Reflects value from donor into receiver + * @param {CSSProperty} donor Donor CSS property from which value should + * be reflected + * @param {CSSProperty} receiver Property that should receive reflected + * value from donor + */ function reflectValue(donor, receiver) { var value = getReflectedValue(donor.name(), donor.value(), receiver.name(), receiver.value()); @@ -8401,19 +8401,19 @@ emmet.define("reflectCSSValue", function(require, _) { } /** - * Returns value that should be reflected for refName CSS property - * from curName property. This function is used for special cases, - * when the same result must be achieved with different properties for different - * browsers. For example: opаcity:0.5; → filter:alpha(opacity=50);

- * - * This function does value conversion between different CSS properties - * - * @param {String} curName Current CSS property name - * @param {String} curValue Current CSS property value - * @param {String} refName Receiver CSS property's name - * @param {String} refValue Receiver CSS property's value - * @return {String} New value for receiver property - */ + * Returns value that should be reflected for refName CSS property + * from curName property. This function is used for special cases, + * when the same result must be achieved with different properties for different + * browsers. For example: opаcity:0.5; → filter:alpha(opacity=50);

+ * + * This function does value conversion between different CSS properties + * + * @param {String} curName Current CSS property name + * @param {String} curValue Current CSS property value + * @param {String} refName Receiver CSS property's name + * @param {String} refValue Receiver CSS property's value + * @return {String} New value for receiver property + */ function getReflectedValue(curName, curValue, refName, refValue) { var cssEditTree = require("cssEditTree"); var utils = require("utils"); @@ -8442,21 +8442,21 @@ emmet.define("reflectCSSValue", function(require, _) { return { /** - * Adds custom reflect handler. The passed function will receive matched - * CSS property (as CSSEditElement object) and should - * return true if it was performed successfully (handled - * reflection), false otherwise. - * @param {Function} fn - * @param {Object} options - */ + * Adds custom reflect handler. The passed function will receive matched + * CSS property (as CSSEditElement object) and should + * return true if it was performed successfully (handled + * reflection), false otherwise. + * @param {Function} fn + * @param {Object} options + */ addHandler: function(fn, options) { handlers.add(fn, options); }, /** - * Removes registered handler - * @returns - */ + * Removes registered handler + * @returns + */ removeHandler: function(fn) { handlers.remove(fn, options); } @@ -8507,11 +8507,11 @@ emmet.exec(function(require, _) { */ emmet.exec(function(require, _) { /** - * Extract number from current caret position of the editor and - * increment it by step - * @param {IEmmetEditor} editor - * @param {Number} step Increment step (may be negative) - */ + * Extract number from current caret position of the editor and + * increment it by step + * @param {IEmmetEditor} editor + * @param {Number} step Increment step (may be negative) + */ function incrementNumber(editor, step) { var utils = require("utils"); var actionUtils = require("actionUtils"); @@ -8564,9 +8564,9 @@ emmet.exec(function(require, _) { } /** - * Returns length of integer part of number - * @param {String} num - */ + * Returns length of integer part of number + * @param {String} num + */ function intLength(num) { num = num.replace(/^\-/, ""); if (~num.indexOf(".")) { @@ -8606,10 +8606,10 @@ emmet.exec(function(require, _) { + "like \\n\\t in this preference."); /** - * Inserts newline character with proper indentation in specific positions only. - * @param {IEmmetEditor} editor - * @return {Boolean} Returns true if line break was inserted - */ + * Inserts newline character with proper indentation in specific positions only. + * @param {IEmmetEditor} editor + * @return {Boolean} Returns true if line break was inserted + */ actions.add("insert_formatted_line_break_only", function(editor) { var utils = require("utils"); /** @type emmet.resources */ @@ -8670,11 +8670,11 @@ emmet.exec(function(require, _) { }, { hidden: true }); /** - * Inserts newline character with proper indentation. This action is used in - * editors that doesn't have indentation control (like textarea element) to - * provide proper indentation - * @param {IEmmetEditor} editor Editor instance - */ + * Inserts newline character with proper indentation. This action is used in + * editors that doesn't have indentation control (like textarea element) to + * provide proper indentation + * @param {IEmmetEditor} editor Editor instance + */ actions.add("insert_formatted_line_break", function(editor) { if (!actions.run("insert_formatted_line_break_only", editor)) { var utils = require("utils"); @@ -8793,27 +8793,27 @@ emmet.exec(function(require, _) { }, { label: "Encode\\Decode data:URL image" }); /** - * Test if text starts with token at pos - * position. If pos is omitted, search from beginning of text - * @param {String} token Token to test - * @param {String} text Where to search - * @param {Number} pos Position where to start search - * @return {Boolean} - * @since 0.65 - */ + * Test if text starts with token at pos + * position. If pos is omitted, search from beginning of text + * @param {String} token Token to test + * @param {String} text Where to search + * @param {Number} pos Position where to start search + * @return {Boolean} + * @since 0.65 + */ function startsWith(token, text, pos) { pos = pos || 0; return text.charAt(pos) == token.charAt(0) && text.substr(pos, token.length) == token; } /** - * Encodes image to base64 - * - * @param {IEmmetEditor} editor - * @param {String} imgPath Path to image - * @param {Number} pos Caret position where image is located in the editor - * @return {Boolean} - */ + * Encodes image to base64 + * + * @param {IEmmetEditor} editor + * @param {String} imgPath Path to image + * @param {Number} pos Caret position where image is located in the editor + * @return {Boolean} + */ function encodeToBase64(editor, imgPath, pos) { var file = require("file"); var actionUtils = require("actionUtils"); @@ -8852,11 +8852,11 @@ emmet.exec(function(require, _) { } /** - * Decodes base64 string back to file. - * @param {IEmmetEditor} editor - * @param {String} data Base64-encoded file content - * @param {Number} pos Caret position where image is located in the editor - */ + * Decodes base64 string back to file. + * @param {IEmmetEditor} editor + * @param {String} data Base64-encoded file content + * @param {Number} pos Caret position where image is located in the editor + */ function decodeFromBase64(editor, data, pos) { // ask user to enter path to file var filePath = String(editor.prompt("Enter path to file (absolute or relative)")); @@ -8884,9 +8884,9 @@ emmet.exec(function(require, _) { */ emmet.exec(function(require, _) { /** - * Updates image size of <img src=""> tag - * @param {IEmmetEditor} editor - */ + * Updates image size of <img src=""> tag + * @param {IEmmetEditor} editor + */ function updateImageSizeHTML(editor) { var offset = editor.getCaretPos(); @@ -8910,9 +8910,9 @@ emmet.exec(function(require, _) { } /** - * Updates image size of CSS property - * @param {IEmmetEditor} editor - */ + * Updates image size of CSS property + * @param {IEmmetEditor} editor + */ function updateImageSizeCSS(editor) { var offset = editor.getCaretPos(); @@ -8940,10 +8940,10 @@ emmet.exec(function(require, _) { } /** - * Returns image dimensions for source - * @param {IEmmetEditor} editor - * @param {String} src Image source (path or data:url) - */ + * Returns image dimensions for source + * @param {IEmmetEditor} editor + * @param {String} src Image source (path or data:url) + */ function getImageSizeForSource(editor, src, callback) { var fileContent; var au = require("actionUtils"); @@ -9040,32 +9040,32 @@ emmet.define("cssResolver", function(require, _) { prefix: "emmet", /** - * Indicates this prefix is obsolete and should't be used when user - * wants to generate all-prefixed properties - */ + * Indicates this prefix is obsolete and should't be used when user + * wants to generate all-prefixed properties + */ obsolete: false, /** - * Returns prefixed CSS property name - * @param {String} name Unprefixed CSS property - */ + * Returns prefixed CSS property name + * @param {String} name Unprefixed CSS property + */ transformName: function(name) { return "-" + this.prefix + "-" + name; }, /** - * List of unprefixed CSS properties that supported by - * current prefix. This list is used to generate all-prefixed property - * @returns {Array} - */ + * List of unprefixed CSS properties that supported by + * current prefix. This list is used to generate all-prefixed property + * @returns {Array} + */ properties: function() { return getProperties("css." + this.prefix + "Properties") || []; }, /** - * Check if given property is supported by current prefix - * @param name - */ + * Check if given property is supported by current prefix + * @param name + */ supports: function(name) { return _.include(this.properties(), name); } @@ -9073,9 +9073,9 @@ emmet.define("cssResolver", function(require, _) { /** - * List of registered one-character prefixes. Key is a one-character prefix, - * value is an prefixObj object - */ + * List of registered one-character prefixes. Key is a one-character prefix, + * value is an prefixObj object + */ var vendorPrefixes = {}; var defaultValue = "${1};"; @@ -9186,10 +9186,10 @@ emmet.define("cssResolver", function(require, _) { } /** - * Check if provided snippet contains only one CSS property and value. - * @param {String} snippet - * @returns {Boolean} - */ + * Check if provided snippet contains only one CSS property and value. + * @param {String} snippet + * @returns {Boolean} + */ function isSingleProperty(snippet) { var utils = require("utils"); snippet = utils.trim(snippet); @@ -9215,10 +9215,10 @@ emmet.define("cssResolver", function(require, _) { } /** - * Normalizes abbreviated value to final CSS one - * @param {String} value - * @returns {String} - */ + * Normalizes abbreviated value to final CSS one + * @param {String} value + * @returns {String} + */ function normalizeValue(value) { if (value.charAt(0) == "-" && !/^\-[\.\d]/.test(value)) { value = value.replace(/^\-+/, ""); @@ -9295,10 +9295,10 @@ emmet.define("cssResolver", function(require, _) { } /** - * Check if passed CSS property support specified vendor prefix - * @param {String} property - * @param {String} prefix - */ + * Check if passed CSS property support specified vendor prefix + * @param {String} property + * @param {String} prefix + */ function hasPrefix(property, prefix) { var info = vendorPrefixes[prefix]; @@ -9311,11 +9311,11 @@ emmet.define("cssResolver", function(require, _) { } /** - * Search for a list of supported prefixes for CSS property. This list - * is used to generate all-prefixed snippet - * @param {String} property CSS property name - * @returns {Array} - */ + * Search for a list of supported prefixes for CSS property. This list + * is used to generate all-prefixed snippet + * @param {String} property CSS property name + * @returns {Array} + */ function findPrefixes(property, noAutofill) { var result = []; _.each(vendorPrefixes, function(obj, prefix) { @@ -9353,11 +9353,11 @@ emmet.define("cssResolver", function(require, _) { } /** - * Format CSS property according to current syntax dialect - * @param {String} property - * @param {String} syntax - * @returns {String} - */ + * Format CSS property according to current syntax dialect + * @param {String} property + * @param {String} syntax + * @returns {String} + */ function formatProperty(property, syntax) { var ix = property.indexOf(":"); property = property.substring(0, ix).replace(/\s+$/, "") @@ -9368,12 +9368,12 @@ emmet.define("cssResolver", function(require, _) { } /** - * Transforms snippet value if required. For example, this transformation - * may add !important declaration to CSS property - * @param {String} snippet - * @param {Boolean} isImportant - * @returns {String} - */ + * Transforms snippet value if required. For example, this transformation + * may add !important declaration to CSS property + * @param {String} snippet + * @param {Boolean} isImportant + * @returns {String} + */ function transformSnippet(snippet, isImportant, syntax) { if (!_.isString(snippet)) snippet = snippet.data; @@ -9393,10 +9393,10 @@ emmet.define("cssResolver", function(require, _) { } /** - * Helper function that parses comma-separated list of elements into array - * @param {String} list - * @returns {Array} - */ + * Helper function that parses comma-separated list of elements into array + * @param {String} list + * @returns {Array} + */ function parseList(list) { var result = _.map((list || "").split(","), require("utils").trim); return result.length ? result : null; @@ -9442,10 +9442,10 @@ emmet.define("cssResolver", function(require, _) { var cssSyntaxes = ["css", "less", "sass", "scss", "stylus"]; /** - * XXX register resolver - * @param {TreeNode} node - * @param {String} syntax - */ + * XXX register resolver + * @param {TreeNode} node + * @param {String} syntax + */ require("resources").addResolver(function(node, syntax) { if (_.include(cssSyntaxes, syntax) && node.isElement()) { return module.expandToSnippet(node.abbreviation, syntax); @@ -9456,14 +9456,14 @@ emmet.define("cssResolver", function(require, _) { var ea = require("expandAbbreviation"); /** - * For CSS-like syntaxes, we need to handle a special use case. Some editors - * (like Sublime Text 2) may insert semicolons automatically when user types - * abbreviation. After expansion, user receives a double semicolon. This - * handler automatically removes semicolon from generated content in such cases. - * @param {IEmmetEditor} editor - * @param {String} syntax - * @param {String} profile - */ + * For CSS-like syntaxes, we need to handle a special use case. Some editors + * (like Sublime Text 2) may insert semicolons automatically when user types + * abbreviation. After expansion, user receives a double semicolon. This + * handler automatically removes semicolon from generated content in such cases. + * @param {IEmmetEditor} editor + * @param {String} syntax + * @param {String} profile + */ ea.addHandler(function(editor, syntax, profile) { if (!_.include(cssSyntaxes, syntax)) { return false; @@ -9491,27 +9491,27 @@ emmet.define("cssResolver", function(require, _) { return module = { /** - * Adds vendor prefix - * @param {String} name One-character prefix name - * @param {Object} obj Object describing vendor prefix - * @memberOf cssResolver - */ + * Adds vendor prefix + * @param {String} name One-character prefix name + * @param {Object} obj Object describing vendor prefix + * @memberOf cssResolver + */ addPrefix: addPrefix, /** - * Check if passed CSS property supports specified vendor prefix - * @param {String} property - * @param {String} prefix - */ + * Check if passed CSS property supports specified vendor prefix + * @param {String} property + * @param {String} prefix + */ supportsPrefix: hasPrefix, /** - * Returns prefixed version of passed CSS property, only if this - * property supports such prefix - * @param {String} property - * @param {String} prefix - * @returns - */ + * Returns prefixed version of passed CSS property, only if this + * property supports such prefix + * @param {String} property + * @param {String} prefix + * @returns + */ prefixed: function(property, prefix) { return hasPrefix(property, prefix) ? "-" + prefix + "-" + property @@ -9519,9 +9519,9 @@ emmet.define("cssResolver", function(require, _) { }, /** - * Returns list of all registered vendor prefixes - * @returns {Array} - */ + * Returns list of all registered vendor prefixes + * @returns {Array} + */ listPrefixes: function() { return _.map(vendorPrefixes, function(obj) { return obj.prefix; @@ -9529,29 +9529,29 @@ emmet.define("cssResolver", function(require, _) { }, /** - * Returns object describing vendor prefix - * @param {String} name - * @returns {Object} - */ + * Returns object describing vendor prefix + * @param {String} name + * @returns {Object} + */ getPrefix: function(name) { return vendorPrefixes[name]; }, /** - * Removes prefix object - * @param {String} name - */ + * Removes prefix object + * @param {String} name + */ removePrefix: function(name) { if (name in vendorPrefixes) delete vendorPrefixes[name]; }, /** - * Extract vendor prefixes from abbreviation - * @param {String} abbr - * @returns {Object} Object containing array of prefixes and clean - * abbreviation name - */ + * Extract vendor prefixes from abbreviation + * @param {String} abbr + * @returns {Object} Object containing array of prefixes and clean + * abbreviation name + */ extractPrefixes: function(abbr) { if (abbr.charAt(0) != "-") { return { @@ -9600,10 +9600,10 @@ emmet.define("cssResolver", function(require, _) { }, /** - * Search for value substring in abbreviation - * @param {String} abbr - * @returns {String} Value substring - */ + * Search for value substring in abbreviation + * @param {String} abbr + * @returns {String} Value substring + */ findValuesInAbbreviation: function(abbr, syntax) { syntax = syntax || "css"; @@ -9668,11 +9668,11 @@ emmet.define("cssResolver", function(require, _) { }, /** - * Extracts values from abbreviation - * @param {String} abbr - * @returns {Object} Object containing array of values and clean - * abbreviation name - */ + * Extracts values from abbreviation + * @param {String} abbr + * @returns {Object} Object containing array of values and clean + * abbreviation name + */ extractValues: function(abbr) { // search for value start var abbrValues = this.findValuesInAbbreviation(abbr); @@ -9690,11 +9690,11 @@ emmet.define("cssResolver", function(require, _) { }, /** - * Normalizes value, defined in abbreviation. - * @param {String} value - * @param {String} property - * @returns {String} - */ + * Normalizes value, defined in abbreviation. + * @param {String} value + * @param {String} property + * @returns {String} + */ normalizeValue: function(value, property) { property = (property || "").toLowerCase(); var unitlessProps = prefs.getArray("css.unitlessProperties"); @@ -9710,13 +9710,13 @@ emmet.define("cssResolver", function(require, _) { }, /** - * Expands abbreviation into a snippet - * @param {String} abbr Abbreviation name to expand - * @param {String} value Abbreviation value - * @param {String} syntax Currect syntax or dialect. Default is 'css' - * @returns {Object} Array of CSS properties and values or predefined - * snippet (string or element) - */ + * Expands abbreviation into a snippet + * @param {String} abbr Abbreviation name to expand + * @param {String} value Abbreviation value + * @param {String} syntax Currect syntax or dialect. Default is 'css' + * @returns {Object} Array of CSS properties and values or predefined + * snippet (string or element) + */ expand: function(abbr, value, syntax) { syntax = syntax || "css"; var resources = require("resources"); @@ -9800,12 +9800,12 @@ emmet.define("cssResolver", function(require, _) { }, /** - * Same as expand method but transforms output into - * Emmet snippet - * @param {String} abbr - * @param {String} syntax - * @returns {String} - */ + * Same as expand method but transforms output into + * Emmet snippet + * @param {String} abbr + * @param {String} syntax + * @returns {String} + */ expandToSnippet: function(abbr, syntax) { var snippet = this.expand(abbr, null, syntax); if (_.isArray(snippet)) { @@ -9819,9 +9819,9 @@ emmet.define("cssResolver", function(require, _) { }, /** - * Split snippet into a CSS property-value pair - * @param {String} snippet - */ + * Split snippet into a CSS property-value pair + * @param {String} snippet + */ splitSnippet: function(snippet) { var utils = require("utils"); snippet = utils.trim(snippet); @@ -9891,9 +9891,9 @@ emmet.define("cssGradient", function(require, _) { } /** - * Parses linear gradient definition - * @param {String} - */ + * Parses linear gradient definition + * @param {String} + */ function parseLinearGradient(gradient) { var direction = defaultLinearDirections[0]; @@ -9932,10 +9932,10 @@ emmet.define("cssGradient", function(require, _) { } /** - * Parses color stop definition - * @param {String} colorStop - * @returns {Object} - */ + * Parses color stop definition + * @param {String} colorStop + * @returns {Object} + */ function parseColorStop(colorStop) { colorStop = normalizeSpace(colorStop); @@ -9977,9 +9977,9 @@ emmet.define("cssGradient", function(require, _) { } /** - * Resolves property name (abbreviation): searches for snippet definition in - * 'resources' and returns new name of matched property - */ + * Resolves property name (abbreviation): searches for snippet definition in + * 'resources' and returns new name of matched property + */ function resolvePropertyName(name, syntax) { var res = require("resources"); var prefs = require("preferences"); @@ -10000,9 +10000,9 @@ emmet.define("cssGradient", function(require, _) { } /** - * Fills-out implied positions in color-stops. This function is useful for - * old Webkit gradient definitions - */ + * Fills-out implied positions in color-stops. This function is useful for + * old Webkit gradient definitions + */ function fillImpliedPositions(colorStops) { var from = 0; @@ -10027,10 +10027,10 @@ emmet.define("cssGradient", function(require, _) { } /** - * Returns textual version of direction expressed in degrees - * @param {String} direction - * @returns {String} - */ + * Returns textual version of direction expressed in degrees + * @param {String} direction + * @returns {String} + */ function textualDirection(direction) { var angle = parseFloat(direction); @@ -10051,10 +10051,10 @@ emmet.define("cssGradient", function(require, _) { } /** - * Creates direction definition for old Webkit gradients - * @param {String} direction - * @returns {String} - */ + * Creates direction definition for old Webkit gradients + * @param {String} direction + * @returns {String} + */ function oldWebkitDirection(direction) { direction = textualDirection(direction); @@ -10082,11 +10082,11 @@ emmet.define("cssGradient", function(require, _) { } /** - * Returns list of CSS properties with gradient - * @param {Object} gradient - * @param {String} propertyName Original CSS property name - * @returns {Array} - */ + * Returns list of CSS properties with gradient + * @param {Object} gradient + * @param {String} propertyName Original CSS property name + * @returns {Array} + */ function getPropertiesForGradient(gradient, propertyName) { var props = []; var css = require("cssResolver"); @@ -10122,13 +10122,13 @@ emmet.define("cssGradient", function(require, _) { } /** - * Pastes gradient definition into CSS rule with correct vendor-prefixes - * @param {EditElement} property Matched CSS property - * @param {Object} gradient Parsed gradient - * @param {Range} valueRange If passed, only this range within property - * value will be replaced with gradient. Otherwise, full value will be - * replaced - */ + * Pastes gradient definition into CSS rule with correct vendor-prefixes + * @param {EditElement} property Matched CSS property + * @param {Object} gradient Parsed gradient + * @param {Range} valueRange If passed, only this range within property + * value will be replaced with gradient. Otherwise, full value will be + * replaced + */ function pasteGradient(property, gradient, valueRange) { var rule = property.parent; var utils = require("utils"); @@ -10211,8 +10211,8 @@ emmet.define("cssGradient", function(require, _) { } /** - * Search for gradient definition inside CSS property value - */ + * Search for gradient definition inside CSS property value + */ function findGradient(cssProp) { var value = cssProp.value(); var gradient = null; @@ -10231,10 +10231,10 @@ emmet.define("cssGradient", function(require, _) { } /** - * Tries to expand gradient outside CSS value - * @param {IEmmetEditor} editor - * @param {String} syntax - */ + * Tries to expand gradient outside CSS value + * @param {IEmmetEditor} editor + * @param {String} syntax + */ function expandGradientOutsideValue(editor, syntax) { var propertyName = prefs.get("css.gradient.defaultProperty"); @@ -10291,11 +10291,11 @@ emmet.define("cssGradient", function(require, _) { } /** - * Search for gradient definition inside CSS value under cursor - * @param {String} content - * @param {Number} pos - * @returns {Object} - */ + * Search for gradient definition inside CSS value under cursor + * @param {String} content + * @param {Number} pos + * @returns {Object} + */ function findGradientFromPosition(content, pos) { var cssProp = null; /** @type EditContainer */ @@ -10320,10 +10320,10 @@ emmet.define("cssGradient", function(require, _) { // XXX register expand abbreviation handler /** - * @param {IEmmetEditor} editor - * @param {String} syntax - * @param {String} profile - */ + * @param {IEmmetEditor} editor + * @param {String} syntax + * @param {String} profile + */ require("expandAbbreviation").addHandler(function(editor, syntax, profile) { var info = require("editorUtils").outputInfo(editor, syntax, profile); if (!_.include(cssSyntaxes, info.syntax)) @@ -10378,8 +10378,8 @@ emmet.define("cssGradient", function(require, _) { // XXX register "Reflect CSS Value" action delegate /** - * @param {EditElement} property - */ + * @param {EditElement} property + */ require("reflectCSSValue").addHandler(function(property) { var utils = require("utils"); @@ -10412,10 +10412,10 @@ emmet.define("cssGradient", function(require, _) { return module = { /** - * Parses gradient definition - * @param {String} gradient - * @returns {Object} - */ + * Parses gradient definition + * @param {String} gradient + * @returns {Object} + */ parse: function(gradient) { var result = null; require("utils").trim(gradient).replace(/^([\w\-]+)\((.+?)\)$/, function(str, type, definition) { @@ -10433,11 +10433,11 @@ emmet.define("cssGradient", function(require, _) { }, /** - * Produces linear gradient definition used in early Webkit - * implementations - * @param {Object} gradient Parsed gradient - * @returns {String} - */ + * Produces linear gradient definition used in early Webkit + * implementations + * @param {Object} gradient Parsed gradient + * @returns {String} + */ oldWebkitLinearGradient: function(gradient) { if (_.isString(gradient)) gradient = this.parse(gradient); @@ -10480,11 +10480,11 @@ emmet.define("cssGradient", function(require, _) { }, /** - * Returns string representation of parsed gradient - * @param {Object} gradient Parsed gradient - * @param {String} prefix Vendor prefix - * @returns {String} - */ + * Returns string representation of parsed gradient + * @param {Object} gradient Parsed gradient + * @param {String} prefix Vendor prefix + * @returns {String} + */ toString: function(gradient, prefix) { if (gradient.type == "linear") { var fn = (prefix ? "-" + prefix + "-" : "") + "linear-gradient"; @@ -10519,15 +10519,15 @@ emmet.exec(function(require, _) { _.extend(resources, { /** - * Add generator. A generator function fn will be called - * only if current abbreviation matches regexp regular - * expression and this function should return null if - * abbreviation cannot be resolved - * @param {RegExp} regexp Regular expression for abbreviation element name - * @param {Function} fn Resolver function - * @param {Object} options Options list as described in - * {@link HandlerList#add()} method - */ + * Add generator. A generator function fn will be called + * only if current abbreviation matches regexp regular + * expression and this function should return null if + * abbreviation cannot be resolved + * @param {RegExp} regexp Regular expression for abbreviation element name + * @param {Function} fn Resolver function + * @param {Object} options Options list as described in + * {@link HandlerList#add()} method + */ addGenerator: function(regexp, fn, options) { if (_.isString(regexp)) regexp = new RegExp(regexp); @@ -10581,12 +10581,12 @@ emmet.define("tagName", function(require, _) { return { /** - * Returns best matched child element name for passed parent's - * tag name - * @param {String} name - * @returns {String} - * @memberOf tagName - */ + * Returns best matched child element name for passed parent's + * tag name + * @param {String} name + * @returns {String} + * @memberOf tagName + */ resolve: function(name) { name = (name || "").toLowerCase(); @@ -10600,74 +10600,74 @@ emmet.define("tagName", function(require, _) { }, /** - * Returns mapped child element name for passed parent's name - * @param {String} name - * @returns {String} - */ + * Returns mapped child element name for passed parent's name + * @param {String} name + * @returns {String} + */ getMapping: function(name) { return elementMap[name.toLowerCase()]; }, /** - * Check if passed element name belongs to inline-level element - * @param {String} name - * @returns {Boolean} - */ + * Check if passed element name belongs to inline-level element + * @param {String} name + * @returns {Boolean} + */ isInlineLevel: function(name) { return this.isTypeOf(name, "inlineLevel"); }, /** - * Check if passed element belongs to block-level element. - * For better matching of unknown elements (for XML, for example), - * you should use !this.isInlineLevel(name) - * @returns {Boolean} - */ + * Check if passed element belongs to block-level element. + * For better matching of unknown elements (for XML, for example), + * you should use !this.isInlineLevel(name) + * @returns {Boolean} + */ isBlockLevel: function(name) { return this.isTypeOf(name, "blockLevel"); }, /** - * Check if passed element is void (i.e. should not have closing tag). - * @returns {Boolean} - */ + * Check if passed element is void (i.e. should not have closing tag). + * @returns {Boolean} + */ isEmptyElement: function(name) { return this.isTypeOf(name, "empty"); }, /** - * Generic function for testing if element name belongs to specified - * elements collection - * @param {String} name Element name - * @param {String} type Collection name - * @returns {Boolean} - */ + * Generic function for testing if element name belongs to specified + * elements collection + * @param {String} name Element name + * @param {String} type Collection name + * @returns {Boolean} + */ isTypeOf: function(name, type) { return _.include(elementTypes[type], name); }, /** - * Adds new parent–child mapping - * @param {String} parent - * @param {String} child - */ + * Adds new parent–child mapping + * @param {String} parent + * @param {String} child + */ addMapping: function(parent, child) { elementMap[parent] = child; }, /** - * Removes parent-child mapping - */ + * Removes parent-child mapping + */ removeMapping: function(parent) { if (parent in elementMap) delete elementMap[parent]; }, /** - * Adds new element into collection - * @param {String} name Element name - * @param {String} collection Collection name - */ + * Adds new element into collection + * @param {String} name Element name + * @param {String} collection Collection name + */ addElementToCollection: function(name, collection) { if (!elementTypes[collection]) elementTypes[collection] = []; @@ -10678,11 +10678,11 @@ emmet.define("tagName", function(require, _) { }, /** - * Removes element name from specified collection - * @param {String} name Element name - * @param {String} collection Collection name - * @returns - */ + * Removes element name from specified collection + * @param {String} name Element name + * @param {String} collection Collection name + * @returns + */ removeElementFromCollection: function(name, collection) { if (collection in elementTypes) { elementTypes[collection] = _.without(this.getCollection(collection), name); @@ -10690,10 +10690,10 @@ emmet.define("tagName", function(require, _) { }, /** - * Returns elements name collection - * @param {String} name Collection name - * @returns {Array} - */ + * Returns elements name collection + * @param {String} name Collection name + * @returns {Array} + */ getCollection: function(name) { return elementTypes[name]; } @@ -10728,8 +10728,8 @@ emmet.exec(function(require, _) { } /** - * @param {AbbreviationNode} item - */ + * @param {AbbreviationNode} item + */ function bemParse(item) { if (require("abbreviationUtils").isSnippet(item)) return item; @@ -10771,9 +10771,9 @@ emmet.exec(function(require, _) { } /** - * @param {String} className - * @returns {String} - */ + * @param {String} className + * @returns {String} + */ function normalizeClassName(className) { var utils = require("utils"); className = (" " + (className || "") + " ").replace(/\s+/g, " "); @@ -10790,12 +10790,12 @@ emmet.exec(function(require, _) { } /** - * Processes class name - * @param {String} name Class name item to process - * @param {AbbreviationNode} item Host node for provided class name - * @returns Processed class name. May return Array of - * class names - */ + * Processes class name + * @param {String} name Class name item to process + * @param {AbbreviationNode} item Host node for provided class name + * @returns Processed class name. May return Array of + * class names + */ function processClassName(name, item) { name = transformClassName(name, item, "element"); name = transformClassName(name, item, "modifier"); @@ -10858,14 +10858,14 @@ emmet.exec(function(require, _) { } /** - * Low-level function to transform user-typed class name into full BEM class - * @param {String} name Class name item to process - * @param {AbbreviationNode} item Host node for provided class name - * @param {String} entityType Type of entity to be tried to transform - * ('element' or 'modifier') - * @returns {String} Processed class name or original one if it can't be - * transformed - */ + * Low-level function to transform user-typed class name into full BEM class + * @param {String} name Class name item to process + * @param {AbbreviationNode} item Host node for provided class name + * @param {String} entityType Type of entity to be tried to transform + * ('element' or 'modifier') + * @returns {String} Processed class name or original one if it can't be + * transformed + */ function transformClassName(name, item, entityType) { var separators = getSeparators(); var reSep = new RegExp("^(" + separators[entityType] + ")+", "g"); @@ -10906,28 +10906,28 @@ emmet.exec(function(require, _) { } /** - * Recursive function for processing tags, which extends class names - * according to BEM specs: http://bem.github.com/bem-method/pages/beginning/beginning.ru.html - *

- * It does several things:
- *
    - *
  • Expands complex class name (according to BEM symbol semantics): - * .block__elem_modifier → .block.block__elem.block__elem_modifier - *
  • - *
  • Inherits block name on child elements: - * .b-block > .__el > .__el → .b-block > .b-block__el > .b-block__el__el - *
  • - *
  • Treats first dash symbol as '__'
  • - *
  • Double underscore (or typographic '–') is also treated as an element - * level lookup, e.g. ____el will search for element definition in parent’s - * parent element: - * .b-block > .__el1 > .____el2 → .b-block > .b-block__el1 > .b-block__el2 - *
  • - *
- * - * @param {AbbreviationNode} tree - * @param {Object} profile - */ + * Recursive function for processing tags, which extends class names + * according to BEM specs: http://bem.github.com/bem-method/pages/beginning/beginning.ru.html + *

+ * It does several things:
+ *
    + *
  • Expands complex class name (according to BEM symbol semantics): + * .block__elem_modifier → .block.block__elem.block__elem_modifier + *
  • + *
  • Inherits block name on child elements: + * .b-block > .__el > .__el → .b-block > .b-block__el > .b-block__el__el + *
  • + *
  • Treats first dash symbol as '__'
  • + *
  • Double underscore (or typographic '–') is also treated as an element + * level lookup, e.g. ____el will search for element definition in parent’s + * parent element: + * .b-block > .__el1 > .____el2 → .b-block > .b-block__el1 > .b-block__el2 + *
  • + *
+ * + * @param {AbbreviationNode} tree + * @param {Object} profile + */ function process(tree, profile) { if (tree.name) bemParse(tree, profile); @@ -11000,9 +11000,9 @@ emmet.exec(function(require, _) { + "every element, set this option to *"); /** - * Add comments to tag - * @param {AbbreviationNode} node - */ + * Add comments to tag + * @param {AbbreviationNode} node + */ function addComments(node, templateBefore, templateAfter) { var utils = require("utils"); @@ -11108,10 +11108,10 @@ emmet.exec(function(require, _) { "A comma-separated list of tag names that should always get inner indentation."); /** - * Get indentation for given node - * @param {AbbreviationNode} node - * @returns {String} - */ + * Get indentation for given node + * @param {AbbreviationNode} node + * @returns {String} + */ function getIndentation(node) { if (_.include(prefs.getArray("format.noIndentTags") || [], node.name())) { return ""; @@ -11121,28 +11121,28 @@ emmet.exec(function(require, _) { } /** - * Test if passed node has block-level sibling element - * @param {AbbreviationNode} item - * @return {Boolean} - */ + * Test if passed node has block-level sibling element + * @param {AbbreviationNode} item + * @return {Boolean} + */ function hasBlockSibling(item) { return item.parent && require("abbreviationUtils").hasBlockChildren(item.parent); } /** - * Test if passed item is very first child in parsed tree - * @param {AbbreviationNode} item - */ + * Test if passed item is very first child in parsed tree + * @param {AbbreviationNode} item + */ function isVeryFirstChild(item) { return item.parent && !item.parent.parent && !item.index(); } /** - * Check if a newline should be added before element - * @param {AbbreviationNode} node - * @param {OutputProfile} profile - * @return {Boolean} - */ + * Check if a newline should be added before element + * @param {AbbreviationNode} node + * @param {OutputProfile} profile + * @return {Boolean} + */ function shouldAddLineBreak(node, profile) { var abbrUtils = require("abbreviationUtils"); if (profile.tag_nl === true || abbrUtils.isBlock(node)) @@ -11156,10 +11156,10 @@ emmet.exec(function(require, _) { } /** - * Need to add newline because item has too many inline children - * @param {AbbreviationNode} node - * @param {OutputProfile} profile - */ + * Need to add newline because item has too many inline children + * @param {AbbreviationNode} node + * @param {OutputProfile} profile + */ function shouldBreakChild(node, profile) { // we need to test only one child element, because // hasBlockChildren() method will do the rest @@ -11185,11 +11185,11 @@ emmet.exec(function(require, _) { } /** - * Processes element with matched resource of type snippet - * @param {AbbreviationNode} item - * @param {OutputProfile} profile - * @param {Number} level Depth level - */ + * Processes element with matched resource of type snippet + * @param {AbbreviationNode} item + * @param {OutputProfile} profile + * @param {Number} level Depth level + */ function processSnippet(item, profile, level) { item.start = item.end = ""; if (!isVeryFirstChild(item) && profile.tag_nl !== false && shouldAddLineBreak(item, profile)) { @@ -11203,11 +11203,11 @@ emmet.exec(function(require, _) { } /** - * Check if we should add line breaks inside inline element - * @param {AbbreviationNode} node - * @param {OutputProfile} profile - * @return {Boolean} - */ + * Check if we should add line breaks inside inline element + * @param {AbbreviationNode} node + * @param {OutputProfile} profile + * @return {Boolean} + */ function shouldBreakInsideInline(node, profile) { var abbrUtils = require("abbreviationUtils"); var hasBlockElems = _.any(node.children, function(child) { @@ -11225,11 +11225,11 @@ emmet.exec(function(require, _) { } /** - * Processes element with tag type - * @param {AbbreviationNode} item - * @param {OutputProfile} profile - * @param {Number} level Depth level - */ + * Processes element with tag type + * @param {AbbreviationNode} item + * @param {OutputProfile} profile + * @param {Number} level Depth level + */ function processTag(item, profile, level) { item.start = item.end = placeholder; var utils = require("utils"); @@ -11272,11 +11272,11 @@ emmet.exec(function(require, _) { } /** - * Processes simplified tree, making it suitable for output as HTML structure - * @param {AbbreviationNode} tree - * @param {OutputProfile} profile - * @param {Number} level Depth level - */ + * Processes simplified tree, making it suitable for output as HTML structure + * @param {AbbreviationNode} tree + * @param {OutputProfile} profile + * @param {Number} level Depth level + */ require("filters").add("_format", function process(tree, profile, level) { level = level || 0; var abbrUtils = require("abbreviationUtils"); @@ -11309,10 +11309,10 @@ emmet.exec(function(require, _) { } /** - * Creates HAML attributes string from tag according to profile settings - * @param {AbbreviationNode} tag - * @param {Object} profile - */ + * Creates HAML attributes string from tag according to profile settings + * @param {AbbreviationNode} tag + * @param {Object} profile + */ function makeAttributesString(tag, profile) { var attrs = ""; var otherAttrs = []; @@ -11342,20 +11342,20 @@ emmet.exec(function(require, _) { } /** - * Test if passed node has block-level sibling element - * @param {AbbreviationNode} item - * @return {Boolean} - */ + * Test if passed node has block-level sibling element + * @param {AbbreviationNode} item + * @return {Boolean} + */ function hasBlockSibling(item) { return item.parent && item.parent.hasBlockChildren(); } /** - * Processes element with tag type - * @param {AbbreviationNode} item - * @param {OutputProfile} profile - * @param {Number} level Depth level - */ + * Processes element with tag type + * @param {AbbreviationNode} item + * @param {OutputProfile} profile + * @param {Number} level Depth level + */ function processTag(item, profile, level) { if (!item.parent) // looks like it's root element @@ -11392,11 +11392,11 @@ emmet.exec(function(require, _) { } /** - * Processes simplified tree, making it suitable for output as HTML structure - * @param {AbbreviationNode} tree - * @param {Object} profile - * @param {Number} level Depth level - */ + * Processes simplified tree, making it suitable for output as HTML structure + * @param {AbbreviationNode} tree + * @param {Object} profile + * @param {Number} level Depth level + */ require("filters").add("haml", function process(tree, profile, level) { level = level || 0; var abbrUtils = require("abbreviationUtils"); @@ -11425,10 +11425,10 @@ emmet.exec(function(require, _) { */ emmet.exec(function(require, _) { /** - * Creates HTML attributes string from tag according to profile settings - * @param {AbbreviationNode} node - * @param {OutputProfile} profile - */ + * Creates HTML attributes string from tag according to profile settings + * @param {AbbreviationNode} node + * @param {OutputProfile} profile + */ function makeAttributesString(node, profile) { var attrQuote = profile.attributeQuote(); var cursor = profile.cursor(); @@ -11440,11 +11440,11 @@ emmet.exec(function(require, _) { } /** - * Processes element with tag type - * @param {AbbreviationNode} item - * @param {OutputProfile} profile - * @param {Number} level Depth level - */ + * Processes element with tag type + * @param {AbbreviationNode} item + * @param {OutputProfile} profile + * @param {Number} level Depth level + */ function processTag(item, profile, level) { if (!item.parent) // looks like it's root element return item; @@ -11491,11 +11491,11 @@ emmet.exec(function(require, _) { } /** - * Processes simplified tree, making it suitable for output as HTML structure - * @param {AbbreviationNode} tree - * @param {Object} profile - * @param {Number} level Depth level - */ + * Processes simplified tree, making it suitable for output as HTML structure + * @param {AbbreviationNode} tree + * @param {Object} profile + * @param {Number} level Depth level + */ require("filters").add("html", function process(tree, profile, level) { level = level || 0; var abbrUtils = require("abbreviationUtils"); @@ -11602,9 +11602,9 @@ emmet.exec(function(require, _) { }; /** - * Removes "select" attribute from node - * @param {AbbreviationNode} node - */ + * Removes "select" attribute from node + * @param {AbbreviationNode} node + */ function trimAttribute(node) { node.start = node.start.replace(/\s+select\s*=\s*(['"]).*?\1/, ""); } @@ -11712,9 +11712,9 @@ emmet.define("lorem", function(require, _) { prefs.define("lorem.defaultLang", "en"); /** - * @param {AbbreviationNode} tree - * @param {Object} options - */ + * @param {AbbreviationNode} tree + * @param {Object} options + */ require("abbreviationParser").addPreprocessor(function(tree, options) { var re = /^(?:lorem|lipsum)([a-z]{2})?(\d*)$/i, match; @@ -11738,20 +11738,20 @@ emmet.define("lorem", function(require, _) { }); /** - * Returns random integer between from and to values - * @param {Number} from - * @param {Number} to - * @returns {Number} - */ + * Returns random integer between from and to values + * @param {Number} from + * @param {Number} to + * @returns {Number} + */ function randint(from, to) { return Math.round(Math.random() * (to - from) + from); } /** - * @param {Array} arr - * @param {Number} count - * @returns {Array} - */ + * @param {Array} arr + * @param {Number} count + * @returns {Array} + */ function sample(arr, count) { var len = arr.length; var iterations = Math.min(len, count); @@ -11783,10 +11783,10 @@ emmet.define("lorem", function(require, _) { } /** - * Insert commas at randomly selected words. This function modifies values - * inside words array - * @param {Array} words - */ + * Insert commas at randomly selected words. This function modifies values + * inside words array + * @param {Array} words + */ function insertCommas(words) { var len = words.length; var totalCommas = 0; @@ -11807,12 +11807,12 @@ emmet.define("lorem", function(require, _) { } /** - * Generate a paragraph of "Lorem ipsum" text - * @param {Number} wordCount Words count in paragraph - * @param {Boolean} startWithCommon Should paragraph start with common - * "lorem ipsum" sentence. - * @returns {String} - */ + * Generate a paragraph of "Lorem ipsum" text + * @param {Number} wordCount Words count in paragraph + * @param {Boolean} startWithCommon Should paragraph start with common + * "lorem ipsum" sentence. + * @returns {String} + */ function paragraph(lang, wordCount, startWithCommon) { var data = langs[lang]; if (!data) { @@ -11845,12 +11845,12 @@ emmet.define("lorem", function(require, _) { return { /** - * Adds new language words for Lorem Ipsum generator - * @param {String} lang Two-letter lang definition - * @param {Object} data Words for language. Maight be either a space-separated - * list of words (String), Array of words or object with text and - * common properties - */ + * Adds new language words for Lorem Ipsum generator + * @param {String} lang Two-letter lang definition + * @param {Object} data Words for language. Maight be either a space-separated + * list of words (String), Array of words or object with text and + * common properties + */ addLang: function(lang, data) { if (_.isString(data)) { data = { words: _.compact(data.split(" ")) };