Hi Eskha,

Please use this second attached file. The previous one had a small issue in
variable definition.


Best wishes
Mohammad


On Sun, Feb 28, 2021 at 9:45 AM Mohammad Rahmani <[email protected]>
wrote:

> Hi Eskha,
>  This is revision 2 of list-pages. It now combines the features of
> list-search by Tobias Beer and the first release of list-pages.
>  I have attached the second release called list-pages-search.
>
> Simply download attached file and drag and drop into
> https://tiddlywiki.com/
> Open the Test List-Pages-Search and see how it works.
>
>
> Please let me know if it works as you explained! I will later add this to
> Yazd/TW-Scripts for future references.
>
>
> Best wishes
> Mohammad
>
>
> On Wed, Feb 24, 2021 at 6:41 PM Eskha <[email protected]> wrote:
>
>> Hello Mohammad,
>>
>> Thank you for this useful macro.
>>
>> I was wondering if it was possible to integrate it with Tobias
>> list-search macro (see below) since it would be a very powerful combination?
>>
>> Best regards,
>>
>> Eskha
>>
>>
>> \define list-search(
>> filter:"[tags[]]",
>> search:"search:title",
>> state:"$:/temp/list-search",
>> template:"$:/core/ui/ListItemTemplate",
>> placeholder:"Filter",
>> limit:100000
>> )
>> <div>
>> <$edit-text
>> tiddler="$state$"
>> type="search"
>> tag="input"
>> default=""
>> placeholder="$placeholder$"/>
>> </div>
>>
>> <$reveal state="$state$" type="match" text="">
>> <$list filter="$filter$+[limit[$limit$]]" template="$template$"/>
>> </$reveal>
>>
>> <$reveal state="$state$" type="nomatch" text="">
>> <$list filter="$filter$+[$search${$state$}]+[limit[$limit$]]"
>> template="$template$"/>
>> </$reveal>
>> \end
>>
>>
>> Le mercredi 24 février 2021 à 13:28:07 UTC+1, Mohammad a écrit :
>>
>>> In the call to *qualify *the xx$/state is used on purpose to see the
>>> stateTid
>>> Remove xx after test!
>>>
>>> Best wishes
>>> Mohammad
>>>
>>>
>>> On Wed, Feb 24, 2021 at 3:55 PM Mohammad Rahmani <[email protected]>
>>> wrote:
>>>
>>>> I have developed a* list-pages* macros similar to list-links, but it
>>>> is a little lengthy
>>>>
>>>> \define list-pages(filter, entries-per-page:5, template,
>>>> stateTid:"pagingTid")
>>>> <$vars stateTid=<<qualify xx$/state/$stateTid$>> >
>>>> <$vars total-entries={{{ [subfilter<__filter__>count[]] }}}
>>>> page-number={{{[<stateTid>get[text]] ~[[1]]}}} >
>>>> <$vars
>>>> low={{{[<page-number>subtract[1]multiply<__entries-per-page__>]}}}
>>>>        high={{{[<page-number>multiply<__entries-per-page__>]}}} >
>>>>
>>>> <!-- create nav buttons --->
>>>> <$list filter="[<page-number>compare:number:lt[2]then[yes]else[no]]"
>>>> variable=state>
>>>> <$button disabled=<<state>> >Prev
>>>> <$action-listops $tiddler=<<stateTid>> $field=text
>>>> $subfilter="+[subtract[1]] ~[[1]]"/>
>>>> </$button>
>>>> </$list>
>>>> <$list
>>>> filter="[<high>compare:number:gteq<total-entries>then[yes]else[no]]"
>>>> variable=state>
>>>> <$button disabled=<<state>>>Next
>>>> <$action-listops $tiddler=<<stateTid>> $field=text
>>>> $subfilter="+[add[1]] ~[[2]]"/>
>>>> </$button>
>>>> </$list>
>>>>
>>>> Displaying <$text text={{{[<low>add[1]]}}}/> through <<high>> of
>>>> <<total-entries>> Results
>>>>
>>>> <$list filter="[subfilter<__filter__>first<high>]
>>>> -[subfilter<__filter__>first<low>]" template=<<__template__>> />
>>>>
>>>> </$vars>
>>>> </$vars>
>>>> </$vars>
>>>> \end
>>>>
>>>>
>>>> It accepts:
>>>> * any Tiddlywiki filter or filter combinations
>>>> * it accepts template (so it is very powerful in creating different
>>>> outputs
>>>> * can be used in a tiddler several times (has stateTid)
>>>> * number of output per page can be set
>>>>
>>>> This macro can be hacked and used for situations where you have too
>>>> many outputs. Paging prevents a long output and hence slows down TW
>>>> performance!
>>>>
>>>> *Evaluations*
>>>> To give a try, download attached JSON and drag and drop into
>>>> https://tiddlywiki.com/
>>>> Look at the Test tiddler
>>>> As an example a simple template was created for test purposes.
>>>>
>>>> *Question:*
>>>> What simpler solution do you propose?
>>>> What improvement do you suggest?
>>>>
>>>>
>>>> Best wishes
>>>> Mohammad
>>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "TiddlyWiki" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/tiddlywiki/24fce8f6-f523-4cb4-b54f-9027b04b4c23n%40googlegroups.com
>> <https://groups.google.com/d/msgid/tiddlywiki/24fce8f6-f523-4cb4-b54f-9027b04b4c23n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMCSgn1EnTn%2BHWZ7REBK%3D8aa8bi0pnraGrJf-DTnYxzMYQ%40mail.gmail.com.

Attachment: list-pages-search-macro-with-example.json
Description: application/json

Reply via email to