Skip to content

Node.js based forum software built for the modern web

closes #927

psychobunnyecc1c315ccd0
diff --git a/public/src/templates.js b/public/src/templates.js
index 2f2d9ad9fe..e9eee153a5 100644
--- a/public/src/templates.js
+++ b/public/src/templates.js
@@ -385,8 +385,14 @@
} else if (data[d] instanceof Object) {
template = parse(data[d], d + '.', template);
} else {
- checkConditional(namespace + d, data[d]);
- checkConditional('!' + namespace + d, !data[d]);
+ var key = namespace + d,
+ value = typeof data[d] === 'string' ? data[d].replace(/^\s+|\s+$/g, '') : data[d];
+
+ if (key === 'metaTags.content' && data[d]) {
+ console.log(typeof data[d] === 'string', data[d].replace(/^\s+|\s+$/g, ''));
+ }
+ checkConditional(key, value);
+ checkConditional('!' + key, !value);
if (blockInfo && blockInfo.iterator) {
checkConditional('@first', blockInfo.iterator === 0);
@@ -395,7 +401,7 @@
checkConditional('!@last', blockInfo.iterator !== blockInfo.total);
}
- template = replace(namespace + d, data[d], template);
+ template = replace(key, value, template);
}
}
}
@@ -406,7 +412,8 @@
namespace = '';
} else {
// clean up all undefined conditionals
- template = template.replace(/(<!-- IF([^@]*?)(ELSE -->| -->))|(<!-- ENDIF([^@]*?)-->)/gi, '');
+ template = template.replace(/<!-- ELSE -->/gi, 'ENDIF -->')
+ .replace(/<!-- IF([^@]*?)ENDIF([^@]*?)-->/gi, '');
}
return template;