Comparing version 0.0.8 to 0.0.9
@@ -31,2 +31,4 @@ /** | ||
api.addPagelet({ | ||
'for': attr['for'], | ||
model: attr.model, | ||
id: attr.id, | ||
@@ -45,3 +47,3 @@ mode: attr.mode, | ||
return '<div id="' + attr.id + '"></div>'; | ||
return attr['for'] ? '' : '<div id="' + attr.id + '"></div>'; | ||
}; | ||
@@ -48,0 +50,0 @@ } |
{ | ||
"name": "yog-swig", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "custom swig template, add some tag or filter ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
var ignore = 'ignore', | ||
missing = 'missing', | ||
only = 'only', | ||
id = "id", | ||
group = "group", | ||
mode = "mode"; | ||
attrs = ["id", "mode", "group", "for", "model"]; | ||
@@ -60,2 +58,3 @@ /** | ||
var file, w, k; | ||
parser.on(types.STRING, function(token) { | ||
@@ -74,4 +73,4 @@ | ||
if (k == id || k == group || k == mode) { | ||
out.v = token.match.replace(/^['"]|['"]$/g, ''); | ||
if (~attrs.indexOf(k)) { | ||
out.v = token.match.replace(/^("|')?(.*)\1$/g, '$2'); | ||
out.k = k; | ||
@@ -91,3 +90,3 @@ this.out.push(out); | ||
if (token.match === id) { | ||
if (~attrs.indexOf(token.match)) { | ||
k = token.match; | ||
@@ -97,12 +96,2 @@ return false; | ||
if (token.match === mode) { | ||
k = token.match; | ||
return false; | ||
} | ||
if (token.match === group) { | ||
k = token.match; | ||
return false; | ||
} | ||
if (!w && token.match === 'with') { | ||
@@ -109,0 +98,0 @@ w = true; |
13773
320