Transclusion template using toc vs. list-links

164 views
Skip to first unread message

A M Alfaro

unread,
May 10, 2017, 3:39:47 PM5/10/17
to TiddlyWiki
Hi all,

I'm trying to do a few things which I can get to mostly work the way I want up until I try to create a template for it all. I've created project tiddlers to which I add the following code:
!!Next
     
<<toc-selective-expandable 'WA#####' tag[#1.Next] sort[title]>>


Every time I paste that over from Notepad++, I have to do a find/replace for the "WA####" bit which is just the name of the project tiddler.

While I was creating Contact tiddlers, I learned about <currentTiddler> and utilized it in a list:
<<list-links "[tag[^1.Project]tag<currentTiddler>tag[##!.Active]!title[TagCloud]]">>


For a while now I've been trying to create a template for the project tiddlers that would automatically display everything the way I want, but I can't seem to get it to recognize the target tiddler. This is the whole block of code I'm working with:
<hr>
 !Actions
<$button class="tc-btn-invisible" popup=<
<qualify "$:/temp/popup2">> style='border-radius: 12px; width:100%; border: 2px solid #d1e0e0; background-color: #d1e0e0; color: #003300;'>
»/«
</$button>
<$reveal type="nomatch" state=<
<qualify "$:/temp/popup2">> text="">
<div class="tc-table-of-contents">

 !!Next
  <<toc-selective-expandable
<currentTiddler> tag[#1.Next] sort[title]>>
 !!Waiting
  <<toc-selective-expandable
<currentTiddler> tag[#2.Waiting] sort[title]>>
 !!Future
  <<toc-selective-expandable
<currentTiddler> tag[#3.Future] sort[title]>>
 !!Done
  <<toc-selective-expandable
<currentTiddler> tag[#4.Done] sort[title]>>
</div>
</$reveal>


and I've done just about every variation I can think of: with the word "tag" before <currentTiddler>, putting apostrophes around <currentTiddler> (with and without the angle brackets), no apostrophes (with and without angle brackets), using square brackets with/without "tag", and even "{{!!title}}.

At some point, I want to figure out how to sticky reveal the sections so that I can open the expandable lists without it closing and having to be reopened. That's why I don't just want to use the list-links, which does work. Am I missing something or is it just not possible in toc? Or is something else mucking it up?

TIA,
ama

Mark S.

unread,
May 10, 2017, 5:24:02 PM5/10/17
to TiddlyWiki
The first parameter expects the actual name of a tiddler. It's seeing "<currentTiddler>" which doesn't exist (usually).

Put the whole thing in a macro (e.g. mytoc()), replace <currentTiddler> with $(currentTiddler)$. Invoke with <<mytoc>>. Also, I believe you need to combine the tag and the sort and put in quotes, like: "tag[#1.Next]sort[title]". Otherwise, TW will split at the white space, and only "tag[#1.Next]" will get applied.

HTH
Mark

A M Alfaro

unread,
May 10, 2017, 6:35:29 PM5/10/17
to TiddlyWiki
Thanks for the direction. Guess I have a lot more reading to do in the documentation.

FWIW, the space isn't affecting anything. Sort is applied fine. However, if the convention should be as you described, I'll follow that. I think one of the things that's confused me is that it sometimes seems like there isn't a strong convention in the code examples. Like with this toc vs. list. Spacing won't work in list, but it doesn't seem to affect toc. Or when I'm googling things, depending on years, syntax seems to change as TW5 evolves.

Thanks again,
ama

Mark S.

unread,
May 10, 2017, 7:09:07 PM5/10/17
to TiddlyWiki
Change the "sort" to "!sort" with your original sort filter with no quotes and the space and I think you'll see that the sort isn't doing anything. It just happens to sort by title by default.

Good luck!
Mark

A M Alfaro

unread,
May 11, 2017, 5:32:16 PM5/11/17
to TiddlyWiki
Ah! Thank you.

ama
Reply all
Reply to author
Forward
0 new messages