Hi Tristan,

This was the export part of the code I came up with for testing:

exports.run = function(text) {
    
 var vartext = "[["+text.split(",").join("]] [[")+"]]"   ;
return vartext ;  

};

Both our approaches probably need something in there to squeeze out spaces 
after commas.

Have fun!
Mark


On Wednesday, April 13, 2016 at 11:49:29 PM UTC-7, Tristan Kohl wrote:
>
> Hi Mark,
>
> here is my macro code:
> /*\
>
> title: $:/plugins/mirodin/ebooks/linklist.js
> type: application/javascript
> module-type: macro
>
> \*/
> (function() {
>
> "use strict";
>
> /*
> List all field values as comma separated list of clickable links.
> */
>
> exports.name = "linklist";
>
> exports.params = [];
>
> /*
> Run the macro
> */
> exports.run = function(field) {
>  if (typeof field === "undefined") {
>  return "''Please pass field.''";
>  }
>  var elements = field.split(",");
>  var result = "";
>  for (var i = 0; i < elements.length; i++) {
>  result += "[[" + elements[i] + "]], ";
>  }
>  result = result.slice(0, -2);
>  return result;
> };
>
> })();
>
> Thanks for your hint, that works for me too and the whole call is way more 
> readable.
>
> Cheers
> Tristan
>

-- 
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/2d34c21f-dcf2-4301-919c-a08f9baf9b19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to