[TW5] Best handling of sorting section numbers?

119 views
Skip to first unread message

Michael Wiktowy

unread,
Mar 27, 2015, 11:49:54 AM3/27/15
to tiddl...@googlegroups.com
Hello all,

I have a tiddlywiki document full of tiddlers with titles of the format  "§1.1 Title of first section", "§1.2 Title of second section", "§1.3 Title of third section"... etc.

None of the sorting operators handles sorting of these once you get up to §1.10 because it will sort it before §1.2 and things start to get jumbled.

So I resort to adding a separate "order" field to each tiddler and manually put in a number after the "." and before the first space and nsort that to control the sort properly in filters and tables of contents.

Is there some sort of string parsing functionality built-in to TiddlyWiki so that I can split out the number that I need and feed it to sort[] automatically? Is there a better way than what I am currently doing?

Thanks,
/Mike

Stephan Hradek

unread,
Mar 29, 2015, 4:28:36 AM3/29/15
to tiddl...@googlegroups.com
When you already have an order field, why not add a suborder field? Instead of puttong "1.10" into "order" put "1" into order and "10" into "suborder".

Richard Smith

unread,
Mar 29, 2015, 6:30:20 AM3/29/15
to tiddl...@googlegroups.com
Hi Michael,

There is a widget here http://eucaly-tw5.tiddlyspot.com/ called "match filter" that lets you extract pieces of fields. At first I thought I could use it to solve your problem but once you've extracted the pieces and sorted them, there's no way to relate them to the original tiddler-titles they were extracted from.

The best I could think of was that you could use it to set the chapter and subchapter fields automatically. I made an example here https://dl.dropboxusercontent.com/u/83055414/tiddlywiki%20%288%29.html

At the moment you have to click a button to set the fields for each tiddler but I think Jed can show us how to do it all with a single click in 5.1.8.

Regards,
Richard

Michael Wiktowy

unread,
Mar 30, 2015, 1:35:29 AM3/30/15
to tiddl...@googlegroups.com
Thank you Richard,

Thanks for the match filter plugin pointer. Your example helps a great deal also.

I had been adding subsection order fields manually on section creation which adds a whole lot of clicking and scrolling for each ... which adds up when you are doing this hundreds of times.

It would be great if the sort filter was a little bit smarter and allowed a regexp filter to be nested in it to extract out the parts you want to sort on so helper-fields aren't needed. The semi-automated method you provide will help a lot in the meanwhile.

Thanks!
/Mike

Michael Wiktowy

unread,
Mar 30, 2015, 1:45:02 AM3/30/15
to tiddl...@googlegroups.com
Sort answer, efficiency.

I didn't want to manually add a second field that I didn't need since I had already split each section into separate subdocuments and only needed to sort on the subsection. So I just added a subsection field as you were suggesting. With Richard's handy button tool to add section/subsection fields, I may go back and add both to give me more ordering flexibility in the future.
Reply all
Reply to author
Forward
0 new messages