3 Handlebars.registerHelper('mkws-json', function(obj) {
8 Handlebars.registerHelper('mkws-paragraphs', function(obj) {
10 for (var i = 0; i < obj.length; i++) {
11 acc.push('<p>', obj[i], '</p>');
17 Handlebars.registerHelper('mkws-translate', function(s) {
22 // We need {{mkws-attr '@name'}} because Handlebars can't parse {{@name}}
23 Handlebars.registerHelper('mkws-attr', function(attrName) {
24 return this[attrName];
29 * Use as follows: {{#mkws-if-any NAME1 having="NAME2"}}
30 * Applicable when NAME1 is the name of an array
31 * The guarded code runs only if at least one element of the NAME1
32 * array has a subelement called NAME2.
34 Handlebars.registerHelper('mkws-if-any', function(items, options) {
35 var having = options.hash.having;
36 for (var i in items) {
38 if (!having || item[having]) {
39 return options.fn(this);
46 Handlebars.registerHelper('mkws-first', function(items, options) {
47 var having = options.hash.having;
48 for (var i in items) {
50 if (!having || item[having]) {
51 return options.fn(item);
58 Handlebars.registerHelper('mkws-commaList', function(items, options) {
61 for (var i in items) {
62 if (i > 0) out += ", ";
63 out += options.fn(items[i])
70 Handlebars.registerHelper('mkws-index1', function(obj) {
71 return obj.data.index + 1;