Hi,
I’m trying to find a way to hide an empty parameter but I can’t find one, or maybe, I’m just not understanding it correctly.
An example code:
- In a
Template
called `infoboxA I have this:
<ul><$parameters param1="" param2="" param3="">
<li>Param1: <<param1>></li>
<li>Param2: <<param2>></li>
<li>Param3: <<param3>></li>
</$parameters></ul>
- Then in
Test
page I have this:
<$transclude $tiddler="infoboxA"
param1="This is Parameter 1"
param2="This is Parameter 2"
/>
- The result is:
* Param1: This is Parameter 1
* Param2: This is Parameter 2
* Param3:
What I would like to achieve is if a param is empty, like in the example above it’s param3
, it wouldn’t show.
Something like:
<ul><$parameters param1="" param2="" param3="">
{{hide-if-empty}}<li>Param1: <<param1>></li>{{/hide-if-empty}}
{{hide-if-empty}}<li>Param2: <<param2>></li>{{/hide-if-empty}}
{{hide-if-empty}}<li>Param3: <<param3>></li>{{/hide-if-empty}}
</$parameters></ul>
And the output will be:
* Param1: This is Parameter 1
* Param2: This is Parameter 2
Since this is the first time I dived into the this, I would like to keep it simple at first so I can follow. (I only used TiddlyWiki for note taking before.) Is it possible to achieve while keeping it as simple as possible?
Thank you!