mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-24 16:06:58 +00:00
Fix visible transclude
This commit is contained in:
parent
8f9d5cabaa
commit
3090bb104e
@ -7,16 +7,16 @@ Block transclusions are shown in red, and inline transclusions are shown in gree
|
||||
-->
|
||||
\widget $transclude
|
||||
<!-- Use a parameters widget so that we can access the `$params` data -->
|
||||
<$parameters tiddler="" $$tiddler="" mode="" $$mode="" $params="@params">
|
||||
<$parameters tiddler="" $$tiddler="" mode="" $$mode="" $parseMode="@parseMode" $params="@params">
|
||||
<!-- 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]] }}}
|
||||
mode={{{ [[$mode]is[variable]then<$mode>!is[blank]] :else[[mode]is[variable]then<mode>!is[blank]] :else[<@parseMode>] }}}
|
||||
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;">
|
||||
<$genesis $type=<<outputTag>> style="color:white;padding:4px;" style.background=<<outputColour>>>
|
||||
<$genesis $type=<<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 -->
|
||||
<$list filter="[<@params>jsonindexes[]]" emptyMessage="(none)">
|
||||
@ -26,17 +26,17 @@ Block transclusions are shown in red, and inline transclusions are shown in gree
|
||||
</$list>
|
||||
</div>
|
||||
</$genesis>
|
||||
<$genesis $type="element" $tag=<<outputTag>> style="background:white;color:black;padding:4px;">
|
||||
<$genesis $type=<<outputTag>> style="background:white;color:black;padding:4px;">
|
||||
<!-- Look for a parameter starting with $ to determine if we are in legacy mode -->
|
||||
<$list filter="[<@params>jsonindexes[]] :filter[<currentTiddler>prefix[$]] +[limit[1]]" variable="ignore" emptyMessage="""
|
||||
<!-- Legacy mode: we render the transclusion without a dollar sign for recursionMarker and mode -->
|
||||
<$genesis $type="transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" recursionMarker="no" mode=<<mode>>>
|
||||
<$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" recursionMarker="no" mode=<<mode>>>
|
||||
<!-- 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 -->
|
||||
<$genesis $type="transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" $$recursionMarker="no" $$mode=<<mode>>>
|
||||
<$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" $$recursionMarker="no" $$mode=<<mode>>>
|
||||
<!-- Reach back up to the grandparent transclusion to get the correct slot fill value -->
|
||||
<$slot $name="ts-raw" $depth="2"/>
|
||||
</$genesis>
|
||||
|
Loading…
Reference in New Issue
Block a user