mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-17 23:34:50 +00:00
989947b99a
* Make filter operator examples easily editable * Add 'Reset' button to filter operator examples * Only display the reset button when filter has changed * Introduce '.doc-example input' class rather than re-use tc-advanced-search to make input wider * Grab focus for the filter text box * Fix firefox ctrl-z/undo issue by replacing list widget with filter transclusion * Replace spaced indent with tabs to make it consistent with the other code
51 lines
2.0 KiB
Plaintext
51 lines
2.0 KiB
Plaintext
created: 20150117152607000
|
|
modified: 20150228114306000
|
|
title: $:/editions/tw5.com/operator-macros
|
|
tags: $:/tags/Macro
|
|
|
|
\define .operator-examples(op,text:"Examples") <$link to="$op$ Operator (Examples)">$text$</$link>
|
|
|
|
\define .operator-example-tryit-actions() <$action-setfield $tiddler=<<.state>> text="show" filter=<<__eg__>>/>
|
|
\define .operator-example(n,eg,ie)
|
|
<div class="doc-example">
|
|
<$list filter="[title<.state-prefix>addsuffix{!!title}addsuffix[/]addsuffix[$n$]]" variable=".state">
|
|
<$reveal state=<<.state>> type="nomatch" text="show">
|
|
`$eg$`
|
|
<$macrocall $name=".if" cond="""$ie$""" then="""<dd>→ $ie$</dd>"""/>
|
|
<dl>
|
|
<dd><$button actions=<<.operator-example-tryit-actions>>>Try it</$button></dd>
|
|
</dl>
|
|
</$reveal>
|
|
<$reveal state=<<.state>> type="match" text="show">
|
|
<$edit-text tiddler=<<.state>> field="filter" tag="input" type=search focus="true"/>
|
|
<dl>
|
|
<dd>
|
|
<$button set=<<.state>> setTo="">Hide</$button>
|
|
<$reveal stateTitle=<<.state>> stateField="filter" type="nomatch" text=<<__eg__>>>
|
|
<$button actions=<<.operator-example-tryit-actions>>>Reset</$button>
|
|
</$reveal>
|
|
</dd>
|
|
</dl>
|
|
<blockquote class="doc-example-result">
|
|
<ul><$list filter={{{[<.state>get[filter]]}}} emptyMessage="(empty)">
|
|
<li><$link><$view field="title"/></$link></li>
|
|
</$list></ul>
|
|
</blockquote>
|
|
</$reveal>
|
|
</$list>
|
|
\end
|
|
|
|
\define .inline-operator-example(eg)
|
|
<code><$text text=<<__eg__>>/></code> evaluates to <$list filter=<<__eg__>> emptyMessage="(empty)"> <code><$text text=<<currentTiddler>>/></code> </$list>
|
|
\end
|
|
|
|
\define .this-is-operator-example() This example tiddler is used to illustrate some of the [[Filter Operators]].
|
|
\define .using-days-of-week() These examples make use of the [[Days of the Week]] tiddler.
|
|
\define .s-matching-is-case-sensitive() In looking for matches for <<.place S>>, capital and lowercase letters are treated as different.
|
|
|
|
\define .node-only-operator()
|
|
|
|
<$macrocall $name=".note" _="This operator is <<.em not>> available when ~TiddlyWiki is running in a web browser."/>
|
|
|
|
\end
|