freelinks alias-variant request, partial workaround

147 views
Skip to first unread message

springer

unread,
Apr 11, 2021, 7:34:13 PM4/11/21
to TiddlyWiki
Dear all,

Freelinks are especially great when text gets dumped into a wiki from multiple sources (such as students in a class, or excepts from texts), and where the main author/curator of the wiki can't or shouldn't modify the text generated by other authors. 

Currently,  out of caution around potential performance-drag, I have freelinks picking up titles for only a select set of tiddlers: those tagged with keyword ... and now also for keyword-alias. (In 5.1.24 prerelease: Filter defining tiddlers to which freelinks are made: "[tag[keyword]] [tag[keyword-alias]]")

I continue to hope that freelinks will one day work seamlessly with an "aliases" or "title-variants" field... It's hard to imagine any person who finds freelinks useful but who wouldn't benefit from getting title-variants recognized without fuss.

But for now, I'll share a very limited workaround, so that a freelink (virtual link) to empiricism (or at least, a functional equivalent) will display whenever tiddler text mentions empiricists (for example).

I actually generate a tiddler called empiricists and then populate it with {{empiricism}}. I then set the caption field to empiricism, and add the tag keyword-alias.

Then, two tweaks to the system make it look almost seamless -- assuming you don't really need to *see* titles rather than this more semantically pointed (but not-necessarily-unique) caption field. 

(1a) Modify $:/core/ui/ViewTemplate/title

<$view field="title"/> can be replaced with 
<$transclude field="caption">{{!!title}}</$transclude>

(1b) Do the same for $:/core/macros/timeline (if the Recents sidebar tab is front-and-center, as with a blog). ...  and also modify timeline macro to reflect something like:

\define timeline(limit:"100",format:"DDth MMM YYYY",subfilter:"!tag[keyword-alias]",dateField:"modified")

(2) In my case, an additional ViewTemplate footer template (a dynamic table showing rows for each tag-child of the keyword specified in tiddler's title, displaying exactly on tiddlers which serve as tags), and this also needs to be added in to better mimic the original tiddler. So my content for the keyword-alias tiddler empiricists is actually:

{{empiricism}}
{{empricism||keyword}}

As you can imagine, this is clunky, given that title-variants of X can't be specified in the very process of creating tiddler X, and I need to clone the above solution for each additional variant, such as empiricist (singular) and so on. However the actual "weight" of each tiddler alias is minimal, so effort is the main constraint. 

Still, it's finally possible to ensure that if a student posts about empiricists, we'll all see a link that effectively invites us to visit the keyword empiricism

Unless, of course, they misspell that keyword entirely. : |

Note, of course, this solution is better for a use-case like mine where those who follow these variant-links don't usually need to edit the original. Since my students don't generally edit the keywords directly, that's not yet a problem for me. 

Again, though: Any solution that requires a proliferation of tiddlers (as well as messing with the timeline macro, etc.) feels less than ideal. Freelinks will be better when a field directly in the "beacon" tiddler lists all the title-variant strings that ought to point there. Fingers crossed!

Cheers, and wishing you all a season of resilience...

-Springer

Mark S.

unread,
Apr 12, 2021, 2:41:24 PM4/12/21
to TiddlyWiki
Maybe uni-links would be more useful, rather than having to apply multiple hacks?

springer

unread,
Apr 13, 2021, 11:59:45 PM4/13/21
to TiddlyWiki
Mark, thanks for mentioning that related plugin. As far as I could tell on my first browse-through when it was first announced, uni-link changes how links display, but they still need to use [[hard markup|?]]. ("It allows users to assign an aliases field to tiddlers, that can be referenced with a slightly modified link syntax.") 

My use case, though, involves chunks of text pasted into the wiki from other sources, so I'm not wanting to go in and set up [[links-like-this|?]] all over the place. The freelinking is essential, and my hack is designed to cast a wider net for certain freelink-worthy terms.

Are you suggesting that uni-link would integrate with freelinks and help in this use-case? Crucial to my situation: I still want the actual variant strings within tiddlers to continue displaying *whatever it was* that the original author typed...

So far, it strikes me that uni-link is designed for roughly the contrary challenge to mine: a systematic single-author wiki where author wants to use a concise markup to streamlines the cumbersome old [[workarounds for plurals and such|workaround]], while also enabling retroactive global changes to how certain [[hardlinked variants|c]] display. (So, if I change my dog's nickname, all I do is update the caption field for the dog's tiddler... Standard links to the dog's official name [[Rex]] still look and function the same, but any uni-links via the caption [[Rex|c]] immediately all show the new nickname. Cool! But not what I need to do...)

Happy to hear if you think I'm misunderstanding...

-Springer

TiddlyTweeter

unread,
Apr 14, 2021, 5:39:04 AM4/14/21
to TiddlyWiki
springer, you empiricist you!

I have a question

         Could one dynamically, by normal button, switch OFF/ON the Freelinks plugin at will?

It seems to me it is brilliant
BUT I use it to INVESTIGATE. I don't need it 24-7. 
But I do use is 7-24. 
Switch on-off??

Just a thought
TT

PMario

unread,
Apr 14, 2021, 6:24:49 AM4/14/21
to TiddlyWiki
On Wednesday, April 14, 2021 at 5:59:45 AM UTC+2 springer wrote:
Mark, thanks for mentioning that related plugin. As far as I could tell on my first browse-through when it was first announced, uni-link changes how links display, but they still need to use [[hard markup|?]]. ("It allows users to assign an aliases field to tiddlers, that can be referenced with a slightly modified link syntax.") 

That's right.
 
My use case, though, involves chunks of text pasted into the wiki from other sources, so I'm not wanting to go in and set up [[links-like-this|?]] all over the place. The freelinking is essential, and my hack is designed to cast a wider net for certain freelink-worthy terms.

If one of your major goals is to _not_ modify the original text, you have to have freelinks active. I think your usecase is a valid one for using freelinks.

I'm not the biggest fan of freelinks, because of its performance implications, that's why I did not have a look at the freelink code yet.

I don't know, if there would be a possibility to make it work with the uni-link alias-functionality. I even think atm the plugins won't work together. ... But I didn't test that either.
 
Are you suggesting that uni-link would integrate with freelinks and help in this use-case? Crucial to my situation: I still want the actual variant strings within tiddlers to continue displaying *whatever it was* that the original author typed...

I'll have a look at the code. ... I am interested to speed up alias handling with its own trie-based index.
 
So far, it strikes me that uni-link is designed for roughly the contrary challenge to mine: a systematic single-author wiki where author wants to use a concise markup to streamlines the cumbersome old [[workarounds for plurals and such|workaround]], while also enabling retroactive global changes to how certain [[hardlinked variants|c]] display.

Exactly right!
 
(So, if I change my dog's nickname, all I do is update the caption field for the dog's tiddler... Standard links to the dog's official name [[Rex]] still look and function the same, but any uni-links via the caption [[Rex|c]] immediately all show the new nickname. Cool! But not what I need to do...)

Happy to hear if you think I'm misunderstanding...

You are right.

have fun!
mario

PMario

unread,
Apr 14, 2021, 6:35:27 AM4/14/21
to TiddlyWiki
On Wednesday, April 14, 2021 at 11:39:04 AM UTC+2 TiddlyTweeter wrote:
I have a question

         Could one dynamically, by normal button, switch OFF/ON the Freelinks plugin at will?

It should be simple to create a new "page-button", that enables and disables the $:/config/Freelinks/Enable setting.

The button can be made visible on the right sidebar main area.  So it would be really quick to reach it.

-mario

PMario

unread,
Apr 14, 2021, 6:36:57 AM4/14/21
to TiddlyWiki
The only thing we need here is a __good__ and optimized for TW "freelink" SVG image, that we can use.

-m

TiddlyTweeter

unread,
Apr 14, 2021, 7:30:57 AM4/14/21
to TiddlyWiki
 PMario wrote:
The only thing we need here is a __good__ and optimized for TW "freelink" SVG image, that we can use.

Right on! 

      Shirley, among the  37K+ icons of https://morosanuae.github.io/tw-icons/ there must be at least one that works for that?

Best wishes
TT

PMario

unread,
Apr 14, 2021, 2:46:25 PM4/14/21
to TiddlyWiki
On Monday, April 12, 2021 at 1:34:13 AM UTC+2 springer wrote:

I continue to hope that freelinks will one day work seamlessly with an "aliases" or "title-variants" field... It's hard to imagine any person who finds freelinks useful but who wouldn't benefit from getting title-variants recognized without fuss.

You know, that freelinks plugin has setting for "Ignore case". So case isn't important, but "typos" are ;)

-m

PMario

unread,
Apr 14, 2021, 3:07:05 PM4/14/21
to TiddlyWiki
Hi Springer,

I did have a closer look at the freelinks pugin code. ... I could identify some possibilities to make the function more performant.

I did the following:

 - download the whole https://tiddlywiki.com/prerelease/
 - open 30 tiddlers from the recent tab
   - I did start from the top and opened 30 of them + ControlPanel to change some settings.
 - Then I did switch between "Recent" and "Contents" tab, to see the "delay"

The UI needs about 1200ms .. which is very clunky in my opinion. ...

Some debugging shows, that freelinks needs to do about 1300 tests with 1400 titles. ... That's some heavy searching which needs some time. ..

1300 tests come from the open tiddlers in the story list. ...

----------

It would be nice to get some data from you. So

How many content tiddlers does your wiki have?
How many of them are tagged to be "freelinked"?  including your workaround tiddlers.

How long does your PC need, if 30 tiddlers from TW page are open in the story list. Please download, install the plugin and test

-mario

springer

unread,
Apr 14, 2021, 3:39:45 PM4/14/21
to TiddlyWiki
An icon for freelinks might be easier if we could leverage a suggestive metaphor. So far, I have been weighing:

* magnetize (tiddlers "want" to connect with each other)
* X-ray (viewing mode that sees "under the surface")
* turbo (add support for max efficiency, at cost of some extra "heat")
* beacon (some tiddlers send out little beacons so we see them from further away)

There's also an icon for the "all-seeing eye" which would seem apt: https://morosanuae.github.io/tw-icons/#%24%3A%2Fimages%2Fsvg-icon%2Foriginals-all-seeing-eye

-Springer

PMario

unread,
Apr 14, 2021, 3:48:40 PM4/14/21
to TiddlyWiki
On Monday, April 12, 2021 at 1:34:13 AM UTC+2 springer wrote:
...
But for now, I'll share a very limited workaround, so that a freelink (virtual link) to empiricism (or at least, a functional equivalent) will display whenever tiddler text mentions empiricists (for example).

Having a look at your OP it seems your freelink "titles" and your aliases should be "short", since you use the caption field. Which is convenient for shorter titles.

With short I mean 1 or 2 words and not whole sentences like eg: "TiddlyDrive Add-on for Google Drive by Joshua Stubbs"

About your workflow.

 - Someone copy pastes some content into a tiddler named: empiricism
 - The text isn't changed
 - This user would also define some aliases eg: empiricists experimentation ....

Freelinks should also link to this tiddler of 1 of the aliases matches. Right?

-mario



springer

unread,
Apr 14, 2021, 3:49:15 PM4/14/21
to TiddlyWiki
PMario,

Indeed "ignore case" is great, and I was delighted when Jeremy confirmed the option would be added in. But between that (straightforward) and anticipating lots of typos (silly bush-whacking), there are plurals and other grammatical variants, essential name variants, etc.

springer

unread,
Apr 14, 2021, 4:01:48 PM4/14/21
to TiddlyWiki
My particular use case is actually: 

- I have already populated the wiki with tiddlers for various keywords (definitions, "nodes" of likely connection among related items, etc.) 
- Seminar students paste in their reflective writing each week
- I also paste in excerpts from other authors (philosophical source texts)

With freelinks (set to look only for title-strings of tiddlers tagged "keyword"), all this pasted-in tiddler content renders "lit up" with links, even though there's no markup. But it annoyingly won't pull "ethical" to "ethics" etc.

The "magnetic" tiddlers (the ones to which I want links to pop up automatically) always have short names (usually one or two words); the variant names are also short.

-Springer

Mark S.

unread,
Apr 14, 2021, 5:13:27 PM4/14/21
to TiddlyWiki
I wonder if instead of comparing with tiddlers, the plugin used data tiddlers there could be an improvement in performance as well as increased ease of setting up new terms. The way it would work is that comparisons would be made from the top of the data tiddler to the bottom, taking the one that came first. So if you wanted to make sure that "Empiricism, a way of life" was linked before plain old "Empiricism", then you could put that at the top of the list. Or maybe vice-versa, depending on how the original code works. In any event, whenever you wanted to add a new misspelling, you'd just add an entry to the data dictionary:

Empiricalism: Empiricism

Then you could also have different dictionaries that could be applied for different topics which would also improve performance and reduce ambiguity. 

Reply all
Reply to author
Forward
0 new messages