Hi Dmitry
> What I'm struggling with is inability to use the result of a macro as a
parameter for a filter, or a value of a variable or a field in the current
tiddler. Basically, what I wanna do is a tiddler that shows a list of all
tiddlers that were created on a given date (that is chosen by $edit-text
widget - but it is in wrong format, so I'm using macro to convert one date
string to another).
The trick that you can often use is to compose the elements of the filter
through a macro definition. For example:
\define myFilter()
[is[current]tag[$(param)$]]
\end
<$set name="param" value={{!!myfield}}>
<$list filter=<<myFilter>> template="myTemplate"/>
</$set>
Does that help?
Best wishes
Jeremy
On Thu, Apr 24, 2014 at 12:05 PM, Dmitry Ivashkin <[email protected]
> wrote:
> Thank you Jeremy! This is helpful.
>
> What I'm struggling with is inability to use the result of a macro as a
> parameter for a filter, or a value of a variable or a field in the current
> tiddler. Basically, what I wanna do is a tiddler that shows a list of all
> tiddlers that were created on a given date (that is chosen by $edit-text
> widget - but it is in wrong format, so I'm using macro to convert one date
> string to another).
>
> --
> Best regards,
> Dmitry Ivashkin
>
>
> On Thu, Apr 24, 2014 at 12:08 PM, Jeremy Ruston
> <[email protected]>wrote:
>
>> Hi Dmitry
>>
>> On Wed, Apr 23, 2014 at 3:03 PM, Dmitry Ivashkin <
>> [email protected]> wrote:
>>
>>> Also, where can I find documentation about methods and properties of
>>> "this" object in javascript macros?
>>>
>>
>> The "this" object in a JavaScript macro points to the containing widget
>> instance in the render tree. So that means it has the methods described in
>> widget.js:
>>
>>
>> https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/widget.js
>>
>>
>>>
>>> this.getVariable("currentTiddler")
>>>
>>> but couldn't find any sort of documentation.
>>>
>>
>> There is some documentation in the source code for widget.js.
>>
>>
>>> Same for *story* object, etc.
>>>
>>
>> There isn't really a "story" object in TW5 in the same way as TWC.
>>
>>
>>> I have a tiddler with a custom field in it, and would like to be able
>>>> to set its value from macro. Macro will be called everytime some other
>>>> field of the same tiddler changes
>>>>
>>>
>> Is there a way to achieve that?
>>>>
>>>
>> Macros are just used to return a chunk of wikitext for further
>> processing. They should not make modifications to tiddlers in the wiki
>> store. The reason is that you can't control when the macro is called; it
>> may be called repeatedly as part of refresh processing. So it's important
>> that macros do not have any other side effects beyond generating their text.
>>
>> I've updated the docs a little to reflect the points you've raised:
>>
>>
>> https://github.com/Jermolene/TiddlyWiki5/commit/fecf3a556fc1e84f5d8a056b08cadff0532dd81d
>>
>> Best wishes
>>
>> Jeremy
>>
>>
>>> --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "TiddlyWiki" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/tiddlywiki/jeP2-qlpdrk/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> [email protected].
>>>>
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at http://groups.google.com/group/tiddlywiki.
>>>> 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 [email protected].
>>>
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/tiddlywiki.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Jeremy Ruston
>> mailto:[email protected]
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "TiddlyWiki" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/tiddlywiki/jeP2-qlpdrk/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/tiddlywiki.
>> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/tiddlywiki.
> For more options, visit https://groups.google.com/d/optout.
>
--
Jeremy Ruston
mailto:[email protected]
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.