Tapatalk

Highlighting special character codes in HTML

Highlighting special character codes in HTML

351
Basic UserBasic User
351

    Dec 01, 2004#1

    Again, I apologize for a newbie question. I'd like to highlight special character codes (e.g., >) when viewing HTML. I've tried adding a /C section to the /L HTML block of my wordfile.txt file. I've tried listing the character codes I use all the time, but they aren't highlighted in the HTML code. However, if I simply list the ampersand, it's highlighted.

    Is there a way to do this? Thanks again for the handholding.

    Mary

    6,686587
    Grand MasterGrand Master
    6,686587

      Dec 07, 2004#2

      Yes, it is possible. But the solution has one big disadvantage - correct html entities then act as word delimiters, so for example the german word Hölle (engl. hell) are 5 words ("H", "&", "ouml", ";" and "lle"). So selecting words with entities cannot be done anymore with a single double click.

      Okay, first you have to add '&' and ';' to the /Delimiters = list.

      Second, you have to add one of the two color sections below. The first one (green) is for case-insensitive html syntax highlighting (normal for html), the second is for case-sensitive highlighting. Html is not case-sensitive, but the entities are. So turn off auto-correcting when you use case-insensitive highlighting. And don't forget to set the correct color number /Cx.

      /Cx"Entities (no case)"
      aacute acirc acute aelig agrave alefsym alpha amp and ang aring asymp atilde auml
      bdquo beta brvbar bull
      cap ccedil cedil cent chi clubs cong copy crarr cup curren
      dagger darr deg delta diams divide
      eacute ecirc egrave empty emsp ensp epsilon equiv eta eth euml euro exist
      forall frac12 frac14 frac34 frasl
      gamma ge gt
      harr hearts hellip
      iacute icirc iexcl igrave image infin int iota iquest isin iuml
      kappa
      lambda lang laquo larr lceil ldquo le lfloor lowast loz lrm lsaquo lsquo lt
      macr mdash micro middot minus mu
      nabla nbsp ndash ne ni not notin nsub ntilde nu
      oacute ocirc ograve oline omega omicron oplus or ordf ordm oslash otilde otimes ouml
      para part permil perp phi pi piv plusmn pound prime prod prop psi
      quot
      radic rang raquo rarr rceil rdquo real reg rfloor rho rlm rsaquo rsquo
      sbquo sdot sect shy sigma sigmaf sim spades sub sube sum sup1 sup2 sup3 sup supe szlig
      tau there4 theta thetasym thinsp thorn times trade
      uacute uarr ucirc ugrave uml upsih upsilon uuml
      weierp
      xi
      yacute yen yuml
      zeta zwj zwnj


      /Cx"Entities (with case)"
      AElig Aacute Acirc Agrave Alpha Aring Atilde Auml
      Beta
      Ccedil Chi
      Dagger Delta
      ETH Eacute Ecirc Egrave Epsilon Eta Euml
      Gamma
      Iacute Icirc Igrave Iota Iuml
      Kappa
      Lambda
      Mu
      Ntilde Nu
      Oacute Ocirc Ograve Omega Omicron Oslash Otilde Ouml
      Phi Pi Psi
      Rho
      Sigma
      THORN Tau Theta
      Uacute Ucirc Ugrave Upsilon Uuml
      Xi
      Yacute
      Zeta
      aacute acirc acute aelig agrave alefsym alpha amp and ang aring asymp atilde auml
      bdquo beta brvbar bull
      cap ccedil cedil cent chi clubs cong copy crarr cup curren
      dArr dagger darr deg delta diams divide
      eacute ecirc egrave empty emsp ensp epsilon equiv eta eth euml euro exist
      forall frac12 frac14 frac34 frasl
      gamma ge gt
      hArr harr hearts hellip
      iacute icirc iexcl igrave image infin int iota iquest isin iuml
      kappa
      lArr lambda lang laquo larr lceil ldquo le lfloor lowast loz lrm lsaquo lsquo lt
      macr mdash micro middot minus mu
      nabla nbsp ndash ne ni not notin nsub ntilde nu
      oacute ocirc ograve oline omega omicron oplus or ordf ordm oslash otilde otimes ouml
      para part permil perp phi pi piv plusmn pound prime prod prop psi
      quot
      rArr radic rang raquo rarr rceil rdquo real reg rfloor rho rlm rsaquo rsquo
      sbquo sdot sect shy sigma sigmaf sim spades sub sube sum sup sup1 sup2 sup3 supe szlig
      tau there4 theta thetasym thinsp thorn times trade
      uArr uacute uarr ucirc ugrave uml upsih upsilon uuml
      weierp
      xi
      yacute yen yuml
      zeta zwj zwnj
      Best regards from an UC/UE/UES for Windows user from Austria

      351
      Basic UserBasic User
      351

        Dec 07, 2004#3

        Thanks, Mofi. You're definitely correct about highlighting of correct entities, and I'd been thinking about the ramifications of setting this up. I'll give it a test run. If the highlighting becomes annoying, I'll back it out. Thanks, again!

        Mary

        1
        NewbieNewbie
        1

          Dec 12, 2004#4

          With apologies to the estimable Mofi, I find a much simpler solution to the problem is to use the "Marker Characters" line to identify HTML entities, as in:

          "/Marker Characters = "&;"

          The &; pair is then added to your choice of color groups to specify the highlighting color.

          This won't work for some non-conforming HTML pages, but the current W3C HTML/XHTML specs advise against using the "&" literal in page content, so the only thing appearing between "&" and ";" will be a "special character," or "entity." (And, of course - the "erroneous" highlighting will alert you to the presence of a non-conforming usage, e.g. "cats & dogs; fighting again.)

          351
          Basic UserBasic User
          351

            Dec 12, 2004#5

            Thanks, BenF. That did the trick! Thanks, too, to all for helping me get my coding environment just the way I want it!

            Mary

            6,686587
            Grand MasterGrand Master
            6,686587

              Dec 13, 2004#6

              Good trick to use marker characters. It is really easier to define.

              But at least the & must be defined in the delimiters list or entities inside a word are not highlighted. So the problem with entities splitting words still exist.

              And a second disadvantage exists with the marker character solution, ALL characters between & and ; are highlighted, independent if this string is really an entity or not.

              Big advantage of the marker character solution is that everyone can see easily, if the ; is missing at the end, which I have often seen on html pages created with Frontpage and pages created by a script. And second advantage is that everyone can see easily, if a & as text literal is not written as entity, as it always should be, which BenF has already explained.

              So my solution approach is best for html creators which write html directly with UltraEdit like I. The marker character approach is best for users which use UltraEdit to view and verify html pages.

              Thanks BenF for his contribution and his solution, which is more useful for most of the users.
              Best regards from an UC/UE/UES for Windows user from Austria

              351
              Basic UserBasic User
              351

                Dec 13, 2004#7

                Thanks for the information, Mofi. When I get a chance, I'll implement your method, and compare the two solutions. I'm a coder, so I'd like to see both in action.

                Mary