1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-06 10:06:19 +00:00
TiddlyWiki5/core/wiki/macros/dumpvariables.tid

124 lines
4.2 KiB
Plaintext
Raw Normal View History

title: $:/core/macros/dumpvariables
tags: $:/tags/Macro
\whitespace trim
<!-- =================== -->
\procedure dumpvariables(subfilter:"[variables[]]")
<ul>
<$list filter="[variables[]] :and[subfilter<subfilter>]" variable="varname">
<li>
<strong><code><$text text=<<varname>>/></code></strong>:<br/>
<$codeblock code={{{ [<varname>getvariable[]] }}}/>
</li>
</$list>
</ul>
\end
<!-- =================== -->
\procedure search-variables(subfilter:"[<currentTiddler>]")
\procedure search() $:/temp/search/dump
\procedure sub-search() $:/temp/search/sub-dump
\procedure state() $:/state/search/var/
\procedure toggleState()
<$action-setfield $tiddler=<<getVarState>> text={{{ [<getVarState>get[text]] +[toggle[yes],[no]] }}}/>
\end toggleState
\procedure toggleInfoState()
<$action-setfield $tiddler=<<getToggleInfoState>> text={{{ [<getToggleInfoState>get[text]] +[toggle[yes],[no]] }}}/>
<$action-setfield $tiddler=<<getSubSearch>> text={{{ [<getSubSearchText>!is[blank]then<getSubSearchText>] :else[<varname>] }}} />
\end toggleInfoState
\procedure clearStatesButton()
<$button class="tc-btn-invisible tc-tiny-gap-left">
<$action-deletetiddler $filter="[prefix<state>] [prefix[$:/temp]]"/>
{{$:/core/images/fold-all-button}}
</$button>
\end clearStatesButton
\procedure clearSearchButton()
<$button class="tc-btn-invisible tc-tiny-gap-left">
<$action-deletetiddler $tiddler=<<search>>/>
{{$:/core/images/close-button}}
</$button>
\end clearSearchButton
\procedure expandAllStatesButton()
<$button class="tc-btn-invisible tc-tiny-gap-left">
<$action-setfield $tiddler=<<state>> text={{{ [<getToggleInfoState>get[text]] +[toggle[yes],[no]] }}}/>
<$list filter="[variables[]] +[search::some<getSearchText>] :filter[subfilter<subfilter>]" variable="varname">
<$action-setfield $tiddler=<<getVarState>> text="yes"/>
</$list>
{{$:/core/images/unfold-all-button}}
</$button>
\end expandAllStatesButton
\procedure info()
<!-- <$let xx={{{ "\define" [<varname>] +[join[ ]] }}}> -->
<div class="multi-columns">
<$list filter="[all[tiddlers+shadows]] :filter[search:text,tags:words<getSubSearchText>]
:filter[!prefix[$:/temp]]
:filter[!prefix[$:/state]]
-[[$:/config/OriginalTiddlerPaths]]
:filter[!type[application/javascript]]
-[[$:/core]]
:filter[!plugin-type[plugin]]"
>
<$link class="tc-small-gap-left"/><br>
</$list>
</div>
\end info
\function getSearchText() [<search>get[text]]
\function getSubSearch() [<sub-search>] [<varname>] [<qualify>] +[join[/]]
\function getSubSearchText() [<getSubSearch>get[text]]
\function getVarState() [<state>addsuffix<varname>] [<qualify>] +[join[]]
\function getToggleInfoState() [<state>addsuffix<varname>]
<$text text="Search Variables - "/><%if [<thisTiddler>!match[$:/AdvancedSearch]]%><code><<subfilter>></code><%endif%>
<$edit-text tiddler=<<search>> tag=input/> <<clearSearchButton>>
<% if [<state>get[text]match[yes]] %>
<<clearStatesButton>>
<% else %>
<<expandAllStatesButton>>
<% endif %>
<$list filter="[variables[]] +[search::some<getSearchText>] :filter[subfilter<subfilter>]" variable="varname">
<div class="tc-var-item">
<$button actions=<<toggleState>> class="tc-small-gap-left tc-btn-invisible">
<% if [<getVarState>get[text]match[yes]] %>
{{$:/core/images/down-arrow}}
<% else %>
{{$:/core/images/right-arrow}}
<% endif %>
<strong class="tc-tiny-gap-right"><code><$text text=<<varname>>/></code></strong>
<$text text={{{ "#" [<varname>getvariable[]length[]] +[join[ ]] }}}/>
</$button>
<% if [<getVarState>get[text]match[yes]] %>
<$button actions=<<toggleInfoState>> class="tc-btn-invisible tc-small-gap-left" disabledX={{{[<getSearchText>is[blank]then[yes]else[no]] }}}>
<% if [<getToggleInfoState>get[text]match[yes]] %>
{{$:/core/images/down-arrow}}
<% else %>
{{$:/core/images/right-arrow}}
<% endif %>
</$button>
<% if [<getToggleInfoState>get[text]match[yes]] %>
<div class="tc-labeled-input-wrapper">
<span class="tc-fixed-label tc-align-right">Search text, tags:</span>
<$edit-text tiddler=<<getSubSearch>> tag=input class="tc-fluid-input tc-small-gap-left"/>
</div>
<<info>>
<% endif %>
<$codeblock code={{{ [<varname>getvariable[]] }}}/>
<% endif %>
</div>
</$list>
<hr>
\end