Hey PMario

thank you for your time writing all this to me

what I want to do, in simpler form, is replace all occurrences of a word 
(say Word1 ) with [[Word1]]

so, in other terms, converting a "freelink" to a "backlink"

I could do it in any language in 3 minutes top can't understand why it is 
so complicated in TW :S 

On Tuesday, May 12, 2020 at 4:53:50 PM UTC+3, PMario wrote:
>
> Hi Tony,
>
> TW core has a so-called "hook" mechanism, that could be used here. It is 
> described in the TW dev edition, with a minimal example, that just shows 
> the basic mechanism.  
>
> See the th-saving-tiddler hook 
> <https://tiddlywiki.com/dev/#HookMechanism:HookMechanism%20%5B%5BHook%3A%20th-saving-tiddler%5D%5D>
>  
> info. ... You could do a *javascript *regexp *search and replace* in the 
> hook.  
>
> BUT as a user of such an editor, I personally would consider a behaviour 
> like this as a very offensive action. ... If you just want to learn about 
> the inner workings of TW core, I think it's a good example, with a little 
> bit of risk involved, to keep it interesting. 
>
> I did use the th-importing-tiddler hook with my bundler plugin, to log 
> imported tiddlers into a log tiddler. ... This can be a "real world" 
> example how you can implement it as a plugin.
>
> To do hooks right, you also need to understand when they are executed, so 
> you'll also need to have a closer look at TW core code. 
>
> th-saving-tiddler is executed here: 
> https://github.com/Jermolene/TiddlyWiki5/blob/d1441d29fde17fd382658d7b541cab513d86a936/core/modules/widgets/navigator.js#L323
>
> th-importing-tiddler is executed here: 
> https://github.com/Jermolene/TiddlyWiki5/blob/d1441d29fde17fd382658d7b541cab513d86a936/core/modules/widgets/navigator.js#L559
>
> *That's 1 way to do it. *
>
> have fun!
> mario
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/84b7c65b-a6e1-4c76-8ad4-7d8ac54aee73%40googlegroups.com.

Reply via email to