Hi, I've tried your example and it works for me on a recent tiddlywiki

Maybe you just forgot to save and reload?


Hello everybody!
>
> I'm stuck in a basic and probably easy thing: I cannot get any javascript 
> macro to work in my tiddlywiki. My wiki is a 5.1.19 version running on 
> nodejs. 
>
> For an example let's take this makro from TW5 Magick (
> http://tw5magick.tiddlyspot.com/):
>
> ===========
> /*\
> title: $:/macros/skeeve/mysamplemacro.js
> type: application/javascript
> module-type: macro
>
> <<mysamplemacro character address>>
>
> Example:
> <<mysamplemacro>>
> <<mysamplemacro "Donald Duck">>
> <<mysamplemacro "Mickey Mouse" "Mouse House">>
>
> \*/
> (function(){
>
> /*jslint node: true, browser: true */
> /*global $tw: false */
> "use strict";
>
> /*
> Information about this macro
> This is the mysamplemacro of Tiddly Wiki 5 written in JavaScript 
> */
>
> exports.name = "mysamplemacro";
>
> exports.params = [
>     { name: "character" },
>     { name: "address" }
> ];
>
> /*
> Run the macro
> */
> exports.run = function(character, address) {
>     if( !character) character = "Bugs Bunny";
>     if( !address) address = "Rabbit Hole Hill";
>     var output ="Hi, I'm " + character + " and I live in " + address;
>     return output;
> };
>
> })();
> ============
>
> This is quite simple and it works perfect on TW5 Magicks Tiddlywiki. I 
> imported this above tiddler to my wiki and the field definitions came with 
> it: 'Type: application/javascript' and 'module-type: macro'. 
>
> TW5 Magick, the source of this example, runs on an outdated 5.0.7-beta. To 
> access the macro a simple <<mysamplemacro "Donald Duck">> does it there. 
>
> On my 5.1.19: nope. 
>
> At tiddlywiki.com I found the \define pragma for standard macros. I found 
> https://tiddlywiki.com/dev/index.html#JavaScript%20Macros, which explains 
> the basics of javascript macros. I was reading google groups for hours. But 
> I didn't find out how to bring this together to a working solution in a 
> current version of tiddlywiki.
>
> Could someone please give me an example how to access this macro?
>
> Thank you!
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/7a0df790-635b-4361-be1e-6e148aa3834b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to