mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-07 22:33:50 +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),
|
index = results.indexOf(operator.operand),
|
||||||
pairIndex = (operator.operands[1] ? results.indexOf(operator.operands[1]) : -1);
|
pairIndex = (operator.operands[1] ? results.indexOf(operator.operands[1]) : -1);
|
||||||
if(index === -1) {
|
if(index === -1) {
|
||||||
results.push(operator.operand);
|
|
||||||
if(pairIndex !== -1) {
|
if(pairIndex !== -1) {
|
||||||
results.splice(pairIndex,1);
|
results.splice(pairIndex,1,operator.operand);
|
||||||
|
} else {
|
||||||
|
results.push(operator.operand);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
results.splice(index,1);
|
|
||||||
if(operator.operands[1]) {
|
if(operator.operands[1]) {
|
||||||
results.push(operator.operands[1]);
|
results.splice(index,1,operator.operands[1]);
|
||||||
|
} else {
|
||||||
|
results.splice(index,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results;
|
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[]] -[[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[]] +[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]] +[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() {
|
it("should handle multiple operands for search-replace", function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user