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

141 lines
5.0 KiB
Plaintext

title: $:/core/macros/dumpvariables
tags: $:/tags/Global
\whitespace trim
\procedure _initRawFilter() [variables:raw<type>]
\procedure _initFilter() [variables<type>]
\function _f.filterString() [<sort>match[raw]then<_initRawFilter>else<_initFilter>]
\function _f.varFormat() [<format>!is[blank]then<format>else[$type$ $name$($params$)]]
\function _f.formattedVar() [<varname>format:variable<_f.varFormat>]
<!-- =================== -->
\procedure dumpvariables(type sort:"sort" subfilter:"[[]]" format)
<ul>
<li><<transclusion>></li>
<$list filter="[subfilter<_f.filterString>] +[filter<subfilter>]" variable="varname">
<li>
<code><$text text=<<_f.formattedVar>>/></code><br/>
<% if [<_f.formattedVar>prefix[\function]] %>
<$codeblock code={{{ [<varname>getvariable[value]] }}}/>
<% endif %>
<$codeblock code={{{ [<varname>getvariable[]] }}}/>
</li>
</$list>
</ul>
\end
\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>format:variable[$type$ $name$$params$]] }}} />
\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="[subfilter<_f.filterString>] +[search::some<getSearchText>] +[filter<subfilter>]" variable="varname">
<$action-setfield $tiddler=<<getVarState>> text="yes"/>
</$list>
{{$:/core/images/unfold-all-button}}
</$button>
\end expandAllStatesButton
\procedure info()
<div class="multi-columns">
<$list filter="[all[tiddlers+shadows]] :filter[search:text,tags:words<getSubSearchText>]
-[[$:/config/OriginalTiddlerPaths]]
-[[$:/HistoryList]]
-[[$:/StoryList]]
-[[$:/core]]
:filter[!type[application/javascript]]
:filter[!prefix[$:/temp]]
:filter[!prefix[$:/state]]
: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>]
<!-- =================== -->
\procedure search-variables(type sort:"sort" subfilter:"[[]]" format)
\function _f.varFormat() [<format>!is[blank]then<format>else[$type$ $name$($params$) $firstLine$]]
<$text text="Search Variables - "/><%if [<thisTiddler>!match[$:/AdvancedSearch]]%><code class="tc-small-gap-right">sort: <<sort>>, type:<<type>></code><%endif%>
<$edit-text tiddler=<<search>> tag=input/> <<clearSearchButton>>
<% if [<state>get[text]match[yes]] %>
<<clearStatesButton>>
<% else %>
<<expandAllStatesButton>>
<% endif %>
<!-- <$list filter="[subfilter<subfilter>] +[search::some<getSearchText>]" variable="varname"> -->
<$list filter="[subfilter<_f.filterString>] +[search::some<getSearchText>] +[filter<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 %>
<code class="tc-tiny-gap-right"><$text text=<<_f.formattedVar>>/></code>
<!-- <$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 %>
<% if [<varname>prefix[\function]] %>
<$codeblock code={{{ [<varname>getvariable[value]] }}}/>
<% endif %>
<$codeblock code={{{ [<varname>getvariable[]] }}}/>
<% endif %>
</div>
</$list>
<hr>
\end