Slider Macro II

Hi, I am using the following slider II macro

\define slider-ii(title)
<$set name="revealState" value=<<qualify "$:/state-reveal-$title$">>>
<style>.ac-btn{font-weight:500}.ac-dtl{margin-top:0.0rem;padding:0 5px;}open</style>
  <$reveal type="nomatch" state=<<revealState>> text="yes">
    <$button class="tc-btn-invisible tc-tiddlylink" set=<<revealState>> setTo="yes">
      {{$:/core/images/right-arrow}}
    </$button>
  </$reveal>
  <$reveal type="match" state=<<revealState>> text="yes">
    <$button class="tc-btn-invisible tc-tiddlylink" set=<<revealState>> setTo="no">
      {{$:/core/images/down-arrow}}
    </$button>
  </$reveal>
  <$view tiddler="$title$" field="caption">
    <$view tiddler="$title$" field="title"></$view>
  </$view>
  

<$reveal type="match" state=<<revealState>> text="yes">
<$transclude tiddler="$title$" mode="block" />
</$reveal>
</$set>
\end

Works exactly how I need it to hide blocks of text in a tiddler. It uses the caption of the tiddler to label the slider, which is fine, but I would like to format part of the label in bold. I tried to add the formatting to the caption field but it just prints the characters instead of formatting them. Is this achievable?

G’day,

What you provided, is that the unmodified slider II macro, or your modified version?

If it is a modified version, could you post the original?

Hi!

No, i made no changes to it. I got it from here

https://kookma.github.io/TW-Scripts/

actually, I tell a Lie. I added the <style> tags at the top but nothing functional. Here is the macro anyway:

\define slider-ii(title)
<$set name="revealState" value=<<qualify "$:/state-reveal-$title$">>>
<h2>
  <$reveal type="nomatch" state=<<revealState>> text="yes">
    <$button class="tc-btn-invisible tc-tiddlylink" set=<<revealState>> setTo="yes">
      {{$:/core/images/right-arrow}}
    </$button>
  </$reveal>
  <$reveal type="match" state=<<revealState>> text="yes">
    <$button class="tc-btn-invisible tc-tiddlylink" set=<<revealState>> setTo="no">
      {{$:/core/images/down-arrow}}
    </$button>
  </$reveal>
  <$view tiddler="$title$" field="caption">
    <$view tiddler="$title$" field="title"></$view>
  </$view>
  
</h2>

<$reveal type="match" state=<<revealState>> text="yes">
<$transclude tiddler="$title$" mode="block" />
</$reveal>
</$set>
\end

Try using the TranscludeWidget instead of the ViewWidget for your outer caption:

… instead of:

Edited to correct the code snippet above (which explains the next three posts in this thread).

Legend! works like a dream!

If you dont mind, can you explain the difference between the transclude and view widgets?

Oh! wait! the formatting is displayed now, but when I click it, it dosent display the tiddler

D’oh! I forgot to change the closing tag from </$view> to </$transclude>!

Yep! that did the trick! Should have probably spotted that myself but dont fully understand the macro :stuck_out_tongue:

Thanks!

You’ll likely get a better answer from someone else, but my understanding is <$view> is oriented more toward getting the raw contents of a field whereas <$transclude> actually parses those contents (HTML or wikitext) and renders them as a finished product.

Glad that did the trick! You would not want to know how I tried to solve a similar issue a while back for myself. :sweat_smile:

Lol! was it a little over complicated? :stuck_out_tongue: