Can we deal with nested macro calls and how?

122 views
Skip to first unread message

peuhpeuh singe

unread,
Jan 25, 2017, 12:03:10 PM1/25/17
to TiddlyWiki
Hello twexperts !

I have a tiddler "fooTimeLine" with a field "dueto" containing a date in tw format. I then want to create a button that is associated to the creation of a new tiddler having as fields:
1) "dueto" with the value in "fooTimeLine" and
2) "end" with the value corresponding to the day after those of "dueto"

My problem is with point 2). I use the nice dateTime macro ($:/macros/skeeve/dateTime.js at http://tiddlystuff.tiddlyspot.com) but I do not know how to resolve the different macro evaluations:


\define nextDay(day)
<$macrocall $name="dateTime" ts=$day$ format="YYYY0MM0DD0000000" add="+1D"/>
\end
dateTime

<$set name="end" value=<<nextDay {{fooTimeLine!!dueto}}>>>

<$button>
<$x-maketid  $title={{fooTimeLine!!appointmentName}}  tags="Date" text="a few comments"
 dueto
={{fooTimeLine!!dueto}} end=<<end>>/>

Create
</
$button>

</$set>



 which does not work due to the fact macro consists in simple substitution. I am ok with why it does not work but I do not know how to tackle the problem without rewritting a dedicated macro and I thus request your help : Can we deal with nested macro calls and how ?

BJ

unread,
Jan 25, 2017, 12:46:35 PM1/25/17
to tiddl...@googlegroups.com
HI Peuhpeuh,

there are may ways to fix this, problably the easiest is to change the macro:



\define nextDay(day)
<$macrocall $name="dateTime" ts={{$day$}} format="YYYY0MM0DD0000000" add="+1D"/>
\end
dateTime
<$set name="end" value=<<nextDay "fooTimeLine!!dueto">>>




all the best

BJ

peuhpeuh singe

unread,
Jan 26, 2017, 3:26:12 AM1/26/17
to tiddl...@googlegroups.com
Thanks for your answer BJ. However, (and I maybe misunderstood something in your solution) but it provides me the same result as my solution which is that the created tiddler (with title {{fooTimeLine!!appointmentName}}) as a field end that equals to "$macrocall $name="dateTime" ts={{fooTimeLine!!dueto}} format="YYYY0MM0DD0000000" add="+1D"/> and not to the corresponding subsitution. Any ideas ?

Thanks in advance,
Peuph

BJ

unread,
Jan 26, 2017, 5:21:16 AM1/26/17
to TiddlyWiki
OK try this

\define nextD(day)

<$button>
<$x-maketid  $title={{fooTimeLine!!appointmentName}} tags="Date" text="a few comments"

 dueto
={{fooTimeLine!!dueto}} end=<<dateTime ts:$day$ format:"YYYY0MM0DD0000000" add:"+1D">>/>
MAKE IT
</
$button>
\end

----
<$macrocall $name="nextD" day={{fooTimeLine!!dueto}}/>

peuhpeuh singe

unread,
Jan 26, 2017, 8:51:55 AM1/26/17
to TiddlyWiki
Thanks it does the job.
Nevertheless, it is so tricky ! and I really like tw5 and I think that, if there is really no more intuitive way to deal with that, it deserves one.

Thanks all for developping all this useful stuff.

Tobias Beer

unread,
Jan 26, 2017, 1:47:25 PM1/26/17
to TiddlyWiki
Hi there,

Would be great to see an example of your final implementation,
perhaps as an MTC somewhere.

Are you using a datepicker to modify that due-date later?

Best wishes,

Tobias. 
Reply all
Reply to author
Forward
0 new messages