1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-27 14:48:19 +00:00

Tiddler helper method to return a block of fields

This commit is contained in:
Jeremy Ruston 2012-11-11 14:12:10 +00:00
parent d3e6a0cdf0
commit 030f16981a

View File

@ -35,4 +35,22 @@ exports.getFieldString = function(field) {
}
};
/*
Get all the fields as a name:value block. Options:
exclude: an array of field names to exclude
*/
exports.getFieldStringBlock = function(options) {
options = options || {};
var exclude = options.exclude || [];
var fields = [];
for(var field in this.fields) {
if($tw.utils.hop(this.fields,field)) {
if(exclude.indexOf(field) === -1) {
fields.push(field + ": " + this.getFieldString(field));
}
}
}
return fields.join("\n");
};
})();