2022-05-06 14:39:45 +00:00
|
|
|
title: $:/core/ui/VisibleTransclude
|
|
|
|
|
|
|
|
<!--
|
|
|
|
Import this component to make all the child transclusions visible.
|
|
|
|
|
|
|
|
Block transclusions are shown in red, and inline transclusions are shown in green.
|
|
|
|
-->
|
2022-05-13 08:18:25 +00:00
|
|
|
\widget $transclude(tiddler,$tiddler,mode,$mode)
|
2022-05-06 14:39:45 +00:00
|
|
|
<!-- Replicate the logic of the transclude widget to determine the output mode, and hence the tag and colour to use for output -->
|
|
|
|
<$let
|
|
|
|
mode={{{ [[$mode]is[variable]then<$mode>!is[blank]] :else[[mode]is[variable]then<mode>!is[blank]] :else[<parseAsInline>match[yes]then[inline]else[block]] }}}
|
|
|
|
outputTag={{{ [<mode>match[inline]then[span]else[div]] }}}
|
|
|
|
outputColour={{{ [<mode>match[inline]then[green]else[red]] }}}
|
|
|
|
>
|
|
|
|
<!-- Use divs or spans according to the mode -->
|
|
|
|
<$genesis $type="element" $tag=<<outputTag>> style="color:white;padding:4px;" style.background=<<outputColour>>>
|
|
|
|
<$genesis $type="element" $tag=<<outputTag>> style="display: inline-block;">
|
|
|
|
<div style="background:white;color:black;font-size: 12px;line-height:1.2;text-align:left;font-weight:normal;padding:4px;margin:4px;">
|
|
|
|
<!-- Render the parameters to the transclusion -->
|
2022-05-11 12:51:11 +00:00
|
|
|
<$list filter="[<@params>jsonindexes[]]" emptyMessage="(none)">
|
2022-05-06 14:39:45 +00:00
|
|
|
<div>
|
2022-05-11 12:51:11 +00:00
|
|
|
<$text text=<<currentTiddler>>/><$text text=": "/><$text text={{{ [<@params>jsonget<currentTiddler>] }}}/>
|
2022-05-06 14:39:45 +00:00
|
|
|
</div>
|
|
|
|
</$list>
|
|
|
|
</div>
|
|
|
|
</$genesis>
|
|
|
|
<$genesis $type="element" $tag=<<outputTag>> style="background:white;color:black;padding:4px;">
|
|
|
|
<!-- Look for a parameter starting with $ to determine if we are in legacy mode -->
|
2022-05-11 12:51:11 +00:00
|
|
|
<$list filter="[<@params>jsonindexes[]] :filter[<currentTiddler>prefix[$]] +[limit[1]]" variable="ignore" emptyMessage="""
|
2022-05-06 14:39:45 +00:00
|
|
|
<!-- Legacy mode: we render the transclusion without a dollar sign for recursionMarker and mode -->
|
2022-05-11 12:51:11 +00:00
|
|
|
<$genesis $type="transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" recursionMarker="no" mode=<<mode>>>
|
2022-05-06 14:39:45 +00:00
|
|
|
<!-- Reach back up to the grandparent transclusion to get the correct slot value -->
|
|
|
|
<$slot $name="ts-raw" $depth="2"/>
|
|
|
|
</$genesis>
|
|
|
|
""">
|
|
|
|
<!-- Non-legacy mode: we use dollar signs for the recursionMarker and mode -->
|
2022-05-11 12:51:11 +00:00
|
|
|
<$genesis $type="transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" $$recursionMarker="no" $$mode=<<mode>>>
|
2022-05-13 08:18:25 +00:00
|
|
|
<!-- Reach back up to the grandparent transclusion to get the correct slot fill value -->
|
2022-05-06 14:39:45 +00:00
|
|
|
<$slot $name="ts-raw" $depth="2"/>
|
|
|
|
</$genesis>
|
|
|
|
</$list>
|
|
|
|
</$genesis>
|
|
|
|
</$genesis>
|
|
|
|
<$let>
|
|
|
|
\end
|