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

Greetings.
Due to $param="$tid$" and

"$:/plugins/giffmex/subsume/macro/subsume-edit": {
            "text": "\\define subsume-edit(tid:\"\") <details><summary><$view tiddler=\"$tid$\"

in $:/plugins/giffmex/subsume/macro/subsume-edit , Rename on Relink only work in <<subsume-edit>> after changing relink config code below

 "$:/config/flibbles/relink/macros/subsume-edit/tide": {
            "text": "title",
            "title": "$:/config/flibbles/relink/macros/subsume-edit/tide",
        },
"$:/config/flibbles/relink/macros/subsume-edit/tid": {
            "text": "title",
            "title": "$:/config/flibbles/relink/macros/subsume-edit/tide",
        },

please fix it!

PS: How can I change the version number 1.0.3?

Hi @HydroWood0 , I am not ignoring you. I have a business trip for a few days and am pretty swamped. But I hope to get to this by the end of the week.

1 Like

Hi @HydroWood0 ,

I am not understanding you. Precisely what tiddler did you update with your snippet? (I have pasted it below)

 "$:/config/flibbles/relink/macros/subsume-edit/tide": {
            "text": "title",
            "title": "$:/config/flibbles/relink/macros/subsume-edit/tide",
        },
"$:/config/flibbles/relink/macros/subsume-edit/tid": {
            "text": "title",
            "title": "$:/config/flibbles/relink/macros/subsume-edit/tide",
        },

$__plugins_giffmex_subsume.json (5.2 KB)

Sorry for my poor expression. This is the edited source code.

2 Likes

Hi @HydroWood0

I finally got to look at this. First, it is not clear from your original post what is wrong with the Subsume-edit macro. If you could show me the code here, of both my current tiddler text, and what you would like to correct it to, hopefully I will see better what you are asking for, and can help you.

The json that you sent me has an old version of the tiddler in question ($:/plugins/giffmex/subsume/macro/subsume-edit), that did not include the code for using captions. So I will not change my tiddler to that, since I don’t want to lose that functionality.

The version number of the plugin is in the version field of the main plugin tiddler ($:/plugins/giffmex/subsume/). I think you might be able to change that yourself.