Hey Mark,
Just tried it out and everything worked perfectly! Did a little bit of
tweaking and things are well on their way to completion.
Thank you so much for the rapid and thorough response!
On Wednesday, May 31, 2017 at 5:31:36 PM UTC-7, Mark S. wrote:
>
> Your code changed a bit. I don't have time to explain what I did, but if
> you experiment with this it should help:
>
> Macro: createTaskTiddler
>
>
> \define basetitle() $(p1)$ Task: $(p2)$
> \define createTaskTiddler()
> <$edit-text tiddler="$:/state/new-task-title" tag="input" default=""
> placeholder="Task Title"/>
> <$button>
> <$vars p2={{$:/state/new-task-title!!text}} p1="$(curTag)$" >
> <$action-createtiddler $basetitle=<<basetitle>> tags="$(curTag)$"
> completed="false"/>
> </$vars>
> <$action-deletetiddler $tiddler="$:/state/new-task-title" />
> <$action-sendmessage $message="tm-auto-save-wiki"/>
> Add Task
> </$button>
> \end
>
>
> Template file (I took out the new sections you had added in order to
> concentrate on the naming code, but you can paste those back in):
>
>
> <$list filter="[is[current]tag[PR Tasks]]">
>
>
> <$set name="curTask" value=<<currentTiddler>>>
>
> <$list filter="[is[current]tags[]]+[!tag[PR Tasks]]">
> <$set name="curTag" value=<<currentTiddler>>>
>
> <<createTaskTiddler>>
>
>
> </$set>
> </$list>
> </$set>
>
> </$list>
>
> Quickly, $(var)$ and $var$ only work INSIDE a macro. They also only work
> when called from a prior macro (not inside the current macro). So if you
> define a variable and want to use it immediately, you have to invoke it
> like <<myvarname>>.
>
>
> Good luck,
> Mark
>
> On Wednesday, May 31, 2017 at 3:59:08 PM UTC-7, Matthew DeAbreu wrote:
>>
>> Hello!
>>
>> I've been using TW5 on and off for quite a while and I've recently
>> decided to use it for taking notes/tasks while working. As part of this I'd
>> like to have a quick and easy way to create tiddlers with a given prefix
>> (based on tags) and a name. I haven't done much in the way of customizing
>> TW5 before so most of this is quite new, any help/suggestions would be
>> appreciated.
>>
>> For example:
>> If I have a tiddler titled "PR123456 Tasks" tagged with "PR123456 [[PR
>> Tasks]]" I would like to have a text edit field that will take the task
>> name and produce a tiddler titled "PR123456 Task: task-name-here".
>>
>> Here's some sample code:
>>
>>
>> \define concat(word1 word2)
>> $word1$ $word2$
>> \end
>>
>>
>> \define createTaskTiddler(prefix tags)
>> <$edit-text tiddler="$:/state/new-task-title" tag="input" default=""
>> placeholder="Task Title"/>
>> <$button>
>> <$vars name={{$:/state/new-task-title!!text}}>
>> <$action-createtiddler $basetitle="$prefix$$(name)$" tags="$tags$"
>> completed="false"/>
>> </$vars>
>> <$action-deletetiddler $tiddler="$:/state/new-task-title"/>
>> <$action-sendmessage $message="tm-auto-save-wiki"/>
>> Add Task
>> </$button>
>> \end
>>
>>
>> <$list filter="[is[current]tags[]]+[!tag[PR Tasks]]">
>> <$set name="prNum" value=<<currentTiddler>>>
>> <$set name="prefix" value=<<concat $(prNum)$ "Task: ">>>
>>
>>
>> <<createTaskTiddler $(prefix)$ "$(prNum)$ Task">>
>>
>>
>> </$set>
>> </$set>
>> </$list>
>>
>>
>> You can view a semi working demo here:
>> https://tw.mdeabreu.com/work.html#PR123456%20Tasks
>> When you try it you should be able to see that when you attempt to add a
>> new task the tiddler created has the title "PR123456 Tasks: " but it is
>> failing to transclude the title.
>>
>> Any tips, help, and suggestions would be greatly appreciated.
>>
>> Thanks!
>>
>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/2e15540f-b943-44b0-82a2-3c3b40157a50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.