ListWidget block format elusive

37 views
Skip to first unread message

Dave Parker

unread,
Jun 29, 2020, 12:08:44 AM6/29/20
to TiddlyWiki
Hi, I have this macro:
\define datehx2(here)

@@color:red;font-size:65%;
<$list filter="[title[$here$]get[dates]sort[]]"/>@@

\end

\define datehx()

<$macrocall $name=datehx2 here=<<currentTiddler>> />

\end
<<datehx>>

It is supposed to list all the entries in the field "dates" (which are in the format "2020-06-28"), but it lists in inline format

I've tried inserting a blank line in between any number of the lines to trigger block formatting, and nothing helps.  

I've also tried inserting "<br>" at various points but nothing seems to work.

1' question - how do I force block formatting in this situation?
2' question - why is the resultant list successfully reduced in size, but not turned red? 


thanks,
- Dave

Dave Parker

unread,
Jun 29, 2020, 12:30:20 AM6/29/20
to TiddlyWiki
another weird thing: when I put 2 dates in the "dates" field, when its rendered, it renders as one single link: "2020-06-27 2020-06-28"

I don't want it to be a link at all though (so far)

Eric Shulman

unread,
Jun 29, 2020, 2:07:47 AM6/29/20
to TiddlyWiki
On Sunday, June 28, 2020 at 9:08:44 PM UTC-7, Dave Parker wrote:
Hi, I have this macro:
\define datehx2(here)

@@color:red;font-size:65%;
<$list filter="[title[$here$]get[dates]sort[]]"/>@@

\end

\define datehx()

<$macrocall $name=datehx2 here=<<currentTiddler>> />

\end
<<datehx>>

... list all the entries in the field "dates" (which are in the format "2020-06-28")...
 
1' question - how do I force block formatting in this situation?

You are using the "short form" of the <$list> widget, where it ends with "/>", rather than using <$list>...</$list>
When using this short form, the default output is just the tiddler titles, without any other formatting.
This is what results in a single line rather than showing each tiddler title on its own line.

2' question - why is the resultant list successfully reduced in size, but not turned red? 

As you noted, the output is producing *links*, rather than plain text.
The default styling for links is to show them using a blue color which supersedes
any plain text "color:red" attribute that is otherwise in effect.

To fix these two problems:
1) Use the full <$list>...</$list> widget syntax with specified output rather than default output
2) Use the <$text> widget to force the output to be plain text.

If the "dates" field contains a *list* of dates, then "get[dates]" isn't the
right filter to use.  Instead, you want to "enlist{!!dates}" so that the <$list> widget 
uses the field contents as a list of separate items, rather than as one text item.

and... there's no need for all that macro stuff, just to pass the currentTiddler value around.
Instead, you can refer to the currentTiddler variable directly in the filter syntax.

Something like this should do what you want:
<$list filter="[<currentTiddler>enlist{!!dates}sort[]]" variable="this_date">
   @@color:red;font-size:65%; <$text text=<<this_date>>/><br>@@
</$list>

enjoy,
-e


Dave Parker

unread,
Jun 29, 2020, 9:56:26 AM6/29/20
to TiddlyWiki
Oh wow, usually it's just some little thing like a bracket or quote I've missed, ha ha.

Thank you Eric! - that's a whole new (to me) way of looking at using currentTiddler, and I hadn't heard of enlist before either.

I wonder how many other little macros using macrocall and current tiddler I'm going to want to re-write


TW -where learning something new every day is an understatement :D

Reply all
Reply to author
Forward
0 new messages