Page 1 of 1

Extra <br> in html

Posted: Tue Mar 07, 2006 10:38 am
by Hanno
Hi Sergey,

In a TRichViewEdit I type in one word, followed by 2 carriage returns and then another word, so it looks like this:

Code: Select all

Hello

Sergey
When I save it to Html it writes code like this:
<p class=X><span class=X>Hello</span></p>
<p class=X><span class=X><br></span> </p>
<p class=X><span class=X>Sergey</span></p>

Which produces Html that renders an extra blank line like this:

Code: Select all

Hello


Sergey
I have just moved to v1.9.23 from v1.8 so I am noticing some differences here and maybe I am doing something wrong. But in CRVData.pas, in the function TCustomRVData.GetTextForHTML, the block of code at the top is adding the <br> tag when it shouldn't.

if (Result='') and IsFromNewLine(ItemNo) and
((ItemNo+1=ItemCount) or IsParaStart(ItemNo+1)) then begin
Result := Format('<br%s>', [RV_HTMLGetEndingSlash(SaveOptions)]);

I have commented out the line above in bold. Now when I save to html the html looks correct, but is this wrong to comment out this line?

Posted: Tue Mar 07, 2006 5:36 pm
by Sergey Tkachenko
In older versions, empty lines were saved as
<p> </p>
In newer versions, they are saved as
<p><br></p>

But both <br> and  ... They should not be together.
Can you send me this document as RVF file?

Posted: Wed Mar 08, 2006 2:21 pm
by Hanno
Thanks Sergey, your reply pointed me in the right direction. Once I knew what it was supposed to be doing, I found the problem - I have some extra code that processes the html looking for the old way of doing things, and replacing the tags it found. So it was my code. Sorry for the trouble.