Thank you Saq for the solutions!! Helps a lot : )

@Mohammed, I did try a search in the TW-scripts. So I think I will add a 
pull request to include Saq's solutions soon!

Op zaterdag 15 mei 2021 om 11:46:45 UTC+2 schreef Anjar:

> Hi,
>
> This would be very easy if we had a general way to hard-replace macros at 
> tiddler save; see https://groups.google.com/g/tiddlywiki/c/crnjiJ4Spq4 (I'm 
> mentioning it here since google groups doesn't show backlinks..)
>
> Best,
> Anders
>
> lørdag 15. mai 2021 kl. 11:41:31 UTC+2 skrev [email protected]:
>
>> Below are three different ways to do this using reduce and without 
>> wikify. The last one uses a custom filter printf[] that is attached.
>> Note that you can use a tiddler for your template as well.
>>
>> *#1 - addprefix galore*
>>
>> <$button> save to a single tiddler 
>> <$vars lb="
>> "> 
>> <$action-setfield $tiddler="report" text={{{ [tag[About]] 
>> :reduce[get[text]addprefix<lb>addprefix<lb>addprefix{!!title}addprefix[!!]addprefix<lb>addprefix<accumulator>]
>>  
>> }}}/> 
>> </$vars> 
>> </$button>
>>
>> *#2 - search-replace*
>>
>> <$button> save to a single tiddler 
>> <$vars template="
>> !! _TITLE_
>>
>> _TEXT_
>> "> 
>> <$action-setfield $tiddler="report" text={{{ [tag[About]] 
>> :reduce[<template>search-replace:gi[_TITLE_],{!!title}search-replace[_TEXT_],{!!text}addprefix<accumulator>]
>>  
>> }}}/> 
>> </$vars> 
>> </$button>
>>
>> *#3 - printf[]*
>>
>> <$button> save to a single tiddler 
>> <$vars template="
>> !! $0$
>>
>> $1$
>> "> 
>> <$action-setfield $tiddler="report" text={{{ [tag[About]] 
>> :reduce[<template>printf{!!title},{!!text}addprefix<accumulator>] }}}/> 
>> </$vars> 
>> </$button>
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d6e97852-c71c-4298-8654-616c0d441898n%40googlegroups.com.

Reply via email to