Home Download Buy Blog Forum Support

Syntax highlighting problem

Syntax highlighting problem

Postby thany on Mon Nov 19, 2012 12:44 pm

First time user here :)

It seems that any syntax highlighting after this HTML is suspended:
Code: Select all
<div id=content>

And is resumed after the matching closing tag.

See the attached screenshot.

I'm using a fresh install of whatever the latest version is (just downloaded a half hour ago), on Windows 7 x64 SP1.
Attachments
sublimetext-syntax-highlight.png
sublimetext-syntax-highlight.png (118.75 KiB) Viewed 814 times
thany
 
Posts: 9
Joined: Mon Nov 19, 2012 12:39 pm

Re: Syntax highlighting problem

Postby phillip.koebbe on Mon Nov 19, 2012 1:51 pm

I'm just going to make a wild guess here. It very well could be waaaaay off. Try putting quotes around the attribute values

Code: Select all
<div class="article">
  <div id="content">
  ...
  </div>
</div>


I'm wondering if the regex expects quotes to be there.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Syntax highlighting problem

Postby thany on Mon Nov 19, 2012 1:58 pm

That works around the problem.

But without quotes is perfectly valid HTML, so I won't change it just for the sake of working around a bug in my editor.
thany
 
Posts: 9
Joined: Mon Nov 19, 2012 12:39 pm

Re: Syntax highlighting problem

Postby phillip.koebbe on Mon Nov 19, 2012 2:00 pm

If that indeed addresses the issue, it's not a bug in the editor. It's the HTML syntax definition that is written in such a way as to expect quotes. If you are adept at regular expressions, you can edit it to not require them.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Syntax highlighting problem

Postby nick. on Mon Nov 19, 2012 3:01 pm

It's generally considered bad practice to not quote attribute values. What happens when your value has whitespace? Or if you want to add several classes to an element? Double-quotes make the attribute-value relationship unambiguous.

Larger discussion here: http://stackoverflow.com/questions/6495 ... attributes
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Re: Syntax highlighting problem

Postby thany on Mon Nov 19, 2012 4:02 pm

This one is static and will never have whitespace or quotes. Besides it's perfectly well specified what exactly must be quoted and what can remain unquoted. Furthermore, this validator will tell you what's valid or not, and will work in every browser that came out in the past 40 years. What's more, the syntax highlighter is clearly named "HTML", not "XHTML". Lastly, these kind of responses are usually made by people who are simply uncomfortable with unquoted attributes anyway. No offense.

So I don't see a problem.

About the regex. Well, yes i am okay with regexes, it's just that I'm not going to adapt internal config files. They would be overwritten in the next version. It's a fix that should be in the next version of the application, not in my local config.
thany
 
Posts: 9
Joined: Mon Nov 19, 2012 12:39 pm

Re: Syntax highlighting problem

Postby nick. on Mon Nov 19, 2012 7:57 pm

You're welcome to ignore my advice, I don't mind.

Regarding the syntax files, it's unlikely the change will be made in the official packages. This isn't a new problem, and hasn't been addressed so far as I know.
The syntax definitions are compatible with Textmate, which does have a github repo for it's syntax files. You can push your changes there if you want.
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot] and 30 guests