vandyke-toolkit
Advanced tools
Comparing version 0.0.0 to 0.0.1
{ | ||
"name": "vandyke-toolkit", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "Toolkit for the VanDyke template engine", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -7,7 +7,7 @@ ;(function (root, factory) { | ||
// AMD | ||
define(['module', 'exports', 'require', 'cla55', './writer', './traverser'], factory); | ||
define(['require', 'exports', 'module', 'cla55', './writer', './traverser'], factory); | ||
} else { | ||
console && console.error('Unsupported module environment.'); // jshint ignore:line | ||
} | ||
}(this, function (module, exports, require) { | ||
}(this, function (require, exports, module) { | ||
@@ -209,4 +209,15 @@ 'use strict'; | ||
before: function (ctx, node) { | ||
if (node.attributes.length >= 1) { | ||
this.content().write(', {'); | ||
var hasExpression = node.attributes.filter(function (child) { | ||
return child.type === 'Expression'; | ||
}).length > 0; | ||
if (hasExpression) { | ||
this.option('.attributes_spread', true); | ||
// Register use of component shortcut | ||
this.setProxy('spread'); | ||
this.content().write(', spread('); | ||
} else if (node.attributes.length >= 1) { | ||
this.content().write(','); | ||
} else { | ||
@@ -217,10 +228,24 @@ this.content().write(', null'); | ||
beforeEach: function (ctx, node, i) { | ||
// Separation comma | ||
if (i) { | ||
this.content().write(', '); | ||
} | ||
// Open object for properties | ||
if (node.attributes[i].type === 'Property' && (!node.attributes[i - 1] || node.attributes[i - 1].type !== 'Property')) { | ||
this.content().write('{'); | ||
} | ||
}, | ||
after: function (ctx, node) { | ||
if (node.attributes.length >= 1) { | ||
afterEach: function (ctx, node, i) { | ||
// Close object for properties | ||
if (node.attributes[i].type === 'Property' && (!node.attributes[i + 1] || node.attributes[i + 1].type !== 'Property')) { | ||
this.content().write('}'); | ||
} | ||
}, | ||
after: function () { | ||
if (this.option('.attributes_spread')) { | ||
this.content().write(')'); | ||
this.option('.attributes_spread', false); | ||
} | ||
} | ||
@@ -227,0 +252,0 @@ } |
{ | ||
"name": "vandyke-toolkit", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "Toolkit for the VanDyke template engine", | ||
@@ -8,3 +8,3 @@ "license": "MIT", | ||
"name": "Evan Vosberg", | ||
"email": "evanvosberg@inext.me" | ||
"email": "evanvosberg@urban.to" | ||
}, | ||
@@ -11,0 +11,0 @@ "homepage": "https://github.com/brix/vandyke-toolkit", |
@@ -7,7 +7,7 @@ ;(function (root, factory) { | ||
// AMD | ||
define(['module', 'exports', 'require', 'cla55', './tokenizer'], factory); | ||
define(['require', 'exports', 'module', 'cla55', './tokenizer'], factory); | ||
} else { | ||
console && console.error('Unsupported module environment.'); // jshint ignore:line | ||
} | ||
}(this, function (module, exports, require) { | ||
}(this, function (require, exports, module) { | ||
@@ -154,4 +154,4 @@ 'use strict'; | ||
Attribute: function Attribute() { | ||
var node = this.createNode('Property'), | ||
token = this.token(); | ||
var token = this.token(), | ||
node; | ||
@@ -167,29 +167,35 @@ // Expect white space | ||
// Expect identifier | ||
this.expect(token.is('Identifier')); | ||
this.expect(token.is('Identifier') || (token.is('Punctuator') && token.hasValue('{'))); | ||
// Check whether the attribute is an event listener | ||
this.option('._ctx_listener', token.hasValue(/^on/)); | ||
if (token.is('Identifier')) { | ||
node = this.createNode('Property'); | ||
// Get name identifier | ||
node.name = this.Identifier(); | ||
// Check whether the attribute is an event listener | ||
this.option('._ctx_listener', token.hasValue(/^on/)); | ||
// Read token | ||
token = this.token(); | ||
// Get name identifier | ||
node.name = this.Identifier(); | ||
if (token.is('Punctuator') && token.hasValue('=')) { | ||
// Attribute with value | ||
this.next(); | ||
// Read token | ||
token = this.token(); | ||
// Detect value | ||
node.value = this.detect('String', 'Expression'); | ||
if (token.is('Punctuator') && token.hasValue('=')) { | ||
// Attribute with value | ||
this.next(); | ||
this.expect(node.value); | ||
// Detect value | ||
node.value = this.detect('String', 'Expression'); | ||
this.expect(node.value); | ||
} else { | ||
// Attribute without value | ||
node.value = null; | ||
} | ||
// Clear listener context | ||
this.option('._ctx_listener', false); | ||
} else { | ||
// Attribute without value | ||
node.value = null; | ||
node = this.Expression(); | ||
} | ||
// Clear listener context | ||
this.option('._ctx_listener', false); | ||
return node; | ||
@@ -196,0 +202,0 @@ }, |
@@ -7,7 +7,7 @@ ;(function (root, factory) { | ||
// AMD | ||
define(['module', 'exports', 'require', 'cla55', './composer', './parser'], factory); | ||
define(['require', 'exports', 'module', 'cla55', './composer', './parser'], factory); | ||
} else { | ||
console && console.error('Unsupported module environment.'); // jshint ignore:line | ||
} | ||
}(this, function (module, exports, require) { | ||
}(this, function (require, exports, module) { | ||
@@ -14,0 +14,0 @@ 'use strict'; |
@@ -7,7 +7,7 @@ ;(function (root, factory) { | ||
// AMD | ||
define(['module', 'exports', 'require', 'cla55'], factory); | ||
define(['require', 'exports', 'module', 'cla55'], factory); | ||
} else { | ||
console && console.error('Unsupported module environment.'); // jshint ignore:line | ||
} | ||
}(this, function (module, exports, require) { | ||
}(this, function (require, exports, module) { | ||
@@ -14,0 +14,0 @@ 'use strict'; |
@@ -7,7 +7,7 @@ ;(function (root, factory) { | ||
// AMD | ||
define(['module', 'exports', 'require', 'cla55', './token'], factory); | ||
define(['require', 'exports', 'module', 'cla55', './token'], factory); | ||
} else { | ||
console && console.error('Unsupported module environment.'); // jshint ignore:line | ||
} | ||
}(this, function (module, exports, require) { | ||
}(this, function (require, exports, module) { | ||
@@ -14,0 +14,0 @@ 'use strict'; |
@@ -7,7 +7,7 @@ ;(function (root, factory) { | ||
// AMD | ||
define(['module', 'exports', 'require', 'cla55'], factory); | ||
define(['require', 'exports', 'module', 'cla55'], factory); | ||
} else { | ||
console && console.error('Unsupported module environment.'); // jshint ignore:line | ||
} | ||
}(this, function (module, exports, require) { | ||
}(this, function (require, exports, module) { | ||
@@ -14,0 +14,0 @@ 'use strict'; |
@@ -7,7 +7,7 @@ ;(function (root, factory) { | ||
// AMD | ||
define(['module', 'exports', 'require', 'vandyke', './composer', './parser', './register', './token', './tokenizer', './traverser', './writer'], factory); | ||
define(['require', 'exports', 'module', 'vandyke', './composer', './parser', './register', './token', './tokenizer', './traverser', './writer'], factory); | ||
} else { | ||
console && console.error('Unsupported module environment.'); // jshint ignore:line | ||
} | ||
}(this, function (module, exports, require) { | ||
}(this, function (require, exports, module) { | ||
@@ -14,0 +14,0 @@ 'use strict'; |
@@ -7,7 +7,7 @@ ;(function (root, factory) { | ||
// AMD | ||
define(['module', 'exports', 'require', 'cla55'], factory); | ||
define(['require', 'exports', 'module', 'cla55'], factory); | ||
} else { | ||
console && console.error('Unsupported module environment.'); // jshint ignore:line | ||
} | ||
}(this, function (module, exports, require) { | ||
}(this, function (require, exports, module) { | ||
@@ -14,0 +14,0 @@ 'use strict'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64338
1611