mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
rename suffix each:list to each_list-item
based on #1422, improves readability of the filter expression tests passed
This commit is contained in:
parent
b152a0a894
commit
ef3e44eb48
@ -20,7 +20,7 @@ exports.each = function(source,operator,options) {
|
||||
var results =[] ,
|
||||
value,values = {},
|
||||
field = operator.operand || "title";
|
||||
if(operator.suffix !== "list") {
|
||||
if(operator.suffix !== "list-item") {
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler) {
|
||||
value = (field === "title") ? title : tiddler.getFieldString(field);
|
||||
|
@ -219,8 +219,8 @@ describe("Filter tests", function() {
|
||||
|
||||
it("should handle the each operator", function() {
|
||||
expect(wiki.filterTiddlers("[each[modifier]sort[title]]").join(",")).toBe("$:/TiddlerTwo,TiddlerOne");
|
||||
expect(wiki.filterTiddlers("[each:list[tags]sort[title]]").join(",")).toBe("one,two");
|
||||
expect(wiki.filterTiddlers("[each:list[authors]sort[title]]").join(",")).toBe("Bloggs,Joe,John Doe");
|
||||
expect(wiki.filterTiddlers("[each:list-item[tags]sort[title]]").join(",")).toBe("one,two");
|
||||
expect(wiki.filterTiddlers("[each:list-item[authors]sort[title]]").join(",")).toBe("Bloggs,Joe,John Doe");
|
||||
});
|
||||
|
||||
it("should handle the eachday operator", function() {
|
||||
|
@ -6,7 +6,7 @@ type: text/vnd.tiddlywiki
|
||||
caption: each
|
||||
op-purpose: select one of each group of input titles by field
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-suffix: optionally, `list`
|
||||
op-suffix: optionally, `list-item`
|
||||
op-parameter: the name of a [[field|TiddlerFields]], defaulting to <<.field title>>
|
||||
op-parameter-name: F
|
||||
op-output: a selection containing the first input title encountered for each distinct value of field <<.place F>>
|
||||
@ -15,7 +15,7 @@ Each input title is processed in turn. The value of field <<.place F>> in the co
|
||||
|
||||
;each
|
||||
:As long as the field's value has not been encountered before, the title is appended to the output.
|
||||
;each:list
|
||||
;each:list-item
|
||||
:The value is treated as a [[title list|Title List]]. Each title in the list considered in turn. If it has not been encountered before, it is appended to the output.
|
||||
|
||||
If a tiddler doesn't contain field <<.place F>>, it is treated as if the field's value was empty.
|
||||
|
@ -6,6 +6,6 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
<<.operator-example 1 "[each[color]]">>
|
||||
<<.operator-example 2 "[sort[title]each[type]]" "the alphabetically first tiddler of each type">>
|
||||
<<.operator-example 3 "[each:list[list]]" "all tiddlers listed anywhere in the core list field">>
|
||||
<<.operator-example 3 "[each:list-item[list]]" "all tiddlers listed anywhere in the core list field">>
|
||||
|
||||
For an example of using the <<.op each>> operator to generate a two-tier list of groups and members, see [[GroupedLists]].
|
||||
|
Loading…
Reference in New Issue
Block a user