Hi,
I want to contstruct a complex string(namely content
at ② and ④) with a variable(namely tocTag
at ①), which is read from another tiddler. I tried several ways however none of them works.
- In line ②:the variable
tocTag
is not passed intoformatTemplate
macro - In line ④:the variable
tocTag
is not be replaced either
And I know $xxx$
is used to substituted variables defined in parameters list, it is just an example in my code. So I want to know:
- Any way to pass a variable into a macro, or
- Any way to replace placeholder with a “local” variable, or
- Is there a more simpler way to solve this problem
Thanks
\define lingo-base() $:/language/Sidebar/TabManager
\define formatTemplate(tocTag)
<div class="tc-table-of-contents">
<<toc-selective-expandable "$tocTag$">>
</div>
\end
\define add-tab-action()
<$list filter="[<stateTiddler>get[tabName]trim[]!is[blank]]" variable="ignore">
<$set name="tocTag" filter="[<stateTiddler>get[tagName]]"> # ① got tagName and assign to tocTag
<$set name="content" value=<<formatTemplate $tocTag$>> > # ② I want pass tocTag to another macro, however this won't work
<$action-createtiddler
$basetitle={{{ [<stateTiddler>get[tabName]] }}}
$savetitle="$:/temp/Sidebar/TabManager/new-tab"
text=<<content>> # ③ this works, however the content is wrong...
text="....$tocTag$..." # ④ this won't work, anyway to do substitution with the `content` variable
/>
</$set>
</$set>
</$list>
\end