Try this:

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

On Wednesday, May 12, 2021 at 12:41:23 PM UTC+2 [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.
>
> Unfortunatelly though, the same variable in the *<$action-setfield>* part 
> is always set either to the literal value of the filter right above (i.e. 
> *<$list 
> filter... *etc ), or is set to the literal text *<<testmonth>>*. It 
> depends on what combination of variable reference I use (I've tried 
> everything descibed in Tobias' Variables vs. Parameters 
> <https://tobibeer.github.io/tb5/#Variables%20vs.%20Parameters> reference 
> list).
>
> 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?
>
> <$vars testmonth='<$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>
> </$vars>
>
>
>
> On Tuesday, May 11, 2021 at 3:20:21 AM UTC+3 TW Tones wrote:
>
>> Quick tips
>>
>>
>>    - Text areas have lines delimited by \n
>>    - if you have the text in a filter you can use splitregexp[\n]] to 
>>    split it into each line, then split again on split[:]] to get the first[] 
>>    item or the fieldname:value
>>       - text must be handled differently as its multiline.
>>       - you can then join[] back as needed.
>>    - Note the fieldname:values resembles a datatiddler format, and may 
>>    present an opportunity.
>>
>> Tones
>> On Monday, 10 May 2021 at 21:27:19 UTC+10 [email protected] wrote:
>>
>>> Ah yes, thanks for reminding me. Although it was purely for showing how 
>>> I want to split the date per field. I haven't yet reached the point where 
>>> I'm trying to reference actual fields.
>>>
>>> I'm trying to see if some or even most of what I've described can be 
>>> achieved with <$list filter>-ing through the text area input. Maybe 
>>> combining splits, regexes and splitregexes. 
>>>
>>> The other approach would be to code a JavaScript macro but that gets 
>>> quite more complicated and is not as easy to play with until I get it right.
>>>
>>> On Monday, May 10, 2021 at 12:33:35 PM UTC+3 PMario wrote:
>>>
>>>> Hi,
>>>> *Field names *have to be *lowercase *only.
>>>> -m
>>>>
>>>> On Monday, May 10, 2021 at 11:25:48 AM UTC+2 [email protected] wrote:
>>>>
>>>>> I'm moving my personal journal written in markdown files into 
>>>>> Tiddlywiki. I'm looking for a way to perform string/text manipulation on 
>>>>> the input of an <$edit-text>.
>>>>>
>>>>> Currently, each entry starts with a ##header which was the date the 
>>>>> entry was written. A blank line follows and then one or more paragraphs 
>>>>> of 
>>>>> the main entry body:
>>>>>
>>>>>     ## YYYYMMDD
>>>>>
>>>>>     Lorem ipsum dolor sit amet, consectetur adipiscing elit...
>>>>>
>>>>> I've created a Journal Entry tiddler page which would have an <$edit-text 
>>>>> tag=textarea> widget. I'll manually paste in the textarea each 
>>>>> journal entry and by pressing a button it will be split into the 
>>>>> following 
>>>>> elements/fields, which would then be added as a new tiddler with the 
>>>>> following fields:
>>>>>
>>>>>     Title: YYYYMMDD
>>>>>     Text: Lorem ipsum (etc)
>>>>>     Year: YYYY
>>>>>     Month: MM
>>>>>
>>>>> I'm looking for a way way to perform all the little subtring() 
>>>>> manipulations and isolating the header line and the main body. I've 
>>>>> already 
>>>>> figured how to create a new tiddler from a series of existing fields. 
>>>>>
>>>>

-- 
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/297eff97-c812-439e-83f2-0b20b9f2d07cn%40googlegroups.com.

Reply via email to