Part of ACREP-32.
authorMike Taylor <mike@indexdata.com>
Mon, 29 Jun 2015 19:02:46 +0000 (20:02 +0100)
committerMike Taylor <mike@indexdata.com>
Mon, 29 Jun 2015 19:02:46 +0000 (20:02 +0100)
Add new Handlebars helper mkws-indexplus.
Emits the current index in an iteration, plus a constant.

src/mkws-handlebars.js

index 3a59e9c..27975cd 100644 (file)
@@ -122,6 +122,10 @@ Handlebars.registerHelper('mkws-index1', function(obj) {
   return obj.data.index + 1;
 });
 
   return obj.data.index + 1;
 });
 
+Handlebars.registerHelper('mkws-indexplus', function(delta, obj) {
+  return obj.data.index + delta;
+});
+
 Handlebars.registerHelper('mkws-repeat', function(count, options) {
   var out = "";
   for (var i = 0; i < count; i++) {
 Handlebars.registerHelper('mkws-repeat', function(count, options) {
   var out = "";
   for (var i = 0; i < count; i++) {