yes! This worked, and makes sense of the wikify widget. I had spotted it 
while trying to figure this out, but hadn't been sure how to use it or even 
if it was the thing I needed to solve this. Turns out it was.

Using style instead of class is handy for this instance. Maybe some time 
I'll move it out into its own stylesheet, but that's something to learn 
some other day!

Thanks so much everyone for your help. These changes are now reflected on 
https://trumad.github.io/budgetlywiki/ going forward and the project is 
complete, unless I come up with more improvements. Thanks!

On Tuesday, 11 May 2021 at 17:33:44 UTC+1 Eric Shulman wrote:

> On Tuesday, May 11, 2021 at 8:58:04 AM UTC-7 tru...@gmail.com 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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/25cbca20-d271-46de-b0c6-d370d36bc04cn%40googlegroups.com.

Reply via email to