Hey Joe,

You've deciphered the whole list-links macro perfectly. Since the list
widget is one of the most important one in TiddlyWiki, you'll have to spend
more time on it. It's code is written in JavaScript, but I don't think that
reading the code will make you understand its fonctionning better that
reading the docs for lists and filters and try (direcly on tiddlywiki.com
if you want). Filters syntax is very important to master if you want to
program TiddlyWiki. Along with the list widget, it offers very flexible
ways to filter tiddlers in order to process dynamic lists. Why dynamic?
Because if a tiddler is created afterward that matches the filter, then the
list widget immediately processes it, as if it was just waiting for your
new tiddler to enter the game.

Cheers,
Xavier.

-- Xavier Cazin

On Sat, Mar 10, 2018 at 11:12 PM, Joe Armstrong <joea...@gmail.com> wrote:

> Wow thanks - more twisty passages
>
> So the definition is
>
> \define list-links(filter,type:"ul",subtype:"li",class:"")
> <$type$ class="$class$">
> <$list filter="$filter$">
> <$subtype$>
> <$link to={{!!title}}>
> <$transclude field="caption">
> <$view field="title"/>
> </$transclude>
> </$link>
> </$subtype$>
> </$list>
> </$type$>
> \end
>
>
> Now all I need is a line by line description of how this works - at a
> guess (and I have to guess
> since I have seen no description) the first line says that list links
> has three parameters called filter type subtype and class
>
> I also assume that if values are not supplied by the caller
> that the quoted value is used. For example if no subtype is
> given the value "li" is assumed.
>
> Then I assume that $var$ in the definition means substitute the
> value of the variable so
> <$type$ class="$class$">
>
> is expanded into <ul class="""">
>
> so far so good (I am getting warm?)
>
> Next line
>
> <$list filter="$filter$">
>
> So this expands into <$lst filter=something>
>
> Where something came from the caller
>
> So now I need to find out what <$list ...> does
>
> I can find the documentation but where is the code for
> this - this is the list widget I assume.
>
> Thanks BTW I'm slowly getting there
>
> next problem find the code
>
> for <$list ,,,> and
> <$link ...>
>
> etc.
>
> Cheers
>
> /Joe
>
>
>
>
>
>
> On Saturday, 10 March 2018 13:39:32 UTC-8, Xavier wrote:
>>
>> Hi Joe,
>>
>> More knowledgeable people would express it differently, but one way to
>> look at these constructs is that the "result" of most widgets and macros is
>> to act on the wiki (render elements and respond to user interaction), so 
>> *don't
>> look at them as programming functions* from which you could generally
>> get a result in order to save it and/or reuse it. They are more like
>> procedures.
>>
>> The only way to reuse the result of an action (or of a sequence of
>> actions) like you would do with a function, is thus to "wikify" it
>> programmatically. The wikify widget does that explicitly: it saves the
>> string result of a sequence of actions so that you can repurpose it).
>> Calling a string-only macro (maybe with variable substitution) without any
>> instructions is another way to do wikification.
>>
>> You can find examples of macros if you look for *macro* under Avanced
>> Search / Shadows tab. You will find there https://tiddlywiki.com/#%24%3A
>> %2Fcore%2Fmacros%2Flist, which contains the definition of the list-links
>> macro.
>>
>> Cheers,
>> Xavier.
>>
>> -- Xavier Cazin
>>
>> On Sat, Mar 10, 2018 at 7:25 PM, Joe Armstrong <joe...@gmail.com> wrote:
>>
>>> TW seems to have three types of code: JS functions, TW macros, and TW
>>> widgets. It's not clear to me how these are evaluated,
>>>
>>> nor what the order of evaluation is.
>>>
>>>
>>> 1) macros - what are they? How do they differ from regular JS functions
>>> - how are they evaluated?
>>>
>>> what do they return? Is the return text re-evaluated?
>>>
>>>
>>> 2) widgets - what do they return? how are they evaluated?
>>>
>>>
>>> 3) How can I find a macro-definition ?
>>>
>>> I looked for ages for the source of the list-links macro but could not
>>> find it
>>>
>>>
>>> Cheers
>>>
>>>
>>> /Joe
>>>
>>>
>>> --
>>> 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 tiddlywiki+...@googlegroups.com.
>>> To post to this group, send email to tiddl...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/tiddlywiki.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/tiddlywiki/fd7fb9a8-fe80-4a1a-a528-2074b6f0b2af%40googlegroups.com
>>> <https://groups.google.com/d/msgid/tiddlywiki/fd7fb9a8-fe80-4a1a-a528-2074b6f0b2af%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 tiddlywiki+unsubscr...@googlegroups.com.
> To post to this group, send email to tiddlywiki@googlegroups.com.
> 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/108ed46e-2ed3-40df-8823-f7f3f3e48b74%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/108ed46e-2ed3-40df-8823-f7f3f3e48b74%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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/CADeSwYNyuctU2%2B1AbnzDe2989CS9B-LfDSWTHw6gWs-H6qQw_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to