mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-18 13:12: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") {
|
||||
value = parseTreeNode.attributes.tiddler.value;
|
||||
}
|
||||
// ignore empty value (like `{{!!field}}`), and deduplicate
|
||||
if(value && transcludes.indexOf(value) === -1 && value !== title) {
|
||||
if (!value) {
|
||||
value = title;
|
||||
}
|
||||
// Empty value (like `{{!!field}}`) means self-referential transclusion. Also deduplicate the result.
|
||||
if(transcludes.indexOf(value) === -1) {
|
||||
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();
|
||||
|
||||
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'/>"});
|
||||
|
||||
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() {
|
||||
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();
|
||||
|
||||
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'/>"});
|
||||
|
||||
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() {
|
||||
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();
|
||||
|
||||
wiki.addTiddler({
|
||||
|
Loading…
Reference in New Issue
Block a user