Apostrophes and quotes confuse syntax coloring

Apostrophes and quotes confuse syntax coloring

28
Basic UserBasic User
28

    Apr 08, 2005#1

    Consider this HTML:

    <html>
    <h1>Bill's Site</h1>
    <p>I like 12" subs</p>
    </html>

    UltraEdit's syntax coloring gets thrown off; everything from the ' or " to the end of the line is grey.

    How can I get UltraEdit to ignore the ' and ", unless they are used for attributes, which is what Dreamweaver and HomeSite do? I don't want to escape all my ' and " (into &apos; and ").

    NOTE: If I omit the <html> tags, the syntax coloring seems to work well:

    <h1>Bill's Site</h1>
    <p>I like 12" subs</p>

    351
    Basic UserBasic User
    351

      Apr 12, 2005#2

      Hi, Tripecac. The behavior you're seeing is a result of a setting in the HTML section of your wordfile.txt file. Look at the first line of the HTML_LANG definition. If you don't see the text "Noquote" (without quotes) prior to "Block Comment On...", add it. I'm not sure if the order of the settings matter (as long as they're after the language identified). Save your wordfile.txt and look at an appropriate HTML file to see if this fixes your problem.

      6
      NewbieNewbie
      6

        Apr 12, 2005#3

        Interesting. I've been noticing the same problem with multiple formatting of my HTML/JS/ASP (rendered) code from HTML pages so I opened up my WORDFILE.TXT and temporarily changed the reference to the "VBScript Active Server Pages" from "/L10" to "/X10" which effectively removes it from the syntax highlighting options (it was #10 in my WORDFILE.TXT file -- your results may vary).

        I switched back to my HTML/JS/ASP file and noticed the syntax highlighting was now what I wanted. Maybe take a look at the default wordfile languages installed and temporarily rename the language (like I did above) to negate similar wordfile lists to see if there are one (or more) lists that collide.

        My UE version: 11.00b+1

        28
        Basic UserBasic User
        28

          Apr 12, 2005#4

          mary.vivit -

          Thanks!

          I already have noquote in the first line:
          /L3"HTML" HTML_LANG Nocase Noquote Block Comment On = <!-- Block Comment Off = --> File Extensions = HTM HTML SHTML HTT HTX JSP PHP PHTML ASP
          The weird thing is that I have another line which mentions HTML_LANG too:
          /L20"XSL" Nocase HTML_LANG Block Comment On = <!-- Block Comment Off = --> Block Comment On Alt = <% Block Comment Off Alt = %> File Extensions = XSL XSLT
          I pasted some XSLT rules onto the end of the word file, because I deal a lot with XSL.

          I also notice that there isn't an empty line before the /L20 ... line. Should there be?

          Maybe the XSL rules are screwing up the HTML rules?

            Apr 12, 2005#5

            I tried some changes to the word file to see what would fix the quotes problem:

            1) added blank line before the /L20 line
            -- no effect on HTML quotes problem
            -- no effect on XSLT colors (good)

            2) changed "HTML_LANG" in /L20 line to XSL_LANG
            -- HTML quotes problem when away (good!)
            -- no effect on XSLT colors (good)

            Wow, could that second "HTML_LANG" have been the problem?

              Apr 12, 2005#6

              diakonos -

              In your /X10 line, do you see HTML_LANG? What if you change it to something other than HTML_LANG and re-enable the coloring (change the /X10 to /L10) ?

                Apr 20, 2005#7

                I'm starting to think that setting NoQuotes for a markup language isn't a perfect fix.

                When quotes actually surround attributes, coloring the quotes' contents is useful:

                <a href="blaa.htm">blaa</a>

                When quotes are within text nodes, coloring isn't as useful:

                <p>John waved "hi". I waved "hi" back.</p>

                Is there a way to get UltraEdit to color attributes' values but ignore quotes (' and ") which appear within text nodes?

                Trav

                1
                NewbieNewbie
                1

                  Apr 26, 2005#8

                  This is why some characters have a special meaning in (X)HTML...
                  Quotes, &, < etc. have to be replaced by their entities.

                  28
                  Basic UserBasic User
                  28

                    Apr 26, 2005#9

                    Actually, I don't think it's invalid to use unescaped quotes in XML/XHTML:

                    <title>Bob's Collection of 7" Singles</title>

                    At least, W3C's validators never complain about my ' and ".

                    The bigger point, however, is that most hand coders are *not* going to type out the entities: Bob&apos;s and "7. We're going to type quotes, and will expect UltraEdit to ignore our quotes within text nodes.

                    Dreamweaver and Homesite ignore text nodes' ' and "; UltraEdit should do the same in order to hit par. Right now UltraEdit is lagging behind when it comes to quote coloring.

                    119
                    Power UserPower User
                    119

                      Apr 26, 2005#10

                      Tripecac, UltraEdit is a general purpose editor, not an HTML editor. Expecting feature parity with special-purpose applications like Dreamweaver isn't really reasonable. With any general purpose editor it's almost a guarantee that there will be minor bugs in the syntax highlighting for a particular language. That's the trade-off for being able to use one application for all of your programming. Jack of all trades, master of none. That said, we can hope that IDM will find a clever way of doing what you want in a generic, language-neutral way.

                      28
                      Basic UserBasic User
                      28

                        Apr 26, 2005#11

                        I currently use Dreamweaver to edit html, xml, xsl, php, and css, and UltraEdit for all my other text files.

                        I'm trying to migrate from Dreamweaver to some other (more reliable) general-purpose editor (yes, I regard Dreamweaver as general-purpose too). My goal is to edit all my ASCII files with a single, trustable editor.

                        I've been using UltraEdit 7 for years and am now evaluating UltraEdit 11. I like its new features. It's almost as "good" as Dreamweaver for hand coding; there are just a couple things that are irritating me. The syntax coloring is one. Limited file management is the other.

                        UltraEdit sells itself as "The ideal text, HEX, HTML, and programmer's editor". They advertise "Syntax highlighting" as the second programmer's feature. So, syntax coloring for HTML is not an afterthought; it seems like a pretty important area to get "right". (For comparison, Macromedia lists "syntax coloring" fifth among DW's code editing features.)

                        I realize that UltraEdit costs about 1/10 as much as Dreamweaver, and probably has 1/10 (or even 1/100) the users, so there's not as much $$$ to allocate to individual features like syntax coloring. On the other hand, UltraEdit's developers don't have to worry about WYSIWYG, wizard, and template-related features that you see (and I ignore) in Dreamweaver. UltraEdit can remain focused on text editing.

                        I hope IDM find some time to polish the syntax coloring logic... maybe not for UltraEdit 11.x, but at least in time for UEStudio.

                        Maybe if they make their syntax coloring logic more mod-able (and write some comprehensive help files), we can do some of the work for them.

                        Travis