2019-03-30 10:52:49 +00:00
|
|
|
title: $:/core/macros/dumpvariables
|
2024-02-21 16:39:00 +00:00
|
|
|
tags: $:/tags/Global
|
2019-03-30 10:52:49 +00:00
|
|
|
|
2022-04-16 16:19:05 +00:00
|
|
|
\whitespace trim
|
2024-02-15 21:08:39 +00:00
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
<!-- CONST string definitions -->
|
|
|
|
\define DV-VAR-FILTER-OPTIONS() fn var proc macro widget
|
|
|
|
\define DV-TMP-FILTER-OPTIONS() $:/temp/varSearch/options
|
|
|
|
\define DV-TMP-SORT-OPTIONS() $:/temp/varSearch/sort
|
2024-02-21 16:39:00 +00:00
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
\define DV-RAW-FILTER-STR() [variables:raw<_tf.dv-type>]
|
|
|
|
\define DV-FILTER-STR() [variables<_tf.dv-type>]
|
|
|
|
|
|
|
|
\define DV-TMP-SEARCH() $:/temp/varSearch
|
|
|
|
\define DV-TMP-SEARCH-DETAILS() $:/temp/varSearch/details
|
|
|
|
\define DV-SEARCH-STATE() $:/state/varSearch
|
|
|
|
|
|
|
|
\function tf.dv-filterString() [<_tf.dv-sort>match[raw]then<DV-RAW-FILTER-STR>else<DV-FILTER-STR>]
|
|
|
|
\function tf.dv-formattedVar() [<varname>format:variable<_tf.dv-varFormat>]
|
2024-02-21 16:39:00 +00:00
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
<!-- =================== -->
|
|
|
|
<!-- dumpvariables main -->
|
2024-02-16 15:20:48 +00:00
|
|
|
<!-- =================== -->
|
2024-02-23 00:19:15 +00:00
|
|
|
\procedure dumpvariables(type sort subfilter:"[[]]" format)
|
|
|
|
<!-- The following function is needed since the "format" string can contain closing brackets ")" -->
|
2024-02-22 18:41:21 +00:00
|
|
|
\function _tf.dv-varFormat() [<format>!is[blank]then<format>else[$type$ $name$($params$)]]
|
2024-02-23 00:19:15 +00:00
|
|
|
\function _tf.dv-type() [<type>]
|
|
|
|
\function _tf.dv-sort() [<sort>]
|
2019-03-30 10:52:49 +00:00
|
|
|
<ul>
|
2024-02-22 18:41:21 +00:00
|
|
|
<$list filter="[subfilter<tf.dv-filterString>] +[filter<subfilter>]" variable="varname">
|
2024-02-15 21:08:39 +00:00
|
|
|
<li>
|
2024-02-22 18:41:21 +00:00
|
|
|
<code><$text text=<<tf.dv-formattedVar>>/></code><br/>
|
|
|
|
<% if [<tf.dv-formattedVar>prefix[\function]] %>
|
2024-02-21 16:39:00 +00:00
|
|
|
<$codeblock code={{{ [<varname>getvariable[value]] }}}/>
|
|
|
|
<% endif %>
|
2024-02-15 21:08:39 +00:00
|
|
|
<$codeblock code={{{ [<varname>getvariable[]] }}}/>
|
|
|
|
</li>
|
|
|
|
</$list>
|
2019-03-30 10:52:49 +00:00
|
|
|
</ul>
|
|
|
|
\end
|
2024-02-15 21:08:39 +00:00
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
<!-- search-variables helper functions -->
|
|
|
|
\procedure dv-toggleState()
|
|
|
|
<$action-setfield $tiddler=<<tf.dv-varState>> text={{{ [<tf.dv-varState>get[text]] +[toggle[yes],[no]] }}}/>
|
|
|
|
\end
|
2024-02-16 15:20:48 +00:00
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
\procedure dv-toggleInfoState()
|
|
|
|
<$action-setfield $tiddler=<<tf.dv-toggleInfoState>> text={{{ [<tf.dv-toggleInfoState>get[text]] +[toggle[yes],[no]] }}}/>
|
|
|
|
<!-- Existing user modified "search text details" should be preserved. If empty use default formatted signature -->
|
|
|
|
<$action-setfield $tiddler=<<tf.dv-detailsSearch>> text={{{ [<tf.dv-getDetailsSearchText>!is[blank]then<tf.dv-getDetailsSearchText>] :else[<varname>format:variable[$type$ $name$($params$)]] }}} />
|
|
|
|
\end
|
2024-02-15 21:08:39 +00:00
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
\procedure dv-clearStatesButton()
|
2024-02-15 21:08:39 +00:00
|
|
|
<$button class="tc-btn-invisible tc-tiny-gap-left">
|
2024-02-22 18:41:21 +00:00
|
|
|
<!-- "search text details" should be preserved -->
|
2024-02-22 18:54:04 +00:00
|
|
|
<$action-deletetiddler $filter="[prefix<DV-SEARCH-STATE>]"/>
|
2024-02-15 21:08:39 +00:00
|
|
|
{{$:/core/images/fold-all-button}}
|
|
|
|
</$button>
|
2024-02-22 18:41:21 +00:00
|
|
|
\end
|
2024-02-15 21:08:39 +00:00
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
\procedure dv-clearSearchButton()
|
2024-02-15 21:08:39 +00:00
|
|
|
<$button class="tc-btn-invisible tc-tiny-gap-left">
|
2024-02-22 18:54:04 +00:00
|
|
|
<$action-deletetiddler $tiddler=<<tf.dv-searchText>>/>
|
2024-02-15 21:08:39 +00:00
|
|
|
{{$:/core/images/close-button}}
|
|
|
|
</$button>
|
2024-02-22 18:41:21 +00:00
|
|
|
\end
|
2024-02-15 21:08:39 +00:00
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
\procedure dv-expandAllStatesButton()
|
2024-02-15 21:08:39 +00:00
|
|
|
<$button class="tc-btn-invisible tc-tiny-gap-left">
|
2024-02-22 18:41:21 +00:00
|
|
|
<$action-setfield $tiddler=<<DV-SEARCH-STATE>> text={{{ [<tf.dv-toggleInfoState>get[text]] +[toggle[yes],[no]] }}}/>
|
|
|
|
<!-- only expand currently visible elements -->
|
|
|
|
<$list filter="[subfilter<tf.dv-filterString>] +[search::some<tf.dv-getSearchText>] +[filter<subfilter>]" variable="varname">
|
|
|
|
<$action-setfield $tiddler=<<tf.dv-varState>> text="yes"/>
|
2024-02-15 21:08:39 +00:00
|
|
|
</$list>
|
|
|
|
{{$:/core/images/unfold-all-button}}
|
|
|
|
</$button>
|
2024-02-22 18:41:21 +00:00
|
|
|
\end
|
2024-02-15 21:08:39 +00:00
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
\procedure dv-info()
|
2024-02-15 21:08:39 +00:00
|
|
|
<div class="multi-columns">
|
2024-02-22 18:41:21 +00:00
|
|
|
<$list filter="[all[tiddlers+shadows]] :filter[search:text,tags:words<tf.dv-getDetailsSearchText>]
|
2024-02-15 21:08:39 +00:00
|
|
|
-[[$:/config/OriginalTiddlerPaths]]
|
2024-02-21 16:39:00 +00:00
|
|
|
-[[$:/HistoryList]]
|
|
|
|
-[[$:/StoryList]]
|
2024-02-15 21:08:39 +00:00
|
|
|
-[[$:/core]]
|
2024-02-21 16:39:00 +00:00
|
|
|
:filter[!type[application/javascript]]
|
2024-02-22 18:41:21 +00:00
|
|
|
:filter[!prefix[$:/temp/]]
|
|
|
|
:filter[!prefix[$:/state/]]
|
2024-02-15 21:08:39 +00:00
|
|
|
:filter[!plugin-type[plugin]]"
|
|
|
|
>
|
|
|
|
<$link class="tc-small-gap-left"/><br>
|
|
|
|
</$list>
|
|
|
|
</div>
|
2024-02-22 18:41:21 +00:00
|
|
|
\end
|
|
|
|
|
|
|
|
\procedure dv-filterOptions()
|
|
|
|
<style>
|
|
|
|
.tc-dv-filterOptions [data-gap="right"] {
|
|
|
|
width: auto;
|
|
|
|
margin-right: .25em;
|
|
|
|
}
|
|
|
|
</style>
|
2024-02-23 00:19:15 +00:00
|
|
|
<span class="tc-dv-filterOptions tc-small-gap-right">
|
|
|
|
{{$:/language/Search/Variables/Option/Type}}
|
2024-02-22 18:41:21 +00:00
|
|
|
<$list filter="[enlist<DV-VAR-FILTER-OPTIONS>]" variable="option">
|
2024-02-23 00:19:15 +00:00
|
|
|
<$checkbox tiddler=<<tf.dv-tmpTypeOptions>> listField="text" checked=<<option>>
|
|
|
|
class="tc-small-gap-left tc-small-gap-right" data-gap="right"
|
2024-02-22 18:41:21 +00:00
|
|
|
>
|
|
|
|
<<option>>
|
|
|
|
</$checkbox>
|
2024-02-23 00:19:15 +00:00
|
|
|
</$list>|
|
2024-02-22 18:41:21 +00:00
|
|
|
</span>
|
|
|
|
\end
|
2024-02-15 21:08:39 +00:00
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
\procedure dv-sortOptions()
|
2024-02-23 00:19:15 +00:00
|
|
|
<span class="tc-dv-sortOptions">
|
|
|
|
{{$:/language/Search/Variables/Option/Sort}}
|
|
|
|
<$select tiddler=<<tf.dv-tmpSortOptions>> default="alphabetical" class="tc-tiny-gap-left">
|
2024-02-22 18:41:21 +00:00
|
|
|
<option value="alphabetical">alphabetical</option>
|
|
|
|
<option value="raw">raw</option>
|
|
|
|
</$select>
|
|
|
|
</span>
|
|
|
|
\end
|
2024-02-15 21:08:39 +00:00
|
|
|
|
2024-02-23 00:19:15 +00:00
|
|
|
\function tf.dv-tmpTypeOptions() [<DV-TMP-FILTER-OPTIONS>] [<qualify>] +[join[/]]
|
2024-02-22 18:41:21 +00:00
|
|
|
\function tf.dv-tmpSortOptions() [<DV-TMP-SORT-OPTIONS>] [<qualify>] +[join[/]]
|
2024-02-15 21:08:39 +00:00
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
\function tf.dv-searchText() [<DV-TMP-SEARCH>] [<qualify>] +[join[/]]
|
|
|
|
\function tf.dv-getSearchText() [<tf.dv-searchText>get[text]]
|
2024-02-15 21:08:39 +00:00
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
\function tf.dv-detailsSearch() [<DV-TMP-SEARCH-DETAILS>] [<varname>] [<qualify>] +[join[/]]
|
|
|
|
\function tf.dv-getDetailsSearchText() [<tf.dv-detailsSearch>get[text]]
|
|
|
|
|
|
|
|
\function tf.dv-varState() [<DV-SEARCH-STATE>] [<varname>] [<qualify>] +[join[/]]
|
|
|
|
\function tf.dv-toggleInfoState() [<DV-SEARCH-STATE>] [<varname>] +[join[/]]
|
|
|
|
|
|
|
|
<!-- ============================== -->
|
|
|
|
<!-- search-variables main function -->
|
|
|
|
<!-- ============================== -->
|
|
|
|
\procedure search-variables(type sort subfilter:"[[]]" format)
|
2024-02-23 00:19:15 +00:00
|
|
|
<!-- The following function is needed since the "format" string can contain closing brackets ")" -->
|
2024-02-22 18:41:21 +00:00
|
|
|
\function _tf.dv-varFormat() [<format>!is[blank]then<format>else[$type$ $name$($params$)]]
|
2024-02-23 00:19:15 +00:00
|
|
|
\function _tf.dv-type() [<type>!is[blank]then<type>] :else[<tf.dv-tmpTypeOptions>get[text]]
|
|
|
|
\function _tf.dv-sort() [<sort>!is[blank]then<sort>] :else[<tf.dv-tmpSortOptions>get[text]] :else[[alphabetical]]
|
2024-02-15 21:08:39 +00:00
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
<% if [<type>is[blank]] %>
|
|
|
|
<<dv-filterOptions>>
|
|
|
|
<% endif %>
|
|
|
|
<% if [<sort>is[blank]] %>
|
|
|
|
<<dv-sortOptions>>
|
|
|
|
<% endif %>
|
|
|
|
<div class="tc-dv-search-input">
|
|
|
|
<% if [<thisTiddler>!match[$:/AdvancedSearch]] %>
|
|
|
|
<$text text={{$:/language/Search/Variables/Search}}/>
|
|
|
|
<%if [<sort>!is[blank]] %><code class="tc-small-gap">sort:<<_tf.dv-sort>></code><%endif%>
|
2024-02-23 00:19:15 +00:00
|
|
|
<%if [<type>!is[blank]] %><code class="tc-small-gap">type:<<_tf.dv-type>></code><%endif%>
|
2024-02-22 18:41:21 +00:00
|
|
|
<% endif %>
|
|
|
|
<$edit-text tiddler=<<tf.dv-searchText>> tag=input/> <<dv-clearSearchButton>>
|
|
|
|
<% if [<DV-SEARCH-STATE>get[text]match[yes]] %>
|
|
|
|
<<dv-clearStatesButton>>
|
|
|
|
<% else %>
|
|
|
|
<<dv-expandAllStatesButton>>
|
|
|
|
<% endif %>
|
|
|
|
</div>
|
|
|
|
<$list filter="[subfilter<tf.dv-filterString>] +[search::some<tf.dv-getSearchText>] +[filter<subfilter>]" variable="varname">
|
2024-02-16 15:20:48 +00:00
|
|
|
<div class="tc-var-item">
|
2024-02-22 18:41:21 +00:00
|
|
|
<$button actions=<<dv-toggleState>> class="tc-small-gap-left tc-btn-invisible">
|
|
|
|
<% if [<tf.dv-varState>get[text]match[yes]] %>
|
2024-02-15 21:08:39 +00:00
|
|
|
{{$:/core/images/down-arrow}}
|
|
|
|
<% else %>
|
|
|
|
{{$:/core/images/right-arrow}}
|
|
|
|
<% endif %>
|
2024-02-22 18:41:21 +00:00
|
|
|
<code class="tc-small-gap-right"><$text text=<<tf.dv-formattedVar>>/></code>
|
|
|
|
<% if [<tf.dv-formattedVar>prefix[\function]] %>
|
2024-02-23 00:19:15 +00:00
|
|
|
<span class="tc-tiny-gap-right"><$text text={{{ [<varname>format:variable[$firstLine$]] }}}/></span>
|
2024-02-22 18:41:21 +00:00
|
|
|
<% endif %>
|
2024-02-15 21:08:39 +00:00
|
|
|
</$button>
|
|
|
|
|
2024-02-22 18:41:21 +00:00
|
|
|
<% if [<tf.dv-varState>get[text]match[yes]] %>
|
|
|
|
<$button actions=<<dv-toggleInfoState>> class="tc-btn-invisible tc-small-gap-left">
|
|
|
|
<% if [<tf.dv-toggleInfoState>get[text]match[yes]] %>
|
2024-02-15 21:08:39 +00:00
|
|
|
{{$:/core/images/down-arrow}}
|
|
|
|
<% else %>
|
|
|
|
{{$:/core/images/right-arrow}}
|
|
|
|
<% endif %>
|
|
|
|
</$button>
|
2024-02-22 18:41:21 +00:00
|
|
|
<% if [<tf.dv-toggleInfoState>get[text]match[yes]] %>
|
2024-02-15 21:08:39 +00:00
|
|
|
<div class="tc-labeled-input-wrapper">
|
2024-02-22 18:41:21 +00:00
|
|
|
<span class="tc-fixed-label tc-align-right">{{$:/language/Search/Variables/Search/Details}}</span>
|
|
|
|
<$edit-text tiddler=<<tf.dv-detailsSearch>> tag=input class="tc-fluid-input tc-small-gap-left"/>
|
2024-02-15 21:08:39 +00:00
|
|
|
</div>
|
2024-02-22 18:41:21 +00:00
|
|
|
<<dv-info>>
|
2024-02-15 21:08:39 +00:00
|
|
|
<% endif %>
|
2024-02-21 16:39:00 +00:00
|
|
|
<% if [<varname>prefix[\function]] %>
|
|
|
|
<$codeblock code={{{ [<varname>getvariable[value]] }}}/>
|
|
|
|
<% endif %>
|
2024-02-15 21:08:39 +00:00
|
|
|
<$codeblock code={{{ [<varname>getvariable[]] }}}/>
|
|
|
|
<% endif %>
|
|
|
|
</div>
|
|
|
|
</$list>
|
|
|
|
\end
|