Hi Tony,

 Clever solution. I bookmark this solution.

By the way as S. S above indicated there is some confusing cases with 
toc-macro uses caption/title when caption is not existed or empty. 
For my case, I need to remove the extra spaces when caption is used, and I 
realized that is because line breaks in my code!  See my first post above.

--Mohammad


On Friday, January 4, 2019 at 2:01:23 PM UTC+3:30, TonyM wrote:
>
> Mohammad,
>
> If the purpose of this macro is to show the caption then if not existing 
> the title then there is now a more elegant way.
>
> <$list filter="[all[current]has[caption]get[caption]] 
> ~[{!!title}]"></$list>
>
> However this returns a tiddler link even to the caption
>
> So Try this
> <$list filter="[all[current]has[caption]get[caption]] ~[{!!title}]" 
> variable=name>
> <$link to=<<currentTiddler>> tooltip="Custom tooltip"><<name>></$link>
> </$list>
>
> Or make a macro
> \define caption-title()
> <$list filter="[all[current]has[caption]get[caption]] ~[{!!title}]" 
> variable=name>
> <$link to=<<currentTiddler>> tooltip="Custom tooltip"><<name>></$link>
> </$list>
> \end
>
> and use <<caption-title>> no paramters to always show first the caption, 
> then the titlewith an active link.
>
> Regards
> Tony
>
>
> On Friday, 4 January 2019 19:18:46 UTC+11, Mohammad wrote:
>>
>> I have a macro as below to show the title or caption of a tiddler based 
>> on the availability of caption field
>>
>> \define mac(tid)
>> [<$view tiddler=$tid$ field="caption">
>> <$view tiddler=$tid$ field="title"/>
>> </$view>]
>> \end
>>
>> Then I have several tiddlers like t-2016, t-2017, t-2018, t-2019. The two 
>> tiddler t-2017 and t-2018 also have c-2017 and c-2018 as caption.
>>
>> Using the above macro as below gives the below results
>>
>> Note <<mac t-2017>> and <<mac t-2018>> and <<mac t-2019>> and  <<mac t-
>> 2016>> give different result.
>>
>> Result:
>>
>> Note [c-2017] and [c-2018] and [ t-2019 ] and [ t-2016 ] give different 
>> result.
>>
>> As you can see extra spaces are inserted when title is shown! What is the 
>> problem.
>>
>> --Mohammad
>>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/14ea5924-4753-4fca-b35a-5f8d2f1cef47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to