On Wednesday, June 9, 2021 at 9:53:36 AM UTC-7 [email protected] wrote:

> I can't figure out how to:
> 1) Make the toc div text a variable, named tocscript, to call it in the 
> script like the fields, so I can add it to the new tiddler being created.
>

Move the toc div text into a macro named "tocscript".  Macros are 
essentially variables that can accept parameters.

2) Update the tag name in the toc-selective-expandable macro before it is 
> added to the new tiddler being created.
>

Within a macro, there are two forms of syntax that are automatically 
replaced when the macro is processed:
* instances of $paramname$ are replaced by corresponding values that are 
passed to the macro as parameters
* instances of $(varname)$ are replaced by corresponding values that are 
defined in variables before the macro is invoked

Thus, for your purposes:
\define temp() $:/temp/input/$(currentTiddler)$

\define tocscript()
<div class="tc-table-of-contents">
<<toc-selective-expandable "$(storyabbrev)$" "sort[title]">>
</div>
\end

|      Story Name:|<$edit-text tiddler=<<temp>> field="storyname"/>    |
|   Story Abbreviation:|<$edit-text tiddler=<<temp>> field="storyabbrev"/>  
|

<$tiddler tiddler=<<temp>>>
<$button> Create Story
   <$vars storyabbrev={{!!storyabbrev}}>
   <$action-setfield $tiddler={{!!storyabbrev}} text=<<tocscript>> 
tags="Stories" />
   <$action-setfield $tiddler={{{ [{!!storyabbrev}addsuffix[ Chapter 001]] 
}}} tags={{!!storyabbrev}} />
   <$action-deletetiddler tiddler=<<temp>> />
   </$vars>
</$button>
</$tiddler>
 
Notes:
* The $vars widget fetches the !!storyabbrev input value to turn it into a 
variable named "storyabbrev", so that it can then be automatically replaced 
in the tocscript macro
* I don't see anywhere that you actually use the "!!storyname" input value

enjoy,
-e

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/5a0abe47-7b1f-47cc-ac18-83fb3b400a66n%40googlegroups.com.

Reply via email to