mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +00:00
Fix handling of {!!title} in a filter with no currentTiddler
Fixes #6721
This commit is contained in:
parent
8e64e21039
commit
35b0833e0c
@ -50,7 +50,7 @@ exports.getTextReference = function(textRef,defaultText,currTiddlerTitle) {
|
|||||||
if(tr.field) {
|
if(tr.field) {
|
||||||
var tiddler = this.getTiddler(title);
|
var tiddler = this.getTiddler(title);
|
||||||
if(tr.field === "title") { // Special case so we can return the title of a non-existent tiddler
|
if(tr.field === "title") { // Special case so we can return the title of a non-existent tiddler
|
||||||
return title;
|
return title || defaultText;
|
||||||
} else if(tiddler && $tw.utils.hop(tiddler.fields,tr.field)) {
|
} else if(tiddler && $tw.utils.hop(tiddler.fields,tr.field)) {
|
||||||
return tiddler.getFieldString(tr.field);
|
return tiddler.getFieldString(tr.field);
|
||||||
} else {
|
} else {
|
||||||
|
@ -621,6 +621,8 @@ Tests the filtering mechanism.
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should handle indirect operands", function() {
|
it("should handle indirect operands", function() {
|
||||||
|
expect(wiki.filterTiddlers("[{!!missing}]").join(",")).toBe("");
|
||||||
|
expect(wiki.filterTiddlers("[{!!title}]").join(",")).toBe("");
|
||||||
expect(wiki.filterTiddlers("[prefix{Tiddler8}] +[sort[title]]").join(",")).toBe("Tiddler Three,TiddlerOne");
|
expect(wiki.filterTiddlers("[prefix{Tiddler8}] +[sort[title]]").join(",")).toBe("Tiddler Three,TiddlerOne");
|
||||||
expect(wiki.filterTiddlers("[modifier{Tiddler8!!test-field}] +[sort[title]]").join(",")).toBe("TiddlerOne");
|
expect(wiki.filterTiddlers("[modifier{Tiddler8!!test-field}] +[sort[title]]").join(",")).toBe("TiddlerOne");
|
||||||
var fakeWidget = {wiki: wiki, getVariable: function() {return "Tiddler Three";}};
|
var fakeWidget = {wiki: wiki, getVariable: function() {return "Tiddler Three";}};
|
||||||
|
Loading…
Reference in New Issue
Block a user