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
tags: $:/tags/Macro
\define colour-picker-update-recent()
\procedure colour-picker-update-recent()
<$action-listops
$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
\define colour-picker-inner(actions)
<$button tag="a" tooltip="""$(colour-picker-value)$""">
$(colour-picker-update-recent)$
<$transclude $variable="__actions__"/>
<span style="display:inline-block; background-color: $(colour-picker-value)$; width: 100%; height: 100%; border-radius: 50%;"/>
\procedure colour-picker-inner(actions)
<$button tag="a" tooltip=<<colour-picker-value>>>
<<colour-picker-update-recent>>
<$transclude $variable="actions"/>
<span style.display="inline-block" style.backgroundColor=<<colour-picker-value>> style.width="100%" style.height="100%" style.borderRadius="50%"/>
</$button>
\end
\define colour-picker-recent-inner(actions)
\procedure colour-picker-recent-inner(actions)
\whitespace trim
<$set name="colour-picker-value" value="$(recentColour)$">
<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/>
<$set name="colour-picker-value" value=<<recentColour>>>
<$transclude $variable="colour-picker-inner" actions=<<actions>>/>
</$set>
\end
\define colour-picker-recent(actions)
\procedure colour-picker-recent(actions)
\whitespace trim
{{$:/language/ColourPicker/Recent}}<$list filter="[list[$:/config/ColourPicker/Recent]]" variable="recentColour">
&#32;
<$macrocall $name="colour-picker-recent-inner" actions=<<__actions__>>/>
<$transclude $variable="colour-picker-recent-inner" actions=<<actions>>/>
</$list>
\end
\define colour-picker(actions)
\procedure colour-picker(actions)
\whitespace trim
<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">
&#32;
<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/>
<$transclude $variable="colour-picker-inner" actions=<<actions>>/>
</$list>
---
<$edit-text tiddler="$:/config/ColourPicker/New" tag="input" default="" placeholder=""/>
&#32;
<$edit-text tiddler="$:/config/ColourPicker/New" tag="input" default="" placeholder="" class="tc-small-gap-right"/>
<$edit-text tiddler="$:/config/ColourPicker/New" type="color" tag="input"/>
<$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>
</div>

View File

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