From 5e4e2eed19a5dd94be5904e725edac0f052dcf2e Mon Sep 17 00:00:00 2001 From: aris alexis Date: Sat, 19 Jul 2014 18:41:46 +0200 Subject: [PATCH] added isEven conditional block renders the block if expression is even. helps with fluid grids and putting
stuff, dynamically rendering columns --- lib/swag.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/swag.js b/lib/swag.js index 1272ca5..b75872a 100644 --- a/lib/swag.js +++ b/lib/swag.js @@ -500,6 +500,16 @@ } }, ['safe:string|number', 'safe:string|number']); + + Swag.addHelper('isEven', function(value, options) { + + if (!(value % 2)) { + return options.fn(this); + } else { + return options.inverse(this); + } + }, ['safe:string|number']); + Swag.addHelper('isnt', function(value, test, options) { if (!value || value !== test) { return options.fn(this);