You have to manually add a "module-type" field and set it's value to 
"macro".

Here is a bare-bones example from the wiki-core (note the tiddler meta-data 
for this javacript macro is in a comment in the heading of the file):
https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/macros/version.js

Best,
Joshua Fontany

On Thursday, February 27, 2020 at 7:26:06 AM UTC-8, David wrote:
>
> Thanks for putting together this simple script.  However, it did n't work 
> for me.  I also get a blank tiddler.  
>
> I have tried the refresh button as well as saving and reloading the whole 
> page.
>
> I created a new Tiddler called "JsTiddler" and put your content in it, and 
> set the "Type" field to "application/javascript".  In the current version 
> of TW, I do not see a field for "module".
>
> Then i created a new tiddler like you did to test it.  I kept the type as 
> the default (text/vnd.tiddlywiki) and pasted in your code.
>
> I reloaded the tw and my test tiddler is still blank.
>
> I'm not new to JavaScript, but have an intermediate knowledge of that.  
> But I'm new to TW, especially macros.
>
>
> On Monday, October 17, 2016 at 4:04:10 AM UTC-4, Erock wrote:
>>
>> I have been learning about javascript macros recently and was trying to 
>> create a simple one to start with, but I can't seem to get it to work. I've 
>> read lots of documentation, forums, etc., but still can't seem to figure 
>> out why it won't work. Here is what I've been doing. I set up two tiddlers, 
>> JsTiddler and RunTiddler. I added a very simple javascript macro to 
>> JsTiddler, and set its type = "application/javascript" and module-type = 
>> "macro". Here is the text:
>> /*\
>> title: JsTiddler
>> type: application/javascript
>> module-type: macro
>> \*/
>> (function(){
>>
>> /*jslint node: true, browser: true */
>> /*global $tw: false */
>> "use strict";
>>
>> exports.name = "jstiddler";
>>
>> exports.params = [];
>>
>> /*
>> Run the macro
>> */
>> exports.run = function() {
>>     return "Hello World";
>> };
>>
>> })();
>>
>> I then created a second tiddler to import and display the macro called 
>> RunTiddler. This is its text:
>> <$importvariables filter="[[JsTiddler]]">
>> <$macrocall $name="jstiddler" />
>> </$importvariables>
>>
>> However, when I run this, all I get is a blank tiddler.  I have tried 
>> filtering in different ways (such as using tags), but that didn't help 
>> either. I have also been able to use <<now>> and <<version>> in both <<>> 
>> and <$macrocall> syntax, so I know that my wiki can use js tiddlers. Can 
>> anyone tell me what I'm doing wrong? Thanks.
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/9f5f9b96-d533-403c-aa8c-a8950b5ee005%40googlegroups.com.

Reply via email to