If in a browser console (FF and Chrome, press F12 and see the console) 
enter the below JavaScript code it will work

a= "One"
b="Two"
s="\n"
y=a + s +b

then you get
 
a="One"
"One"
b="Two"
"Two"
s="\n"
"
"
a+s+b
"One
Two"


Note the two line text in the output. That means the "\n" treated as a 
line-break or newline.

Now, do the same in Tiddlywiki.

Create a JS macro as below:

(function(){/*jslint node: true, browser: true *//*global $tw: false */"use 
strict";

exports.name = "jsmac";

exports.params = [
    {name: "a"},
    {name: "b"},
    {name: "s"} 
];
/*
Run the macro
*/
exports.run = function(a, b, s) {

    return a + s + b;
}
})();



I have attached *jsmac *tiddler above to this post


*Test:*

Drag and drop the below tiddler into an empty wiki. save and reload

Then create a test tiddler with the below contents

<$macrocall $name=jsmac
a="one"
b="two"
s=" \n "
/>

What you get is:

one \t two

That means Twiddlywiki JavaScript macro does not work as expected.

What is wrong here?



Note:
If you like to test on Tiddlywiki.com

Drag and drop the attached two tiddler to Tiddlywiki.com
Save and reload (a copy will saved on your system)

--Mohammad

-- 
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 post to this group, send email to [email protected].
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/bf1fa660-48b5-474f-b2f5-253b193b36a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: macro_jsmac.tid
Description: Binary data

Attachment: Test JMAC.tid
Description: Binary data

Reply via email to