On Sat, May 15, 2021 at 8:33 PM Saq Imtiaz <[email protected]> wrote:

> Just in the interest of thoroughness, option 3 from my post above can be
> further simplified to:
>
> <$button> save to a single tiddler
> <$vars template="
> $(accumulator)$
> !! $0$
>
> $1$
> ">
> <$action-setfield $tiddler="report" text={{{ [tag[About]]
> :reduce[<template>printf{!!title},{!!text}] }}}/>
> </$vars>
> </$button>
>
> However, the previous form makes it easier to understand how reduce is
> being used if one is not used to it.
>

Lovely! I need to go through this! The $0$ and $1$ as place holder seems to
create a lot of flexibility!



> On Saturday, May 15, 2021 at 4:39:12 PM UTC+2 Mohammad wrote:
>
>> WOW, great solution Saq!
>>
>> If we could have some good CSS for print in TW, then we could produce
>> wonderful output in PDF format!
>>
>>
>>
>> Best wishes
>> Mohammad
>>
>>
>> On Sat, May 15, 2021 at 2:11 PM Saq Imtiaz <[email protected]> wrote:
>>
>>> 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/dd5d5a24-44ab-4c7a-8934-fc2cc1a79771n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/tiddlywiki/dd5d5a24-44ab-4c7a-8934-fc2cc1a79771n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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/8793816d-56b4-456e-b2f8-d75faa837fccn%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/8793816d-56b4-456e-b2f8-d75faa837fccn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAAV1gMCr4ov92m1rox1H3BUg52vanjBpDmwORngzcz9c-KrsPQ%40mail.gmail.com.

Reply via email to