apply macro to outer tiddler of transcluded pair?

29 megtekintés
Ugrás az első olvasatlan üzenetre

Dave

olvasatlan,
2017. márc. 20. 23:47:462017. 03. 20.
– TiddlyWiki

Sorry if this is complicated (seems that way to me), but I have a question about using macros in remote tiddlers that are transcluded to change field content locally. 


There are three layers: the macro tiddler, the test tiddler which calls upon the macro, and the date tiddler that want's to record the test, but uniquely in today's tiddler.

Lets say I have a tiddler just named as today's date: [[2017-03-20]]


In it I have this transclusion: {{Lumbar Kemps}} which has this content:

<<s.test "Lumbar Kemps" left>>

which refers to this macro pair in another macro tiddler tagged with $:/tags/Macro

\define s.test.result(mytestname,myresult)
<$transclude tiddler="$mytestname$ Dxs" index="$myresult$"/>
\end

\define s.test(testname,testfield)
<$select tiddler="""$(currentTiddler)$""" field="""$testname$-$testfield$""">
<$list filter="[list[testDictionary##$testname$]]"><!-- gets the list of options for this test-->
<option value=<<currentTiddler>>><$text text=<<currentTiddler>>/></option>
</$list>
</
$select>
<$set name="result" value={{$(currentTiddler)$!!$testname$-$testfield$}}>
<$macrocall $name=s.test.result myresult=<<result>> mytestname="$testname$" />
</$set>
\end

What I want to happen is for the $(currentTiddler)$ in the select widget to be "2017-3-20", not "Lumbar Kemps", but that's not what's happening (the results are being recorded in [[Lumbar Kemps]]).

Is there a way to make this work the way I want it to?


Thanks,

- Dave

Eric Shulman

olvasatlan,
2017. márc. 21. 0:34:502017. 03. 21.
– TiddlyWiki
On Monday, March 20, 2017 at 8:47:46 PM UTC-7, Dave wrote:

Sorry if this is complicated (seems that way to me), but I have a question about using macros in remote tiddlers that are transcluded to change field content locally. 

... 

In it I have this transclusion: {{Lumbar Kemps}} which has this content:

<<s.test "Lumbar Kemps" left>>

What I want to happen is for the $(currentTiddler)$ in the select widget to be "2017-3-20", not "Lumbar Kemps", but that's not what's happening (the results are being recorded in [[Lumbar Kemps]]).  Is there a way to make this work the way I want it to?


Instead of {{TiddlerName}}, use {{||TiddlerName}}.  This will apply the indicated tiddler as a *template* for the values from the current tiddler and leaves the value of $(currentTiddler)$ unchanged when the template is transcluded (i.e., it will remain [[2017-03-20]], rather being set to [[Lumbar Kemps]])


enjoy,
-e

Dave

olvasatlan,
2017. márc. 21. 2:06:302017. 03. 21.
– TiddlyWiki
Thank you sir!
Válasz mindenkinek
Válasz a szerzőnek
Továbbítás
0 új üzenet