lynx-dev
[Top][All Lists]
Advanced

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

Re: LYNX-DEV Centering <pre> text.


From: Klaus Weide
Subject: Re: LYNX-DEV Centering <pre> text.
Date: Wed, 7 May 1997 14:36:38 -0500 (CDT)

On Wed, 7 May 1997, Wayne Buttles wrote:

> On Wed, 7 May 1997, Gunnar Strand wrote:
> 
> > How can I get Lynx to center <pre> tagged text? Putting it in a table
> > doesn't work. 
> 
> To properly apply multiple formatting styles onto a body of text you need
> a multi-pass system.  Since Lynx only makes one HTML pass at the incomming
> document it can't do it.  Lynx will never know the widest line before it
> has to apply the centering.

Or to put it another way:
Lynx cannot center block-level elements as a whole.  It applies centering
to lines, not blocks (various kinds paragraphs etc.)  When CENTER or
ALIGN=CENTER is in effect for a contained block-level element, centering
may get (in some cases) applied to the individual lines of that, but not
to the thing as a whole. 

> I have been pondering this problem myself.  Just where is the best place
> to intercept the incomming stream? 

How about this (just a sketchy idea):

Do it late in the game, at the GridText level.  Make the HText have child
mini-HText structures (with only the necessary structure members and
methods of a full HText). Generalize the functions in GridText.c which
append things to the text, so that they can work on a mini-HText (don't
use the global LYcols for width etc.).  Make calls to e.g.
HText_appendCharacter(text) work as usual (append to text) in the normal
case, but propagate to miniHText_appendCharacter(text->childtext) instead
if a mini-HText text->childtext is "open".  Some tags result in "opening"
(allocating etc.) a mini-HText child.  Maybe HTML.c wouldn't have to know
about it at all, just make the calls to new HText_* functions.
Ally recursion.
When a mini-HText child of a "containing" HText (which may be either
another mini- or the main one) is closed, text lines and anchor lists
of the child have to be merged/pasted/reordered/repositioned with/into
the ones of the containing HText - taking into account the overall "style"
(centering, indentation etc.) for the child's block.  Here it would get
real messy...
This also wouldn't work for things like table cells if the width (or a
maximum for it) isn't a priori known.

   Klaus

;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

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