mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-04-25 04:54:49 +00:00
Fix: transcludes and backtranscludes operators to always include self-referential transclusion (#8257)
* fix: ignore self-referential transclusion
* feat: support old <$transclude tiddler param
* fix: restore old behavior: include itself like backlinks[]
* refactor: use LinkedList in transcludes[] and backtranscludes[]
* fix: only fallback to title when {{!!xxx}}, not when input is empty
* refactor: move transcludes ast extractor to a file
* refactor: move links ast extractor to a file
* Revert "refactor: move links ast extractor to a file"
This reverts commit 5600a00cd8.
* Revert "refactor: move transcludes ast extractor to a file"
This reverts commit 61d5484f09.
* lint: use pushTop and remove space
This commit is contained in:
@@ -22,6 +22,9 @@ describe('Backtranscludes and transclude filter tests', function() {
|
||||
it('should have no backtranscludes', function() {
|
||||
expect(wiki.filterTiddlers('TestIncoming +[backtranscludes[]]').join(',')).toBe('');
|
||||
});
|
||||
it('should have no transcludes', function() {
|
||||
expect(wiki.filterTiddlers('TestIncoming +[transcludes[]]').join(',')).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('A tiddler added to the wiki with a transclude to it', function() {
|
||||
@@ -38,6 +41,9 @@ describe('Backtranscludes and transclude filter tests', function() {
|
||||
it('should have a backtransclude', function() {
|
||||
expect(wiki.filterTiddlers('TestIncoming +[backtranscludes[]]').join(',')).toBe('TestOutgoing');
|
||||
});
|
||||
it('should have a transclude', function() {
|
||||
expect(wiki.filterTiddlers('TestOutgoing +[transcludes[]]').join(',')).toBe('TestIncoming');
|
||||
});
|
||||
});
|
||||
|
||||
describe('A tiddler transclude with template will still use the tiddler as result.', function() {
|
||||
@@ -182,35 +188,52 @@ 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({
|
||||
title: 'TestOutgoing',
|
||||
text: "{{!!created}}\n\nA transclude to {{!!title}}"});
|
||||
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('recognize soft transclusion defined by widget', function() {
|
||||
describe('include explicit self transclusion', function() {
|
||||
var wiki = new $tw.Wiki();
|
||||
|
||||
wiki.addTiddler({
|
||||
title: 'TestOutgoing',
|
||||
text: "<$tiddler tiddler='TestIncoming'><$transclude $tiddler /></$tiddler>"});
|
||||
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('TestOutgoing');
|
||||
});
|
||||
|
||||
it('should have no back transcludes', function() {
|
||||
expect(wiki.filterTiddlers('TestOutgoing +[backtranscludes[]]').join(',')).toBe('TestOutgoing');
|
||||
});
|
||||
});
|
||||
|
||||
describe('recognize transclusion defined by widget', function() {
|
||||
var wiki = new $tw.Wiki();
|
||||
|
||||
wiki.addTiddler({
|
||||
title: 'TestOutgoing',
|
||||
text: "<$tiddler tiddler='TestIncoming'><$transclude $tiddler /></$tiddler>\n\n<$transclude tiddler='TiddlyWiki Pre-release'/>"});
|
||||
|
||||
it('should have a transclude', function() {
|
||||
expect(wiki.filterTiddlers('TestOutgoing +[transcludes[]]').join(',')).toBe('TestIncoming');
|
||||
expect(wiki.filterTiddlers('TestOutgoing +[transcludes[]]').join(',')).toBe('TestIncoming,TiddlyWiki Pre-release');
|
||||
});
|
||||
|
||||
it('should have a back transclude', function() {
|
||||
expect(wiki.filterTiddlers('TestIncoming +[backtranscludes[]]').join(',')).toBe('TestOutgoing');
|
||||
expect(wiki.filterTiddlers('[[TiddlyWiki Pre-release]] +[backtranscludes[]]').join(',')).toBe('TestOutgoing');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user