From a75d4ca003b1ed6d6f721a4bae8f546d7f15e067 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Sun, 10 Mar 2024 11:39:16 +0100 Subject: [PATCH] Docs - operator macros, templates and filter-run template (#8035) --- .../tiddlers/system/filter-run-template.tid | 31 ++++---- .../tiddlers/system/operator-macros.tid | 78 +++++++++++-------- .../tiddlers/system/operator-template.tid | 30 +++---- 3 files changed, 77 insertions(+), 62 deletions(-) diff --git a/editions/tw5.com/tiddlers/system/filter-run-template.tid b/editions/tw5.com/tiddlers/system/filter-run-template.tid index f812cdb96..73b4a2510 100644 --- a/editions/tw5.com/tiddlers/system/filter-run-template.tid +++ b/editions/tw5.com/tiddlers/system/filter-run-template.tid @@ -1,27 +1,28 @@ code-body: yes created: 20230316112235083 list-before: $:/core/ui/ViewTemplate/body -modified: 20230326145802667 +modified: 20240229161432000 tags: $:/tags/ViewTemplate title: $:/editions/tw5.com/filter-run-template type: text/vnd.tiddlywiki -\define .op-place() -<$macrocall $name=".if" - cond="""$(op-name)$""" - then="<<.place '$(op-name)$'>> = " - else=""/> -\end - -\define .op-row() -<$macrocall $name=".if" - cond="""$(op-body)$""" - then="""$(op-head)$<<.op-place>>$(op-body)$""" - else=""/> -\end - \whitespace trim +\procedure .op-place() +<% if [!is[blank]] %> + <$macrocall $name=".place" _=<> />= +<% endif %> +\end + +\procedure .op-row() +<% if [!is[blank]] %> + + <> + <<.op-place>><> + +<% endif %> +\end + <$list filter="[all[current]tag[Named Filter Run Prefix]]"> <$let op-head="" op-body="" op-name=""> diff --git a/editions/tw5.com/tiddlers/system/operator-macros.tid b/editions/tw5.com/tiddlers/system/operator-macros.tid index afa0593b1..2b19d56db 100644 --- a/editions/tw5.com/tiddlers/system/operator-macros.tid +++ b/editions/tw5.com/tiddlers/system/operator-macros.tid @@ -1,52 +1,66 @@ created: 20150117152607000 -modified: 20230617183916622 +modified: 20240229132501000 tags: $:/tags/Macro +code-body: yes title: $:/editions/tw5.com/operator-macros -\define .operator-examples(op,text:"Examples") <$link to="$op$ Operator (Examples)">$text$ + +\whitespace trim + +\procedure .operator-examples(op,text:"Examples") <$link to=`$(op)$ Operator (Examples)`><> \procedure .operator-example-tryit-actions() <$action-setfield $tiddler=<<.state>> text="show" filter=<>/> + \procedure .operator-example(n,eg,ie)
-<$list filter="[title<.state-prefix>addsuffix{!!title}addsuffix[/]addsuffix]" variable=".state"> -<$reveal state=<<.state>> type="nomatch" text="show"> - <$text text=<>/> - <$macrocall $name=".if" cond=<> then={{{[[
→ ]addsuffixaddsuffix[
]]}}}/> -
-
<$button actions=<<.operator-example-tryit-actions>>>Try it
-
- -<$reveal state=<<.state>> type="match" text="show"> - <$edit-text tiddler=<<.state>> field="filter" tag="input" type=search focus="true"/> -
-
- <$button set=<<.state>> setTo="">Hide - <$reveal stateTitle=<<.state>> stateField="filter" type="nomatch" text=<>> - <$button actions=<<.operator-example-tryit-actions>>>Reset - -
-
-
-
    <$list filter={{{[<.state>get[filter]]}}} emptyMessage="(empty)"> -
  • <$link><$view field="title"/>
  • -
-
- - + <$list filter="[title<.state-prefix>addsuffix{!!title}addsuffix[/]addsuffix]" variable=".state"> + <$reveal state=<<.state>> type="nomatch" text="show"> + <$text text=<>/> + <% if [!is[blank]] %> +
→ <>
+ <% endif %> +
+
<$button actions=<<.operator-example-tryit-actions>>>Try it
+
+ + <$reveal state=<<.state>> type="match" text="show"> + <$edit-text tiddler=<<.state>> field="filter" tag="input" type=search focus="true"/> +
+
+ <$button set=<<.state>> setTo="">Hide + <$reveal stateTitle=<<.state>> stateField="filter" type="nomatch" text=<>> + <$button actions=<<.operator-example-tryit-actions>>>Reset + +
+
+
+
    + <$list filter={{{[<.state>get[filter]]}}} emptyMessage="(empty)"> +
  • <$link><$view field="title"/>
  • + +
+
+ + +
\end -\define .inline-operator-example(eg) -<$text text=<<__eg__>>/> evaluates to <$list filter=<<__eg__>> emptyMessage="(empty)"> <$text text=<>/> +\procedure .inline-operator-example(eg) + + <$text text=<>/> + +evaluates to +<$list filter=<> emptyMessage="(empty)"> + <$text text=<>/> + \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() +\procedure .node-only-operator() <$macrocall $name=".note" _="This operator is <<.em not>> available when ~TiddlyWiki is running in a web browser."/> \end - -
<$view field="text"/>
\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/system/operator-template.tid b/editions/tw5.com/tiddlers/system/operator-template.tid index 88bee6a24..f4f3e08ef 100644 --- a/editions/tw5.com/tiddlers/system/operator-template.tid +++ b/editions/tw5.com/tiddlers/system/operator-template.tid @@ -1,26 +1,26 @@ created: 20150203173506000 +modified: 20240229155612000 list-before: $:/core/ui/ViewTemplate/body -modified: 20230602181119360 tags: $:/tags/ViewTemplate code-body: yes title: $:/editions/tw5.com/operator-template -\define .op-place() -<$macrocall $name=".if" - cond="""$(op-name)$""" - then="<<.place '$(op-name)$'>> = " - else=""/> -\end - -\define .op-row() -<$macrocall $name=".if" - cond="""$(op-body)$""" - then="""
""" - else=""/> -\end - \whitespace trim +\procedure .op-place() +<% if [!is[blank]] %> + <$macrocall $name=".place" _=<> />= +<% endif %> +\end + +\procedure .op-row() +<% if [!is[blank]] %> + + + +<% endif %> +\end + <$list filter="[all[current]tag[Filter Operators]]"> <$let op-head="" op-body="" op-name="">
$(op-head)$<<.op-place>>$(op-body)$
<><<.op-place>><>