mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-06-24 22:33:16 +00:00
Fix whitespace in x-listops.js and tweak toggle operator (#5024)
* Replaced leading spaces with tabs * Tweak toggle[] to insert new value in same list position
This commit is contained in:
parent
a2b2e117e3
commit
13499557bf
|
@ -196,14 +196,16 @@ Extended filter operators to manipulate the current list.
|
|||
index = results.indexOf(operator.operand),
|
||||
pairIndex = (operator.operands[1] ? results.indexOf(operator.operands[1]) : -1);
|
||||
if(index === -1) {
|
||||
results.push(operator.operand);
|
||||
if(pairIndex !== -1) {
|
||||
results.splice(pairIndex,1);
|
||||
results.splice(pairIndex,1,operator.operand);
|
||||
} else {
|
||||
results.push(operator.operand);
|
||||
}
|
||||
} else {
|
||||
results.splice(index,1);
|
||||
if(operator.operands[1]) {
|
||||
results.push(operator.operands[1]);
|
||||
results.splice(index,1,operator.operands[1]);
|
||||
} else {
|
||||
results.splice(index,1);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
|
|
|
@ -758,6 +758,7 @@ function runTests(wiki) {
|
|||
expect(wiki.filterTiddlers("[[Tiddler Three]tags[]] -[[one]] +[toggle[one]]").join(",")).toBe("two,one");
|
||||
expect(wiki.filterTiddlers("[[Tiddler Three]tags[]] +[toggle[three],[four]]").join(",")).toBe("one,two,three");
|
||||
expect(wiki.filterTiddlers("[[Tiddler Three]tags[]] [[three]] +[toggle[three],[four]]").join(",")).toBe("one,two,four");
|
||||
expect(wiki.filterTiddlers("[[Tiddler Three]tags[]] [[three]] [[four]] +[toggle[three],[five]]").join(",")).toBe("one,two,five,four");
|
||||
});
|
||||
|
||||
it("should handle multiple operands for search-replace", function() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user