This is a simple macro to generate output for a filter in a specified range! For example if your filter produces 100 output, you can call macro to display only output 10 to 20.
Use case: make a simple pagination macro!
Code and Demo
- Open https://tiddlywiki.com/prerelease/
- Create a new tiddler tagged it with
$:/tags/Macro
- Put the below script as its text
\define list-range(filter, lower, upper)
<$list filter=<<__filter__>> counter=n>
<$list filter="""
[<n>compare:integer:gteq[$lower$]]
:intersection[<n>compare:integer:lteq[$upper$]]""" variable=null>
<$text text={{{ [<n>pad[3]addsuffix[. ]] }}}/><$link/><br>
</$list>
</$list>
\end
- Save
Example
Display output 10-20 of tiddlers tagged with [tag[Filter Operators]]
and sorted by title.
- Create a new tiddler
- Call
list-range
as below
<<list-range filter:"[tag[Filter Operators]sort[title]]" lower:10 upper:20>>
Produces
- append Operator
- asin Operator
- atan Operator
- atan2 Operator
- average Operator
- backlinks Operator
- before Operator
- bf Operator
- butfirst Operator
- butlast Operator
- ceil Operator
Improvement
- Propose other simple filters
- Produce the result using one $list widget