How to build a tag list for comsuption by <$action-sendmessage $message="tm-new-tiddler" ... />?

65 views
Skip to first unread message

markh...@gmail.com

unread,
Feb 20, 2018, 10:39:57 PM2/20/18
to tiddl...@googlegroups.com
I want to generate a new tiddler from entered data (<$button><$action-sendmessage ... /> /> from <$edit-text ... />). I'm having problems generating a tag list that is to consist of one of the entered values plus a text literal (two tags total).

I can't figure out how to concatenate something for consumption by <$action-sendmessage ... />.

Below are the three tiddlers I'm using (simplified). Probably only the third tiddler "newProjectButton" is important here, but I don't have a good handle yet on substitution and transclusion, so the whole simplified series is presented.

The attempt to generate the new project tiddler is intended to be done when viewing tiddler one "hostTiddler".

Tiddler one:
title=hostTiddler
text=hostTiddler: displays all projects, including a tabbed interface. Tabs are for projects, or ticklers, or statuses, et cetra.
{{transcludedTiddler}}

Tiddler two:
title=transcludedTiddler
text=transcludedTiddler: displays a tab page. In this case it would show a list of projects (not included in this sample). It also hosts a button for starting a new project.
{{newProjectButton}}

Tiddler three:
title=newProjectButton
text=newProjectButton: provides entries and control necessary for starting a new project.
Need a new project? Click this [[button|newProjectButton]] and a tiddler will be created and tagged with the project number and  //''project''// and will have the following fields and values:<br>
> Project number: <$edit-text tiddler="$:/state/project-number" tag="input" default=""/>
> Project title (from the [[Project number]], will be used as the new project tiddler's title): {{$:/state/project-number}}
> Tag list: <$edit-text tiddler="$:/state/project-taglist" tag="input" default=""/> Don't want to have to manually enter these tags for the new project tiddler; the tags should be derived from the //''$:/state/project-number''// entered above plus the text literal "//''project''//". How to do this?
<$button>
   <$action-sendmessage
      $message="tm-new-tiddler"
      title={{$:/state/project-number}}
      tags={{$:/state/project-taglist}}
      projectnumber={{$:/state/project-number}}
   />
   New project
</$button>

Thanks much, everyone!

Mark Hylton

Stephan Hradek

unread,
Feb 21, 2018, 2:07:42 AM2/21/18
to tiddl...@googlegroups.com
Do I understand correct, that the main question is, how to concatenate $:/state/project-number with the word "project"?

Should it be one tag or 2?

For concatenation you usually require a macro. Try this

\define projecttags() project $(projectnumber)$

<$set name="projectnumber" value={{$:/state/project-number}}>

<$button>
   
<$action-sendmessage
      $message
="tm-new-tiddler"
      title
={{$:/state/project-number}}

      tags
=<<projecttags>>
   
/>
   New project
</
$button>
</$set>

use

\define projecttags() [[project $(projectnumber)$]]

if "project 123" should be just one tag


markh...@gmail.com

unread,
Feb 21, 2018, 12:19:41 PM2/21/18
to tiddl...@googlegroups.com
Stephan, this worked perfectly. My TW/Javascript/HTML/CSS chops are practically non-existant. As my TW needs grow, I'm starting to learn more, but I'm still basically a TW script-kiddie.

BTW, two tags in the list.

Thanks much!

~Mark
Reply all
Reply to author
Forward
0 new messages