[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lynx-dev] Gopher directory rendering problem
From: |
Ciprian Dorin Craciun |
Subject: |
Re: [Lynx-dev] Gopher directory rendering problem |
Date: |
Tue, 18 Mar 2008 17:44:30 +0200 |
Thanks for your info! It works.
I have attached a patch with the modification you have suggested.
Ciprian.
P.S. I recently (re-)discovered the Gopher protocol and it seemed
a very nice idea for a simple content distribution protocol (and it
could be very easibly built into appliances). (Also I wanted to try my
Erlang knowledge to build a Gopher server into it... And for testing
purposes I used 7070 port, which doesn't work with Firefox...)
On Mon, Mar 17, 2008 at 2:05 AM, Thomas Dickey <address@hidden> wrote:
> On Sun, 16 Mar 2008, Thorsten Glaser wrote:
>
> > Thomas Dickey dixit:
>
> >
> >> thanks - it's been a while since I'd seen a live gopher site.
> >
> > gopher://gopher.semmel.ch/ from Ventilator, an author on the german
> > news site http://symlink.ch/
>
> Here's what happens: WWW/Library/Implementation/HTGopher.c creates an HTML
> document in an internal stream, and puts most of it in a <PRE>...</PRE>.
>
> GridText is not seeing the first newline (which would split the line)
> since the logic in src/HTML.c for HTML_put_character() around line 350 for
> the HTML_PRE case is not seeing the me->inPRE flag set.
>
> case HTML_PRE: /* Formatted text */
> /*
> * We guarantee that the style is up-to-date in begin_litteral. But
> we
> * still want to strip \r's.
> */
> if (c != '\r' &&
> !(c == '\n' && me->inLABEL && !me->inP) &&
> !(c == '\n' && !me->inPRE)) { <-- this condition should pass
> me->inP = TRUE;
> me->inLABEL = FALSE;
> HText_appendCharacter(me->text, c);
> }
> me->inPRE = TRUE;
> break;
>
>
> In turn, that is not set because of this chunk in src/HTML.c around line
> 2270:
>
> case HTML_PRE: /* Formatted text */
> /*
> * Set our inPRE flag to FALSE so that a newline immediately
> following
> * the PRE start tag will be ignored. HTML_put_character() will set
> it
> * to TRUE when the first character within the PRE block is received.
> * - FM
> */
> me->inPRE = FALSE;
> /* FALLTHRU */
>
> Using that clue, I see that adding a PUT('\n'); in HTGopher.c after the
> START(HTML_PRE) call passes in the "newline immediately following", which
> sets the flag, making the newline seen as a place to split the line, etc.
>
> The chunk in HTGopher.c looks like this now:
>
> END(HTML_H1);
> PUTC('\n');
> START(HTML_PRE);
> PUTC('\n'); <--- add this
> while ((ich = NEXT_CHAR) != EOF) {
>
>
>
> --
> Thomas E. Dickey
> http://invisible-island.net
> ftp://invisible-island.net
patch.diff
Description: Text Data