1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 05:19:57 +00:00

Fix previews of filtered palettes

This commit is contained in:
Jeremy Ruston 2024-11-14 17:40:58 +00:00
parent c2ee0727a5
commit 3faf9bae5c

View File

@ -3,14 +3,15 @@ title: $:/snippets/currpalettepreview
\whitespace trim
\procedure colour-div-filtered(class,styleName,styleColour)
\function colour(name) [<currentTiddler>getindex<name>] :else[<currentTiddler>get[palette-import]getindex<name>] :else[[none]] :map[subfilter<currentTiddler>]
<$let colour-filter={{{ [<currentTiddler>getindex<styleColour>] }}}>
<!-- Note the join, needed to cope with palette entries containing spaces -->
<$let colour-result={{{ [subfilter<colour-filter>join[ ]] }}}>
\function colour(name) [<colour-palette>getindex<name>] :else[<colour-palette>get[palette-import]getindex<name>] :else[[none]] :map[subfilter<currentTiddler>] +[join[ ]]
<!-- Note the join, needed to cope with palette entries containing spaces -->
<$let
colour-palette=<<currentTiddler>>
colour-result={{{ [function[colour],<styleColour>] +[join[ ]] }}}
>
<div class=<<class>> style={{{ [<styleName>addsuffix[:]addsuffix<colour-result>addsuffix[;]] }}}>
<$slot $name="ts-raw" $depth="2"/>
</div>
</$let>
</$let>
\end colour-div-filtered