You could define the macro globally in it's own tiddler, so it's separate 
from the rest of the code. Or, as I mentioned, you could do the 
concatenation inside your JS macro.

Have fun
-- Mark

On Thursday, February 8, 2018 at 7:44:45 AM UTC-8, Tristan Kohl wrote:
>
> Hi Mark,
>
> that works, thank you so much for this I would never have come to this by 
> myself.
>
> However my guts hurt when I see a macro defined inside a tiddler. I know 
> that this is the way TW works but whenever I develop software I work very 
> hard to separate concerns as much as possible so mashing everything 
> together is a tough pill :)
>
> Nevertheless this solves my problem so thanks again.
>
> Cheers,
> Tristan
>
>
> On Thursday, February 8, 2018 at 4:32:15 PM UTC+1, Mark S. wrote:
>>
>> Whenever you need to concatenate, you almost need a helper macro. 
>> Something like this might work:
>>
>>
>> \define myfilter() [tag[action]hive[$(title)$]]
>>
>> <$vars title={{!!title}}>
>> <$macrocall $name=mymacro filter=<<myfilter>> columns="title date text" 
>> columns2="UID Date Notes"/>
>> </$vars>
>>
>> Of course, I'm just guessing at your argument names and I had no way of 
>> testing this. You might be able to do this without using <$macrocall>, but 
>> macrocall is usually a little more predictable. You could also set up your 
>> environmental variables and then pick them up inside your JS macro using 
>> getVar (or is it getVariable? -- look around). Then you could concatenate 
>> within your JS (JS being a lot more predictable than TW syntax).
>>
>> Good luck
>>
>> -- Mark
>>
>> On Thursday, February 8, 2018 at 7:10:37 AM UTC-8, Tristan Kohl wrote:
>>>
>>> Hey guys,
>>>
>>> for my wiki I need to substitute part of a filter which gets passed to a 
>>> macro which in turn builds a table from those tiddlers.
>>>
>>> My call looks like this:
>>> <<table [tag[action]hive{!!title}] "title date text" "UID Date Notes">>
>>> Obviously that does not work (I dropped a console.log in my JS macro), 
>>> my macro gets passed the filter without substituted title. What else I 
>>> tried and did not work:
>>>
>>>    - Enclosing the filter in quotes
>>>    - Using the filter without quotes
>>>    - Using {{!!title}}
>>>    - $set a variable and concatenate the filter: [tag[action]hive<var>] 
>>>    - Results in an TW error claiming the widget being null (maybe my macro 
>>> is 
>>>    not bullet proof)
>>>    - $set a variable by making the substitution the vars value: <$set 
>>>    name="var" value={{!!title}}>
>>>
>>> My initial thought was this might be caused by the tiddler being 
>>> transcluded via the *tabs* macro. But when I just drop the filter 
>>> inside a list widget it shows the correct tiddlers and a {{!!title}} inside 
>>> the transcluded tiddler revealed the name of the "parent" tiddler - so no 
>>> problem there.
>>>
>>>
>>> I am out of ideas so I came here hoping someone is willing to point me 
>>> into the right direction.
>>>
>>>
>>> Cheers,
>>>
>>> Tristen
>>>
>>

-- 
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/a81b9d74-2f64-41c4-9ce7-99764fef2cac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to