Through your suggestions I have made at least some progress. Given the code
\define listDescendants(tag)
[[$tag$]]
<$list filter="[tag[$tag$]tag[concepts]]">
[[<$view field="title" />]]
<$macrocall $name="listDescendants" tag=<<currentTiddler>> />
</$list>
\end
\define myMacro()
<$set name="myList" value=<<listDescendants "NameOfConceptTiddler">> >
<$set name="finalFilter" value=<<assembleFilter>> >
<<myMacro2>>
</$set>
</$set>
\end
\define assembleFilter()
$(myList)$ +[tagging[]tag[memos]]
\end
\define myMacro2()
<$list filter=<<finalFilter>> >
<<showListItem>>
</$list>
\end
\define showListItem()
» <$link to={{!!title}}><$view field="caption" ><$view field="title"
/></$view></$link><br>
\end
<<myMacro>>
I do get a list of memos tagged with concepts in the tree that I am
traversing, but strangely enough it does not include those tagged only with
the ancestor. Any ideas?
@Evan, some comments on your notes:
1) Check.
2) It appears that $(variable)$ does not always work inside macros either.
For instance, given that finalFilter is a variable defined in the enclosing
macro myMacro2,
\define myMacro2()
<$list filter=<<finalFilter>> >
<<showListItem>>
</$list>
\end
works, while
\define myMacro2()
<$list filter=$(finalFilter)$ >
<<showListItem>>
</$list>
\end
does not.
3) Using <$set> as in the above example appears to be a rather simple
workaround given the limitations of <$filter>.
Best regards,
Linus
2015-09-12 19:17 GMT+02:00 Evan Balster <[email protected]>:
> A few notes:
>
> 1) Macros always have to be at the top of the file, before any WikiText.
>
> 2) The syntax $(variable)$ only applies inside macros. Outside macros,
> use <<variable>>.
>
> 3) Your trick isn't working because there's no way to *render* WikiText
> into a filter expression. Basically, the code inside <<myList>> doesn't
> get executed if it's passed to an attribute like <$list filter=<<mylist>>
> >. I've just opened a topic suggesting a feature which would make this
> possible: read here
> <https://groups.google.com/d/topic/tiddlywiki/E_JbL_5TGyY/discussion>.
> That said, it's likely there are other ways to solve your problem which
> don't involve composing an intermediate list.
>
>
> On Saturday, 12 September 2015 05:42:35 UTC-5, Linus Johnsson wrote:
>
>> Thank you for your kind replies. Both suggestions rendered brackets just
>> fine. As you seem to have anticipated, this immediately landed me in a
>> different kind of problem. I defined the following macro:
>>
>> \define listDescendants(tag)
>> <$list filter="[tag[$tag$]tag[concepts]]">
>> [[<$view field="title" />]]
>> <$macrocall $name="listDescendants" tag=<<currentTiddler>> />
>> </$list>
>> \end
>>
>> The macro works as intended. I do not understand, however, why the
>> following (trivial) examples will not reproduce the list returned by the
>> macro. I need to get this to work in order before I add filter runs. First,
>>
>> <$set name="myList" value=<<listDescendants "NameOfConceptTiddler">> >
>> <$list filter=<<myList>> />
>> </$set>
>>
>> returns the macro code itself, with the spaces between the tokens
>> removed. As for my second attempt,
>>
>> <$set name="myList" value=<<listDescendants "NameOfConceptTiddler">> >
>> <$list filter="$(myList)$" />
>> </$set>
>>
>> it just returns "$(myList)$".
>>
>> Wrapping the calling code in a macro does not work either:
>>
>> \define myMacro
>> <$set name="myList" value=<<listDescendants "NameOfConceptTiddler">> >
>> <$list filter=$(myList)$ />
>> </$set>
>> \end
>>
>> <<myMacro>>
>>
>> All I get is "\define myMacro $(myList)$ \end".
>>
>> I am thoroughly confused. Obviously there is something about the syntax
>> that I have not yet grasped. Please enlighten me!
>>
>> Best regards,
>> Linus
>>
>>
>> 2015-09-11 4:02 GMT+02:00 'c pa' via TiddlyWiki <
>> [email protected]>:
>>
>>> Linus,
>>>
>>> Ahhh, the old create a list and then parse it trick. I have done that
>>> before. I think what I ended up doing is storing the list in a temporary
>>> tiddler's list and then parsing that list to get the results
>>>
>>> You can use [ and ] to create square brackets
>>>
>>> So something like [[<$view field="title"/>]] will create
>>> the title
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "TiddlyWiki" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/tiddlywiki/XH4tgLlr7fY/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/tiddlywiki.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/tiddlywiki/c052b929-6b6b-492d-8b75-0bdf2df6b3d9%40googlegroups.com
>>> <https://groups.google.com/d/msgid/tiddlywiki/c052b929-6b6b-492d-8b75-0bdf2df6b3d9%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "TiddlyWiki" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/tiddlywiki/XH4tgLlr7fY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/tiddlywiki.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/3e9b1041-7721-479d-96f3-a7e9eb4c7930%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/3e9b1041-7721-479d-96f3-a7e9eb4c7930%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
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 http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/CANHXGJQ6cYmKj9HrwKr-FgyTpAzSwP4GVZtiWvD%2BPpa4MkkHyw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.