Hi Mark, Hi Mat
I am happy to hear that.
To be honest I would not have not have managed to do this without your help, in fact it is the second thing in javascript I ever did.
I got a small amelioration:

|if (text !== null) {...|

avoids red alerts which were happend before so we have this:

|/*\
title: $:/core/modules/macros/roles.js
type: application/javascript
module-type: macro
Making some replacements in Textinputs
\*/

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

/*
Information about this macro
*/
  exports.name
 = 'roles';
  exports.params = [{ name: 'text'  }];
/*
Run the macro
*/
exports.run = function(text) {
if (text == null) {

    var text = " ";

}
var regex = /\[\[.*?\]\]/g;
var text = text.match(regex);
if (text !== null) {
var text = "[[" + text.join("]] [[") + "]]";
return text
}
} ;

})();|

It would be nice to turn this into a general extract macro with start and end parameters and the option to keep or chop start and end. So far Thomas Elmingers extract Macro did this Job for me but some things like those brackets are stubborn. I will see what I can achieve.
Cheers! Jan


Am 16.07.2019 um 16:38 schrieb 'Mark S.' via TiddlyWiki:
Do you mean /Jan's/ macro?

On Tuesday, July 16, 2019 at 4:27:50 AM UTC-7, Mat wrote:

    Mark, I have a strong feeling your macro will be very useful for me.
    Would you mind documenting it a little in the "Information about
    this macro" part (what it does, how to use)?
    And might it be something relevant to integrate into your PR
    <https://github.com/Jermolene/TiddlyWiki5/pull/2963>?
    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 <mailto:tiddlywiki+unsubscr...@googlegroups.com>. To post to this group, send email to tiddlywiki@googlegroups.com <mailto: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/6155117b-6ad0-4e1a-bce6-721a09de8d8a%40googlegroups.com <https://groups.google.com/d/msgid/tiddlywiki/6155117b-6ad0-4e1a-bce6-721a09de8d8a%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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/5D2E21FE.30306%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to