mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-18 21:22:52 +00:00
fix: restore old behavior: include itself like backlinks[]
This commit is contained in:
parent
a3bf9c0f1c
commit
ed6a63a925
@ -571,8 +571,11 @@ exports.extractTranscludes = function(parseTreeRoot, title) {
|
|||||||
} else if(parseTreeNode.attributes.tiddler && parseTreeNode.attributes.tiddler.type === "string") {
|
} else if(parseTreeNode.attributes.tiddler && parseTreeNode.attributes.tiddler.type === "string") {
|
||||||
value = parseTreeNode.attributes.tiddler.value;
|
value = parseTreeNode.attributes.tiddler.value;
|
||||||
}
|
}
|
||||||
// ignore empty value (like `{{!!field}}`), and deduplicate
|
if (!value) {
|
||||||
if(value && transcludes.indexOf(value) === -1 && value !== title) {
|
value = title;
|
||||||
|
}
|
||||||
|
// Empty value (like `{{!!field}}`) means self-referential transclusion. Also deduplicate the result.
|
||||||
|
if(transcludes.indexOf(value) === -1) {
|
||||||
transcludes.push(value);
|
transcludes.push(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ describe('Backtranscludes and transclude filter tests', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ignore self transclusion', function() {
|
describe('include implicit self transclusion', function() {
|
||||||
var wiki = new $tw.Wiki();
|
var wiki = new $tw.Wiki();
|
||||||
|
|
||||||
wiki.addTiddler({
|
wiki.addTiddler({
|
||||||
@ -190,15 +190,15 @@ describe('Backtranscludes and transclude filter tests', function() {
|
|||||||
text: "{{!!created}}\n\nAn implicit self-referential transclude to <$transclude $field='created'/> and <$transclude field='created'/>"});
|
text: "{{!!created}}\n\nAn implicit self-referential transclude to <$transclude $field='created'/> and <$transclude field='created'/>"});
|
||||||
|
|
||||||
it('should have no transclude', function() {
|
it('should have no transclude', function() {
|
||||||
expect(wiki.filterTiddlers('TestOutgoing +[transcludes[]]').join(',')).toBe('');
|
expect(wiki.filterTiddlers('TestOutgoing +[transcludes[]]').join(',')).toBe('TestOutgoing');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have no back transcludes', function() {
|
it('should have no back transcludes', function() {
|
||||||
expect(wiki.filterTiddlers('TestOutgoing +[backtranscludes[]]').join(',')).toBe('');
|
expect(wiki.filterTiddlers('TestOutgoing +[backtranscludes[]]').join(',')).toBe('TestOutgoing');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Explicit self transclusion', function() {
|
describe('include explicit self transclusion', function() {
|
||||||
var wiki = new $tw.Wiki();
|
var wiki = new $tw.Wiki();
|
||||||
|
|
||||||
wiki.addTiddler({
|
wiki.addTiddler({
|
||||||
@ -206,15 +206,15 @@ describe('Backtranscludes and transclude filter tests', function() {
|
|||||||
text: "{{TestOutgoing!!created}}\n\n<$transclude $tiddler='TestOutgoing' $field='created'/> and <$transclude tiddler='TestOutgoing' field='created'/>"});
|
text: "{{TestOutgoing!!created}}\n\n<$transclude $tiddler='TestOutgoing' $field='created'/> and <$transclude tiddler='TestOutgoing' field='created'/>"});
|
||||||
|
|
||||||
it('should have no transclude', function() {
|
it('should have no transclude', function() {
|
||||||
expect(wiki.filterTiddlers('TestOutgoing +[transcludes[]]').join(',')).toBe('');
|
expect(wiki.filterTiddlers('TestOutgoing +[transcludes[]]').join(',')).toBe('TestOutgoing');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have no back transcludes', function() {
|
it('should have no back transcludes', function() {
|
||||||
expect(wiki.filterTiddlers('TestOutgoing +[backtranscludes[]]').join(',')).toBe('');
|
expect(wiki.filterTiddlers('TestOutgoing +[backtranscludes[]]').join(',')).toBe('TestOutgoing');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('recognize soft transclusion defined by widget', function() {
|
describe('recognize transclusion defined by widget', function() {
|
||||||
var wiki = new $tw.Wiki();
|
var wiki = new $tw.Wiki();
|
||||||
|
|
||||||
wiki.addTiddler({
|
wiki.addTiddler({
|
||||||
|
Loading…
Reference in New Issue
Block a user