1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-07 10:34:53 +00:00
TiddlyWiki5/editions/test/tiddlers/tests/data/transclude/CustomWidget-OverrideTransclude.tid
jeremy@jermolene.com f307f00e32 Fixes to enable the transclude widget itself to be overridden
There are two big changes here:

Replace the previous "ts-wrapper" mechanism, which we had been using to redefine custom widgets inside their definitions to prevent recursive calls. Now we've got the genesis widget we can instead control recursion through a new "$remappable" attribute that allows the custom widget mechanism to be skipped.

We also extend the slot widget to allow a depth to be specified; it then reaches up by the indicated number of transclusion widgets to find the one from which it should retrieve the slot value.
2022-05-05 08:20:14 +01:00

33 lines
708 B
Plaintext

title: Transclude/CustomWidget/OverrideTransclude
description: Custom widget definition attempting to override transclude
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
<$transclude $tiddler='TiddlerOne' one='Ferret'>
</$transclude>
+
title: TiddlerZero
Antelope
+
title: TiddlerOne
\whitespace trim
<!-- Redefine the <$transclude> widget by defining a transcludable variable with that name -->
\function <$transclude>(one:'Jaguar')
\whitespace trim
<$text text=<<one>>/>
<$slot $name="body">
Whale
</$slot>
\end
<$genesis $type="transclude" $remappable="no" $$tiddler="TiddlerZero">
Crocodile
</$genesis>
+
title: ExpectedResult
<p>Antelope</p>