On Tuesday, May 11, 2021 at 8:58:04 AM UTC-7 [email protected] wrote:
> I had a trial run of using TW's built-in math operators, hoping they could
> allow the result to be evaluated in a variable, but it didn't work. It's
> the same issue - even when it's a negative value, sign[] interprets it as a
> positive. Probably because it's coercing the wikitext string to a number,
> instead of using the number from the result?
Try this:
<$wikify name=number text={{budgetDelta}}>
<$set name=csscolor
filter="[<number>sign[]match[-1]then[color:red;font-weight:bold]else[color:black;]]">
<span style=<<csscolor>>><<number>></span>
</$set>
</$wikify>
Notes:
1) Use $wikify instead of $set. This allows the contents of
{{budgetDelta}} to be parsed by the formula plugin rather than just
retrieving the formula text
2) Set "csscolor" rather than "cssclassname". This uses literal CSS styles
rather than references to classname declarations
3) use "style=<<csscolor>> to apply the computed styles
enjoy,
-e
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/4d80cb49-5f2e-41db-ae2d-8f22d377cd3dn%40googlegroups.com.