grunt-bake
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -361,5 +361,31 @@ /* | ||
} | ||
}, | ||
var_as_array_key: { | ||
options: { | ||
content: { | ||
"pages": { | ||
"page1": { | ||
"title": "Page 1" | ||
}, | ||
"page2": { | ||
"title": "Page 2" | ||
}, | ||
"page3": { | ||
"title": "Page 3" | ||
}, | ||
"page4": { | ||
"title": "Page 4" | ||
}, | ||
"page5": { | ||
"title": "Page 5" | ||
} | ||
} | ||
} | ||
}, | ||
files: { | ||
"tmp/var_as_array_key.html": "test/fixtures/var_as_array_key.html" | ||
} | ||
} | ||
} | ||
} ); | ||
@@ -366,0 +392,0 @@ |
{ | ||
"name": "grunt-bake", | ||
"description": "Bake external includes into files to create static pages with no server-side compilation time", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"homepage": "https://github.com/MathiasPaumgarten/grunt-bake", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -207,3 +207,9 @@ /* | ||
function resolveName( name, values ) { | ||
return mout.object.get( values, name ) || ""; | ||
name = name.replace( /\[([^\]]+)\]/g, function( match, inner ) { | ||
return "." + resolveName( inner, values ); | ||
}); | ||
var value = mout.object.get( values, name ); | ||
return value !== undefined ? value : ""; | ||
} | ||
@@ -416,7 +422,7 @@ | ||
// assign meta vars with information about current iteration | ||
values[ forEachName + "@index" ] = String( index ); | ||
values[ forEachName + "@iteration" ] = String( index + 1 ); | ||
values[ forEachName + "@index" ] = index; | ||
values[ forEachName + "@iteration" ] = index + 1; | ||
values[ forEachName + "@first" ] = ( index === 0 ); | ||
values[ forEachName + "@last" ] = ( ( total - 1 ) === index ); | ||
values[ forEachName + "@total" ] = String( total ); | ||
values[ forEachName + "@total" ] = total; | ||
@@ -423,0 +429,0 @@ fragment += linebreak + parse( includeContent, includePath, values ); |
@@ -34,3 +34,4 @@ "use strict"; | ||
"tmp/foreach_meta.html": "test/expected/foreach_meta.html", | ||
"tmp/multiline_bake.html": "test/expected/multiline_bake.html" | ||
"tmp/multiline_bake.html": "test/expected/multiline_bake.html", | ||
"tmp/var_as_array_key.html": "test/expected/var_as_array_key.html" | ||
}; | ||
@@ -37,0 +38,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
48401
68
799