Problems setting title of a newly created tiddler

Just experimenting, nd Need to strengthen my 5.3.0 knowledge before I can determine an optimum answer.

A Couple of facts;

  • The unusedtitle Macro is a javascript modual, not a traditional macro
  • If you make a procedure containing the macrocall you still need to wikify if for use.
  • In 5.3.0 you can call this macro as if it were a procedure
<$transclude $variable=unusedtitle baseName=`<<now "YYYY0MM0DD">>` template="$baseName$-$count:4$" />
  • But this still not solve our need to use a widget to get a value to give it to a parameter within a widget (except by wikifying at the last moment).

Still researching

[Edited]

As I suspected you can do it with the triple curly braces, ie a “filtered transclusion”, or the new substitution method. In both cases the result should be returned without needing to wikify.

  • In this case I made my own unused title “filter” but it could be made into a function.

See the two examples below;

<$let today=<<now YYYY0MM0DD>> >
{{{ [range[1],[99]] +[pad[2]addprefix[-]addprefix<today>!has[title]] +[first[]]  }}}

`${ [range[1],[99]] +[pad[2]addprefix[-]addprefix<today>!has[title]] +[first[]] }$`


<$button>
<$action-createtiddler $basetitle={{{ [range[1],[99]] +[pad[2]addprefix[-]addprefix<today>!has[title]] +[first[]]  }}} tags="test" text="content">
<$action-navigate $to=<<createTiddler-title>>/>
</$action-createtiddler>
Create 1
</$button>

<$button>
<$action-createtiddler $basetitle=`${ [range[1],[99]] +[pad[2]addprefix[-]addprefix<today>!has[title]] +[first[]] }$` tags="test" text="content">
<$action-navigate $to=<<createTiddler-title>>/>
</$action-createtiddler>
Create 2
</$button>

</$let>

Now I move this filter into a function including remove the need for the today variable and it looks good.

\function next-title() [range[1],[99]] +[pad[2]addprefix[-]addprefix<now YYYY0MM0DD>!has[title]] +[first[]]

<$button>
<$action-createtiddler $basetitle={{{ [function[next-title]]  }}} tags="test" text="content">
<$action-navigate $to=<<createTiddler-title>>/>
</$action-createtiddler>
Create A
</$button>

<$button>
<$action-createtiddler $basetitle=`${ [function[next-title]]  }$` tags="test" text="content">
<$action-navigate $to=<<createTiddler-title>>/>
</$action-createtiddler>
Create B
</$button>
  • Of course you can easily modify the function, even add parameters.
  • Here I solved the complexity with using a widget to provide an attribute value, but not using one, but building my own “unused title” filter/function.

The Question remains what is the best way to use a widget to provide an attribute value?

2 Likes