Community
    • Login

    UDL 2.1: When an Operator is also a Delimeter

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 700 Views 2 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.
    • Erin D. SmaleE Offline
      Erin D. Smale
      last edited by

      Hi all,

      I’m writing a UDL that supports HTML tags and also uses “<” as an operator. You can see where this is going…

      My goal is to highlight HTML tags, so I’ve included “<” and “>” as Delimiters. However, when I use “<” in an operation, it’s interpreted as a delimiter opening so everything following it is highlighted as if it were HTML, until it sees a closing “>”.

      Here’s a screenshot of the UDL and how it renders:

      66790dc1-51e9-43ac-a25c-e2f4daf71232-image.png

      I’ve searched through the forum and couldn’t find a direct resolution, so I’m thinking the solve is a bit more complex than what I can accomplish via the UDL GUI. To that end, could someone please point me in the right direction?

      Cheers,
      -Erin

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Offline
        PeterJones @Erin D. Smale
        last edited by

        @Erin-D-Smale said in UDL 2.1: When an Operator is also a Delimeter:

        I’m thinking the solve is a bit more complex than what I can accomplish via the UDL GUI.

        I cannot think of an immediate way around it using the UDL itself.

        However, you can add extra highlighting to anything in Notepad++ (whether using a builtin lexer or to a User Defined Language (UDL)) using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo.

        So if you leave <> as the delimiter4 style in the UDL, you could use the PythonScript solution to search on r'\h[<>]\h' (ie, search for less than or greater than as long as it has a horizontal space character (space or tab) to both the left and right of the operator) and apply a different color to those spaced-out instances of the angle-brackets (and you could make the PythonScript use the same color as your Operators’ Styler).

        Erin D. SmaleE 1 Reply Last reply Reply Quote 2
        • Erin D. SmaleE Offline
          Erin D. Smale @PeterJones
          last edited by

          @PeterJones - Thanks very much for the tip. I’ll give this a shot over the weekend and post results in case others have the same problem.

          Cheers,
          -Erin

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors