In another thread I used a macro to solve an issue:
I really need to get better at the new things. So I thought that this was a good candidate to use a procedure instead. I thought it would be a mechanical transformation. But it hasn’t worked yet, and I’m wondering if someone might be able to offer guidance.
The macro begins like this:
\define paginate(filter) <!--
^^^^^^^ -->
<$let
start={{{ [{!!page-number}subtract[1]multiply{!!items-per-page}] }}}
count= {{{ $filter$ +[count[]] }}}
<!-- ^^^^^^^^ -->
last-page={{{ $filter$ +[count[]divide{!!items-per-page}ceil[]] }}}
<!-- ^^^^^^^^ -->
>
<$list filter="$filter$ +[butfirst<start>first{!!items-per-page}]" >
<!-- ^^^^^^^^ -->
<!--- ... -->
So my naive attempt was just to change to this:
\procedure paginate(filter) <!--
^^^^^^^^^^ -->
<$let
start={{{ [{!!page-number}subtract[1]multiply{!!items-per-page}] }}}
count= {{{ <<filter>> +[count[]] }}}
<!-- ^^^^^^^^^^ -->
last-page={{{ <<filter>> +[count[]divide{!!items-per-page}ceil[]] }}}
<!-- ^^^^^^^^^^ -->
>
<$list filter="<<filter>> +[butfirst<start>first{!!items-per-page}]" >
<!-- ^^^^^^^^^^ -->
<!--- ... -->
and switch the $:/tags/Macro
to $:/tags/Global
.
This doesn’t work at all. Logging the <$let ...>
variables, I get
start:0, count:1 last-page:1
When I get these with the macro:
start: 10, count: 60, last-page: 12
So I know I’m off to the wrong start. Am I just using the wrong syntax, or is there something more fundamental wrong with this idea?