Need help using Alias or Transclusion when invoking a macro

53 views
Skip to first unread message

Jeff

unread,
Jun 2, 2012, 12:36:27 PM6/2/12
to tiddl...@googlegroups.com
I'm using a macro named mgtdList that's normally invoked similarly to this:
<<mgtdList
 title:'TEST Next Starred Actions by Priority - Show By Weekend'
 tags:'(^-Next-Action || Next || Active || ^-Active) && !Done && Starred && !"@Discussion.weekly"'
 startTag:Action
 view:ActionProj
 mode:global
 group:Priority
 gView:bold
 where:'tiddler.hasActiveProject() && (!tiddler.fields.mgtd_date || (tiddler.ticklerIsActive() || tiddler.ticklerWillBeActiveWithin(5) ) )'
 newButtonTags:'Action Next'
However, I'd like to have an Alias or Transclusion like this:
IncludeNextActions: (!Done && (^-Next-Action || Next || Active || ^-Active))
or
alias IncludeNextActions "(!Done && (^-Next-Action || Next || Active || ^-Active))"
So that I can invoke mgtdList like: 
<<mgtdList
title:'TEST Next Starred Actions by Priority - Show By Weekend'
tags:'IncludeNextActions && Starred && !"@Discussion.weekly"'
startTag:Action
view:ActionProj
mode:global
group:Priority
gView:bold
where:'tiddler.hasActiveProject() && (!tiddler.fields.mgtd_date || (tiddler.ticklerIsActive() || tiddler.ticklerWillBeActiveWithin(5) ) )'
newButtonTags:'Action Next'
I just can't figure out any way to make it work. Any suggestions would be greatly appreciated. 
The purpose is that I'm trying to make some options available to mGSD so that people can configure more of it through options or at least have one more level of abstraction away from the code.
 
Thanks ... Jeff

Eric Shulman

unread,
Jun 2, 2012, 1:48:21 PM6/2/12
to TiddlyWiki
On Jun 2, 9:36 am, Jeff <jeff-googlegroups-pub...@gordon-net.com>
wrote:
> I'm using a macro named mgtdList that's normally invoked similarly to this:
> <<mgtdList
...
>  tags:'(^-Next-Action || Next || Active || ^-Active) && !Done && Starred &&
> !"@Discussion.weekly"'
...
> However, I'd like to have an Alias or Transclusion like this:
> IncludeNextActions: (!Done && (^-Next-Action || Next || Active || ^-Active))
> or
> alias IncludeNextActions "(!Done && (^-Next-Action || Next || Active ||
> ^-Active))"
> So that I can invoke mgtdList like:
> <<mgtdList
...
> tags:'IncludeNextActions && Starred && !"@Discussion.weekly"'
...
> The purpose is that I'm trying to make some options available to mGSD so
> that people can configure more of it through options or at least have one
> more level of abstraction away from the code.

The TWCore doesn't have a special syntax that allows you to use
aliases or transclusion to assemble the parameters within a macro.
However, it does support "evaluated parameters", which allows you to
invoke a snippet of javascript code and use the result as a macro
parameter value, and it does have a function for retrieving the stored
contents of a tiddler. You can use these to achieve your desired
goal:

Start by creating a tiddler named [[IncludeNextActions]], containing
your configurable tag expression:
(!Done && (^-Next-Action || Next || Active || ^-Active))

Then, in your macro usage, you can write:

<<mgtdList
...
tags:{{store.getTiddlerText('IncludeNextActions')+' && Starred
&& !"@Discussion.weekly"'}}
...

The content in between the {{...}} is javascript code that first
retrieves the text stored in [[IncludeNextActions]] and then appends
the rest of the tag expression to it. The resulting combined text is
then used as the value of the tags:... macro parameter.

QED.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

WAS THIS ANSWER HELPFUL? IF SO, PLEASE MAKE A DONATION
http://www.TiddlyTools.com/#Donations
Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
http://www.TiddlyTools.com/#Contact

Jeff

unread,
Jun 2, 2012, 3:53:23 PM6/2/12
to tiddl...@googlegroups.com
Thanks SO much Eric!!!! That works perfectly!!!
 
I'm very new to TW and I have to say that your help in these groups plus all the hard work work you've put into plugins have been making this a very enjoyable experience for me!!
Reply all
Reply to author
Forward
0 new messages