Global Macros on Node.js

44 views
Skip to first unread message

Jon Ewing

unread,
Apr 27, 2020, 8:37:04 PM4/27/20
to TiddlyWiki
A bit contrived but this example aptly demonstrated the issue I'm encountering.

In a single file wiki I can define a tiddler with the following simple macro (tagged as '$:/tags/Macro')

\define concat(s1:"" s2:"" s3:"" s4:"" s5:"") $s1$$s2$$s3$$s4$$s5$

I can call that macro as wikitext in another tiddler and it renders

<<concat "This" "Is" "Concatented">>  ---> ThisIsConcatented
 
The exact same macro definition and call from a different tiddler in a Node.js wiki renders nothing. The macro works fine if defined in the same tiddler though.

Am I missing something special about using the Node.js version of Tiddlywiki? Javascript macros work fine but I hate to have to code up javascript for quick and dirty solutions.

I am not an experienced javascript/Node.js/browser developer and so at this time don't understand how to trace TiddlyWiki execution.

Many thanks for any insights.
<<Jon Ewing>>

TonyM

unread,
Apr 27, 2020, 9:14:05 PM4/27/20
to TiddlyWiki
Jon,

Your example not only should work, but does on my node, using BobWin.exe

Something is wrong. When it comes to node versions and single file there is very little difference when using the interactive wiki however it is served.

Regards
Tony
Message has been deleted

Jon Ewing

unread,
Apr 27, 2020, 9:32:11 PM4/27/20
to TiddlyWiki
Tony:

Thanks for running that on another Node.js. I run several Electron apps (ala Joplin) that hadn't had any issues with so I didn't figure it would be npm related. I will dig into that further. I don't run Bob. I do get an error on startup related to the Moment.js plugin. But the plugin is available and works (used on a custom javascript date formatting macro).

> tiddlywiki ~/tiddylwikis/try1  --listen port=8899 --verbose
> Warning: Cannot find plugin 'kixam/moment'

<<jon>>

TonyM

unread,
Apr 27, 2020, 10:23:39 PM4/27/20
to TiddlyWiki
Jon,

It is often worth getting a fresh wiki and adding back your content until the error reoccurs, or disabling plugins and reenabling them.

With macros it is quite easy to define them twice and not be sure which is in use, this sounds as if you have a global macro that works/does not give the result you want, when the macro is not defined locally, and the local one overrides it. Look for tiddlers tagged $:/tags/Macro

Regards
tony
Reply all
Reply to author
Forward
0 new messages