[TW5] Transclusion problem

79 views
Skip to first unread message

Kurt Kincaid

unread,
May 2, 2015, 8:40:53 PM5/2/15
to tiddly...@googlegroups.com
I think (hope?) that this is an easy issue that I am just missing.

I am relatively new to TW5 (I was an old school user of pre-TW5), and I am having a problem with transclusion. I have a button to create a new tiddler, and I want to insert the current user from $:/status/UserName into a field in the new tiddler called "proj_owner". I tried simply including the content of the $:/status/UserName tiddler like this:

<$set name="proj_owner" value={{$:/status/UserName}}>

However, the new tiddler contains "{{$:/status/UserName}}" in the proj_owner field, rather that the actual value. I even tried creating a macro to see if that would help me:

\define whoami(who:{{$:/status/UserName}}) $who$

And then modifying the $set code like this:

<$set name="proj_owner" value=<<whoami>>>

But that yields the same result. I have been driving myself crazy with different permutations to figure this out, but it keeps eluding me. Any pointers or ideas would be greatly appreciated.

Thanks in advance.

Kurt

Andreas Hahn

unread,
May 3, 2015, 4:49:59 AM5/3/15
to tiddly...@googlegroups.com
Hi Kurt,

can you post the full code involved in creating the new tiddler ? As far as I can tell

<$set name="proj_owner" value={{$:/status/UserName}}>
<<proj_owner>>
</$set>

correctly sets the proj_owner variable to the username, whereas your macro approach does not (the result of the macro is not treated as WikiText).

/Andreas

--
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/83af6e63-70ef-4e2a-94bd-5d7d02c47509%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kurt Kincaid

unread,
May 3, 2015, 3:04:02 PM5/3/15
to tiddly...@googlegroups.com
Hi, Andreas.

Your post actually gave me just the right nudge to figure out the problem. Here is the code that ended up working. I am using Skeeve's newtiddler plugin.

<$set name="proj_owner" value={{$:/status/UserName}}>
<$set name="proj_start_date" value=<<now YYYY-0MM-0DD>>>
<$newtiddler title="New Project" skeleton="$:/plugins/kurt/projects/template/project">New Project</$newtiddler>
</$set></$set>

Then in my project template, I have proj_owner and proj_start_date fields set to $(proj_owner)$ and $(proj_start_date)$, respectively.

To be honest, I still am not 100% sure what I was doing wrong. I would have sworn I tried the above approach, but apparently not. At any rate, it works now, so I am happy.

Thanks for your help.

--Kurt
Reply all
Reply to author
Forward
0 new messages