Thank you Jeremy!
Lets see how can I use your solution in my case and I return to you by me 
results.

By the way I am curious about the last paragraph of your reply:

An alternate solution that might be useful would be an alternate mode to 
> the <$macrocall> widget whereby it makes the result of calling the macro 
> available as a variable, instead of directly rendering it.
>

How this is possible? There is nothing in 
documentation: https://tiddlywiki.com/prerelease/#MacroCallWidget
Is it like below

<$macrocall   store=?>
scope of that var
</$macrocall>


Best regards
Mohammad


On Friday, February 22, 2019 at 1:28:58 PM UTC+3:30, Jeremy Ruston wrote:
>
> Hi Mohammad
>
> Thanks that’s great.
>
> I think the button is actually a red herring, and you can see the same 
> behaviour with this simplified version:
>
> \define utility(a, b) This is //$a$//  and ''$b$''.
>
> \define test(tidName, v1, v2)
> <$wikify name="newText" 
> text="""<$macrocall $name="utility"
> a=<<__v1__>> b=<<__v2__>>
> />""">
> <$text text=<<newText>> />
> </$wikify>
> \end
>
> <<test "myTiddler" italic bold>>
>
> You don’t actually need the wikify widget here; the trick is to use macro 
> parameter textual substitution:
>
> \define utility(a, b) This is //$a$//  and ''$b$''.
>
> \define test(a,b)
> <$set name="newText" value=<<utility a:"""$a$""" b:"""$b$""">>>
> <$text text=<<newText>> />
> </$set>
> \end
>
> <<test "myTiddler" italic bold>>
>
> Using textual substitution isn’t ideal because of the issues with quoting 
> (e.g. the example above will fail if the parameter values started with 
> three double quotes).
>
> An alternate solution that might be useful would be an alternate mode to 
> the <$macrocall> widget whereby it makes the result of calling the macro 
> available as a variable, instead of directly rendering it.
>
> Best wishes
>
> Jeremy
>
>
> On 21 Feb 2019, at 14:37, Mohammad <mohammad...@gmail.com <javascript:>> 
> wrote:
>
> Hi Jeremy,
>
> I tried to reproduce a simple example though may seem meaningless.
>
>
> \define utility(a, b) This is //$a$//  and ''$b$''.
>
> \define test(tidName, v1, v2)
> <$wikify name="newText" 
> text="""<$macrocall $name="utility"
> a=<<__v1__>> b=<<__v2__>>
> />""">
> <$action-setfield $tiddler="""$tidName$""" $field="text" 
> $value=<<newText>> />
> </$wikify>
> \end
>
> <$button>Do it
> <<test "myTiddler" italic bold>>
> </$button>
>
>
> What I expect is to see the myTiddley text field as
>
> This is //italic//  and ''bold''.
>
>
>
> But I see this
>
> This is italic and bold.
>
>
> --Mohammad
>
> PS: The real story is I am developing a code to search and replace a 
> string in a tiddler text field.
>
>
>
>
>
> On Thursday, February 21, 2019 at 5:43:34 PM UTC+3:30, Jeremy Ruston wrote:
>>
>> Hi Mohammad
>>
>> Please could you post a complete example?
>>
>> Many thanks,
>>
>> Jeremy
>>
>> On 21 Feb 2019, at 14:06, Mohammad <mohammad...@gmail.com> wrote:
>>
>>
>> One way to store the result of a macro has some parameters is to store it 
>> in wikified variable as below
>>
>>
>> Example
>> See the below code extracted from a longer code. This works correctly. It 
>> calls utility, and save the results in newText and then the action-setfield 
>> passes it to a tiddler as its text field.
>>
>>
>> <$wikify name="newText"  text="""<$macrocall $name="utility" par1=<<val1>> 
>> par2=<<val2>> />""" >
>> <$action-setfield $tiddler="""$tidName$""" $field="text" $value=<
>> <newText>> />
>>
>> </$wikify>
>>
>>
>>
>> Now, assume the *result *of *utility macro *is something like below
>>
>> This is //italic// and this is {{!!caption}}
>>
>>
>> What happens? $Wikify save the wikified result as expected, but I wish 
>> to store in tidName text filed the raw non-wikified result, I mean what 
>> exactly *utility  macro *returns.
>>
>> So, the question is how can I store the result of *utility macro* in 
>> non-wikified (raw form) and pass it to the text filed of some tiddler?
>>
>>
>> --Mohammad
>>
>> -- 
>> 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+...@googlegroups.com.
>> To post to this group, send email to tiddl...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/tiddlywiki.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/tiddlywiki/099d67c2-8bb2-41c9-a372-f0948167bf41%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/tiddlywiki/099d67c2-8bb2-41c9-a372-f0948167bf41%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
> -- 
> 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+...@googlegroups.com <javascript:>.
> To post to this group, send email to tiddl...@googlegroups.com 
> <javascript:>.
> Visit this group at https://groups.google.com/group/tiddlywiki.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywiki/3f5cf631-8ae6-4096-bdcf-c328891cee48%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/3f5cf631-8ae6-4096-bdcf-c328891cee48%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/71f771e4-acf4-4b48-9938-1fde815aa410%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to