mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-28 15:08:46 +00:00
Don't use the widget body as the template if a list-empty widget is present
See discussion here - https://github.com/Jermolene/TiddlyWiki5/pull/7710#issuecomment-1717193296
This commit is contained in:
parent
3f16e52b82
commit
a1acef7324
@ -150,13 +150,14 @@ ListWidget.prototype.makeItemTemplate = function(title,index) {
|
||||
// Check for a <$list-item> widget
|
||||
if(this.explicitListTemplate) {
|
||||
templateTree = this.explicitListTemplate;
|
||||
} else {
|
||||
} else if (!this.explicitEmptyTemplate) {
|
||||
templateTree = this.parseTreeNode.children;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if(!templateTree) {
|
||||
// Default template is a link to the title
|
||||
templateTree = [{type: "element", tag: this.parseTreeNode.isBlock ? "div" : "span", children: [{type: "link", attributes: {to: {type: "string", value: title}}, children: [
|
||||
{type: "text", text: title}
|
||||
{type: "text", text: title}
|
||||
]}]}];
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
title: ListWidget/WithMissingTemplate
|
||||
description: List widget with explicit templates
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
|
||||
\procedure test(filter)
|
||||
<$list filter=<<filter>>>
|
||||
<$list-empty>
|
||||
None!
|
||||
</$list-empty>
|
||||
</$list>
|
||||
\end
|
||||
|
||||
<<test "1 2 3">>
|
||||
|
||||
<<test "">>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p><span><a class="tc-tiddlylink tc-tiddlylink-missing" href="#1">1</a></span><span><a class="tc-tiddlylink tc-tiddlylink-missing" href="#2">2</a></span><span><a class="tc-tiddlylink tc-tiddlylink-missing" href="#3">3</a></span></p><p>None!</p>
|
Loading…
Reference in New Issue
Block a user