1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-18 07:44:51 +00:00

Added indirect transclusion

The name of the tiddler to transclude is taken from a text reference
This commit is contained in:
Jeremy Ruston 2012-11-07 16:11:47 +00:00
parent bdc46a8bc3
commit 34435329e6

View File

@ -56,6 +56,7 @@ exports.info = {
cascadeParams: true, // Cascade names of named parameters to following anonymous parameters
params: {
target: {byName: "default", type: "tiddler"},
targetVia: {byName: true, type: "tiddler"},
template: {byName: true, type: "tiddler"},
templateText: {byName: true, type: "text"},
"with": {byName: true, type: "text", dependentAll: true}
@ -73,6 +74,12 @@ exports.evaluateDependencies = function() {
} else {
dependencies.addDependency(template,true);
}
var targetVia = this.srcParams.targetVia;
if(typeof targetVia === "function") {
dependencies.dependentAll = true;
} else {
dependencies.addDependency(targetVia,true);
}
return dependencies;
};
@ -85,6 +92,8 @@ exports.executeMacro = function() {
// If there's no render title specified then use the current tiddler title
if(this.hasParameter("target")) {
renderTitle = this.params.target;
} else if(this.hasParameter("targetVia")) {
renderTitle = this.wiki.getTextReference(this.params.targetVia,null,this.tiddlerTitle);
} else {
renderTitle = this.tiddlerTitle;
}