mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +00:00
Rewrite more macros.
This commit is contained in:
parent
6b23de81d8
commit
35696e431c
@ -46,7 +46,7 @@ tags: $:/tags/Macro
|
||||
|
||||
---
|
||||
|
||||
<$edit-text tiddler="$:/config/ColourPicker/New" tag="input" default="" placeholder="" class="tc-small-gap-right"/>
|
||||
<$edit-text tiddler="$:/config/ColourPicker/New" tag="input" default="" placeholder="" class="tc-tiny-gap-right"/>
|
||||
<$edit-text tiddler="$:/config/ColourPicker/New" type="color" tag="input"/>
|
||||
<$set name="colour-picker-value" value={{$:/config/ColourPicker/New}}>
|
||||
<%if [{$:/config/ColourPicker/New}!is[blank]] %>
|
||||
|
@ -1,7 +1,7 @@
|
||||
title: $:/core/macros/dumpvariables
|
||||
tags: $:/tags/Macro
|
||||
|
||||
\define dumpvariables()
|
||||
\procedure dumpvariables()
|
||||
\whitespace trim
|
||||
<ul>
|
||||
<$list filter="[variables[]]" variable="varname">
|
||||
|
@ -1,14 +1,14 @@
|
||||
title: $:/core/macros/list
|
||||
tags: $:/tags/Macro
|
||||
|
||||
\define list-links(filter,type:"ul",subtype:"li",class:"",emptyMessage,field:"caption")
|
||||
\procedure list-links(filter,type:"ul",subtype:"li",class:"",emptyMessage,field:"caption")
|
||||
\whitespace trim
|
||||
<$genesis $type=<<__type__>> class=<<__class__>>>
|
||||
<$list filter=<<__filter__>> emptyMessage=<<__emptyMessage__>>>
|
||||
<$genesis $type=<<__subtype__>>>
|
||||
<$genesis $type=<<type>> class=<<class>>>
|
||||
<$list filter=<<filter>> emptyMessage=<<emptyMessage>>>
|
||||
<$genesis $type=<<subtype>>>
|
||||
<$link to={{!!title}}>
|
||||
<$let tv-wikilinks="no">
|
||||
<$transclude field=<<__field__>>>
|
||||
<$transclude field=<<field>>>
|
||||
<$view field="title"/>
|
||||
</$transclude>
|
||||
</$let>
|
||||
@ -18,24 +18,24 @@ tags: $:/tags/Macro
|
||||
</$genesis>
|
||||
\end
|
||||
|
||||
\define list-links-draggable-drop-actions()
|
||||
\procedure list-links-draggable-drop-actions()
|
||||
<$action-listops $tiddler=<<targetTiddler>> $field=<<targetField>> $subfilter="+[insertbefore<actionTiddler>,<currentTiddler>]"/>
|
||||
\end
|
||||
|
||||
\define list-links-draggable(tiddler,field:"list",emptyMessage,type:"ul",subtype:"li",class:"",itemTemplate)
|
||||
\procedure list-links-draggable(tiddler,field:"list",emptyMessage,type:"ul",subtype:"li",class:"",itemTemplate)
|
||||
\whitespace trim
|
||||
<span class="tc-links-draggable-list">
|
||||
<$vars targetTiddler="""$tiddler$""" targetField="""$field$""">
|
||||
<$genesis $type=<<__type__>> class="$class$">
|
||||
<$list filter="[list[$tiddler$!!$field$]]" emptyMessage=<<__emptyMessage__>>>
|
||||
<$vars targetTiddler=<<tiddler>> targetField=<<field>>>
|
||||
<$genesis $type=<<type>> class=<<class>>>
|
||||
<$list filter="[<tiddler>get<field>enlist-input[]]" emptyMessage=<<emptyMessage>>>
|
||||
<$droppable
|
||||
actions=<<list-links-draggable-drop-actions>>
|
||||
tag="""$subtype$"""
|
||||
tag=<<subtype>>
|
||||
enable=<<tv-enable-drag-and-drop>>
|
||||
>
|
||||
<div class="tc-droppable-placeholder"/>
|
||||
<div>
|
||||
<$transclude tiddler="""$itemTemplate$""">
|
||||
<$transclude tiddler=<<itemTemplate>>>
|
||||
<$link to={{!!title}}>
|
||||
<$let tv-wikilinks="no">
|
||||
<$transclude field="caption">
|
||||
@ -64,46 +64,46 @@ tags: $:/tags/Macro
|
||||
</span>
|
||||
\end
|
||||
|
||||
\define list-tagged-draggable-drop-actions(tag)
|
||||
\procedure list-tagged-draggable-drop-actions(tag)
|
||||
\whitespace trim
|
||||
<!-- Save the current ordering of the tiddlers with this tag -->
|
||||
<$set name="order" filter="[<__tag__>tagging[]]">
|
||||
<$set name="order" filter="[<tag>tagging[]]">
|
||||
<!-- Remove any list-after or list-before fields from the tiddlers with this tag -->
|
||||
<$list filter="[<__tag__>tagging[]]">
|
||||
<$list filter="[<tag>tagging[]]">
|
||||
<$action-deletefield $field="list-before"/>
|
||||
<$action-deletefield $field="list-after"/>
|
||||
</$list>
|
||||
<!-- Save the new order to the Tag Tiddler -->
|
||||
<$action-listops $tiddler=<<__tag__>> $field="list" $filter="+[enlist<order>] +[insertbefore<actionTiddler>,<currentTiddler>]"/>
|
||||
<$action-listops $tiddler=<<tag>> $field="list" $filter="+[enlist<order>] +[insertbefore<actionTiddler>,<currentTiddler>]"/>
|
||||
<!-- Make sure the newly added item has the right tag -->
|
||||
<!-- Removing this line makes dragging tags within the dropdown work as intended -->
|
||||
<!--<$action-listops $tiddler=<<actionTiddler>> $tags=<<__tag__>>/>-->
|
||||
<!-- Using the following 5 lines as replacement makes dragging titles from outside into the dropdown apply the tag -->
|
||||
<$list filter="[<actionTiddler>!contains:tags<__tag__>]">
|
||||
<$list filter="[<actionTiddler>!contains:tags<tag>]">
|
||||
<$fieldmangler tiddler=<<actionTiddler>>>
|
||||
<$action-sendmessage $message="tm-add-tag" $param=<<__tag__>>/>
|
||||
<$action-sendmessage $message="tm-add-tag" $param=<<tag>>/>
|
||||
</$fieldmangler>
|
||||
</$list>
|
||||
</$set>
|
||||
\end
|
||||
|
||||
\define list-tagged-draggable(tag,subFilter,emptyMessage,itemTemplate,elementTag:"div",storyview:"")
|
||||
\procedure list-tagged-draggable(tag,subFilter,emptyMessage,itemTemplate,elementTag:"div",storyview:"")
|
||||
\whitespace trim
|
||||
<span class="tc-tagged-draggable-list">
|
||||
<$set name="tag" value=<<__tag__>>>
|
||||
<$set name="tag" value=<<tag>>>
|
||||
<$list
|
||||
filter="[<__tag__>tagging[]$subFilter$]"
|
||||
emptyMessage=<<__emptyMessage__>>
|
||||
storyview=<<__storyview__>>
|
||||
filter=`[<tag>tagging[]$(subFilter)$]`
|
||||
emptyMessage=<<emptyMessage>>
|
||||
storyview=<<storyview>>
|
||||
>
|
||||
<$genesis $type=<<__elementTag__>> class="tc-menu-list-item">
|
||||
<$genesis $type=<<elementTag>> class="tc-menu-list-item">
|
||||
<$droppable
|
||||
actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>"""
|
||||
actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<tag>>/>"""
|
||||
enable=<<tv-enable-drag-and-drop>>
|
||||
>
|
||||
<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/>
|
||||
<$genesis $type=<<__elementTag__>>>
|
||||
<$transclude tiddler="""$itemTemplate$""">
|
||||
<$genesis $type=<<elementTag>> class="tc-droppable-placeholder"/>
|
||||
<$genesis $type=<<elementTag>>>
|
||||
<$transclude tiddler=<<itemTemplate>>>
|
||||
<$link to={{!!title}}>
|
||||
<$view field="title"/>
|
||||
</$link>
|
||||
@ -114,11 +114,11 @@ tags: $:/tags/Macro
|
||||
</$list>
|
||||
<$tiddler tiddler="">
|
||||
<$droppable
|
||||
actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>"""
|
||||
actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<tag>>/>"""
|
||||
enable=<<tv-enable-drag-and-drop>>
|
||||
>
|
||||
<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/>
|
||||
<$genesis $type=<<__elementTag__>> style="height:0.5em;"/>
|
||||
<$genesis $type=<<elementTag>> class="tc-droppable-placeholder"/>
|
||||
<$genesis $type=<<elementTag>> style="height:0.5em;"/>
|
||||
</$droppable>
|
||||
</$tiddler>
|
||||
</$set>
|
||||
|
@ -2,33 +2,34 @@ title: $:/core/macros/thumbnails
|
||||
tags: $:/tags/Macro
|
||||
|
||||
<!-- This macro does not use \whitespace trim because it could affect the caption -->
|
||||
\define thumbnail(link,icon,color,background-color,image,caption,width:"280",height:"157")
|
||||
<$link to="""$link$"""><div class="tc-thumbnail-wrapper"
|
||||
\procedure thumbnail(link,icon,color,background-color,image,caption,width:"280",height:"157")
|
||||
<$link to=<<link>>><div class="tc-thumbnail-wrapper"
|
||||
><div
|
||||
class="tc-thumbnail-image"
|
||||
style="width:$width$px;height:$height$px;"><$reveal
|
||||
style.width={{{ [<width>addsuffix[px]] }}} style.height={{{ [<height>addsuffix[px]] }}}>
|
||||
<$reveal
|
||||
type="nomatch"
|
||||
text=""
|
||||
default="""$image$"""
|
||||
default=<<image>>
|
||||
tag="div"
|
||||
style="width:$width$px;height:$height$px;"
|
||||
>[img[$image$]]</$reveal><$reveal
|
||||
style=`width:$(width)$px;height:$(height)$px;`
|
||||
><$image source=<<image>>/></$reveal><$reveal
|
||||
type="match"
|
||||
text=""
|
||||
default="""$image$"""
|
||||
default=<<image>>
|
||||
tag="div"
|
||||
class="tc-thumbnail-background"
|
||||
style="width:$width$px;height:$height$px;background-color:$background-color$;"
|
||||
style=`width:$(width)$px;height:$(height)$px;background-color:$(background-color)$;`
|
||||
></$reveal></div><div
|
||||
class="tc-thumbnail-icon"
|
||||
style="fill:$color$;color:$color$;"
|
||||
>$icon$</div><div class="tc-thumbnail-caption">$caption$</div></div></$link>
|
||||
style.fill=<<color>> style.color=<<color>>
|
||||
><<icon>></div><div class="tc-thumbnail-caption"><<caption>></div></div></$link>
|
||||
\end
|
||||
|
||||
\define thumbnail-right(link,icon,color,background-color,image,caption,width:"280",height:"157")
|
||||
<div class="tc-thumbnail-right-wrapper"><<thumbnail """$link$""" """$icon$""" """$color$""" """$background-color$""" """$image$""" """$caption$""" """$width$""" """$height$""">></div>
|
||||
\procedure thumbnail-right(link,icon,color,background-color,image,caption,width:"280",height:"157")
|
||||
<div class="tc-thumbnail-right-wrapper"><$transclude $variable="thumbnail" link=<<link>> icon=<<icon>> color=<<color>> background-color=<<background-color>> image=<<image>> caption=<<caption>> width=<<width>> height=<<height>>/></div>
|
||||
\end
|
||||
|
||||
\define list-thumbnails(filter,width:"280",height:"157")
|
||||
<$list filter="""$filter$"""><$macrocall $name="thumbnail" link={{!!link}} icon={{!!icon}} color={{!!color}} background-color={{!!background-color}} image={{!!image}} caption={{!!caption}} width="""$width$""" height="""$height$"""/></$list>
|
||||
\procedure list-thumbnails(filter,width:"280",height:"157")
|
||||
<$list filter=<<filter>>><$transclude $variable="thumbnail" link={{!!link}} icon={{!!icon}} color={{!!color}} background-color={{!!background-color}} image={{!!image}} caption={{!!caption}} width=<<width>> height=<<height>>/></$list>
|
||||
\end
|
||||
|
@ -17,7 +17,7 @@ tags: $:/tags/Macro
|
||||
<%endif%>
|
||||
<%if [<mode>match[inline]] %>
|
||||
<span class="tc-translink">
|
||||
<$link to=<<title>> class="tc-small-gap-right">
|
||||
<$link to=<<title>> class="tc-tiny-gap-right">
|
||||
<$text text=<<title>>/>
|
||||
</$link>
|
||||
(<$transclude tiddler=<<title>> mode="inline">
|
||||
|
@ -1,62 +1,61 @@
|
||||
title: $:/core/macros/tree
|
||||
tags: $:/tags/Macro
|
||||
|
||||
\define leaf-link(full-title,chunk,separator: "/")
|
||||
<$link to=<<__full-title__>>><$text text=<<__chunk__>>/></$link>
|
||||
\procedure leaf-link(full-title,chunk,separator: "/")
|
||||
<$link to=<<full-title>>><$text text=<<chunk>>/></$link>
|
||||
\end
|
||||
|
||||
\define leaf-node(prefix,chunk)
|
||||
\procedure leaf-node(prefix,chunk)
|
||||
\whitespace trim
|
||||
<li>
|
||||
<$list filter="[<__prefix__>addsuffix<__chunk__>is[shadow]] [<__prefix__>addsuffix<__chunk__>is[tiddler]]" variable="full-title">
|
||||
<$list filter="[<full-title>removeprefix<__prefix__>]" variable="chunk">
|
||||
<span>{{$:/core/images/file}}</span> <$macrocall $name="leaf-link" full-title=<<full-title>> chunk=<<chunk>>/>
|
||||
<$list filter="[<prefix>addsuffix<chunk>is[shadow]] [<prefix>addsuffix<chunk>is[tiddler]]" variable="full-title">
|
||||
<$list filter="[<full-title>removeprefix<prefix>]" variable="chunk">
|
||||
<span class="tc-tiny-gap-right">{{$:/core/images/file}}</span><$transclude $variable="leaf-link" full-title=<<full-title>> chunk=<<chunk>>/>
|
||||
</$list>
|
||||
</$list>
|
||||
</li>
|
||||
\end
|
||||
|
||||
\define branch-node(prefix,chunk,separator: "/")
|
||||
\procedure branch-node(prefix,chunk,separator: "/")
|
||||
\whitespace trim
|
||||
<li>
|
||||
<$set name="reveal-state" value={{{ [[$:/state/tree/]addsuffix<__prefix__>addsuffix<__chunk__>] }}}>
|
||||
<$set name="reveal-state" value={{{ [[$:/state/tree/]addsuffix<prefix>addsuffix<chunk>] }}}>
|
||||
<$reveal type="nomatch" stateTitle=<<reveal-state>> text="show">
|
||||
<$button setTitle=<<reveal-state>> setTo="show" class="tc-btn-invisible">
|
||||
{{$:/core/images/folder}} <$text text=<<__chunk__>>/>
|
||||
{{$:/core/images/folder}} <$text text=<<chunk>>/>
|
||||
</$button>
|
||||
</$reveal>
|
||||
<$reveal type="match" stateTitle=<<reveal-state>> text="show">
|
||||
<$button setTitle=<<reveal-state>> setTo="hide" class="tc-btn-invisible">
|
||||
{{$:/core/images/folder}} <$text text=<<__chunk__>>/>
|
||||
{{$:/core/images/folder}} <$text text=<<chunk>>/>
|
||||
</$button>
|
||||
</$reveal>
|
||||
 
|
||||
<span>(<$count filter="[all[shadows+tiddlers]removeprefix<__prefix__>removeprefix<__chunk__>] -[<__prefix__>addsuffix<__chunk__>]"/>)</span>
|
||||
<span class="tc-tiny-gap-left">(<$count filter="[all[shadows+tiddlers]removeprefix<prefix>removeprefix<chunk>] -[<prefix>addsuffix<chunk>]"/>)</span>
|
||||
<$reveal type="match" stateTitle=<<reveal-state>> text="show">
|
||||
<$macrocall $name="tree-node" prefix={{{ [<__prefix__>addsuffix<__chunk__>] }}} separator=<<__separator__>>/>
|
||||
<$transclude $variable="tree-node" prefix={{{ [<prefix>addsuffix<chunk>] }}} separator=<<separator>>/>
|
||||
</$reveal>
|
||||
</$set>
|
||||
</li>
|
||||
\end
|
||||
|
||||
\define tree-node(prefix,separator: "/")
|
||||
\procedure tree-node(prefix,separator: "/")
|
||||
\whitespace trim
|
||||
<ol>
|
||||
<$list filter="[all[shadows+tiddlers]removeprefix<__prefix__>splitbefore<__separator__>sort[]!suffix<__separator__>]" variable="chunk">
|
||||
<$macrocall $name="leaf-node" prefix=<<__prefix__>> chunk=<<chunk>> separator=<<__separator__>>/>
|
||||
<$list filter="[all[shadows+tiddlers]removeprefix<prefix>splitbefore<separator>sort[]!suffix<separator>]" variable="chunk">
|
||||
<$transclude $variable="leaf-node" prefix=<<prefix>> chunk=<<chunk>> separator=<<separator>>/>
|
||||
</$list>
|
||||
<$list filter="[all[shadows+tiddlers]removeprefix<__prefix__>splitbefore<__separator__>sort[]suffix<__separator__>]" variable="chunk">
|
||||
<$macrocall $name="branch-node" prefix=<<__prefix__>> chunk=<<chunk>> separator=<<__separator__>>/>
|
||||
<$list filter="[all[shadows+tiddlers]removeprefix<prefix>splitbefore<separator>sort[]suffix<__separator__>]" variable="chunk">
|
||||
<$transclude $variable="branch-node" prefix=<<prefix>> chunk=<<chunk>> separator=<<separator>>/>
|
||||
</$list>
|
||||
</ol>
|
||||
\end
|
||||
|
||||
\define tree(prefix: "$:/",separator: "/")
|
||||
\procedure tree(prefix: "$:/",separator: "/")
|
||||
\whitespace trim
|
||||
<div class="tc-tree">
|
||||
<span><$text text=<<__prefix__>>/></span>
|
||||
<span><$text text=<<prefix>>/></span>
|
||||
<div>
|
||||
<$macrocall $name="tree-node" prefix=<<__prefix__>> separator=<<__separator__>>/>
|
||||
<$transclude $variable="tree-node" prefix=<<prefix>> separator=<<separator>>/>
|
||||
</div>
|
||||
</div>
|
||||
\end
|
||||
|
Loading…
Reference in New Issue
Block a user