\define rating() Rating <span style="background-color:$(color)$">{{!!rating}}</span>
<$list filter="[{!!rating}compare:integer:gt[70]then[green]] ~[{!!rating}compare:integer:gt[50]then[grey]] ~[[red]]" variable=color>
<<rating>>
</$list>
Hmmm.... soooo... do I get it right, that in order not to type all that "list" thing each time I need to make 2 macros?
Maybe I answered in an incomplete way: If you want the outer code, i.e the listwidget, to be a macro then you would do as you correctly propose. But the reason so split it up into two macros is only because that css bit can't handle <<...>> as an argument.
Can it be done via some "var" thingy?
<$vars style={{{ [{!!rating}compare:integer:gt[70]then[green]] ~[{!!rating}compare:integer:gt[50]then[grey]] ~[[red]] +[addprefix[color:]]" }}} >
Rating <span style=<<style>>>{{!!rating}}</span>
</$vars>
Hmmm.... soooo... do I get it right, that in order not to type all that "list" thing each time I need to make 2 macros?No, it could all be in one code if it weren't for the fact that "background-color:" can't take <<...>> as an argument but it can take $(...)$ as an argument. I'm not quite sure why. So it's a CSS syntax thing, not really a logic thing.
B-but... why it needs a macro inside?
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>
\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>
<$vars fruit=apple>
This says apple: $(fruit)$
</$vars>
\define rating()
<$vars style={{{ [{!!rating}compare:number:gteq[7]then[green]] ~[{!!rating}compare:number:gteq[5]then[grey]] ~[[red]] +[addprefix[font-size: 1.5em; font-weight: 500; color:]]" }}} >
<span style=<<style>>>{{!!rating}}</span>
</$vars>
\end
Hmmm... I think I get... some of that... me thinks.... :) I also just thought that "define" is possible only as part of marco (https://tiddlywiki.com/#Pragma) and only one define per macro is possible (the one that starts at the very beginning of tiddler), but that's not that important.
since 1 macro is better than 2 macros :) and I can put any kind of css formatting inside the "addprefix" stuff.
[{!!releasedate}compare:date:gr[20200701]]
<$vars date={{!!modified}}>
{{{ [[20220701]compare:date:gr<date>] }}}
</$vars>
After some testing I can only say I agree. Why on earth doesn't that work??? I also tried
<$vars date={{!!modified}}>
{{{ [[20220701]compare:date:gr<date>] }}}
</$vars>
<$vars date={{!!modified}}>
{{{ [[20220701000000000]compare:date:gt<date>then<date>] }}}
</$vars>
{{{ [{!!modified}compare:date:lteq[20220701000000000]] }}}
1) The "greater than" compare suffix mode is "gt"... not "gr" !!!
2) If you are comparing against a date value like {{!!modified}}, you need to specify the full 17-digit value
3) The filter you used in your example will return the literal value, not the <date> variable.
guys... guys... and to put it inside a $list?.. and to combine it with... a tag thing... and a sort thing...ps. btw, if i use only YYYYMMDD format for dates - can I use just "integer" then as comparison type?
2) If you are comparing against a date value like {{!!modified}}, you need to specify the full 17-digit valueAre you sure? This seems to work: {{{ [[20220701]compare:date:gt{!!modified}] }}}
guys... guys... and to put it inside a $list?.. and to combine it with... a tag thing... and a sort thing...
ps. btw, if i use only YYYYMMDD format for dates - can I use just "integer" then as comparison type?
<$list filter="[tag[Comedy]!sort[releasedate]]" variable="title">
<$list filter="[<title>get[releasedate]compare:integer:lteq[20200701]then<title>]">
<$link/> |
</$list>
</$list>
Try this:
<$list filter="[tag[Comedy]!sort[releasedate]]" variable="title">
<$list filter="[<title>get[releasedate]compare:integer:lteq[20200701]then<title>]">
<$link/> |
</$list>
</$list>The outer $list gets the titles of the tiddlers with the desired tag, sorted in descending order by releasedateThe inner $list compares each releasedate to see if it is less than or equal to [20200701] and returns the title
<$list filter="[tag[Comedy]!sort[releasedate
]]" variable="title">
<$list filter="[<title>get[releasedate]compare:integer:gteq[20200701]then<title>]">
<ul> <li> <$link/> <$transclude tiddler={{{ [<currentTiddler>get[rating]addsuffix[-icon]] }}} /> (<$view field="releasedate" format="date" template="0DD.0MM.YYYY"/>) </li> </ul>
</$list>
</$list>
<$list filter="[tag[Comedy]!sort[releasedate]]" variable="title">
<$list filter="[<title>get[releasedate]compare:integer:gteq[20200701]then<title>]">
<ul> <li> <$link/> <$transclude tiddler={{{ [<currentTiddler>get[rating]addsuffix[-icon]] }}} /> (<$view field="releasedate" format="date" template="0DD.0MM.YYYY"/>) </li> </ul>
</$list>
</$list>
Though... a little additional question: how to count those?.. if I had one filter I would just put it here <$count filter="MyFilter"/> but here are two filters... with a variable... so I'm a bit confused...
\define getItems()
<$list filter="[tag[Comedy]!sort[releasedate]]" variable="title">
<$list filter="[<title>get[releasedate]compare:integer:gteq[20200701]then<title>]">
<$text text="[["/><$text text=<<currentTiddler>>/><$text text="]]"/>
</$list>
</$list>
\end
\define showItem()
<li>
<$link/>
<$transclude tiddler={{{ [<currentTiddler>get[rating]addsuffix[-icon]] }}} />
(<$view field="releasedate" format="date" template="[UTC]0DD.0MM.YYYY"/>)
</li>
\end
<$wikify name="theList" text=<<getItems>>>
There are <$count filter=<<theList>> /> items:<br>
<ul><$list filter=<<theList>>><<showItem>></$list></ul>
</$wikify>