mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-01 16:26:57 +00:00
Tiddler helper method to return a block of fields
This commit is contained in:
parent
d3e6a0cdf0
commit
030f16981a
@ -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");
|
||||
};
|
||||
|
||||
})();
|
||||
|
Loading…
x
Reference in New Issue
Block a user