It graphically expands each of the listed tiddlers’ contents when you click each title (as opposed to just being a typical Table of Contents of titles)
Checkbox State Gets Created for the Global Macro Tiddler
This has come down to one thing: how to use a variable or parameter in order to specify a dynamic field name after two exclamation marks for the reveal state
I tried:
using the parameter
<$reveal state=“!!$param$”
using a variable to concatenate the exclamation marks
value=‘!!$param$’
or: value=‘“!!$param$”’
<$reveal state=“$(variable)$”
or: <$reveal state=“.<.<variable.>.>”
removing the quotes brakes it
(The fields and field values get successfully created. But it is simply does not seem syntactic to use a param or var in order to dynamically create a field name.)
Note: It works if you manually enter one of the dynamically created fields:
One possible approach is to use a filter, or the new function definitions
For example {{{ [all[current]get<fieldname>] }}} Will return the content of the field named in the “dynamic” variable fieldname.
Note $(streveal)$ returns the value of the variable “streveal”, but only in some specific cases, such as inside a \define macroname() or the new backtick parameter attributes.
As you did not show if your reveal was in a macro, I can not tell if you are using $(streveal)$ correctly.
All I need to do at this point is get some portion of “qualified” text substituted into that reveal statement - even if for instance it involves replacing larger portions of the reveal statement.
It really seems like it’s simply a syntax issue - some arrangement of quote marks. But I’m really stumped at this point.
“re-writing” the code: yeah unfortunately there are a couple precarious things about this from the get-go.
The whole thing is based on a checkbox, and checkboxes use a state field. I tried to use a “bound” “index”, but that’s also NOT a state tiddler. That’s a data field for a data tiddler.
The macro ends up successfully creating multiple qualified state fields on the content tiddler, for every list the tiddler is tagged in. It’s just that close to working.
As a sidenote: In conjunction with the list widget: I was thinking that the aspect of this being a checkbox is what made it work this way. (That’s a statement and a question.) It might definitely require a complete re-write for buttons.
Sometimes it helps if you state what you want clearly rather than what you need to fix, because there may be other approaches, and others may find it easier to answer.
Like have you tried the TOC expandable macro etc…?
I haven’t tested this in the context of your macro—and in fact, I suspect that it won’t work with your current stnam parameter, as @TW_Tones pointed out. But generally speaking I would try using a substituted attribute value like
<$reveal state=`!!$(param)$`
Note the backticks, not quote marks, around the attribute value.
Here’s a minimal example that should work inside or outside a macro. I added a button purely for ease of testing:
Now that I got the macro worked out, it’s time to make it a procedure. haha
I got hung up on stateTitle vs stateField. “Title” is not the title of the field, but the title of the tiddler that has the field. Field is not the value of the field, but the name/title of the field that has the value. badoink
And of course, <<currentTiddler>> gets more confusing when dealing with the list widget.
I’m still stumped as to why let must be used instead of set.