MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Compliments - Multi Line not working?

    Scheduled Pinned Locked Moved Bug Hunt
    13 Posts 4 Posters 4.6k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      sdetweil @broberg
      last edited by sdetweil

      @broberg said in Compliments - Multi Line not working?:

      The \n gets converted to a whitespace in the textNode

      I see a \n presented on the screen. whenever there is a \n in the compliment string.
      as in “Hey there\n sexy!”

      using the backtics, are supposed to allow line continuation across muiltiple lines AND encode a hex 10 (nl) char. but what a pain.

      var msg=Hey there sexy
      (note that this doesn’t show here on the forum either.)

      it MAY be that the actual newline has to be encoded , NOT the text representation of the newline

       ('\n')
      

      the default compliment text strings contains whitespace, where are NOT converted to breaks. so I don’t understand

      I don’t see any improvement in using the file approach, as its content rules are javascript source rules. not message by line or anything else.

      to test, I did nothing except install MM and edit the built in messages to add \n (two characters) in various places

      i see the pre-line class, and read the description, but still haven’t figured out which nl they are discussing.

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      kayakbabeK 1 Reply Last reply Reply Quote 0
      • kayakbabeK Offline
        kayakbabe @sdetweil
        last edited by kayakbabe

        @sdetweil I figured out that your suggestions of encoding the new line worked for me.
        So, instead of using
        \n
        which textNode was treating literally, I tried encoding it and using this
        \u000A

        so when I tried the following it looked just like I put it into my morecompliments.json

        "roses are red\nviolets are blue\nand I need a line\nto start here anew "

        then I tried
        "roses are red\u000Aviolets are blue\u000Aand I need a line\u000Ato start here anew "

        and it displayed like I wanted it to like so…

        roses are red
        violets are blue
        and I need a line
        to start here anew

        perhaps this will help others.

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @kayakbabe
          last edited by sdetweil

          @kayakbabe crazy. my code splits the line with

          "\n"
          

          the problem was this forum changing the quote from

          '\n'
          

          to
          ‘\n’
          notice the curly quotes, those are bad

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • 1
          • 2
          • 2 / 2
          • First post
            Last post
          Enjoying MagicMirror? Please consider a donation!
          MagicMirror created by Michael Teeuw.
          Forum managed by Sam, technical setup by Karsten.
          This forum is using NodeBB as its core | Contributors
          Contact | Privacy Policy