HTML parser

Hi,
I would like to know if this behavior normal when Grid.EnableHTML is True (default value):

Using:
AdvStringGrid
Delphi 7

AdvStringGrid1.Cells[1,1] := 'no';
AdvStringGrid1.Cells[2,1] := '<no';
AdvStringGrid1.Cells[3,1] := 'id';
AdvStringGrid1.Cells[4,1] := '<id';
AdvStringGrid1.Cells[5,1] := 'y=i';
AdvStringGrid1.Cells[6,1] := 'y<i';

Cell 4,1 will be empty. Cell 6,1 will only show "y". I assume this is because "<i" could be the start of an HTML italic tag? The cell 2,1 will print because there are no supported HTML tag starting with <n?
Cell 4,1 and 6,1 will show correct value if i set EnableHTML to False.

I can live with turning off EnabledHTML but what would happen if I need to use both HTML tags and text containing <i (or any other letter that is used in a HTML tag) in the grid? Let's say I want to print "y<i" with an italic html tag, how to I accomplish this?

Thanks

When you have HTML enabled, the proper syntax for symbols like < and > is &lt; and &gt;

Hi,
how do you suggest I handle this scenario:
I have some cells with html and some with no html.

&lt; will only print the < sign if they are inside a valid HTML tag. All my non html cells will print "y&lt;i".
If i put < instead of &lt;in my non HTML cells then I get the initial problem that everything after the < sign won't print. If I set the EnableHTML property to false then my HTML tags won't parse.

The only simple way I see around this problem to get both scenario to work is to wrap all my strings inside <HTML></HTML> tags even if I do not use HTML and to replace all occurence of "<" by "&lt;" but I find this is kinda awkward. Is this by design?

Thanks

Look at it from the perspective of a parser, how else can the parser determine that it should render the text as HTML or as plain text?
It uses EnableHTML to turn it on or off and it looks if there is a closing tag when EnableHTML = true to determine if the cell contains HTML or not.


You say it looks if there is a closing tag when EnableHTML = true to determine if the cell contains HTML or not.
It doesn't seem to be the case because "<banana" currently show nothing. The parser currently seems to ignore the text if it doesn't end up finding a closing tag. Don't you think this is a bug since you mention the parser is looking for a closing tag and it doesn't seem to be the case?
<b>anana = "anana" in bold (this feels ok)
<banana = "". For this on i would expect to get "<banana" because there is no closing tag (instead of the parser eating my string and returning nothing)
<g>anana = "<g>anana" because G is not a real tag. (this feels ok)
<ganana = "<ganana" (this also feels ok)

Isn't this a bug in the parser?

Thanks

The detection if a cell contains HTML is a bit more sophisticated for the convenience of the developer. It will not only detect closing tags but some commonly used HTML tags that do not have closures, like <BR> <IMG>, ... and to make detection lightweight to not affect performance too much, it checks for <B, <I  in addition to </