Hello and a question.

125 views
Skip to first unread message

Jim

unread,
Sep 15, 2017, 5:12:16 PM9/15/17
to tiddl...@googlegroups.com
Hello. I have just starting to play around with TW and am working on entering historical family information. I am entering people using a one-person-per tiddler scheme as that seemed like a logical choice. Each person tiddler has fields which link to their family members - mother, father, and siblings so far.

My 1st simple question is about referencing fields. Can this line be simplified, or written in a more idiomatic way?

Son of <$link to={{!!father}} > {{!!father}} </$link> & <$link to={{!!mother}} > {{!!mother}} </$link>

The "father" field contains something like:
First Middle Surname



I have a bit of confusion about in which circumstances to use each of the various braces and brackets used in macros, widgets, filters, etc. I find it all non-intuitive and I am constantly referring to the reference documentation, which interrupts my train of thought frequently. Hopefully it'll make sense soon.


Thanks.


Alex Hough

unread,
Sep 15, 2017, 5:21:59 PM9/15/17
to TiddlyWiki
Hi Jim,

Welcome.

have you tried this syntax: {{!!field}} ?


Alex

On 15 September 2017 at 22:12, Jim <jim....@gmail.com> wrote:
Hello. I have just starting to play around with TW and am working on entering historical family information. I am entering people using a one-person-per tiddler scheme as that seemed like a logical choice. Each person tiddler has fields which link to their family members - mother, father, and siblings so far.

My 1st simple question is about referencing fields. Can this line be simplified, or written in a more idiomatic way?

Son of <$link to={{!!father}} > {{!!father}} </$link> & <$link to={{!!mother}} > {{!!mother}} </$link>

I have a bit of confusion about in which circumstances to use each of the various braces and brackets used in macros, widgets, filters, etc. I find it all non-intuitive and I am constantly referring to the reference documentation, which interrupts my train of thought frequently. Hopefully it'll make sense soon.


Thanks.

--
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/581365de-f29b-4a76-be6b-ba0761f63ca4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jim

unread,
Sep 15, 2017, 5:28:28 PM9/15/17
to tiddl...@googlegroups.com
Hi Alex - yes I did but I don't get a link, only the text.  What I just now found is that if I include the brackets in the field, then the {{!!field}} syntax generates a link. So the field needs to be: [[First Middle Surname]] instead of just First Middle Surname.

It's the kind of thing that that frustrates me up when trying to use TW.

Alex Hough

unread,
Sep 15, 2017, 5:33:32 PM9/15/17
to TiddlyWiki
If youv'e not already done it, you could try the list-links macro


Alex

On 15 September 2017 at 22:28, Jim <jim....@gmail.com> wrote:
Hi Alex - yes I did but I don't get a link, only the text.  What I just now found is that if I include the brackets in the field, then the {{!!field}} syntax generates a link. So the field needs to be: [[First Middle Surname]] instead of just First Middle Surname.

It's the kind of thing that that messes me up when trying to use TW.



On Friday, September 15, 2017 at 5:21:59 PM UTC-4, AlexHough wrote:
Hi Jim,

Welcome.

have you tried this syntax: {{!!field}} ?


Alex

--
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.

Mark S.

unread,
Sep 15, 2017, 6:43:21 PM9/15/17
to TiddlyWiki
You seem to have the syntax right. If you just don't want to type stuff a lot, then put your line into a tiddler like "parentage".

Then in the child's tiddler, put {{||parentage}} to have the names with links appear. You can even wrap the code in 'parentage' so that it only shows something if the parent(s) name is there. And/or make a template that will only use the parentage template when the names are available.

HTH
Mark

Jim

unread,
Sep 16, 2017, 2:31:50 PM9/16/17
to TiddlyWiki
Thanks Mark,

You have anticipated some of what I'd like to do. TW's "philosophy of reuse" is appealing. It's the syntax I am getting confused over.

The hardest part is letting go of incorrect assumptions of how  things should work and trying to understand how things actually work.


Jim

unread,
Sep 16, 2017, 2:35:59 PM9/16/17
to TiddlyWiki
An example assumption I made. 

You use [[ ]] to create links. You use {{!!field}} to include a field.  Therefore, [[{{!!field}}]] will create a link using the value of the field.

Mark S.

unread,
Sep 16, 2017, 6:48:17 PM9/16/17
to TiddlyWiki
Your assumption about [[{{!!field}}]] is pretty common. Everyone would like it if it worked that way.

What the parser does is look for anything between [[ and ]] and interpret that text literally. When you try to put {{!!field}} between [[ and ]], it's like when Wiley Coyote draws a door on the side of a canyon wall. Of course he doesn't create a door -- just the image of a door. So when he tries to go throw, he hits solid rock. Basically, whenever you use structures like {{!!field}} it will be interpreted literally everywhere except when called by a Widget.

Continuing the analogy, when the Roadrunner tries the drawn-on door, he goes right through. This is undoubtedly because the Roadrunner is leveraging the power of macros. Or widgets. My analogy is deteriorating a bit. Oh well.

What you want is for the *value* of {{!!field}} to get pasted between [[ and ]]. This pasting is concatenation, and is done with macros.

If you put your text into a macro, like:

\define mylink(link) [[$link$]]

Then you might hope you could call it like:

<<mylink {{!!field}}>>

But this still doesn't work. You need to invoke it using some widget. Typically this is the macrocall widget, the set (or vars) widget, or (like you used) a use-case specific widget (e.g. <$link>).

You can invoke it with macrocall like:

<$macrocall $name=mylink link={{!!linkto}}/>

Or, taking a different approach, you can change the macro to:

\define mylink() [[$(link)$]]

and invoke it inside of a <$vars> widget which grabs the value of !!myfield and turns it into a local variable (e.g $(link)$ in our example). Like:

<$vars link={{!!myfield}}>
<<mylink>>
</$vars>

If you really want the simpler syntax, you can do a 2 step process, like:

\define mylink2(link) [[$link$]]
\define mylink(link)  <$macrocall $name=mylink2 link=$link$/>

<<mylink {{!!myfield}}>>

There's probably other ways to approach this, including the Wikify widget, but this gives a general direction.

HTH

Mark

Beep! Beep!

 

Joshua Fontany

unread,
Sep 16, 2017, 7:12:35 PM9/16/17
to TiddlyWiki
The best way I have figure out how to do this is to $set a variable to the value of the field, and then perform the text replacement into the [[ ]] brackets in a macro. Like so:

\define wikiLink(input) [[$(input)$]]

<$set name="input" value={{!!test-field}} >
<<wikiLink>>
</$set>

Tested and works on tiddlywiki.com

Best,
Joshua F

Joshua Fontany

unread,
Sep 16, 2017, 7:15:26 PM9/16/17
to TiddlyWiki
Nice! I just posted something similar upthread. I really like your 2-step nested macro approach to simplify the syntax.

If you really want the simpler syntax, you can do a 2 step process, like:

\define mylink2(link) [[$link$]]
\define mylink(link)  <$macrocall $name=mylink2 link=$link$/>

<<mylink {{!!myfield}}>>

Mat

unread,
Sep 17, 2017, 7:29:42 PM9/17/17
to TiddlyWiki
title:mymacro
tags
:$:/tags/Macro
text
:
\define family(person) <$link to={{!!$person$}}>{{!!$person$}}</$link>

then whenever you want a link to appear, write e.g

<<family father>>

If you like TW, then please...

<:-)

Jim

unread,
Sep 17, 2017, 9:06:30 PM9/17/17
to TiddlyWiki
This should be an official example. Although maybe 'link-field' would be a better name. Thank you!
Reply all
Reply to author
Forward
0 new messages