How to tansfer Macro to Procedure?

I made a simple Macro for get the list top10

\define list-top10(myfilter)
<$list filter="$myfilter$ +[limit[10]]" variable="current">
 <<current>><br>
</$list>
\end

<<list-top10 "[!is[system]]">>

But when I transfer the Macro to Procedure, it doesnt work.

\procedure list-top10(myfilter)
<$list filter="<<myfilter>> +[limit[10]]" variable="current">
 <<current>><br>
</$list>
\end

<<list-top10 "[!is[system]]">>

How to fix it correctly?

Because you cant use the old form of substitution you need to use a way to treat the value a a filter.

\procedure list-top10(myfilter)
<$list filter="[subfilter<myfilter>] +[limit[10]]" variable="current">
 <<current>><br>
</$list>
\end

<<list-top10 "[!is[system]]">>

You dont need to change it, but its good to learn

3 Likes

Within the $list filter, you can use the [subfilter<varname>] syntax, like this:

<$list filter="[subfilter<myfilter>] +[limit[10]]" variable="current">

enjoy,
-e

3 Likes