1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-02 06:19:57 +00:00

Migrate some old macros to new syntax

This commit is contained in:
Leilei332 2024-11-21 22:03:15 +08:00
parent c0843420d5
commit 6b23de81d8
2 changed files with 32 additions and 33 deletions

View File

@ -1,58 +1,57 @@
title: $:/core/macros/colour-picker title: $:/core/macros/colour-picker
tags: $:/tags/Macro tags: $:/tags/Macro
\define colour-picker-update-recent() \procedure colour-picker-update-recent()
<$action-listops <$action-listops
$tiddler="$:/config/ColourPicker/Recent" $tiddler="$:/config/ColourPicker/Recent"
$subfilter="$(colour-picker-value)$ [list[$:/config/ColourPicker/Recent]remove[$(colour-picker-value)$]] +[limit[8]]" $subfilter="[<colour-picker-value>] [list[$:/config/ColourPicker/Recent]remove<colour-picker-value>] +[limit[8]]"
/> />
\end \end
\define colour-picker-inner(actions) \procedure colour-picker-inner(actions)
<$button tag="a" tooltip="""$(colour-picker-value)$"""> <$button tag="a" tooltip=<<colour-picker-value>>>
$(colour-picker-update-recent)$ <<colour-picker-update-recent>>
<$transclude $variable="__actions__"/> <$transclude $variable="actions"/>
<span style.display="inline-block" style.backgroundColor=<<colour-picker-value>> style.width="100%" style.height="100%" style.borderRadius="50%"/>
<span style="display:inline-block; background-color: $(colour-picker-value)$; width: 100%; height: 100%; border-radius: 50%;"/>
</$button> </$button>
\end \end
\define colour-picker-recent-inner(actions) \procedure colour-picker-recent-inner(actions)
\whitespace trim \whitespace trim
<$set name="colour-picker-value" value="$(recentColour)$"> <$set name="colour-picker-value" value=<<recentColour>>>
<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/> <$transclude $variable="colour-picker-inner" actions=<<actions>>/>
</$set> </$set>
\end \end
\define colour-picker-recent(actions) \procedure colour-picker-recent(actions)
\whitespace trim \whitespace trim
{{$:/language/ColourPicker/Recent}}<$list filter="[list[$:/config/ColourPicker/Recent]]" variable="recentColour"> {{$:/language/ColourPicker/Recent}}<$list filter="[list[$:/config/ColourPicker/Recent]]" variable="recentColour">
&#32; &#32;
<$macrocall $name="colour-picker-recent-inner" actions=<<__actions__>>/> <$transclude $variable="colour-picker-recent-inner" actions=<<actions>>/>
</$list> </$list>
\end \end
\define colour-picker(actions) \procedure colour-picker(actions)
\whitespace trim \whitespace trim
<div class="tc-colour-chooser"> <div class="tc-colour-chooser">
<$macrocall $name="colour-picker-recent" actions=<<__actions__>>/> <$transclude $variable="colour-picker-recent" actions=<<actions>>/>
--- ---
<$list filter="LightPink Pink Crimson LavenderBlush PaleVioletRed HotPink DeepPink MediumVioletRed Orchid Thistle Plum Violet Magenta Fuchsia DarkMagenta Purple MediumOrchid DarkViolet DarkOrchid Indigo BlueViolet MediumPurple MediumSlateBlue SlateBlue DarkSlateBlue Lavender GhostWhite Blue MediumBlue MidnightBlue DarkBlue Navy RoyalBlue CornflowerBlue LightSteelBlue LightSlateGrey SlateGrey DodgerBlue AliceBlue SteelBlue LightSkyBlue SkyBlue DeepSkyBlue LightBlue PowderBlue CadetBlue Azure LightCyan PaleTurquoise Cyan Aqua DarkTurquoise DarkSlateGrey DarkCyan Teal MediumTurquoise LightSeaGreen Turquoise Aquamarine MediumAquamarine MediumSpringGreen MintCream SpringGreen MediumSeaGreen SeaGreen Honeydew LightGreen PaleGreen DarkSeaGreen LimeGreen Lime ForestGreen Green DarkGreen Chartreuse LawnGreen GreenYellow DarkOliveGreen YellowGreen OliveDrab Beige LightGoldenrodYellow Ivory LightYellow Yellow Olive DarkKhaki LemonChiffon PaleGoldenrod Khaki Gold Cornsilk Goldenrod DarkGoldenrod FloralWhite OldLace Wheat Moccasin Orange PapayaWhip BlanchedAlmond NavajoWhite AntiqueWhite Tan BurlyWood Bisque DarkOrange Linen Peru PeachPuff SandyBrown Chocolate SaddleBrown Seashell Sienna LightSalmon Coral OrangeRed DarkSalmon Tomato MistyRose Salmon Snow LightCoral RosyBrown IndianRed Red Brown FireBrick DarkRed Maroon White WhiteSmoke Gainsboro LightGrey Silver DarkGrey Grey DimGrey Black" variable="colour-picker-value"> <$list filter="LightPink Pink Crimson LavenderBlush PaleVioletRed HotPink DeepPink MediumVioletRed Orchid Thistle Plum Violet Magenta Fuchsia DarkMagenta Purple MediumOrchid DarkViolet DarkOrchid Indigo BlueViolet MediumPurple MediumSlateBlue SlateBlue DarkSlateBlue Lavender GhostWhite Blue MediumBlue MidnightBlue DarkBlue Navy RoyalBlue CornflowerBlue LightSteelBlue LightSlateGrey SlateGrey DodgerBlue AliceBlue SteelBlue LightSkyBlue SkyBlue DeepSkyBlue LightBlue PowderBlue CadetBlue Azure LightCyan PaleTurquoise Cyan Aqua DarkTurquoise DarkSlateGrey DarkCyan Teal MediumTurquoise LightSeaGreen Turquoise Aquamarine MediumAquamarine MediumSpringGreen MintCream SpringGreen MediumSeaGreen SeaGreen Honeydew LightGreen PaleGreen DarkSeaGreen LimeGreen Lime ForestGreen Green DarkGreen Chartreuse LawnGreen GreenYellow DarkOliveGreen YellowGreen OliveDrab Beige LightGoldenrodYellow Ivory LightYellow Yellow Olive DarkKhaki LemonChiffon PaleGoldenrod Khaki Gold Cornsilk Goldenrod DarkGoldenrod FloralWhite OldLace Wheat Moccasin Orange PapayaWhip BlanchedAlmond NavajoWhite AntiqueWhite Tan BurlyWood Bisque DarkOrange Linen Peru PeachPuff SandyBrown Chocolate SaddleBrown Seashell Sienna LightSalmon Coral OrangeRed DarkSalmon Tomato MistyRose Salmon Snow LightCoral RosyBrown IndianRed Red Brown FireBrick DarkRed Maroon White WhiteSmoke Gainsboro LightGrey Silver DarkGrey Grey DimGrey Black" variable="colour-picker-value">
&#32; &#32;
<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/> <$transclude $variable="colour-picker-inner" actions=<<actions>>/>
</$list> </$list>
--- ---
<$edit-text tiddler="$:/config/ColourPicker/New" tag="input" default="" placeholder=""/> <$edit-text tiddler="$:/config/ColourPicker/New" tag="input" default="" placeholder="" class="tc-small-gap-right"/>
&#32;
<$edit-text tiddler="$:/config/ColourPicker/New" type="color" tag="input"/> <$edit-text tiddler="$:/config/ColourPicker/New" type="color" tag="input"/>
<$set name="colour-picker-value" value={{$:/config/ColourPicker/New}}> <$set name="colour-picker-value" value={{$:/config/ColourPicker/New}}>
<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/> <%if [{$:/config/ColourPicker/New}!is[blank]] %>
<$transclude $variable="colour-picker-inner" actions=<<actions>>/>
<%endif%>
</$set> </$set>
</div> </div>

View File

@ -1,28 +1,28 @@
title: $:/core/macros/translink title: $:/core/macros/translink
tags: $:/tags/Macro tags: $:/tags/Macro
\define translink(title,mode:"block") \procedure translink(title,mode:"block")
\whitespace trim \whitespace trim
<$list filter="[<__mode__>match[block]]"> <%if [<mode>match[block]] %>
<div class="tc-translink"> <div class="tc-translink">
<div> <div>
<$link to="""$title$"""> <$link to=<<title>>>
<h1><$text text="""$title$"""/></h1> <h1><$text text=<<title>>/></h1>
</$link> </$link>
<$transclude tiddler="""$title$""" mode="block"> <$transclude tiddler=<<title>> mode="block">
<$set name="currentTiddler" value="""$title$"""><$transclude tiddler="$:/language/MissingTiddler/Hint"/></$set> <$set name="currentTiddler" value=<<title>>><$transclude tiddler="$:/language/MissingTiddler/Hint"/></$set>
</$transclude> </$transclude>
</div> </div>
</div> </div>
</$list> <%endif%>
<$list filter="[<__mode__>match[inline]]"> <%if [<mode>match[inline]] %>
<span class="tc-translink"> <span class="tc-translink">
<$link to="""$title$"""> <$link to=<<title>> class="tc-small-gap-right">
<$text text="""$title$"""/> <$text text=<<title>>/>
</$link> </$link>
&#32;(<$transclude tiddler="""$title$""" mode="inline"> (<$transclude tiddler=<<title>> mode="inline">
<$set name="currentTiddler" value="""$title$"""><$transclude tiddler="$:/language/MissingTiddler/Hint"/></$set> <$set name="currentTiddler" value=<<title>>><$transclude tiddler="$:/language/MissingTiddler/Hint"/></$set>
</$transclude>) </$transclude>)
</span> </span>
</$list> <%endif%>
\end \end