Is there a way to get the name of the transclusion used in a parameter?
My way around this at the moment, is to pass the name of a variable rather than the transcluded variable itself. Then, using a local proc, I create the intended transclusion via <$tranclude>
. But is there a better way?
In the following, I’m passing the value "some-proc"
into the parameter change-handler
, notably not <<some-proc>>
(because I want to print its name in the klass
string). When it’s passed as a string like that, I then need to execute "some-proc"
in the procedure handler
.
\widget $edit-text.buffered(selector, change-handler, tag, class)
\procedure handler()
<$transclude $variable=<<change-handler>> />
\end handler
<$let klass={{{ [[E:CHANGE widget:$edit-text.buffered selector:$(selector)$ $change:$(change-handler)$ $(class)$]substitute[]] }}}>
<$eventcatcher selector=<<selector>> $change=<<handler>> tag=<<tag>> class=<<klass>>>
<$slot $name="ts-raw"/>
</$eventcatcher>
</$let>
\end $edit-text.buffered
If there was some way to extract “some-proc” from <<some-proc>>
I wouldn’t need the procedure and the “extra” <$transclude>
. My suspicion is, there’s nothing in wikitext that would allow me to “look back up the tree”.
Thanks for reading.