Filter and list text components:

196 views
Skip to first unread message

tobaisch

unread,
Jan 1, 2018, 7:38:21 AM1/1/18
to TiddlyWiki
hello and a happy new year to all.

This is my wikitext in different tiddlers:

-----------------------
tiddler01
content
:

*Book: Winnetou 1
**Autor: Karl May
.
*Book: Moby Dick
**Autor: Hermann Melville
 
*Book: Taipi
**Autor: Hermann Melville
-----------------------
tiddler02
content
:

*Book: Winnetou 2
**Autor: Karl May

*Book: Silbersee
**Autor: Karl May

*Book: Hithikers Guide to the Galays
**Autor: Douglas Adams

-----------------------

Is it possible to generate a list from the following text modules?
The filter request would be "Karl May"
The Searchterm always stands after the term "**Author:"
The goal, however, always before "** Author:"
Simple:  Target term **Author: Keyword

The target term is always in the text before the sequence: "**Author:" and after the character string "*Book:"
Listed should be the text that always begins with "*Book:" and ends before "**Author:"

The desired result would be in my case this list:

Winnetou 1
Winnetou 2
Silbersee


Is there a possibility?

Thanks
Regards
Tob

Thomas Elmiger

unread,
Jan 1, 2018, 2:15:37 PM1/1/18
to TiddlyWiki
Hi Tob,

All the best for 2018 to you too.

My extract hack (macro) might be able to do the job if used inside a list like shown in the last tiddler here: https://tid.li/tw5/numbers.html

You would have to define something like this (not tested!):


<$list filter="""[FINDyourTIDDLERShere]""">

<ol>
<$list filter="[<currentTiddler>">
<<extract start:"Book: " end:"** Author: Karl May" limit:"no" rmQuotes:"n" prefix:"<li>" suffix:"</li>" mode:"inline">>
</$list>
</ol>
</$list>


The extract macro can be found here: https://tid.li/tw5/hacks.html#%24%3A%2F_telmiger%2Fextract

It might be easier to achieve the same using a regex Tool if you know some regular expressions.

Happy extracting!
Thomas

tobaisch

unread,
Jan 1, 2018, 3:35:32 PM1/1/18
to TiddlyWiki
thanks thomas
it does not work.
sorry, something freezes the browser.
Regards
Tob

Thomas Elmiger

unread,
Jan 1, 2018, 5:47:23 PM1/1/18
to TiddlyWiki
Fixed (and tested):


<ul>
<$list filter="[prefix[tiddler]]" variable="tid">
<$macrocall $name=extract tiddler=<<tid>> start="""Book:""" end="""**Autor: Karl May""" limit="no" prefix="<li>" suffix="</li>" mode="inline">>
</$list>
</ul>
</$list>

tobaisch

unread,
Jan 1, 2018, 7:51:37 PM1/1/18
to TiddlyWiki
I dont now whats wrong.
i extract $:/_telmiger/extract to my tiddlyWiki
and copy the code.
Nothing is happening.
Regards
Tob

TonyM

unread,
Jan 1, 2018, 11:18:18 PM1/1/18
to TiddlyWiki
Tob,

I am not so well versed in the approach you are asking for, and Thomas is helping you with, but from my perspective I would have a tiddler for every author, a tiddler for every book and tag each book with one or more authors. You can then use the Info button on any book or author tiddler to find its Relationships. then if you must use an additional tiddler that combines books into a category or group (like your tiddler examples), I would also use a tag for each category. This allows much to be done without any further design but I would add to the view template a tiddler tagged $:/tags/ViewTemplate to display related books or authors in view mode, and if required use a few <$list widgets to list books and authors in other ways or use http://tobibeer.github.io/tb5/#Taggly%20Tagging%20For%20TW5 to automate tag heirachies.

Regards
Tony

tobaisch

unread,
Jan 2, 2018, 12:58:36 AM1/2/18
to TiddlyWiki
Thanks Tony,
 
would have a tiddler for every author, a tiddler for every book and tag each book with one or more authors.

that is unfortunately only theory.
In fact, there are also books with several and not a few authors.
But no matter. That does not help me with my above mentioned problem anyhow.
And it worked for Thomas, he says.
I'll take a closer look at the TB5 thing, too.
Thanks again
Regards
Tob

Thomas Elmiger

unread,
Jan 2, 2018, 4:03:09 AM1/2/18
to TiddlyWiki
What do you see, Tob? Is the freezing gone? If you get an empty tiddler instead of results you might have to change the first filter where I filtered for tiddler titles starting with "tiddler" as in your examples. [prefix[tiddler]] does this.

Replace it e.g. with [!is[system]sort[title]] and let us know if you get results with this.

Also the start and end strings must match your tiddler content exactly. At first I had a space between the ** and the word Autor. That did not match and my results were empty.

Have a nice day,
Thomas

Thomas Elmiger

unread,
Jan 2, 2018, 4:08:49 AM1/2/18
to TiddlyWiki
Oh, forgot to mention:

1) You say, you "extract $:/_telmiger/extract to my tiddlyWiki" – I hope you know you can import this into your wiki by dragging a link to it to your wiki?

2) The code I gave you should be in a results tiddler (as in: no books listed in the same tiddler).

TonyM

unread,
Jan 2, 2018, 5:39:36 AM1/2/18
to TiddlyWiki
Tob,

The tagging method I mentioned is actually the superior way to handle many to many relationships. I understand you are where you are and are free to do as you wish, however my advice will serve you well in the future. If I may give you my qualifications on this I have being using twc and tw5 for many years, an IT professional of 30+ years and recently professional information/ knowledge management. I expect most of this community would make similar suggestions.

Welcome to the community.

Mark my words, if you move in my suggested direction the benifits will be substantial.

Best wishes
Tony

tobaisch

unread,
Jan 6, 2018, 1:44:09 AM1/6/18
to TiddlyWiki
Thomas, many thanks.
It works so far.
There are some problems because I also have double quotes and other things in the text are not really stringent.
But you gave me a good template to continue working on it.
That's enough for me first as a start.
Thanks
Regards
Many Thanks.

tobaisch

unread,
Jan 9, 2018, 8:37:27 PM1/9/18
to TiddlyWiki
Hello TonyM,
I have now looked at the Tagging Tool by TobiBeer.
I do not really understand the benefit for me. All this I can do with the list widget too. And I do not need hierarchies at the moment either. Maybe I do not really understand it either. The practical examples are missing on the page. [Foo Bar] I consider is an inappropriate example to explain something to someone. :)
No matter.
In general, with the help of the full-text search also tags are not really always needed (I refer to my case).
I type three search words faster than I put three tags in a filter list. I use very few tags and get along very well. Tags are not as flexible in my opinion.

To my request briefly again:
I was not looking for entire Tiddler but for individual sections of text. I wanted to extract those and compare them to their spelling and mistakes.
And under favorable conditions also list as list.
The macro looks a bit bumpy but it works and helps enormously.
I hope it works for 3000 Tiddlers later too. Maybe I have too little computing power with my old device. :)

For your help.
I really appreciate your help. You have really given me very good tips and taught me a better one. Please continue! That's good and thanks for that.
In general you are very active here and I do not doubt your competence. I just need a little bit longer to understand something.
We are not only spatially very separated but also in our knowledge about macros and TW5.
There is also a lot of water in between :)
All the better that we can exchange ourselves with the help of the WWW here on this way. Somehow crazy. Thank you.
Regards
Tob

tobaisch

unread,
Jan 9, 2018, 8:53:13 PM1/9/18
to TiddlyWiki
Hello Thomas again,
is there a way to display a sorted list?
Regards
Tob

TonyM

unread,
Jan 9, 2018, 9:28:48 PM1/9/18
to TiddlyWiki
Tobaisch,

I empathise with you position as a newbie, However regardless it is of great value using a tiddler as your basic unit of information as illustrated in my comments. Your current method is placing multiple "objects or things" in a single tiddler so now you need to build solutions to look inside tiddlers. Creating a tiddler for each book and tagging it as a book basically says this tiddler is a book, you can do the same for authors. There will be no "redundant" (meaning repeating or duplicate information inside a tiddler) you have to maintain. These books and authors can then be related using each others names as tags. I am sure you will come to learn how to use tags more effectively soon, one tip is the Open all button that allows you to open Open all items tagged from the tag pill, just click on a tag appearing in a tiddler (eg Author), Unfortunately the only link to the plugin source I have is here I will see if I can find better.

The "Tagging Tool by TobiBeer." may very well become desirable when you start to take this other route.

When you make tiddlers you search on their name with the standard search box, as you can if you make tags into tiddlers. Lets say you have an author tiddler (also a tag) in that tiddler you can permanently code a list filter to show all authors. 

Whilst reserving some humility I would like to respectfully suggest to consider going down this path because my experience in tiddlywiki and outside tiddlywiki demonstrates your current method is inferior, the one I suggest is not only superior but opens far more possibilities and will ultimately be easier for you. If you remain on your current path you will find it more difficult, and I expect I will be making this point again, as will others.

The trick is learning from others who have travelled this way, you will complete the journey much faster if you do.

Best Wishes
Tony

Birthe C

unread,
Jan 9, 2018, 9:58:06 PM1/9/18
to TiddlyWiki
Hi Tony,

Is it this link http://openall.tiddlyspot.com/ your are looking for?

Birthe

TonyM

unread,
Jan 9, 2018, 10:13:57 PM1/9/18
to TiddlyWiki
Thanks Birthe !

Tony

Thomas Elmiger

unread,
Jan 10, 2018, 2:40:23 AM1/10/18
to tiddl...@googlegroups.com
Hello Tob

My wikitext macro collects and spits out matching text passages as they occur in the tiddler. 

So the only way to sort would be to change the order im the source tiddler. 

The TW concept that allows finding and sorting at the same time would be filters. So maybe a regex filter could help in your case. Bot this is not my territory. 

In the long run the most flexible path to do new things with your data would be to reorganize as suggested by Tony – although it looks like too much work at the moment it might be worth exploring. Jan managed to create temporary tiddlers with content found via my extract macro for his presentation tool. Maybe you could adopt something like that to create new permanent tiddlers with your data in an automated way. 

Good luck!
Thomas 
Reply all
Reply to author
Forward
0 new messages