Hi BJ! Hi Mark!
What a difference two breaks make! Great thanks, I would never have found that trick! I think the rest now is getting the CSS right!
I will have to do some work until I can show the Editor I need this for.

Best wishes Jan






Am 12.07.2019 um 13:47 schrieb BJ:
Hi Jan,
for this to work you need double lines before and after the macro:

|
<divclass=dialogue>

<$macrocall $name="dialogue" text={{!!dialogue}}/>

</div>

|


and I think you return value needs to be like this:


|
|
exports.run =function(text){ text =text.split("\n[[").join("\n:[[");returntext.split("\n").join("\n\n");};
|



|

On Friday, July 12, 2019 at 9:59:07 AM UTC+2, Jan wrote:

    Hi Mark!
    Thanks, the desired colons :-) now are there!  But all \n seem to
    be eaten, even the double \n\n which should make a linebreak.

    You can see the test here *http://szen.io/dia/ * which I hope can
    explain a little what I am trying to achive.

    I changed it the function to

    |   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


    |








    Am 12.07.2019 um 02:08 schrieb 'Mark S.' via TiddlyWiki:
    Ah, there we go. it's "\n" not "/n".

    There are other tweaks. I think the \n on the first [[ might be
    getting trimmed off.

    Good luck!

    On Thursday, July 11, 2019 at 4:48:53 PM UTC-7, Jan wrote:

        Hi Mark,
        you are right in both dimensions: It does not throw the
        error-alert anymore...but it apparently does nothing else
        either.
        It should turn a link (containing the name of the role) at
        the beinning of the Line in editmode into a descriptive list
         <dt>[[Rolename]]</dt> which in Wikisyntax can be indicatet
        by /n/n:[[Rolename]].

        Sorry for the difficulites to express this correctly.
        I fear that this markup is already parsed when inserting the
        text with  {{!!dialogue}}-field so that it actually does not
        find any /n or[[.

        Thanks!



        Am 11.07.2019 um 22:23 schrieb 'Mark S.' via TiddlyWiki:
        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 onhttp://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  <http://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 tiddl...@googlegroups.com.
        To post to this group, send email to tiddl...@googlegroups.com.
        Visit this group at
        https://groups.google.com/group/tiddlywiki
        <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
        
<https://groups.google.com/d/msgid/tiddlywiki/ea6b6fa3-4066-488e-9121-f030c38a85a7%40googlegroups.com?utm_medium=email&utm_source=footer>.
        For more options, visit https://groups.google.com/d/optout
        <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 tiddl...@googlegroups.com <javascript:>.
    To post to this group, send email to tiddl...@googlegroups.com
    <javascript:>.
    Visit this group at https://groups.google.com/group/tiddlywiki
    <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
    
<https://groups.google.com/d/msgid/tiddlywiki/25ed43ad-1583-43f9-afd6-1f8d3065e3f4%40googlegroups.com?utm_medium=email&utm_source=footer>.
    For more options, visit https://groups.google.com/d/optout
    <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 <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/113be6af-2d01-4219-9e60-8dae159d366e%40googlegroups.com <https://groups.google.com/d/msgid/tiddlywiki/113be6af-2d01-4219-9e60-8dae159d366e%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/5D291016.1010401%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to