Show Title of Tiddler with some Chars Trimmed from Front of String

134 views
Skip to first unread message

David

unread,
Apr 10, 2020, 11:02:40 PM4/10/20
to TiddlyWiki
I'm inside a listWidget loop, and I am showing the tiddler title like so...

<$link to=<<item>>><<item>></$link>

But in one particular group of tiddlers, I used a prefix like "Sled: Snow: BR-1000"

The prefix is really awesome for that tree view thing.  But I only want, in this list, to show "BR-1000"

How do I get just a portion of that?

TonyM

unread,
Apr 10, 2020, 11:52:22 PM4/10/20
to TiddlyWiki
David

First a short form of your above code is
'<$link />' if item in the currentToddler

but if you have the prefix you want to remove you can follow this code pattern and alter for your use case.

'<$link to=<<curentTiddler>> >{{{ [all[current]removeprefix[prefix]]}}}</$link>`

Or you can put the triple braces in a text widget..

It all depends on what is available to you to remove the prefix. You could try split[:]last[]

a little more info would help.

Regards
Tony

David

unread,
Apr 11, 2020, 2:14:46 AM4/11/20
to TiddlyWiki
Thanks so much!  The remove prefix was perfect!

Inside the link tags I put...

{{{ [<item>removeprefix[Sled: Snow:]]}}}

Thanks!

TonyM

unread,
Apr 12, 2020, 3:10:56 AM4/12/20
to TiddlyWiki
David

Can I suggest in future you avoid compound titles and use tags or fields to indicate sled and snow etc...

The thing about tiddlywiki is tiddlers titles are their own unique key to the content within. In database technology we know compound keys lead to problems including two names for the same content.

Regards
Tony

David

unread,
Apr 16, 2020, 4:39:20 PM4/16/20
to TiddlyWiki
Tony,

Thanks for the suggestion.  I definitely understand where you're coming from.  In fact, elsewhere in my TW, I have a tiddler, Plastic Cup, that is both a todo item and a dollar tree shopping list item (done via tags) at the same time.

But using the compound titles is actually done because I didn't want to have one name that was ambiguous.  I might have one tiddler that refers to a sled: "Sled: Snow: X-10".  While I may have another X-10 tiddler that is actually a web cam: "Camera: X-10"

In that example, I couldn't have two tidlers named "X-10" could I?  One with sled and snow tags, and the other with camera tag?

Mark S.

unread,
Apr 16, 2020, 5:30:26 PM4/16/20
to TiddlyWiki


On Thursday, April 16, 2020 at 1:39:20 PM UTC-7, David wrote:
Tony,

Thanks for the suggestion.  I definitely understand where you're coming from.  In fact, elsewhere in my TW, I have a tiddler, Plastic Cup, that is both a todo item and a dollar tree shopping list item (done via tags) at the same time.

But using the compound titles is actually done because I didn't want to have one name that was ambiguous.  I might have one tiddler that refers to a sled: "Sled: Snow: X-10".  While I may have another X-10 tiddler that is actually a web cam: "Camera: X-10"

In that example, I couldn't have two tidlers named "X-10" could I?  One with sled and snow tags, and the other with camera tag?


You can put "X-10" in caption or description field. Storing the information, as Tony pointed out, leads to all sorts of headaches.

TonyM

unread,
Apr 16, 2020, 11:05:40 PM4/16/20
to TiddlyWiki
David,

As Mark said and 
You can call them  "X-10 Camera" and "X-10 Sled" or "X-10 a" and "X-10 b" Just don't use a value in the title to determine if it is a camera or a sled. 
Use titles to help distinguish between different objects with similar names, but don't use titles to perform other functions like a category or class that can be set with a field or tag and other ways.

As they say "trust me", I am not kidding, this is based on deep experience of knowledge, information and database management.

To prove this I never have problems naming or renaming tiddlers, and I am curious why this is a problem for many?. I have tried to document how I manage this, but it has eluded me so far :(

Regards
Tony

David

unread,
Apr 17, 2020, 9:26:05 AM4/17/20
to TiddlyWiki
Thank you Mark and Tony.

Here's some extra info that may make a difference.  I AM actually using tags to tell what's a camera and what's a sled.  Any filter is based on the tags, not parsing the title.  The prefix is just nomenclature, is not used in any logic, and is so that I can use that handy treeWidget.

So, knowing that I'm using tags after all, since calling it "X-10 Camera" is okay, I imagine calling it "Camera X-10" is okay too, right?

Thanks

Seriously, thanks so much for your input.

TonyM

unread,
Apr 20, 2020, 10:47:54 PM4/20/20
to TiddlyWiki
David,

So, knowing that I'm using tags after all, since calling it "X-10 Camera" is okay, I imagine calling it "Camera X-10" is okay too, right?

Yes, set your own preferences, however I thought camera was logically first and qualified by X-10 (model?) and was it sled?, Sled X-10 but surely there is not something called X-10 that is applied to many things? The question is in what order do you want them in a simple title list?

Regards
Tony
Reply all
Reply to author
Forward
0 new messages