Hello and thank you very much! I'll take a look and provide any feedback I 
can.

It seems my biggest issue is not having examples that allow me to confirm 
what I'm thinking with what I read. Or at least not having them where I 
think they should be based on where I'm looking inside TiddlyWiki.

IE:

When trying to find the define solution for the toc code above I searched 
the following Tiddlers for a matching example.

https://tiddlywiki.com/#ButtonWidget
https://tiddlywiki.com/#Variables
https://tiddlywiki.com/#Variables%20in%20WikiText
https://tiddlywiki.com/#Macro%20Definitions%20in%20WikiText
https://tiddlywiki.com/#Macros%20in%20WikiText
https://tiddlywiki.com/#Macro%20Calls%20in%20WikiText
https://tiddlywiki.com/#Macro%20Calls%20in%20WikiText%20(Examples)
https://tiddlywiki.com/#dumpvariables%20Macro
https://tiddlywiki.com/#dumpvariables%20Macro%20(Examples)
https://tiddlywiki.com/#variables%20Operator
https://tiddlywiki.com/#variables%20Operator%20(Examples)

Now, after receiving the help from earlier, when I went back and looked at 
the tiddlers in question I noticed this:

\define dumpvariables()
<ul>
<$list filter="[variables[]]" variable="varname">
<li>
<strong><code><$text text=<<varname>>/></code></strong>:<br/>
<$codeblock code={{{ [<varname>getvariable[]] }}}/>
</li>
</$list>
</ul>
\end

and also 

Several of the examples 
on https://tiddlywiki.com/#Macro%20Definitions%20in%20WikiText that also 
nearly match the code provided above in the replies. 

However, for some reason (probably on my side of things) the above example 
and

\define sayhi(name:"Bugs Bunny" address:"Rabbit Hole Hill")
 Hi, I'm $name$ and I live in $address$. 
\end

Didn't seem to be the same to me. In fact, the only reason I was able to 
finally figure out the following was because I knew it should work like the 
code given so it was just a matter of process of elimination. Until a few 
minutes ago, and only because I knew the example worked, as well as the 
code given above for me to consider, was I finally able to see where they 
got "Bugs" from i the output.

\define say-hi-using-variables() 
Hi, I'm $(name)$ and I live in $(address)$. 
\end 

 \define name() Bugs

<$set name="address" value="Rabbit Hole Hill"> 
<<say-hi-using-variables>>
 </$set>

Hi, I'm Bugs and I live in Rabbit Hole Hill.

Long story short, I may just represent an outlier scenario and if that is 
the case I apologize in advance for any easy questions. Of course, I will 
still read over everything and will be sure to ask questions!
On Wednesday, June 9, 2021 at 7:02:00 PM UTC-4 TW Tones wrote:

> iamdar,
>
> Here is a link to some documentation that may help you more generally at 
> this phase of your learing, 
> https://anthonymuscio.github.io/#Standard%20Nomenclature
>
> Its an updated version of something published by Tobias in the past. In 
> particular look at the foot notes about values in parameters widget and 
> HTML, it shows why any "concatenation" to make compound values needs to be 
> done, as ewrioc says the best way without making custom macros and 
> wikifying them is to use the filtered transclusions.  With these you use a 
> filter inside triple curly braces to generate the value (no need for an 
> intermediate variable) and filters permit variables, transclusions and 
> field content to be concatinated.
>
> Also, As someone in the learning phase please do feedback if you need 
> something clarified or added to my document as you have the insight to what 
> is needed during the learning process, unfortunately I now know too much. 
> You can help other that pass this way in the future.
>
> Regards
> Tones
>
>
>
>
> On Thursday, 10 June 2021 at 04:37:15 UTC+10 iamdar...@gmail.com wrote:
>
>> Thank you so much Eric! Really thank you so much! I'm a little happy to 
>> see I was kind of heading in the right direction at one point earlier, 
>> except I put the \end of the tocscript define below the </$tiddler> because 
>> I was afraid it wouldn't include itself in the button code and it broke it 
>> lol. Also thank you very much for providing the explanations as well! 
>>
>> The !!storyname was actually left over from the step before this one. I 
>> hadn't considered having a dynamic toc at first. Though now I'll use it in 
>> the tocscript to help identify the page a bit better. Thank you for looking 
>> that closely at the script!
>>
>>
>>
>> On Wednesday, June 9, 2021 at 2:05:23 PM UTC-4 Eric Shulman wrote:
>>
>>> On Wednesday, June 9, 2021 at 9:53:36 AM UTC-7 iamdar...@gmail.com 
>>> 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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b40192a5-4341-4e14-b3d9-cacb70edf67dn%40googlegroups.com.

Reply via email to