Working with alphabetical lists

132 views
Skip to first unread message

PWL

unread,
Mar 11, 2020, 6:26:47 AM3/11/20
to TiddlyWiki
Hello all,

I have a bit of a conundrum here.  I have alphabetical lists that are generated by the titles of my entries, but some of them have tables with sub entries that I want to insert into the lists alphabetically and I can't seem to figure out how to do it.  I have included screen caps and what little code I have.  And as usual, I am not a programmer in any way shape or form; so please break it down to very simplistic steps please. And thank you for any help you can give.

Here is the code I am using to generate the list

<$list filter="[tag[B]sort[title]]">

<$link to={{!!title}}>
<$view field="title"/>
</$link>

</$list>
[[Bat, Huge|Bat]]


Untitled-2.gifUntitled-4.gif


Mat

unread,
Mar 11, 2020, 7:13:00 AM3/11/20
to TiddlyWiki
You seem to ask two totally different questions, judging from your image:

1) How do I get these table headers, that are not tiddlers but some field in a tiddler, into an alphabetical list
2) How do I alphabetically sort a list based on "pretty links".

...but, unless I misunderstand you, the answer may still be the same for both: I'm guessing you're using some field to define what word/s should be shown in the list.

<$list filter="[tag[B]sort[nickname]]">

<$link>
<$view field="nickname"/>
</$link>

</$list>

Yes, this assumes that you have a nickname field (...how else would you get "Bat, Huge" into the list? You've defined it after the list in your example.)

Note that the $linkwidget uses the currentTiddler as default for its "to=" argument so no need to type it out. (In fact, if it weren't for the $viewwidget you can write <$link/> to get a clickable link to the current tiddler.

<:-)

PWL

unread,
Mar 12, 2020, 6:22:07 AM3/12/20
to TiddlyWiki


Okay I don't think I explained this properly.  The screen capture is of a table.  Its just html and txt nothing more.  There is a tiddly titled Bat.  Bat is tagged as you can see, one of which is the table of contents 'B'.  The tiddly Bat has has a table (just txt) that lists the six different bats (common, large, huge, Asmyth, Night Hunter, and Sinister)  In the table of contents the main tiddly is listed as Bat; and it shows up where it should alphabetically using the code shown.  I want the table of contents to also list the different bats (common, large, huge, Asmyth, Night Hunter, and Sinister) like so:  Bat, Common Bat, Large etc. and I want them to all link back to the main tiddly Bat.  Simple enough using hyperlinks, which I tried.  However they are not inserted into the table of contents in alphabetical order.  Is there a way I can make this happen without making a tiddly for each individual bat type?

PWL

unread,
Mar 13, 2020, 5:24:11 AM3/13/20
to TiddlyWiki
Hey,

So I tried adding a field and inserting this code.... didn't work.  Tried a couple of different variations got some interesting results, like every other link being Bat, huge or Bat Bat, huge.  Any other ideas?

Mark S.

unread,
Mar 13, 2020, 11:30:23 AM3/13/20
to TiddlyWiki
Attached technique using a nickname field.
Wikitext is too convoluted. Javascript would have been much, much easier. Fetch tiddlers. Unpack the list field. Rebuild it as a pseudo title field. Wikify the result. Sort that. Fetch the original name by nick name. Recreate link. Argh.
b-is-for-bat.json

PWL

unread,
Mar 14, 2020, 4:36:29 AM3/14/20
to TiddlyWiki
Check this out, I played with the code a little more and almost got it working.  Here's what I have.

<$list filter="[tag[B]sort[title]]">
<$list filter="[tag[B]sort[huge]]">

<$link to={{!!title}}>
<$link to={{!!Bat}}>


<$view field="title"/>
</$link>
<$view field="huge"/>
</$link>
</$list>

The problem now is that the list repeats until it fills the entire wiki. Yep, gets to Bat, Huge then starts over at the first link and keeps going.
I can't figure out how to make it not do that, the code is the same as the rest of my toc entries with the exception of the additional list filter, link to, and view field.  Below is the code for 'A' in my toc.

<$list filter="[tag[A]sort[title]]">

<$link to={{!!title}}>

<$view field="title"/>
</$link>
</$list>
Reply all
Reply to author
Forward
0 new messages