Macro question

41 views
Skip to first unread message

Damon Pritchett

unread,
Jul 16, 2019, 8:11:24 PM7/16/19
to TiddlyWiki
Hello all you helpful folks. 

I'm having a little nuisance with a macro that I'm using which is shown below:

\define date-str(date)
<$list filter="[[$date$]splitbefore[-]]" variable=x >
<$list filter="[[$date$]removeprefix<x>splitbefore[-]removesuffix[-]]" variable=m>
<$list filter="[[data-months]getindex<m>]" variable="mname">
<$list filter="[[$date$]splitbefore[-]removesuffix[-]]" variable=y>
<$list filter="[[$date$]removeprefix<x>removeprefix<m>removeprefix[-]]" variable=d>
<<mname>> <<d>>, <<y>>
</$list>
</
$list>
</$list>
</
$list>
</$list>
\end

The macro works great except that there is a space at the end of the final result that I can't figure out how to get rid of. Is this just a result of using a macro or is there a change I can make so that the trailing space isn't present?

Many thanks in advance,

Damon



Damon Pritchett

unread,
Jul 16, 2019, 8:25:01 PM7/16/19
to TiddlyWiki
For completeness, I should also show how I'm calling this macro:

The date of the event was <$macrocall $name="date-str" date={{!!mydate}}/>.

Mark S.

unread,
Jul 16, 2019, 8:29:24 PM7/16/19
to TiddlyWiki
Squeeze every bit of white space out of the macro after <<y>>, like:

\define date-str(date)
<$list filter="[[$date$]splitbefore[-]]" variable=x >
<$list filter="[[$date$]removeprefix<x>splitbefore[-]removesuffix[-]]" variable=m>
<$list filter="[[data-months]getindex<m>]" variable="mname">
<$list filter="[[$date$]splitbefore[-]removesuffix[-]]" variable=y>
<$list filter="[[$date$]removeprefix<x>removeprefix<m>removeprefix[-]]" variable=d><<mname>> <<d>>, <<y>></$list></$list></$list></$list></$list>
\end





On Tuesday, July 16, 2019 at 5:11:24 PM UTC-7, Damon Pritchett wrote:

TonyM

unread,
Jul 16, 2019, 8:48:26 PM7/16/19
to TiddlyWiki
Damon,

Could you provide some additional content to this so I can past into TiddlyWiki.com and see the error occuring?

We can then fix it in place and share the fix.

eg
<$macrocall $name=date-str date={{!!modified}} >> />
and other variable settings, what is the dates original format etc...?


Regards
Tony

TonyM

unread,
Jul 16, 2019, 8:51:29 PM7/16/19
to TiddlyWiki
My browser did not refresh the forum before I posted here, So I did not see the additional posts.

Tony

Damon Pritchett

unread,
Jul 16, 2019, 9:21:12 PM7/16/19
to TiddlyWiki
Thanks Mark. That did the trick.

Damon
Reply all
Reply to author
Forward
0 new messages