Simple Alphanumeric Pagination

The below macro creates a list or (table of content) with clickable header for simple pagination based on alphanumeric indexes.

\define simple-pagination(scope:"[all[tiddlers]!is[system]]", stateTiddler:"")

<$let
    state        = "$:/temp/pagination/$(currentTiddler)$"
    tempTid      = {{{ [<__stateTiddler__>!is[blank]then<state>addsuffix[/$stateTiddler$]else<state>] }}}
    titlePrefix  = {{{ [<tempTid>get[text]] }}}
    listfilter   = "[uppercase[]prefix<titlePrefix>]"
>
<!-- create header -->
<$list filter="$scope$ :map[split[]first[]] +[uppercase[]unique[]sort[]]">
<$button><$text text=<<currentTiddler>> />
<$action-setfield $tiddler=<<tempTid>> text=<<currentTiddler>> />
</$button>
</$list>

<!-- generate outputs -->
<$list 
  filter="[subfilter<__scope__>filter<listfilter>sort[title]]"
  template="$:/core/ui/ListItemTemplate" 
/>

</$let>
\end
  • Examples

!! Example i
<<simple-pagination "[tag[Filter Operators]]">>

!! Example ii
<<simple-pagination scope:"[tag[Learning]]" stateTiddler:2>>

!! Example iii
<<simple-pagination scope:"[all[tiddlers+shadows]]" stateTiddler:3>>

Screenscast

img_840_msedge

Demo

Alternative solution

Another solution which produces only an alphabetic index is given here

Credit

@twMat, @TW_Tones, @saqimtiaz

References

3 Likes

6 posts were split to a new topic: Questions about “Simple Alphanumeric Pagination”

Please discuss and ask any questions in the following thread and update the wiki post above with any relevant details:

1 Like