Hi,
The below code uses two macros to obtain two “signatures”
- location-signature
- browser-signature
This code also displays them, and even when they appear identical I never get the “yes” to display only the “no”. Both macros have \whitespace trim
<$list filter="[all[]object-type[browser-location]]">
{{{ [<location-signature>match<browser-signature>then[yes]else[not]] }}}
<$link/> <br><<location-signature>><br>
</$list>
<<browser-signature>>
As usual we need to wikify one or both of the variables in the comparison; then this works.
<$wikify name=browser-signature text="""<<browser-signature>>""">
<$list filter="[all[]object-type[browser-location]]">
<$wikify name=location-signature text="""<<location-signature>>""">
{{{ [<location-signature>match<browser-signature>then[yes]else[not]] }}}
<$link/> <br><<location-signature>><br>
</$wikify>
</$list>
<<browser-signature>>
</$wikify>
Oh how I wish this was not a “feature” of TiddlyWiki! 30 mins wasted again, today.
I can’t address your problem, Tones, because I’m not following what you’re aiming at. But in general terms, you don’t want to use $wikify inside a $list (loop) if the output is not dependent on the $list variable(s).
IOW …
<$wikify name=location-signature text="""<<location-signature>>""">
is a constant – right? So move it outside the $list – especially if the list is lengthy.
And what is the object-type[] operator?
Okay, so I took your code, spun up a couple macros for location-signature and browser-signature and it all seems to work:
\define browser-signature() X
\define location-signature() Y
<$wikify name=browser-signature text="""<<browser-signature>>""">
<$wikify name=location-signature text="""<<location-signature>>""">
<$list filter="[[something]]">
{{{ [<location-signature>match<browser-signature>then[yes]else[not]] }}}
<$link/> <br><<location-signature>><br>
</$list>
<<browser-signature>>
</$wikify></$wikify>
I moved the wikify too.
Thanks @CodaCoder but the macro in the list widget is evaluated on the current tiddler inside the list.
The object-type[fieldvalue] is a nice way to test if the object-type fieldname has the value fieldvalue.
I know it looks like a new operator but its a nice feature to make filters more readable.