[TW5] Still struggling with default values in templates !

70 views
Skip to first unread message

FrD

unread,
Sep 22, 2015, 6:41:17 AM9/22/15
to TiddlyWiki
Hi,

Back again with my templates !
Here is a MTC : https://dl.dropboxusercontent.com/u/9385804/TestTagsTemplate.html

The idea is to have a template to display the tags of a tiddler.
The display is an horizontal list or a vertical one according to a variable : $(tagsclass)$ that is set outside the call to the template.
This variable holds the name of a css class for the ul element.

The tiddler "TagsDisplayTemplate_WithoutDefault" holds the template that works without a default value for $(tagsclass)$. The test is in tiddler "TestTagsDisplay_WithoutDefault". It works as expected.

My attempt at a template with a default value is in tiddler "TagsDisplayTemplate_WithDefault". The test is in tiddler "TestTagsDisplay_WithDefault". As you can see something's going wrong. I can't figure out what !

Any help is welcome !

Thanks

FrD

Eric Shulman

unread,
Sep 22, 2015, 7:39:36 AM9/22/15
to TiddlyWiki
On Tuesday, September 22, 2015 at 3:41:17 AM UTC-7, FrD wrote:
Back again with my templates !
Here is a MTC : https://dl.dropboxusercontent.com/u/9385804/TestTagsTemplate.html
The idea is to have a template to display the tags of a tiddler.
The display is an horizontal list or a vertical one according to a variable : $(tagsclass)$ that is set outside the call to the template.
This variable holds the name of a css class for the ul element.

This should do what you want:

\define tagsDisplay(class:"tags-display-horizontal")
<ul class="$class$">
<$list filter=" [all[current]tags[]]">
<li>{{||$:/core/ui/TagTemplate}}</li>
</$list>
</
ul>
\end
<$macrocall $name="tagsDisplay" class=<<tagsclass>>/>

-e

FrD

unread,
Sep 22, 2015, 7:55:53 AM9/22/15
to TiddlyWiki
Hi Eric,

Thanks ! it works and the code is more straightforward.

FrD
Reply all
Reply to author
Forward
0 new messages