@Eric Shulman

Thank you for enlightening me!

at 1) A case of blindness: I missed the missing `>` at the end of 
`<<listtitle>, because the list title was always  displayed.

at 2) I defined the macros, because I hope that some day I can use 
transclusions with parameters and pass in 'Book', 'Article', 'Video', etc. 
But even then, as your code shows, I probably wouldn't need them.

at 3) A misunderstanding: These are not double quotes, but two double 
single quotes to make the list title bold.

at 4) A case of laziness: I only tested for zero and one cases, not for 
more than one.

at 5) A case of ignorance: I'm not yet familiar with the finer details of 
the use of angle brackets within text and filters. Thanks for the 
clarification.

Your corrected /simpilified code works as desired!

Thanks again,
-Reinhard
On Tuesday, January 18, 2022 at 1:12:35 PM UTC+1 Eric Shulman wrote:

> Here's your code that doesn't work:
> ```
> \define listtitle() ''Books by $(currentTiddler)$''
> \define filter() "[tag[$(currentTiddler)$]tag[Book]]"
>
> <$list filter=<<filter>> variable="_"> <<listtitle> </$list>
>
> <<list-links filter:"[tag[$(currentTiddler)$]tag[Book]]">>
> ```
>
> Here's what's wrong:
> 1) There is a missing `>` at the end of `<<listtitle>`.  As a result, the 
> macro call isn't closed until the final `>>` at the end of the code.  All 
> the content between the error and the ending `>>` are treated as parameters 
> to the macro.
> 2) The `$(variablename)$` syntax is only parsed when it occurs *within a 
> macro*.  Thus, `"[tag[$(currentTiddler)$]tag[Book]"` is actually looking 
> for a literal tag value of `$(currentTiddler)$`.
> 3) You don't need the double-quotes around the content of `\define 
> filter() "..."`.
> 4) If there are multiple Book tiddlers for the current Author, your 
> `<$list>` widget (with the correction for the missing `>`) would display 
> the `<<listtitle>>` text multiple times, once for each matching Book 
> tiddler.
> 5) You don't actually need to use `$(currentTiddler)$` anywhere in the 
> above code... `<<currentTiddler>>` (or `<currentTiddler>` within a filter) 
> is sufficient.  In fact, you don't need to use any macros at all.
>
> Here's some corrected/simplified code:
> ```
> <$list filter="[tag<currentTiddler>tag[Book]limit[1]]" 
> variable="_">''Books by <<currentTiddler>>''</$list>
>
> <<list-links filter:"[tag<currentTiddler>tag[Book]]">>
> ```
>
> Notes:
> 1) The filter for the heading uses `limit[1]` so that the heading text is 
> only displayed once, regardless of how many matching Book tiddlers are 
> found.
>
> enjoy,
> -e
> On Tuesday, January 18, 2022 at 12:54:41 AM UTC-8 [email protected] 
> wrote:
>
>> In the attached TiddlyWiki I describe a strange issue with 'list-links'. 
>> I don't know if this is an error or I just missed something. 
>>
>

-- 
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/7920e3f6-4042-4872-bd4b-070bc9b6e4abn%40googlegroups.com.

Reply via email to