Maintaining one word titles as links?

You may be aware that camel case and words wrapped in [[myword]] result in active tiddler links, and they also allow missing tiddlers. When the title contains a space such as [[my words]] we need to retain the [[ ]] so the title is delimited.

  • Mosty of tiddlywikis tools support this for example “list-links-draggable Macro”

However if it is a simple word, myword it remains as not a link, if we force it to be a link with [[myword]] it will be a link where this is coded.

However with many tiddlywiki tools such as list-links-draggable it (a single word title, will loose its square brackets when it is reordered.

I wonder if there is a way to ensure the square brackets remain even on single words?

Why? because if I have a list in a text field, I want it to appear as a link, just because I reorder it I do not want to loose its “link quality”, and become plain text.

This is in part to support Virtual tiddlers @Springer

Note:
I have a work around however it is unnecessarily complex.

1 Like

I expect TW6 (TWX?) will provide metadata (attributes) for fields.

I was going to say “Your dreaming”, but what are you thinking?

You gave me an idea :nerd_face: What if I extend my tiddler meta tiddlers for a independent meta fields.

If you have a closer look at the “Days of the Week” tiddler, you’ll see, that none of the elements in the list-field have brackets. They are still shown as links, because the list-links macro is used to show them.

So imo it does not matter, if there are brackets or not. It depends on the template, that is used to show the content.

Using double brackets as a delimiter for Title List [[elements with spaces]] and [[internal links]] in wikitext, is a coincidence.

IMO “mis-using” this coincidence should be avoided. Using proper templating will be an advantage in the long run.

just my thoughts.

2 Likes

This is true inside lists and filters where you are handling titles, or templates from the view templates or cascades for one or multiple words. If however you want single words to be recognised as links in wiki text this is not true, unless you wrap them [[word]]. This is a well known manual approach valid in Wikitext, but not apparently handled in widgets and macros.

As stated previously, this also works for missing tiddlers. That is a missing tiddler for [[word]] comes into existence but not for word, even a template to ensure it looks like a link, will not make it a missing tiddler title.

  • However since tools like list-links draggable don’t allow the braces to be retained we are yet again getting an opinionated result, with no option to escape it.
  • You will find format:titlelist also removes the braces around [[word]]. But similtaniously If the titles already have [[two words]] it will wrap them again and give [[[[two words]]]]

I have being “pushed here” because of the issues/limitations I see are unnecessary here Data tiddlers are forced into type=application/json - #22 by TW_Tones

Unless someone can show me another way to get any title, single word, camelCase and with spaces to be recognizes as a missing tiddler, then I am backed into another non-working approach, because of another subtle limitation.

  • With respect I am highlighting limitations I want to fix.
  • I have the imagination to know how to fix them, but apparently can’t persuade any one the need to fix or help them understand how to fix them.

Without detailing the reason, I can assure you if I can overcome these I have a very interesting set of code patterns that become possible, given virtual tiddlers and a body of work I and @Springer are developing over time.

With respect I need solutions to the issues I raise, not dismissals, no offence intended. I respectful suggest whilst, I can make mistakes, these requests are based on a deep understanding of tiddlywiki and attempt to innovate.

This is just to add uniqueness to repost

IMO a generic way to resolve the problem would be, to have a linkedtitles (or something similar) format-suffix, that checks for brackets and adds them to every title if needed.

This should be straight forward to implement and it can be used everywhere, where filter output is formatted. So it should be possible to create new macros that outptut links instead of title lists.

POC

@jeremyruston – Would it be useful to create a PR for this one?

2 Likes

Here is some code to play with.

WARNING: The code attached here is not production ready.

For a real PR we probably need to add “options” to the $tw.utils.stringifyList([title]) core API function to give us the result we want, instead of “hacking” the results as done with the POC code linked here.

$ _core_modules_filters_format_linkedtitles.js.json (835 Bytes)

The following code example contains an edge-case variable “bbb” for test purposes

\procedure bbb() [bbb]

\function test() aaa [<bbb>] [[aa bb]] +[format:linkedtitles[]join[ ]]

\procedure actions()
<$action-setfield $tiddler=<<currentTiddler>> $field=test $value=<<test>> />
\end

<$button actions=<<actions>>>Click me!</$button>

{{!!test}}

Just for clarity’s sake:

{{double braces}}
[[double square brackets]]

You are right. I get it wrong every time I use it :wink: (Fixed it in my posts)

2 posts were split to a new topic: Smarter Fields?

I’m not yet finding places where lists don’t work as expected (though I believe you, @TW_Tones, that you’re encountering such places). Maybe that’s because of my particular ways of using list fields?

However, I do notice that dragging a tiddler title link from the sidebar into a draft tiddler (in edit mode) does not serve to make a [[link]] to that tiddler when that tiddler has a single-word title (without CamelCase and without system prefix).

This does strike me as a simple failure in the way draggable links should work.

I hope so! (Could there be any reason not to?)

I think this is related to this issue: [BUG] Dragging tiddler links inconsistently wraps titles in double square brackets · Issue #7405 · Jermolene/TiddlyWiki5 · GitHub

1 Like

I wondered about this from the first time I saw the way these single-word tiddlers were handled in lists, but I couldn’t think of any place that it could cause problems. As soon as Tony said it, though, it hit home.

For an example, download this and drag it to any wiki

ttw9274.json (444 Bytes)

If you open Tiddler A, you will see a list of the artists of the Billboard’s top 10 hits from 19841. It should look something like this:

Prince Tina Turner Paul McCartney and Michael Jackson Kenny Loggins Phil Collins Van Halen Lionel Richie Yes Ray Parker Jr. Culture Club

There are no separators of any sort, but each act is its own link. The source looks like:

[[Prince]] [[Tina Turner]] [[Paul McCartney and Michael Jackson]] [[Kenny Loggins]] [[Phil Collins]] [[Van Halen]] [[Lionel Richie]] [[Yes]] [[Ray Parker Jr.]] [[Culture Club]]

Note that Prince and Yes have the double square brackets around them, and hence act as links.

Now visit Tiddler B, and you’ll see the same data included by the <<list-links-draggable>> macro. Drag these up and down to rearrange the list. Now look back at Tiddler A. Prince and Yes are no longer links. I’m pretty sure this is the problem Tony is describing.


1I don’t know if says something good about my memory that I remember all but six of the top 100 hits from the year I graduated high school or if it says something terrible about what I’ve filled my memory with!

2 Likes
  • yes we agree but just remove “if needed”

@Scott_Sauyet that is they exact case I first realised this.

Thanks all for you replies overnight for me. I am out today so cant test your suggestions @pmario until I return.