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 "
/*\ 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:[[
" 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
/n
/n:[["); }; })();
/*\
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:[[");
} ;
})();
--
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+...@googlegroups.com.
To post to this group, send email to tiddl...@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/ea6b6fa3-4066-488e-9121-f030c38a85a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddl...@googlegroups.com.
exports.run = function(text) { return text .split("\n[[") .join("\n:[["); return text .split("\n") .join("\n\n"); } ;
because I would like all \newlines to be doublenewlines to make the markup like !/*/# work at the beginning of all lines. Thanks again! Jan
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@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/25ed43ad-1583-43f9-afd6-1f8d3065e3f4%40googlegroups.com.
<div class=dialogue>
<$macrocall $name="dialogue" text={{!!dialogue}}/>
</div>
exports.run = function(text) {
text = text.split("\n[[").join("\n:[[");
return text.split("\n").join("\n\n");
} ;
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@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/113be6af-2d01-4219-9e60-8dae159d366e%40googlegroups.com.