Uhhh, scratch the "leading whitespace fragility" question.  I need to chase 
my own sloppiness down...  :-)


On Thursday, February 23, 2017 at 10:34:03 PM UTC-8, Daniel Cunningham 
wrote:
>
> 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 
> <http://tiddlywiki.com/#Filter%20Expression>.
>
> 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!
>
>
>
> On Thursday, February 23, 2017 at 5:42:43 PM UTC-8, Mark S. wrote:
>>
>> Hi Daniel,
>>
>> Mario's syntax uses the macrocall widget, which is a somewhat more formal 
>> way of calling a macro that works better in some situations.
>>
>> The problem with the timeline macro is that it doesn't give you access to 
>> the sorting order (A/D), as you can see in this filter:
>>
>> [!is[system]$subfilter$has[$dateField$]*!**sort*[$dateField$]limit[
>> $limit$]eachday[$dateField$]]
>>
>> You can't reach the *!sort* in the macro invocation. You can try putting 
>> the following into a tiddler, which is modified from the original timeline 
>> code:
>>
>> \define timeline2(limit:"100",format:"DDth MMM YYYY",subfilter:"",
>> dateField:"modified")
>> <div class="tc-timeline">
>> <$list filter=
>> "[!is[system]$subfilter$has[$dateField$]sort[$dateField$]limit[$limit$]eachday[$dateField$]]"
>> >
>> <div class="tc-menu-list-item">
>> <$view field="$dateField$" format="date" template="$format$"/>
>> <$list filter=
>> "[sameday:$dateField${!!$dateField$}!is[system]$subfilter$sort[$dateField$]]"
>> >
>> <div class="tc-menu-list-subitem">
>> <$link to={{!!title}}>
>> <<timeline-title>>
>> </$link>
>> </div>
>> </$list>
>> </div>
>> </$list>
>> </div>
>> \end
>> <$macrocall $name="timeline2" subfilter="" format={{$:/language/
>> RecentChanges/DateFormat}} dateField="created"/>
>>
>> It seemed to work in my quick test, though I didn't look at dates too 
>> closely. 
>>
>> Good luck!
>> Mark
>>
>>
>> On Thursday, February 23, 2017 at 4:12:26 PM UTC-8, Daniel Cunningham 
>> wrote:
>>>
>>> Many thanks, Mario!  I tried that, and it works.  
>>>
>>> But rather than change a shadow tiddler, I elected to put in into a 
>>> "end-user" tiddler, that I can then place in the sidebar with a 
>>> "$:tags/SideBar" tag.  That gives me the functionality I was looking for.  
>>> Also, I won't shoot myself in the foot if core changes during my "learning 
>>> curve".  :-)
>>>
>>> As a follow-up, the results are still in descending order (same as the 
>>> original Recent tab functionality).  So, to get ascending order, I recon I 
>>> should apply a sort operator to the results of your code segment.  But the 
>>> syntax of your code is very different than that shown in the docs -- can 
>>> you give guidance on this?
>>>
>>> Best,
>>>
>>> -- Daniel
>>>
>>>
>>> On Wednesday, February 22, 2017 at 4:22:50 PM UTC-8, PMario wrote:
>>>>
>>>> On Wednesday, February 22, 2017 at 11:48:49 PM UTC+1, Daniel Cunningham 
>>>> wrote:
>>>>>
>>>>> And then what you are saying is that since this is embedded in the 
>>>>> timeline macro, any sort criteria I try to apply to "created" will be to 
>>>>> no 
>>>>> avail?
>>>>>
>>>>
>>>> Have a look at the docs: http://tiddlywiki.com/#timeline%20Macro
>>>>  
>>>>
>>>>>
>>>>> Unless... I clone the macro & modfify it to use the "created" field?
>>>>>
>>>>
>>>> Edit: $:/core/ui/SideBar/Recent 
>>>> <http://tiddlywiki.com/#%24%3A%2Fcore%2Fui%2FSideBar%2FRecent>
>>>>
>>>> like so: <$macrocall $name="timeline" 
>>>> format={{$:/language/RecentChanges/DateFormat}} dateField="created"/>
>>>>
>>>> and you should be good to go. 
>>>>
>>>> have fun!
>>>> mario
>>>>
>>>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/837cdb0c-1113-4ba9-8395-79dbc3210f7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to