>
>  
> B-but... why it needs a macro inside? 
>

That last solution of mine did *not *have any macro. A macro is a separate 
"codelet" that starts with "\definition". 
 

> why it can't be just: 
>
> <$list filter="[{!!rating}compare:integer:gt[70]then[green]] 
> ~[{!!rating}compare:integer:gt[50]then[grey]] ~[[red]]" variable=color>
> Rating <span style="color:$(color)$">{{!!rating}}</span>
> </$list>
>

OK, first, I agree that it *ought *to be possible to directly insert the 
color into the span thing. Again, my last solution did kind of do this. But 
there are a few issues with the code you write here above:

I'll get to your exact syntax but first, here is a syntax that is "more 
correct but still faulty":

...
Rating <span style="color:<<color>>">{{!!rating}}</span>
...

The <<..>> syntax is the basic way to call a variable. I suspect this 
doesn't work here because the span reads this one: <<color>>  as if it was 
the closing angle bracket of the span tag. So this is why I, in my initial 
solution, split out the whole span out into a macro.

But you ask why $(...)$ doesn't work. This is because $(..)$ is the syntax 
to call a variable when you are in a place where the variable was not 
created. To see the difference, test this:

\define mymacro()
<$vars fruit=banana>
This says banana: <<fruit>><br>
This says apple: $(fruit)$
</$vars>
\end

<$vars fruit=apple>
This says apple: <<fruit>><br>
<<mymacro>>
</$vars>

If you do this (no macro)

<$vars fruit=apple>
This says apple: $(fruit)$
</$vars>

...you don't get anything because it is simply not the syntax to use when 
calling the variable. It should be <<fruit>>.

Your examples also imply a question on the difference between $list and 
$vars. For this specific case, the output from the filter is only one value 
so you can use either, as in your examples. $vars sets a variable to be a 
specific value whereas $list sets a variable to be one value at a time from 
a list of values.

Hope this clarifies.

<:-)

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f467577e-a551-4773-be6a-dcbbd56d072do%40googlegroups.com.

Reply via email to