Why does listing also linkify?

99 views
Skip to first unread message

Mat

unread,
Apr 14, 2020, 3:04:30 AM4/14/20
to TiddlyWiki
Why, actually, does listing something also forcefully convert it into a link? Why can't items just be listed in the form they came?

<$list filter="aaa [[bbb bbb]]"/>    ----->  [[aaa]] [[bbb bbb]]

This is typically useful but this causes problems when using filters as a tool for string manipulation, e.g if trying to identify what is a link and what is not a link, in a text.

<:-)

Mat

unread,
Apr 14, 2020, 3:08:34 AM4/14/20
to TiddlyWiki
Hm, I intended to post that to the dev group. Oh, well.

<:-)

Jeremy Ruston

unread,
Apr 14, 2020, 7:02:17 AM4/14/20
to TiddlyWiki
Hi Mat

If there’s no template content within the list widget, nor a template attribute, then the list widget falls back to using a default template consisting of a <span> or <div> element wrapped around a link to the item. See the section “Content and Attributes” here:

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/5433789f-9af3-4a8a-93cf-02c5440d2b63%40googlegroups.com.

Mat

unread,
Apr 14, 2020, 7:25:27 AM4/14/20
to TiddlyWiki
Thanks Jeremy but so how would I get this output:

filter="aa [[bb]]"   ----->   aa bb

i.e what should the template look like?

AFAICT, the custom template is applied to the output but only after the output is already linkified by the widget... so it is not possible to investigate what was a string and what was a link.

Thank you.

<:-)

Jeremy Ruston

unread,
Apr 14, 2020, 8:02:51 AM4/14/20
to TiddlyWiki
Hi Mat
Do you mean that you want “bb” to be linkified and not “aa”? That’s not quite how filters work: double square brackets within filters are used to delimit titles containing spaces. The brackets don’t remain part of the name, and therefore aren’t visible to the rendering template.

What are you trying to accomplish?

Best wishes

Jeremy


Thank you.

<:-)


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

Mat

unread,
Apr 14, 2020, 8:27:48 AM4/14/20
to TiddlyWiki
Yes, I hope to be able to distinguish between items that are enclosed in brackets and items that are not.

My latest endeavor where I need this is for the TitlePicker (this issue) which looks at what is typed in the editor (as it is typed) and needs to identify strings that are "title fragments", i.e prefixed with "[[" that are not (eventually) followed by "]]" or other non-title indicators like <$ etc . I'm fiddling with various attempts at regexps for this but it would be trivial if I could just sort out the links (i.e the [[...]] ) to begin with. It is particularly tricky to work with double brackets in filters because of how filters treat them.

Given your reply that 

That’s not quite how filters work: double square brackets within filters are used to delimit titles containing spaces. The brackets don’t remain part of the name, and therefore aren’t visible to the rendering template.

...I don't see how the input "aa" can be distinguished from "[[bb]]" then, or?

Again, thank you for your replies.

<:-)

Jeremy Ruston

unread,
Apr 14, 2020, 11:42:55 AM4/14/20
to tiddl...@googlegroups.com
Hi Mat

That’s right, the filter has no memory as to the type of bracketing used to define an item in the list.

But I still don’t quite understand how this relates to your problem. Are you attempting to treat the text of a tiddler as a filter string and then expecting to be able to process the individual words. The problem with that is likely to be the duplicate removal — just try typing “the cat sat on the mat” in the filter tab of advanced search.

Best wishes

Jeremy




<:-)

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

Mat

unread,
Apr 14, 2020, 12:36:04 PM4/14/20
to TiddlyWiki
Hm, OK possibly this particular use case doesn't make sense in this context. I'll ask again if I come across a case that does fit.

Regardless, your answers did clarify what happens to the brackets and why the output "aa [[bb]]" isn't possible - so thank you.

<:-)

TonyM

unread,
Apr 15, 2020, 7:51:24 PM4/15/20
to TiddlyWiki
Mat,

I feel you pain on this one but here is an idea for a possible work around. If I understand your requirement properly.

Trying to identify what is a link and what is not a link

How do you define a link?
  • Rather than consider the square brackets as the indicator of a link perhaps test it again, does the tiddler exist?
  • The Default `<$link/>` will create a link from currentTiddler regardless of if the tiddler exists or not
  • The following filters (From memory) should allow you to use `<$link/>` only if the tiddler exists
  • "[<currentTiddler>has[title]]" "[<title-var>]!is[missing]]" "[<title-var>]is[tiddler]]" and more can be constructed.
Just a thought

Regards
Tony
Reply all
Reply to author
Forward
0 new messages