Skip to content

Node.js based forum software built for the modern web

fixes to template parser: hide block if no data exists (prevents the default tpl skeleton from showing up)

psychobunnyab456e07af3d
diff --git a/public/src/templates.js b/public/src/templates.js
index 29e3850d33..fe7036a778 100644
--- a/public/src/templates.js
+++ b/public/src/templates.js
@@ -62,6 +62,10 @@ var templates = {};
var template = this.html, regex, block;
return (function parse(data, namespace, template) {
+ if (data.length == 0) {
+ regex = makeRegex('[^]*');
+ template = template.replace(regex, '');
+ }
for (var d in data) {
if (data.hasOwnProperty(d)) {
diff --git a/src/templates.js b/src/templates.js
index 3954a792c4..f38a195475 100644
--- a/src/templates.js
+++ b/src/templates.js
@@ -60,6 +60,10 @@ var fs = require('fs');
var template = this.html, regex, block;
return (function parse(data, namespace, template) {
+ if (data.length == 0) {
+ regex = makeRegex('[^]*');
+ template = template.replace(regex, '');
+ }
for (var d in data) {
if (data.hasOwnProperty(d)) {