Link to a 'child' within the context of it's 'parent'

128 views
Skip to first unread message

Clayton Northrup

unread,
Jun 4, 2018, 11:54:47 PM6/4/18
to TiddlyWiki
Hi!

I have a 'parent' tiddler (A) which contains a two panel TOC of 'child' tiddlers [1,2,3].  I want to link to this 'parent' tiddler (A) with a specific 'child' [2] selected.  I can link to the [[parent]] or [[child]] with no problem but I can't figure out how to create a link to the 'child' within the context of the 'parent'.

Thoughts?

Thanks in advance!
Clayton

Mark S.

unread,
Jun 5, 2018, 12:31:22 AM6/5/18
to TiddlyWiki
I think you're asking for a link that will take you UP the TOC tag-tree structure.

The only way to do this is if the child tiddler has only one tag (or there is a way to exclude tags). If a tiddler has more than one tag, it could have multiple "parents".

This macro code makes a link to a parent:

\define parentlink()
<$list filter="[all[current]tags[]limit[1]]"><$link>Parent</$link></$list>
\end

(Invoke with <<parentlink>> )

If all your TOC tags started with a prefix (say T_) then tiddlers could have more than one tag as long as only 1 tag had the prefix. Like:

\define parentlink()
<$list filter="[all[current]tags[]prefix[T_]limit[1]]"><$link>Parent</$link></$list>
\end

Sorry if this is not the problem you meant.

-- Mark

TonyM

unread,
Jun 5, 2018, 3:31:43 AM6/5/18
to TiddlyWiki
Marios https://wikilabs.github.io/editions/tocP/

Table of Contents with a parent field is one way to do this.

How did it become a child to begin with?

If you created the button to do this like the new here button you could ensure tiddlers created that way add the parent to the child tiddler at creation time.

I may create such a button if your are interested.

Tony

TonyM

unread,
Jun 5, 2018, 4:05:09 AM6/5/18
to TiddlyWiki
I did any way,

Drag the attached file into your wiki, you can select if this button appears in the view Template, and you could hide the regular one.

I am not sure how to make it appear bigger, any one know?

Then if you use this button it will add the parent title to the parent field as well as tagging it.

Regards
Tony

TonyM

unread,
Jun 5, 2018, 4:05:52 AM6/5/18
to TiddlyWiki
Sorry, 

With attachement

Tony
new-here-with-parent.bundle.json

TonyM

unread,
Jun 5, 2018, 4:06:28 AM6/5/18
to TiddlyWiki
Edited in forum to include attachment this time
new-here-with-parent.bundle.json

Clayton Northrup

unread,
Jun 5, 2018, 1:46:14 PM6/5/18
to tiddl...@googlegroups.com
Thanks to Mark and Tony for the quick replies and examples! I'm just getting a chance to look them over.  I apologize but I don't think I explained myself very well :/  I should have just included a screenshot in the first place to show what I was talking about instead of speaking in generalities.  I would like to be able to link to the 'Nouns' tiddler with "(3/4) m/mi" ...or any of the other children already selected so their info is showing in the right-hand pane...is that possible?  I'm super new to this so still trying to figure out the capabilities/limitations.  Thanks again!

Mark S.

unread,
Jun 5, 2018, 2:49:05 PM6/5/18
to TiddlyWiki
I'm still confused. Maybe you could draw on the screenshot, to show what you would like to see.

-- Mark

Clayton Northrup

unread,
Jun 5, 2018, 3:18:44 PM6/5/18
to TiddlyWiki
Sorry for all the confusion I'm probably not using the correct words/phrases or I'm trying to do something that can't be done :)  The notebook is a reference for learning Swahili so there are a lot of cross references to relate various rules and parts of speech.  In the example I'm talking about, I have a tiddler for Demonstratives....


as you can see there are links under the "Class #" column.  These are in reference to noun classes for which I have created individual tiddlers...


These 'Noun Class' tiddlers are children to a "Classes" tiddler which is a child to "Nouns".  I can create a link to the individual 'noun class. tiddlers or to the grandparent "Nouns" tiddler with no problem.  however what I want is to create a link to the "Nouns" tiddler so that a specific 'Noun Class' tiddler is selected from the table of contents.  So in the picture below I have the "Nouns" tiddler open and the "Classes" tiddler expanded and the "(3/4) m/mi" 'Noun Class' tiddler selected.  In effect, I am looking for a way to create a link from a different tiddler and open the "Nouns" tiddler, expand "Classes" in the TOC and select a specific 'Noun Class' tiddler.  So for example, from the "Demonstratives" tiddler shown above, click on the "(1/2)..." link and open the "Nouns" tiddler with the "(1/2) m/wa" content displayed on the right side of the pane without having to actually click on the "(1/2) m/wa" link from within the TOC for "Nouns"

Hopefully I didn't make it more confusing :)

Thanks!

Mark S.

unread,
Jun 5, 2018, 3:38:28 PM6/5/18
to TiddlyWiki
Ok, before I get off on the wrong track.

You want to click on the "class #" link (e.g. 1/2) and have the Nouns tiddler open, already displaying the "(1/2) m/wa" tiddler in the TOC, right?

If so, the trick to this, I think, is to use a button (instead of a link) to set the value of the tiddler referenced by selectedTiddler and then navigate to Noun. The button can be changed with CSS I think to look like a link if the appearance is really important to you.

So, does that seem about right?

-- Mark

Clayton Northrup

unread,
Jun 5, 2018, 5:18:51 PM6/5/18
to TiddlyWiki
You want to click on the "class #" link (e.g. 1/2) and have the Nouns tiddler open, already displaying the "(1/2) m/wa" tiddler in the TOC, right?

Yes exactly!! The appearance isn't important at all.  I will start looking into creating a button and if you have any tips/suggestions please pass them along. Thanks!!

Mark S.

unread,
Jun 5, 2018, 5:43:11 PM6/5/18
to TiddlyWiki
Ok, haven't tested this in every possible configuration. In your table tiddler:

\define selectTiddler()
<$action-setfield $tiddler="""$(selectedTiddler)$""" $value="""$(title)$"""/>
<$action-navigate $to="$(toc_home)$"/>
\end
\define toclink(linkname,title,selectedTiddler:"$:/mySelection",toc_home:"Noun")
<$vars title="""$title$""" toc_home="""$toc_home$"""  selectedTiddler="""$selectedTiddler$""" >
<$button actions=<<selectTiddler>> class="tc-btn-invisible tc-tiddlylink">$linkname$
</$button>
</
$vars>
\end



Then for your link, use something like:

<<toclink "1/2" ""(1/2) m/wa"" "$:/mySelection" "Noun">>

The first parameter is the text you want to appear for the link.

The 2nd parameter is the name of the tiddler you want to open in the TOC.
The 3rd parameter is the name of the tiddler that holds the selected Tiddler name. Te default is $:/mySelection, but it must be the same as selectedTiddler in your toc macro.
The 4th parameter is the name of the tiddler that has the TOC. The default for the last parameter is "Noun". I made it flexible in case there were more than 1 TOC's you would be making. Just remember that for each parent/link set  the parameter  for "selectedTiddler" must be the same.

If you use these macros in more than one tiddler, then you might want to put them in a global macro tiddler.

HTH
-- Mark  

Clayton Northrup

unread,
Jun 5, 2018, 7:28:30 PM6/5/18
to TiddlyWiki
Thanks so much for this!! It seems to be navigating to "Nouns" but then also creating new tiddlers with a name equal to the title parameter and not actually selecting the child tiddler in the TOC.  I am probably missing something stupid but unfortunately I don't have much time to dig into it tonight.  I think I'm going to create a new test case from scratch to see if I have something funky in my current config.  I'll keep you posted.  Thanks again.

Mark S.

unread,
Jun 5, 2018, 7:33:11 PM6/5/18
to TiddlyWiki
When you get a chance, please show how you are calling it.

Good luck!
-- Mark

Mark S.

unread,
Jun 5, 2018, 8:44:12 PM6/5/18
to TiddlyWiki
If new tiddlers are being generated, you might be calling with the wrong parameters. This might be a good time to suggest that you be sure to have a backup.

For safety, you could call the toclink macro with names. Like

<<toclink linkname:"1/2" title:"(1/2) m/wa" selectedTiddler:"$:/mySelection" toc_home:"Noun">>

Good luck
-- Mark

TonyM

unread,
Jun 5, 2018, 9:41:27 PM6/5/18
to TiddlyWiki
Folks,

You need to look into the Two Panel TOC implementation to see the selected tiddler and the way the navigation works as it can be using an alternate story and history. I can see how it works in TWOutlier but in other outlines?

Regards
Tony
Reply all
Reply to author
Forward
0 new messages