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+unsubscribe@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/msgid/tiddlywiki/fd7fb9a8-fe80-4a1a-a528-2074b6f0b2af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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 unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscribe@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/msgid/tiddlywiki/108ed46e-2ed3-40df-8823-f7f3f3e48b74%40googlegroups.com.
...
2) widgets - what do they return? how are they evaluated?
[ { "type": "set", "attributes": { "name": { "type": "string", "value": "hello" }, "value": { "type": "string", "value": "hello world" } }, "children": [], "params": [] } ]
- you'll get:- now add the macro call with: <<hello>>
[ { "type": "set", "attributes": { "name": { "type": "string", "value": "hello" }, "value": { "type": "string", "value": "hello world" } }, "children": [ { "type": "macrocall", "name": "hello", "params": [], "isBlock": true } ], "params": [] } ]
These internal structures are created by the TW parsers. They produce the parse-tree.
This parse-tree is used by the TW renderer to produce the HTML output, that the browser can use.
Every widget has a widget.render() function. ...
The module render.js is a startup module, that kicks off the whole parsing and rendering process for eg: the PageTemplate.
A little bit earlier in the startup mechanism, the RootWidget is created. It holds a reference to the browser DOM document element, which allows all widgets, to modify the DOM.
hope that makes sense
have fun!
mario
--
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/i1winZZTGEg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@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/msgid/tiddlywiki/6df4e261-e159-4259-8853-4b16a251e53b%40googlegroups.com.
To unsubscribe from this group and all its topics, 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 unsubscribe from this group and all its topics, 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.