lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev -prettysrc, html comments and cr/lf problem


From: Vlad Harchev
Subject: Re: lynx-dev -prettysrc, html comments and cr/lf problem
Date: Wed, 21 Jul 1999 05:51:43 +0500 (SAMST)

On Thu, 22 Jul 1999, Leonid Pauzner wrote:

> I found out a bug with prettysrc mode, minor one.
> 
> Any web browser should render HTML pages with LF or CR/LF end-of-line symbols
> (the latter mostly on Windows-generated pages) and give the same visual output
> for both end-of-lines. Lynx do so. Unfortunately, in some special situations
> prettysrc mode works differently.
> 
> If HTML comment <!-- xxxx --> consinst of several lines and line breaks are
> cr/lf then in prettysrc mode we see an extra blank line between lines within
> the comment.
> 
> I can not provide the URL (doing experiments on my local files) but this
> should not be a problem to download html page from any Microsoft IIS server
> and insert <!-- , --> somethere in.
> 
> Leonid.
> 

 Here is a patch to fix this. In general, HTML_put_character converts
all cr-lf pairs to '\n', so that no '\r' is passed to HText_put_character.
Since no '\r' from input file is not passed to HText_put_char*, '\r' is used
as internal command for HText to insert blank line.
 When comment is encountered in psrc mode, it's agregated in the chunk until
it's terminated, and then it's emitted via HTML_put_string (surrounded
by proper style changes). HTML_put_string was calling HText_appendText (or
something like this, writing entire string in one call), and since '\r's were
not handled, they were causing extra blank lines. This patch affects behaviour
of HTML_put_string not to call HText_appendText (or something like this) if
in psrc mode, but put comment's content character by character (thus all 
'crlf' will be fixed).

 Best regards,
  -Vlad

--- HTML.c-was  Sat Jul 17 21:14:38 1999
+++ HTML.c      Wed Jul 21 05:36:49 1999
@@ -526,6 +526,17 @@
             *  by the cases above (HTML_PRE or similar may not be the
             *  last element pushed on the style stack). - kw
             */
+#ifdef USE_PSRC
+           if (psrc_view) {
+               /* we do so in order the raw '\r' in the string not to be 
+                  interpreted as internal request to break a line -
+                  passing '\r' to HText_put_character is treated by it as 
+                  request to insert blank line - VH
+               */
+               for(;*s;++s) 
+                   HTML_put_character(me, *s);         
+           } else
+#endif
            HText_appendText(me->text, s);
            break;
        } else {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]