Relink finally showed up to the v5.3.x party, and it brought its friend: Relink-variables

Relink finally has full support for v5.3.x. That includes all the new pragma, and the conditional syntax that came with v5.3.2 (<% if ... %>).

On top of that, this release introduces Relink-variables. This is a new supplemental plugin which allows you to see how and where your variables are being used. Variables are anything defined with \define, \procedure \function, or \widget. Not only that, but you can also rename them from the new “Relink-variables” TiddlerInfo tab.

Check out the “+ Variables” tab in the demo to see how it works.

Enjoy, everyone. Let me know what you think. I’ll still be around for a while for bug-fixes and improvements before retreating once again to become an unheard-from lurker.

-Flibbles

15 Likes

@Flibbles once again thanks for this iconic solution on which many of us now depend on to turbocharge what can be done with tiddlywiki.

  • I am working through these new features and this release and will reply with any important observations.

but a question please?

I see that to achieve this greatness, you have made use of tiddlywiki’s approach and defines 114 tiddlers with a module-type, summarised with this;

<$list filter="[all[shadows+tiddlers]prefix[$:/plugins/flibbles]each[module-type]get[module-type]]">

</$list>

Or more comprehencivly;

<$list filter="[all[shadows+tiddlers]prefix[$:/plugins/flibbles]each[module-type]get[module-type]sort[]]" variable=module-type><<module-type>>, </$list>.

<$list filter="[all[shadows+tiddlers]prefix[$:/plugins/flibbles]each[module-type]get[module-type]sort[]]" variable=module-type>
   <h3>''<<module-type>>''</h3>
   <$list filter="[all[shadows+tiddlers]prefix[$:/plugins/flibbles]module-type<module-type>sort[]]">
 
   </$list>
   <hr>
</$list>

I can see that looking into this code there is a lot to be learned and reused by any enthusiastic tiddlywiki designer. I would hazard to guess that there are many opportunities to make use of your code outside of their original intentions.

  • Do you have a view on this?
  • Could you nominate some of the modules you think may have real additional value given your familiarity with the code?
  • You need not take on this task yourself, let us call it a Relink “after market”, or “off script” use of your code, you can leave it to us enthusiasts, But your 5,000 foot view of it may help use mine this for gems more easily.

@TW_Tones, I’m happy to reply. I absolutely built Relink with the intention that it could be extended. The module approach was clutch for allowing all my supplemental plugins to be interchangeably installable, but I’m careful to keep my API backward-compatible, so anyone is free to include relink-related plugins in their own plugins so they can integrate. I’m kinda hoping more people do some day.

I’ve got some documentation on the demo page that outlines relinktitlesrule which I figured might be likely choice and how you’d create your own. But there are others. I know @pmario has a relinkwikitextrule for his alias link plugin. If anyone ever wanted to support other types beside wikitext, like json or a data tiddler, relinktext would be a good one to override.

But Relink also provides a pretty good framework for renaming anything, not just tiddler titles. Relink-variables was a proof-of-concept. Under the hood, it works by pretending for every macro that there is a tiddler named $:/temp/flibbles/relink-variables/$(containingTiddler)$ $(macroName)$, and it’s able to perform the rename on that. The rules associated with variable names look for that prefix.

And it works, so Relink provides a pretty good framework for delving recursively into the fine-grain parts of the text. All it needs are the rules for what to do.

2 Likes

Interesting fibbles, but I am also thinking about the tools you made for yourself within the plugins that may have use outside the plugins such as filter operators, javascript functions etc…

  • I am exploring now for examples

Thanks a lot! I played with Relink-variables a little bit and it looks very handy so far.

1 Like

Thank you. From the bottom of my heart, thank you!

This is by far my most important plugin, installed on all but my most trivial wikis. I look forward to checking out the new variables section.

4 Likes

Oh sure! The filter operators were requested enough that I documented some of the useful ones. I did the same with wikimethods, though I suspect they’re not as often used.

I’m happy to hear of anyone using these, and if people have ideas of other filters or abilities Relink might provide to be more utility outside what I intended, I’m happy to hear about it.

Thanks @Flibbles I appreciate your generosity to the community.

  • One filter that comes to mind is something like ... softlinks[] so we can retrieve more than hardlinks as documented Hard and Soft Links because this is what relink already does.
  • Another use case that may be just an application of existing relink features would be a way to use ./ and ..// or a folder name referencing external files or server folder names so we can easily change throughout the wiki whist retaining the prefix.

for example https://domain.com/images/myimage.jpg to

  • https://newdomain.com/images/myimage.jpg
  • or https://domain.com/files/myimage.jpg
1 Like

Filters are accommodated in Relink but over here Using tiddlywiki documentation when contained in a plugin - #4 by TW_Tones I have an issue where a large set of filters begin with or without the [all[] eg [tag[TableOfContents] which implies [all[tiddlers], there may even be filters that read [all[tiddlers]], but I need to change a large set of these cases in multiple tiddlers to [all[shadows+tiddlers]

  • I expect there will be filters that are Selection Constructors where [all[shadows+tiddlers] need not be applied, but if done may not interfere.
  • I may one day need to limit which tiddlers this filter update/rename would apply, but in my current situation it would be fine changing all filters in all tiddlers.

Is there a way I can use relink to solve this problem?

  • Relink may already contain the search and manipulation tools to achieve this?

Nice! Congrats on the release.

1 Like

It’s curious that you managed to pick one thing that seems like it should be under Relink’s purview, but is in fact entirely outside its scope. Relink works only with the source text of your tiddlers. It never renders to html, but a [hardlinks[]] filter would have no choice to do that in order to determine what links show up. So in making it, you actually wouldn’t reuse a single line of Relink code.

Fortunately, such a filter would only be about 10-15 lines of code. Unfortunately, it would be very expensive to use (It has to fully render every tiddler passed through it), which is why I suspect no one has ever incorporated it into the core.

This is something Relink could easily be good for. All you’d need to do is override one wikitextrule, and then make a tiddler with the buttons and fields to set up the rename.

Yeah, actually this one would be pretty easy too, though you would need to write one Relink module (a relinkfilter module), and then a tiddler with the buttons and such to control it. It could both correct such cases in your wiki, and report everywhere that you’re using non-shadow tag reporting. If this is something you need, the module wouldn’t be more than about 20 lines of code, and most of that is just performing checks to make sure it’s looking at the right type of filter. Open a Relink github issue if you’d like to pursue this, and I’ll help out.

1 Like

@Flibbles I’ve been playing around with the relink-titles subplugin, which works pretty well. I did notice, though, that the tiddlers which are renamed by this sub-plugin (those further down in the hierarchy) are relinked in [[ ]] links, but seemingly not in lists, e.g. the $:/StoryList list field. After renaming, the story contains the old, no longer existing titles. The originally renamed tiddler is correctly relinked in this list, though, just not the others.
Did I do something wrong?

Yep. I’m seeing it too. It’s a subtle bug that reveals itself most obviously through the StoryList. I’ll look into it tonight.

FYI: I was recently observing a bug just like this in another situation, unrelated to to relink. using tm-rename-tiddler or tm-relink-tiddler, there may be an issue in the core.

  • Just thought I would mention it so you don’t go crazy looking only in your own code.

Thanks @TW_Tones. You may be right that there is such a problem with those messages, but there was definitely an issue with relink here. If a relink were to cause two titles to update (which usually only happens because of Relink-titles), and a tiddler referenced both of those title (like $:StoryList would if both of those tiddlers were open), then the relinking of one would clobber the other.

No more. @Yaisog, as of v2.4.1 released just now, this issue is fixed. Thank you for pointing it out.

1 Like

Dear Relink

I know you use variables
I know you use variables

#Cameron Fischer
#Cameron Fischer

Great
Great

No need explain …

It works
It works

1 Like