Hi Mark,
Thanks for that follow-up! I'm beginning to see (thanks to you and Mario) how this works.
OK,
so I now get how you can negate the sort order inside the macro (with a
bang). And then I see from the docs that the way that expression
evaluates is L-to-R via that "railroad" style
filter syntax.
And now I see how you can't get to the juicy inner goodness unless you explicitly flip that bang in the middle...
...which bothered me. So I extended your initial idea to allow an additional parameterization from outside:
\define timeline2(limit:"100",format:"DDth MMM YYYY",subfilter:"",sortaction"sort",dateField:"modified")
<div class="tc-timeline">
<$list filter="[!is[system]$subfilter$has[$dateField$]$sortaction$[$dateField$]limit[$limit$]eachday[$dateField$]]">
[...]
<$macrocall
$name="timeline2" subfilter=""
format={{$:/language/RecentChanges/DateFormat}} sortaction="sort"
dateField="created"/>
And so, I can make a call using a sortaction of "sort" or "!sort",
and control it from outside. Which works. And taught me a lot, so
thanks to you & Mario for investing your time explaining that to me.
Finally. some observations and questions for you veterans (keeping in mind that I'm not at all familiar with the code base yet):
- Keep
in mind I'm not a "macro-ey" kinda guy. I'm more of "function-ey" or
"object/method-ey" dude, so I'm sure you should take this with a bowling
ball sized grain of salf...
- It kind of "bothered" me that the
declaration "looks" like it has a "default parameterization", but does
not really. In other words, when you call the macro, if you don't
explicitly supply all parameters, it will fail. That seems a bit
fragile, right?
- Death by whitespace: I found out if there's any
leading whitespace (before the macro definition) the tiddler fails.
Also, if there's any whitespace in the filter list, it will fail.
Again, trying not to seem harsh, but it feels rather fragile. Am I
being unfair?
- Is this "macro-ey" stuff kind of like the STL in C++?
- Is
this "fragility" due to the macro mechanism itself? Or is it a
characteristic of JavaScript? Or CSS? Or HTML? Or some intersection
of those elements?
And, again,
most of all... THANKS for your explanations, which have been very useful
in helping me to spin up on the awesomeness that is TiddlyWiki!