Nice. Thank you!
On Friday, April 24, 2020 at 7:04:16 PM UTC-4, TonyM wrote:
>
> David,
>
> You mention context. My New tiddler button looks something like this
>
> <$button>
> <$action-sendmessage $message="tm-new-tiddler"
> title="Task" tags="Task"
> priority="3"
> domain={{!!domain}}
> project={{!!project}}
> client={{!!client}}
> />
> New Task
> </$button>
>
> So basically new tiddlers are created with the same context (in fields) as
> the tiddler where I use the button. The view template displays the new
> button.
>
> Regards
> Tony
>
> On Saturday, April 25, 2020 at 5:52:37 AM UTC+10, David wrote:
>>
>> I'm glad both of you guys chimed in. I learned from both your
>> perspectives.
>>
>> On Friday, April 24, 2020 at 1:54:37 PM UTC-4, Mark S. wrote:
>>>
>>> This is actually a version of a problem that comes up frequently -- how
>>> to concatenate a variable or transclusion into a string.
>>>
>>> This:
>>>
>>> tags="Task <<thisContext>>"
>>>
>>> will not work. It won't create a string with "Task" and the value of
>>> <<thisContext>> >
>>>
>>> This is called concatenation. If you look for "concatenation" on
>>> TiddlyWiki.com there's at least one howto. Unfortunately, it's not the word
>>> that automatically springs to people's heads.
>>>
>>> The two main ways around this problem is to use either {{{ }}} notation
>>> with a addprefix/addsuffix filter operator, or to use a helper macro.
>>> Macro's have substitution variables. A variable for a passed parameter
>>> looks like $variable$ and a substitution variable for an environmental
>>> variable looks like $(variable)$.
>>>
>>> So, at the top of your tiddler create a macro like this:
>>>
>>> \define thebutton()
>>> <$button>
>>> <$action-sendmessage $message="tm-new-tiddler"
>>> title="Task"
>>> tags="Task $(thisContext)$"
>>> priority="3"
>>> />
>>> New Task for <<thisContext>>
>>> </$button>
>>> \end
>>>
>>> Then, down below replace the existing button code like this:
>>>
>>> <<theButton>>
>>>
>>> On Friday, April 24, 2020 at 9:53:26 AM UTC-7, David wrote:
>>>>
>>>> http://www.freezingcode.com/twTemp/category_name_20200424.html
>>>>
>>>> The above tiddlyWiki file illustrates my question.
>>>>
>>>>
>>>> The "New" button in the TODO tiddler (there is one "New" button per
>>>> context section) is supposed to create a new tiddler with tags
>>>> automatically added. One of the tags "Task" is hard coded, and should be.
>>>> The other tag is dynamic, and represents the current section Context (e.g.
>>>> "Context_Home" or "Context_Out", etc.) and is placed in that code,
>>>> hopefully, via a variable.
>>>>
>>>> When you click on one of the "New.." buttons, you'll get a new tiddler
>>>> draft, and notice that the current context is not one of the tags, but the
>>>> variable declaration is: <<thisContext>>. That is what is not working.
>>>>
>>>> This variable worked fine when the listWidget loop was looping over a
>>>> text string of gathered contexts. But the filter has been changed to loop
>>>> over tags now. Apparently that macro style syntax (i.e. <<thisContext>> )
>>>> doesn't quite work the same way now that the iterator is a tag.
>>>>
>>>> Notice also that the variable works in the Button Display Text area, so
>>>> we knot the variable is representing the right thing and is present at
>>>> that
>>>> point in the code.
>>>>
>>>> Thanks for Looking!
>>>>
>>>> <$button>
>>>> <$action-sendmessage $message="tm-new-tiddler"
>>>> title="Task"
>>>> tags="Task <<thisContext>>"
>>>> priority="3"
>>>> />
>>>> New Task for <<thisContext>>
>>>> </$button>
>>>>
>>>>
>>>>
--
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/1f4e30bc-f37e-40fe-8dd1-bb749c65c2a8%40googlegroups.com.