mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 17:10:29 +00:00
Add new subtiddlerfields filter operator
This commit is contained in:
parent
52319ee88a
commit
47cdf55133
31
core/modules/filters/subtiddlerfields.js
Normal file
31
core/modules/filters/subtiddlerfields.js
Normal file
@ -0,0 +1,31 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/subtiddlerfields.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator for returning the names of the fields on the selected subtiddlers of the plugin named in the operand
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.subtiddlerfields = function(source,operator,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
var subtiddler = options.wiki.getSubTiddler(operator.operand,title);
|
||||
if(subtiddler) {
|
||||
for(var fieldName in subtiddler.fields) {
|
||||
$tw.utils.pushTop(results,fieldName);
|
||||
}
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
@ -0,0 +1,8 @@
|
||||
created: 20180403164143915
|
||||
modified: 20180403164257147
|
||||
tags: [[plugintiddlers Operator]] [[Operator Examples]]
|
||||
title: subtiddlerfields Operator (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.operator-example 1 "[[$:/core/copyright.txt]subtiddlerfields[$:/core]]">>
|
||||
|
@ -0,0 +1,13 @@
|
||||
caption: subtiddlerfields
|
||||
created: 20180403164138703
|
||||
modified: 20180403164644231
|
||||
op-input: a [[selection|Title Selection]] of tiddler titles
|
||||
op-output: all field names present in the selected tiddlers within the plugin named <<.place P>>
|
||||
op-parameter: the title of a plugin
|
||||
op-parameter-name: P
|
||||
op-purpose: select all fields present in the selected tiddlers within a plugin
|
||||
tags: [[Filter Operators]] [[Special Operators]]
|
||||
title: subtiddlerfields Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.operator-examples "subtiddlerfields">>
|
Loading…
Reference in New Issue
Block a user