mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-07 22:33:50 +00:00
Fixed handling of shadow tiddlers
This commit is contained in:
parent
351e5b3e1f
commit
2c3f96557f
18
js/Recipe.js
18
js/Recipe.js
@ -117,7 +117,8 @@ Recipe.prototype.chooseTiddlers = function(recipe) {
|
|||||||
if(recipeLine instanceof Array) {
|
if(recipeLine instanceof Array) {
|
||||||
this.chooseTiddlers(recipeLine);
|
this.chooseTiddlers(recipeLine);
|
||||||
} else {
|
} else {
|
||||||
var markerArray = this.markers[recipeLine.marker];
|
var store = recipeLine.marker === "shadow" ? this.store.shadows : this.store,
|
||||||
|
markerArray = this.markers[recipeLine.marker];
|
||||||
if(markerArray === undefined) {
|
if(markerArray === undefined) {
|
||||||
this.markers[recipeLine.marker] = [];
|
this.markers[recipeLine.marker] = [];
|
||||||
markerArray = this.markers[recipeLine.marker];
|
markerArray = this.markers[recipeLine.marker];
|
||||||
@ -133,7 +134,7 @@ Recipe.prototype.chooseTiddlers = function(recipe) {
|
|||||||
if(!found) {
|
if(!found) {
|
||||||
markerArray.push(recipeLine.tiddlers[t].title);
|
markerArray.push(recipeLine.tiddlers[t].title);
|
||||||
}
|
}
|
||||||
this.store.addTiddler(new Tiddler(recipeLine.tiddlers[t]));
|
store.addTiddler(new Tiddler(recipeLine.tiddlers[t]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,19 +270,10 @@ Recipe.tiddlerOutputter = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
shadow: function(out,tiddlers) {
|
shadow: function(out,tiddlers) {
|
||||||
// Shadows are output as a <DIV> with the the ".shadow" suffix removed from the title
|
|
||||||
for(var t=0; t<tiddlers.length; t++) {
|
for(var t=0; t<tiddlers.length; t++) {
|
||||||
var title = tiddlers[t],
|
var title = tiddlers[t],
|
||||||
tid = this.store.getTiddler(title),
|
tid = this.store.shadows.getTiddler(title);
|
||||||
tweakedTiddler;
|
out.push(tiddlerOutput.outputTiddlerDiv(tid));
|
||||||
if(title.indexOf(".shadow") === title.length - 7) {
|
|
||||||
tweakedTiddler = new Tiddler(tid,{
|
|
||||||
title: title.substr(0, title.length-7)
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
tweakedTiddler = tid;
|
|
||||||
}
|
|
||||||
out.push(tiddlerOutput.outputTiddlerDiv(tweakedTiddler));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
var Tiddler = require("./Tiddler.js").Tiddler;
|
var Tiddler = require("./Tiddler.js").Tiddler;
|
||||||
|
|
||||||
var TiddlyWiki = function() {
|
var TiddlyWiki = function TiddlyWiki(shadowStore) {
|
||||||
this.tiddlers = {};
|
this.tiddlers = {};
|
||||||
|
this.shadows = shadowStore === undefined ? new TiddlyWiki(null) : shadowStore;
|
||||||
};
|
};
|
||||||
|
|
||||||
TiddlyWiki.prototype.clear = function() {
|
TiddlyWiki.prototype.clear = function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user