hallo folks,
i need to feed the $template parameter of an <$action-createtiddler> widget 
with the correct template tiddler's name. The latter has a fixed part 
'BASENAME' and a parameterized (or variable) suffix, which is choosen by 
means of a <$select> input. The idea is to have a macro build the full name 
based on the choice made by using <$select>, like in:

\define templatename() BASENAME-{{!!grammar_class}}

the suffix, as you can imagine, is taken from field grammar_class which is 
set by the <$select> widget control.

Now one would expect that things would work nice and easy writing this code:

<$button> create new test tiddler
         <$action-createtiddler 
                 $basetitle='testTiddler'
                 $template=<<templatename>> >
                 <$action-navigate $to=<<createTiddler-title>>/>
         </$action-createtiddler>
</$button>

but disappointingly enough they do not! The new tiddler is created indeed, 
but from NO TEMPLATE at all!
Funny as it is, if we add a debug line like:

template's name: <<templatename>> <br/>

it displays correctly as

    BASENAME-verb (or BASENAME-noun, or adjective, or whatever the 
<$select> choice was)

Hard-coding the name in the macro makes the code work (just for testing 
purposes, there is no point here to have a macro just echoing an hard-coded 
string).

Now, before I ask why ON EARTH the above code doesn't work, let me say that 
I expect for it to be because of how macros are parsed and when macro 
substitution is made, in which case I will do a little comment on it later.

Thanks everybody,
CG 

-- 
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/530e8591-2cc7-4270-bfa3-f878cb195957n%40googlegroups.com.

Reply via email to