You seem to have wrapped the function in another function. This seems to
"work"
/*\
title: $:/core/modules/macros/Dialogue.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 = 'dialogue';
exports.params = [{ name: 'text' }];
/*
Run the macro
*/
exports.run = function(text) {
return text
.split("/n[[")
.filter(it => it)
.join("/n/n:[[");
} ;
})();
By "work" I mean it runs without an error. But I'm not sure it does what
you want yet. Good luck!
On Thursday, July 11, 2019 at 11:29:23 AM UTC-7, Jan wrote:
>
> Hello
> based on an idea of LinOneTwo I tried to build a macro to do replacements
> while transcluding the text-content of a field.
> This macro shall replace all "/n[[" for "/n/n:[[" and shall be applied to a a
> field called dialogue.
> This is one step to build a scene-editor which can properly format dialogue.
> Unfortunately it does not show the result when calling it <$macrocall
> $name="dialogue" text={{!!dialogue}}/> but produces a tender red alert.
> How do you do something like this correctly?
>
> (The code can be tested on http://szen.io/dia/ )
>
> Thanks for help!
> Jan
> /*\
> title: $:/core/modules/macros/Dialogue.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 = 'dialogue';
> exports.params = [{ name: 'text', defalue: '' }];
> /*
> Run the macro
> */
> (function() {
> exports.run = function(text) {
> return text
> .split("/n[[")
> .filter(it => it)
> .join("/n/n:[[");
> };
> })();
>
>
--
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/ea6b6fa3-4066-488e-9121-f030c38a85a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.