On Wednesday, May 12, 2021 at 3:41:23 AM UTC-7 [email protected] wrote:

> I've made some progress with this, here's where I'm currently stuck.
>
> I'm pasting the text (##header and body) in an *<$edit-text>* widget. 
> This is linked to a different, dedicated Tiddler called *NewEntryData*. 
> Then I'm bringing back only the month bit from the header by using the 
> following. The button text appears as it should (*Set to: "05"* for 
> example), so this tells me that the *testmonth *variable is properly 
> filled.
>

The testmonth variable contains $list widget source code.  When you display 
this variable in the button label by using <<testmonth>> you are, in 
effect, using the variable as a macro, which causes the value of the 
variable to be inserted into the output AND also evaluated, which processes 
the $list widget filter, producing the "05" that you see displayed.  
However, when you use the variable as a parameter in the $action-setfield 
widget, the value is NOT evaluated and is simply passed along to the 
$action-setfield, thus storing the unprocessed $list widget filter syntax 
into the field.

Any idea how should I reference the variable in the widget's parameters for 
> it to get the actual content instead of some literal text?
>

Instead of using $vars to set the value of "testmonth", using $wikify, like 
this:

<$wikify name=testmonth text='<$list 
filter="[{NewEntryData!!text}removeprefix[##]trim[]splitregexp[\n]trim[]first[]splitregexp[]rest[4]first[2]join[]]"/>'>
<$button>
<$action-setfield input-month=<<testmonth>> />
Set to: "<<testmonth>>"
</$button>
</$wikify>

This will cause the $list widget filter to be evaluated regardless of 
whether <<testmonth>> is used as an $action-setfield parameter or directly 
rendered and displayed as button text.

Note that Saq's solution, using "filtered transclusion" syntax (tripled 
curly braces) will also cause the filter to be evaluated and assigned as 
the value of <<testmonth>>, producing the desired result as well.

enjoy,
-e

-- 
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/a528e233-c5ae-4d38-8d75-306772530aa9n%40googlegroups.com.

Reply via email to