Help in understanding this code

88 views
Skip to first unread message

passingby

unread,
Sep 25, 2017, 4:48:07 AM9/25/17
to TiddlyWiki
This code comes from here http://nolearning-contactsdb.tiddlyspot.com/#Contacts


\define contactsTabsMacro()

<<tabs "$(thing)$ [[New Contact Form]] [[Contacts Settings]]" $(thing)$>>

\end

<$set name=thing value={{!!contact_list_template}}>
<<contactsTabsMacro {{!!contact_list_template}}>>
</$set>

<!--
---

<$tiddler tiddler={{!!contact_list_template}}>
<$transclude/>
</$tiddler>

---

<<tiddlerSlider "New Contact Form">>

---

<<tiddlerSlider "Contacts Settings">>
-->


what does $(thing)$ mean in the first line?

PMario

unread,
Sep 25, 2017, 6:07:42 AM9/25/17
to tiddl...@googlegroups.com


On Monday, September 25, 2017 at 10:48:07 AM UTC+2, passingby wrote:
what does $(thing)$ mean in the first line?

Thing is the variable used which is defined here:

<$set name=thing value={{!!contact_list_template}}>   <--- "thing" can only be used between here
<<contactsTabsMacro {{!!contact_list_template}}>>
<---------------- and here.
</$set>

-m

Jed Carty

unread,
Sep 25, 2017, 7:03:00 AM9/25/17
to TiddlyWiki
It also means that I should probably go through my old work and update everything to use more descriptive names. I am surprised anyone is looking at that anymore, I had mostly forgotten about it.

passingby

unread,
Sep 25, 2017, 12:39:29 PM9/25/17
to TiddlyWiki
Thanks pmario. What i do not understand is that if the variable is declared in the set macro and is available only within its scope then how come tabs macro is accessing it and whats the meaning of the syntax ($...$).

Jed. Thank you for your code. I want to immitate the in-place editing technique which you ve used. You know, pressing the edit button displays a textbox to edit field value? I liked that and this is why i was trying to understand your code. I find in place editing is better intuitively than taking whole tiddler into edit mode.

Mark S.

unread,
Sep 25, 2017, 12:59:32 PM9/25/17
to TiddlyWiki
The $(...)$ syntax means "substitute the variable defined before this macro was invoked".

So, "thing" was defined by <$set>. The contactTabsMacro is called within the <$set>...</$set> tags so $(thing)$ is available inside of contactTabsMacro.

Mark

passingby

unread,
Sep 25, 2017, 1:02:35 PM9/25/17
to TiddlyWiki
Thanks Mark. I was not seeing it and now suddenly i can. Thanks.
Reply all
Reply to author
Forward
0 new messages