[SOLVED]Multiple Sort rules in TOC

239 views
Skip to first unread message

Ikaro0 Oladed

unread,
Feb 18, 2019, 6:50:49 AM2/18/19
to tiddl...@googlegroups.com
Hi, sorry if this has been answered already but I've been searching with "tc-table-of-contents sort journal" and similar without success.

The scenario is the following:

I've follow documentation on how to create a Contents tab in side bar:
- Create tiddler with tag "$:/tags/SideBar"
- Use div with macro call  "<<toc-selective-expandable "Contents" "sort[title]"  >>

But with this set the expandable section of journal on side bar shows sorted by name and I would like it to be sorted by created date, only for Journal.

I saw on the following documentation a solution that does not seams to work:

As you can see, Journal entries are sorted by name as SortTests and the desired outcome would be a sorted by created for journal.

tidd.png

TonyM

unread,
Feb 18, 2019, 9:46:33 PM2/18/19
to TiddlyWiki
If you do change the sort order in the standard TOC it will apply to everything in the toc. consider using the nsort[] nsortcs and other variations.

You can sort these manually using the tag pill for the Journal tag, you can drag and reorder in the tag pill list of tiddlers.

Perhaps we/you could build your own toc that looks for a toc-sort field in each tiddler, such that Journal could have a "toc-sort" of "+[nsort[]]" that is appended to the filter and the toc would honor it for that level only.

Regards
Tony

Ikaro

unread,
Feb 20, 2019, 4:38:32 AM2/20/19
to TiddlyWiki
Hi TonyM,
Thanks for your time on this, the thing is that by reading the documentation that I posted, I thought that it was possible to do it and for some reason I was not implementing it correctly.
Tried with nsort and not much success.

Thank you anyway.
Regards
Colin

S. S.

unread,
Feb 20, 2019, 5:34:03 AM2/20/19
to TiddlyWiki

Hi Colin,

Sorry for your understandable frustration. I believe there is a mistake in that help tiddler.

Try following those instructions, except use this change: from fuzzy to !!fuzzy

<toc-selective-expandable  "TableOfContents" "sort{!!fuzzy}" >>


Do let us know if it gives you the wanted result.
I will also initiate a correction of that instruction tiddler.

Regards

Ikaro

unread,
Feb 20, 2019, 9:25:34 AM2/20/19
to TiddlyWiki
Hi S.S.

Great!!, that was the reason because it wasn't working, thanks a lot.

I'll post here all in case anyone seeks the solution here:

- I followed documentation in order to create a tab in right menu win a contents tree stile.

tiddler name "Contents"
tiddler tag name "$:/tags/SideBar"
tiddler code:
<div class="tc-table-of-contents">
<<toc-selective-expandable "Contents" "sort{!!journalsort}"  >>
</div>

Then modifying Jornal tid as said in documentation, adding a new field with the same name as the sort reference above "journalsort"(or any other given name, but the same name in both tidds) and field value "created":

tidd01.png





























And now it is sorted as intended:

tidd02.png






















Thanks a lot for the support
Regards
Colin

Mohammad

unread,
Feb 20, 2019, 9:27:48 AM2/20/19
to TiddlyWiki
Good stuff.
Hope somebody notify Jeremy to correct this!

Added to TW-Scripts

Cheers
Mohammad

S. S.

unread,
Feb 20, 2019, 12:23:11 PM2/20/19
to TiddlyWiki

S. S.

unread,
Feb 20, 2019, 12:28:15 PM2/20/19
to TiddlyWiki
Colin,

Thanks for posting the full solution. I'm sure it will help others when they want this same Table of Contents behaviour, which actually makes perfect sense for Journal tiddlers.

Also, by asking your question it made me look carefully at the instruction tiddler. I remember when I was new to TiddlyWiki, I tried this same method, found it didn't work, believed I didn't know what I was doing, and then forgot about it.

Now it's permanently fixed thanks to you!

Cheers

S. S.

unread,
Feb 20, 2019, 12:49:55 PM2/20/19
to TiddlyWiki
On further reflection, this is one helluva elegant solution.
Using a transcluded field to supply a filter operator parameter that selectively applies to only one section of a recursive macro.
I wondered who thought of it so I did a little digging. It was Riz - in this Google Groups post that started in Nov 2016
Sweet!



Reply all
Reply to author
Forward
0 new messages