Need help with an improvement for the Subsume plugin

Hi everyone

H La Vallee came up with an improvement to the Subsume plugin (The Subsume Plugin — Turn links into sliders!), so that it takes the caption field of a subsumed tiddler into account, and displays that in the details summary element rather than the tiddler title.

He (or maybe she? I don’t know what the H stands for, and don’t want to make assumptions) kindly gave me these snippets:

Here's my modified $:/plugins/giffmex/subsume/macro :

\define subsume(tid:"") <details><summary><$list filter="[[$tid$]has[caption]then{$tid$!!caption}else{$tid$!!title}]"><$text text=<<currentTiddler>>/></$list><$link to="$tid$">&nbsp;&nbsp;*&nbsp;</$link></summary><span class="indent1"><$transclude tiddler="$tid$" field="text" mode="block"/></span></details>

and the corresponding $:/plugins/giffmex/subsume/macro/subsume-edit :

\define subsume-edit(tid:"") <details><summary><$list filter="[[$tid$]has[caption]then{$tid$!!caption}else{$tid$!!title}]"><$text text=<<currentTiddler>>/></$list>&nbsp;<$button class="tc-btn-invisible"><$action-sendmessage $message="tm-edit-tiddler" $param="$tid$" />&nbsp;^^{{$:/core/images/edit-button}}^^&nbsp;&nbsp;</$button></summary><span class="indent1"><$transclude tiddler="$tid$" field="text" mode="block"/></span></details>

They work great, generally, but tiddler titles that end in ! break them. He wasn’t sure how to fix it, so he recommended asking here.

I do like the improvement of incorporating the caption field when there is one. Can anybody help with whatever little tweak it needs?

Thanks in advance for your help. Blessings, Dave

1 Like

thanks cskrisz, I will give these a try!

There no need to use has[caption]. Instead, just use get[caption], which only “returns” a value if the caption field has a non-blank value.

To display the caption or title as plain text, you can use the $text widget, like this:

<$text text={{{ [<__tid__>get[caption]else<__tid__>] }}}/>

Alternatively, you can use the $view widget with fallback content, like this:

<$view tiddler=<<__tid__>> field="caption">
   <$view tiddler=<<__tid__>> field="title"/>
</$view>

and if you want the caption or title to be wikified, use the $transclude widget:

<$transclude tiddler=<<__tid__>> field="caption">
   <$transclude tiddler=<<__tid__>> field="title"/>
</$transclude>
2 Likes

hi, this is H!
your solution using $view is great! It passed a test of using >>"""!! as the caption :slight_smile:
I was not aware of the syntax with underscores but it seems like they are a lot more versatile than the textreference method…

with that, the macro is now:

\define subsume(tid:"") <details><summary><$view tiddler=<<__tid__>> field="caption"><$view tiddler=<<__tid__>> field="title"/></$view><$link to="$tid$">&nbsp;&nbsp;*&nbsp;</$link></summary><span class="indent1"><$transclude tiddler="$tid$" field="text" mode="block"/></span></details>

and subsume-edit is:

\define subsume-edit(tid:"") <details><summary><$view tiddler=<<__tid__>> field="caption"><$view tiddler=<<__tid__>> field="title"/></$view>&nbsp;<$button class="tc-btn-invisible"><$action-sendmessage $message="tm-edit-tiddler" $param="$tid$" />&nbsp;^^{{$:/core/images/edit-button}}^^&nbsp;&nbsp;</$button></summary><span class="indent1"><$transclude tiddler="$tid$" field="text" mode="block"/></span></details>

thanks much for your help and for Dave for the great plugin :slight_smile:
H / Scribs

Hi everyone

Thank you @Scribs for the recommended update to the Subsume Plugin, and to @EricShulman for the tweak to make it work correctly.

I have updated the Subsume plugin site and added instructions. See The Subsume Plugin — Turn links into sliders!

2 Likes