Ignore "the" and "a" in dynamic list?

26 views
Skip to first unread message

Adam Viggiani

unread,
Nov 14, 2022, 12:48:47 PM11/14/22
to TiddlyWiki
Hey amazing people!

I'd like to create a dynamic list of books that ignores "the" and "a", to keep it alphabetically tidy, 
But right now I can only get it to render an alphabetical list using:

<$list filter="[has:field[book]get[book]]+[unique[]sort[]]">
    <$link><<currentTiddler>><br></$link>
</$list>

I've tried incorporating a snippet from how to remove stop words:

[enlist<book-list>sortsub<compare-without-stopwords>]

But I can't seem to implement it correctly..

Apologies if this seems a basic fix,
(I'm not a programmer by any means, so I'm just scraping by and trying not to bug you guys with trivial stuff if I can help it.)



Charlie Veniot

unread,
Nov 14, 2022, 1:22:16 PM11/14/22
to TiddlyWiki
Hello,

First, you should first take a look at the example at the bottom of this tiddler

It sounds like that's what you need.

Eric Shulman

unread,
Nov 14, 2022, 2:49:46 PM11/14/22
to TiddlyWiki
Take a look at the actual documentation tiddler (not the static version) here:

Edit that tiddler to see the implementation.  It contains this macro definition:
```
\define compare-without-stopwords()
[<currentTiddler>search-replace:i:regexp[^The |A ],[]]
\end
```
To show a title with the "stop words" moved to the end of the title, add this macro:
\define move-stopwords()
<$text text={{{[<currentTiddler>search-replace:i:regexp[(^The |A )(.*)],[$2, $1]]}}}/>
\end
```
To get your book list as a variable, you can write:
```
<$set name="book-list" filter="[has:field[book]get[book]unique[]sort[]]">
```
You can then use something like this to show the list:
```
<$list filter="[enlist<book-list>sortsub<compare-without-stopwords>]">
   <$link><<move-stopwords>></$link><br/>
</$list>
```

enjoy,
-e
Reply all
Reply to author
Forward
0 new messages