Eclipse HTML editor rules? [message #245177] |
Wed, 09 January 2008 19:41  |
Eclipse User |
|
|
|
Originally posted by: bill.davidson.gmail.com
I'm not actually an Eclipse new comer but I'm not sure where to go with
this question. I recently started a new job working on an old legacy
servlet application. Apparently they either didn't know JSP or it's
old enough that it wasn't available at the time. In any case, they
designed their own HTML template system to solve essentially the same
problem. In order to replace values in the HTML template with values
from the database they came up with a special syntax that embedded these
values in HTML comments. Something like:
<!-- Some.Name.Value -->
They've always used regular text editors like vi and such. I'm trying
to use Eclipse and am having trouble with the HTML text editor.
Eclipse's text editor works just fine when the comment is contained by
a begin/end tag pair. In other words:
<select><!-- Some.List.of.Options --></select>
works perfectly. However, the Eclipse editor gets confused when one of
these HTML comments is inside a tag attribute. For example:
<img src="<!-- Some.Image.URLName -->" alt="">
is flagged as an error by the HTML editor as soon as it sees the "<!--".
It screws up the text coloring and flags other errors due to losing its
place in parsing the tree.
BTW, Vim's HTML text coloring parses this just fine. It treats the
comment as just regular text inside a set of quotes for an attribute.
Is there some way to modify the Eclipse editor's rules for this? I've
been looking all over but I can't seem to find the right Google
incantation for where those rules are or how they are implemented.
Looking through the Eclipse directory isn't going well either. Can
anyone point me to the appropriate files or better yet, docs on how to
fix this?
Obviously, this isn't earth shatteringly bad but it's just plain
annoying.
|
|
|
|
|
Re: Eclipse HTML editor rules? [message #245217 is a reply to message #245215] |
Thu, 10 January 2008 13:24   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Bill,
Comments below.
Bill Davidson wrote:
> Ed Merks wrote:
>>> <img src="<!-- Some.Image.URLName -->" alt="">
>> This doesn't look to be valid XML though....
>
> This is HTML, not XML or XHTML. It doesn't matter. I can't change
> their templating system anyway. This is a big legacy system.
I see.
>
>> I'm pretty sure this isn't valid XML. I think you need to use
>> "<!--..."
>
> Also, < is sure to break the templating system.
If it's looking at raw characters then without a doubt.
>
> Again, HTML != XML and does not have to conform to XML's rules.
> Indeed, even HTML 4.01 strict does not conform to XML's rules.
> Also, by the time the markup gets to the browser, these are
> replaced with data/markup from classes that get the data from
> the database. The example above would become something like
> this for the browser:
>
> <img src="http://www.MyCompany.Com/images/logo.gif" alt="">
>
> The only things that read the file in template form are the
> templating system and any text editors used to edit the templates
> (like Eclipse or Vim for example). Hmmm. Is there a plugin to
> use Vim inside of Eclipse?
There's vi plugin which I use and love http://satokar.com/viplugin/ but
I don't think that solves your colorization problem. I'm not sure where
it's done but given that it's valid HTML it seems reasonable to open a
bugzilla about it. In that bugzilla you could offer to help fix it if
someone would be so kind as to point you to the source code so you could
try to fix it. Do you know which editor you are using? At least for me
with just the platform installed the plain old text editor doesn't seem
to do colorization...
>
> If I can't find out how to modify the parsing rules for Eclipse,
> then my only other option is to live with the annoyance of Eclipse
> thinking the template markup is broken, when it is not.
|
|
|
|
Re: Eclipse HTML editor rules? [message #245233 is a reply to message #245217] |
Thu, 10 January 2008 15:18  |
Eclipse User |
|
|
|
Originally posted by: bill.davidson.gmail.com
Ed Merks wrote:
> There's vi plugin which I use and love http://satokar.com/viplugin/
I'll have to look at that. Sometimes, ":s" can do things that search
and replace cannot.
> I don't think that solves your colorization problem. I'm not sure where
> it's done but given that it's valid HTML it seems reasonable to open a
> bugzilla about it.
I'm not exactly sure it's HTML compliant. The HTML 4.01 docs seem to be
a bit fuzzy on the subject from what I can tell. It doesn't matter
though since I can't change the templating system.
> try to fix it. Do you know which editor you are using? At least for me
> with just the platform installed the plain old text editor doesn't seem
> to do colorization...
I'm using the built-in HTML editor. I've got Eclipse 3.3.1.1. I took
the one labeled "Eclipse IDE for Java EE Developers" from the main
download page. Maybe it includes an HTML editor plugin you don't have?
From Window->Preferences->Web and XML->HTML Files", there are some
options to modify the editor. Unfortunately, nothing is vaguely related
to what I want that I can see.
|
|
|
Powered by
FUDForum. Page generated in 0.12840 seconds