[Kbabel] Re: Highlighting

Stanislav Visnovsky visnovsky@nenya.ms.mff.cuni.cz
Wed, 16 Oct 2002 11:58:09 +0200 (MET DST)


On Mon, 14 Oct 2002, Marco Wegner wrote:

> > > there's no more testing ;-)
> > >
> > > One more question: should I color everything which looks only remotely
> > > like a tag/entity, i.e. "<.*>", "&.*;"?
> >
> > This one is hard to answer, really. Entities are easier here, since you
> > can expect only letters and decimals there, but tags can be pretty
> > complicated. I would just assume <[a-zA-Z].*> to be a bit more precise,
> > but you have read W3C docs, haven't you?
>
> For instance a tag where the name starts with a number (e.g. <0tagname>) is
> invalid. I could easily check for this before highlighting. But this should
> not be done by the highlighter (quoting Stanislav: "IMHO the syntax
> highlighter should simply color the text, not doing any tests."). So how much
> testing should I do? Therefore my question whether simply to check for
> "<.*>" and "&.*;" and leave the rest to validation in CatManListItem.

IMHO syntax highlighter should be as precise as it can get using regular
expressions, but not more than that :-)). Of course, the best way to
would be to highlight exactly the same stuff as the validation does, but
it is not always possible to do that (to keep it in regular expressions).

Maybe we can reuse xml.xml definition of Kate highlighter.

Stanislav