1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 23:03:15 +00:00

Fixed problem with target fields/index being erroneously applied to template

See here for discussion:

https://groups.google.com/d/msg/TiddlyWiki/D3MBNhjaT3E/ph0ZuAhuPFMJ
This commit is contained in:
Jermolene 2013-11-11 22:29:38 +00:00
parent e274a0c7d1
commit d64590a12b
2 changed files with 24 additions and 16 deletions

View File

@ -40,9 +40,7 @@ exports.parse = function() {
var transcludeNode = {
type: "element",
tag: "$transclude",
attributes: {
tiddler: {type: "string", value: template || targetTitle}
},
attributes: {},
isBlock: true
};
var tiddlerNode = {
@ -54,11 +52,16 @@ exports.parse = function() {
isBlock: true,
children: [transcludeNode]
};
if(targetField) {
transcludeNode.attributes.field = {type: "string", value: targetField};
}
if(targetIndex) {
transcludeNode.attributes.index = {type: "string", value: targetIndex};
if(template) {
transcludeNode.attributes.tiddler = {type: "string", value: template};
} else {
transcludeNode.attributes.tiddler = {type: "string", value: targetTitle};
if(targetField) {
transcludeNode.attributes.field = {type: "string", value: targetField};
}
if(targetIndex) {
transcludeNode.attributes.index = {type: "string", value: targetIndex};
}
}
return [tiddlerNode];
};

View File

@ -40,9 +40,8 @@ exports.parse = function() {
var transcludeNode = {
type: "element",
tag: "$transclude",
attributes: {
tiddler: {type: "string", value: template || targetTitle}
}
attributes: {},
isBlock: true
};
var tiddlerNode = {
type: "element",
@ -50,13 +49,19 @@ exports.parse = function() {
attributes: {
tiddler: {type: "string", value: targetTitle}
},
isBlock: true,
children: [transcludeNode]
};
if(targetField) {
transcludeNode.attributes.field = {type: "string", value: targetField};
}
if(targetIndex) {
transcludeNode.attributes.index = {type: "string", value: targetIndex};
if(template) {
transcludeNode.attributes.tiddler = {type: "string", value: template};
} else {
transcludeNode.attributes.tiddler = {type: "string", value: targetTitle};
if(targetField) {
transcludeNode.attributes.field = {type: "string", value: targetField};
}
if(targetIndex) {
transcludeNode.attributes.index = {type: "string", value: targetIndex};
}
}
return [tiddlerNode];
};