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: Foteos Macrides
Subject: Re: LYNX-DEV Centering <pre> text.
Date: Wed, 07 May 1997 20:50:20 -0500 (EST)

Gunnar Strand <address@hidden> wrote:
>Klaus Weide uttered:
>> On Wed, 7 May 1997, Wayne Buttles wrote:
>> > On Wed, 7 May 1997, Gunnar Strand wrote:
>
>[about centering <pre> tags]
>
>> 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. 
>
>Ah. I assumed that there was a lookahead on each element before it was
>rendered (that's how I would do it), which would look at the source as
>a stream of blocks, and not a stream of lines. Now I understand why
>centered tables look the way they do. OTOH should centered text not
>be block centered.

        If you really want PRE blocks to inherit the default alignment
of a containing DIV (or CENTER, which we treat as DIV ALIGN=center),
then you simply pass it that in HTML_start_element():

[...]
    case HTML_PRE:                              /* Formatted text */
        if (!HText_PreviousLineSize(me->text))
            me->inPRE = FALSE;
        else
            me->inPRE = TRUE;
        if (me->Division_Level >= 0) {
            styles[HTML_PRE]->alignment =
                                me->DivisionAlignments[me->Division_Level];
        }
[...]


i.e., add that last if() section, and code to reset it in
HTML_end_element():


[...]
    case HTML_PRE:                              /* Formatted text */
        styles[HTML_PRE]->alignment = HT_LEFT;
[...]


        It makes no difference whether the centering is done line-by-line,
or by some more convoluted scheme for a captured block.  The code is
simply making the assumption that you don't want that inheritence, and
if you don't think that's a good assumption, it's trivial to change
it.  At this point the Lynx code is set up and anxiously waiting for
these things to be done via an external default style sheet which any
user can configure, without having to hack the code itself (indeed, it
was expecting that to happen for the v2.7 release 8-).

                                Fote

=========================================================================
 Foteos Macrides            Worcester Foundation for Biomedical Research
 address@hidden         222 Maple Avenue, Shrewsbury, MA 01545
=========================================================================
;
; 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]