What am I doing wrong with parameters?

41 views
Skip to first unread message

Henry Padilla

unread,
Jul 10, 2015, 9:39:57 AM7/10/15
to tiddly...@googlegroups.com
Macro Tiddler:
  TitleField:
      TaskListMacroSet
  TextField: 
      \define TaskListMacro(ListTitle)
      !!! Tasklist: $ListTitle$
      \end


Base Tiddler:
  TitleField:
      Not Started Task List
  TextField:
      {{TaskListMacroSet}}
      <<TaskListMacro(ListTitle:"Not Started")>>

~~~~~~~~~~~~~~~~~~~~~~
I've tried various combinations of $name$, $(name)$, $("name")$ and so forth, to no avail.
I've been going step by step to build the tiddler I need (a list of lists of tasks in certain statuses). I started with nothing special, everything spelled out, and I've been working at transcluding and writing macros a little bit at a time to make sure I get it right. But this has me stymied. I can make it work with variables, i.e. using $(name)$ and the <$set> pragma, but not parameters.

Thanks ahead of time for the help.
Tom P.

P.S. I have my macro tiddler taged with $:/tags/Macros and I still have to transclude the macro tiddler to get it to work. Has that tag changed?
Actually, it was the other way: I can't get the transcluded macro tiddler to work. If I use the "$:/tags/Macro" tag then I'm OK (including the issue above). 

So it looks like this is a problem with transcluding the macro tiddler. I tried several different ways to transclude:
{{TaskListMacroSet}}
<$transclude tiddler="TaskListMacroSet" />
<$transclude tiddler="TaskListMacroSet" mode="block" />
<$transclude tiddler="TaskListMacroSet" mode="inline" />

None of them work. How am I supposed to transclude the macro tiddler?

Jeremy Ruston

unread,
Jul 10, 2015, 10:25:03 AM7/10/15
to TiddlyWikiDev
Hi Henry

I think that there are two problems here:

* The first is that transcluding a tiddler doesn't make macros defined in that tiddler available in the calling tiddler. You can instead either define it as a global macro by tagging it with $:/tags/Macro or you can use the <$importvariable> widget directly to import macro definitions from a tiddler

* The second problem is that you don't need brackets when calling a macro. Try this:

<<TaskListMacro ListTitle:"Not Started">>

Best wishes

Jeremy.




On Fri, Jul 10, 2015 at 2:39 PM, Henry Padilla <padill...@gmail.com> wrote:
Macro Tiddler:
  TitleField:
      TaskListMacroSet
  TextField: 
      \define TaskListMacro(ListTitle)
      !!! Tasklist: $ListTitle$
      \end


Base Tiddler:
  TitleField:
      Not Started Task List
  TextField:
      {{TaskListMacroSet}}
      <<TaskListMacro(ListTitle:"Not Started")>>

~~~~~~~~~~~~~~~~~~~~~~
I've tried various combinations of $name$, $(name)$, $("name")$ and so forth, to no avail.
I've been going step by step to build the tiddler I need (a list of lists of tasks in certain statuses). I started with nothing special, everything spelled out, and I've been working at transcluding and writing macros a little bit at a time to make sure I get it right. But this has me stymied. I can make it work with variables, i.e. using $(name)$ and the <$set> pragma, but not parameters.

Thanks ahead of time for the help.
Tom P.

P.S. I have my macro tiddler taged with $:/tags/Macros and I still have to transclude the macro tiddler to get it to work. Has that tag changed?

--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/f6737c52-d42c-43f9-9e01-deb906b61819%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Henry Padilla

unread,
Jul 10, 2015, 10:40:49 AM7/10/15
to tiddly...@googlegroups.com, jeremy...@gmail.com
Oh, I thought you could write a macro in a tiddler and then transclude that tiddler when you wanted to use the macro. Like a .h in C++.

Second question (or do you want me to make another post?):
Can we make parameters defaults of other parameters?

For example:
\define TaskList (ListName, ListTitle=$ListName$)
!!! Task List $ListTitle$
<$list filter="[tasklist[$ListName$]!title[TaskSkeleton]!title[JournalSkeleton]!has[draft.of]tag[task]!tag[done]sort[priority]]">
</$list>
\end

Now I can call this macro with either:
<<TaskList ListName:"Analysis" ListTitle:"Analyse/Fix">>
... or ...
<<TaskList ListName:"Review">>


Or is that an enhancement request?

Tom P.

Jeremy Ruston

unread,
Jul 10, 2015, 12:16:01 PM7/10/15
to Henry Padilla, TiddlyWikiDev
Hi Henry

Oh, I thought you could write a macro in a tiddler and then transclude that tiddler when you wanted to use the macro. Like a .h in C++.

Think of the TW display as a tree; transcluding a tiddler grafts the content of that tiddler onto the tree, but it doesn't affect the the parents or siblings.
 
Second question (or do you want me to make another post?):
Can we make parameters defaults of other parameters?

No, currently the default parameter value must be specified as a literal string (with a colon, not an equals sign).
 
Best wishes

Jeremy.
Reply all
Reply to author
Forward
0 new messages