1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-06 18:16:18 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/system/operator-macros.tid

67 lines
2.2 KiB
Plaintext

created: 20150117152607000
modified: 20240229132501000
tags: $:/tags/Macro
code-body: yes
title: $:/editions/tw5.com/operator-macros
\whitespace trim
\procedure .operator-examples(op,text:"Examples") <$link to=`$(op)$ Operator (Examples)`><<text>></$link>
\procedure .operator-example-tryit-actions() <$action-setfield $tiddler=<<.state>> text="show" filter=<<eg>>/>
\procedure .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">
<code><$text text=<<eg>>/></code>
<% if [<ie>!is[blank]] %>
<dd>&rarr;&nbsp;<<ie>></dd>
<% endif %>
<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>
</div>
\end
\procedure .inline-operator-example(eg)
<code>
<$text text=<<eg>>/>
</code>
<span class="tc-tiny-gap">evaluates to</span>
<$list filter=<<eg>> emptyMessage="(empty)">
<code class="tc-tiny-gap-left"><$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.
\procedure .node-only-operator()
<$macrocall $name=".note" _="This operator is <<.em not>> available when ~TiddlyWiki is running in a web browser."/>
\end