HI Philippe,
In addition to what Eric says, I think you need to use a macro like so:


\define stocks (bestbefore)

<$reveal type="match" default=<<day-left bestbefore=bestbefore$>> 
text="YES">>

   @@color:red;( to be discarded )@@
</$reveal>
/end






On Monday, October 31, 2016 at 10:45:29 PM UTC, Philippe Le Toquin wrote:
>
> Hello,
>
> I have looking all over the place and experimented a lot but I can't find 
> how to do what I want to achieve.
>
> I have a list of item (they are ingredients) that contains some fields 
> .One of them is a best before date.
>
> I then list the ingredient using that code to display them as well as the 
> number of days until they expire.
>
> <$list filter="[!has[draft.of]tag[Stocks]]">
>
> * <$link to={{!!title}}><$view field="title"/> </$link>@@color:red;( to be 
> discarded : <$macrocall $name="day-left" bestbefore={{!!bestbefore}} />)@@ 
>
> </$list>
>
> The macro is based on day-diff.js that I modified to only take one day and 
> return YES or NO. 
>
> What I would ideally like to do is that the text in red (to be discarded) 
> only appears if the return of the macro is YES.
>
> I would like to use the RevealWidget but can't make it works. Here is what 
> I tried
>
>
> * <$link to={{!!title}}><$view field="title"/> </$link> <$reveal 
> type="match" state="<$macrocall $name="day-left" 
> bestbefore={{!!bestbefore}} />" text="YES">@@color:red;( to be discarded 
> )@@ </$reveal>
>
> but the result of that is not working. Instead it displays:
>
>
>
>    - Item1
>
> <$reveal type="match" state="YES" text="YES">( to be discarded ) 
> </$reveal>
>
>    - Item2
>
> <$reveal type="match" state="NO" text="YES">( to be discarded ) </$reveal>
>
>
>
>
>
> So my question is : Is it possible to achieve what I want?
>

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/1354e062-4570-45aa-af36-9ffb5391e271%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to