이 문서는 https://tiddlywiki.com/languages/ko-KR/에서 티들리위키의 정적 HTML 표현의 일부입니다

How to change the sort order of sub-branches in a TOC macro

2019년 2월 20일 오전 12:00

Imagine that you are using a Table of Contents macro similar to this:

<<toc-selective-expandable  "TableOfContents" "sort[title]">>

The sorting is fine for most cases, but you would like all your items tagged Journal to be sorted by the created field. How can you apply a separate sort order to just those sub-items tagged Journal?

The trick is to add a field to the parent tagging tiddler (i.e. Journal) that points to a different sort criteria. Let's call the field fuzzy, and populate it with the value created (created is the name of the field that contains a tiddler's creation date).

Now change your Table of Contents to look like this:

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

Now your Table of Contents will sort by title everywhere, except for the children of the Journal tiddler, which will sort by the created date.

The downside to this trick is that you can't apply a reverse sort based on just one special field. If you reverse the sort order, it will be reversed everywhere.