"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "Lynx/lynx_doc/docs/README.TRST" of archive lynx.zip:


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 Tabular Support for Simple Tables
    2 =================================
    3 Some definitions first:
    4 
    5 * NO table support
    6   What it says. :)  Table related tags are treated like other
    7   completely unrecognized tags.
    8   Only listed for completeness, this does not describe Lynx.
    9 
   10 * MINIMAL table support
   11   Table related tags are recognized, and are used to separate
   12   the contents of different cells (by at least a space) and rows
   13   (by a line break) visibly from each other.
   14 
   15 * LYNX minimal table support (LMTS)
   16   The minimal table support as implemented by Lynx up to this point,
   17   also includes the way ALIGN attributes are handled on TABLE, TR
   18   and other specific tweaks (e.g. handle TABLE within PRE specially).
   19   LMTS formatting is briefly described in the Lynx User Guide, see
   20   the section "Lynx and HTML Tables" there. (The Users Guide has not
   21   yet been updated for tabular support.)
   22 
   23 * TABULAR support for tables
   24   Support for tables that really arranges table cells in tabular form.
   25 
   26 * Tabular Rendering for SIMPLE Tables (TRST)
   27   Tabular support for some tables that are 'simple' enough; what this
   28   code change provides.
   29 
   30 One basic idea behind providing TRST is that correct tabular support
   31 for all tables is complex, doesn't fit well into the overwhelmingly
   32 one-pass way in which Lynx does things, and may in the end not give
   33 pleasant results anyway for pages that (ab-)use more complex table
   34 structures for display formatting purposes (especially in view of Lynx
   35 limitations such as fixed character cell size and lack of horizontal
   36 scrolling; see also emacs w3 mode).  Full table support within Lynx
   37 hasn't happened so far, and continues to seem unlikely to happen in the
   38 near future.
   39 
   40 The other basic idea is the observation that for simple tables, as
   41 used mostly for data that are really tabular in nature, LMTS rendering
   42 can be transformed into TRST rendering, after parsing the TABLE element,
   43 by two simple transformations applied line by line:
   44 - Insert spaces in the right places.
   45 - Shift the line as a whole.
   46 
   47 And that's exactly what TRST does.  An implementation based on the
   48 simple observation above is relatively straightforward, for simple
   49 tables.  On encountering the start of a TABLE element, Lynx generates
   50 output as usual for LMTS.  But it also keeps track of cell positions
   51 and lengths in parallel.  If all goes well, that additional information
   52 is used to fix up the already formatted output lines when the TABLE
   53 ends.  If not all goes well, the table was not 'simple' enough, the
   54 additional processing is canceled.  One advantage is that we always
   55 have a 'safe' fallback to well-understood traditional LMTS formatting:
   56 TRST won't make more complex tables look worse than before.
   57 
   58 What are 'simple' tables?  A table is simple enough if each of its TR
   59 rows translates into at most one display line in LMTS formatting (excluding
   60 leading and trailing line breaks), and the width required by each row
   61 (before as well as after fixup) does not exceed the available screen size.
   62 Note that this excludes all tables where some of the cells are marked up as
   63 block elements ('paragraphs').  Tables that include nested TABLE elements
   64 are always specifically excluded, but the inner tables may be subject to
   65 TRST handling.  Also excluded are some constructs that indicate that markup
   66 was already optimized for Lynx (or other browsers with no or minimal table
   67 support): TABLE in PRE, use of TAB.
   68 
   69 The description so far isn't completely accurate.  In many cases, tables are
   70 not simple enough according to the last paragraph, but parts of each TR row
   71 can still benefit from some TRST treatment.  Some partial treatment is done
   72 for some tables in this grey zone, which may or may not help to a better
   73 display, depending on how the table is used.  This is an area where tweaks
   74 in the future are most expected, and where the code's behavior is currently
   75 not well defined.
   76 
   77 One possible approach:
   78 - The table is 'simple' according to all criteria set out in the previous
   79   paragraph, except that some cells at the beginning and/or end of TR rows
   80   may contain block elements (or other markup that results in formatting
   81   like separate paragraphs).
   82 - There is at most one range of (non-empty) table cells in each row whose
   83   contents is not paragraph-formatted, and who are rendered on one line
   84   together by LMTS, separate from the paragraph-formatted cells.  Let's
   85   call these cells the 'core' of a row.
   86 Fixups are then only applied to the text lines showing the 'core' cells.
   87 The paragraph-formatted cells are effectively pulled out before/after
   88 their row (no horizontal space is allocated to them for the purpose of
   89 determining column widths for core line formatting).
   90 
   91 This is expected to be most useful for tables that are mostly
   92 simple tabular data cells, but with the occasional longer
   93 text thrown in.  For example, a table with intended rendering:
   94 
   95       --------------------------------------------------------
   96      |  date  |   item no.   |  price  |       remarks        |
   97      |--------|--------------|---------|----------------------|
   98      | date-1 | item #1      |   $0.00 |                      |
   99      |--------|--------------|---------|----------------------|
  100      | date-2 | item #2      | $101.99 | A longer annotation  |
  101      |        |              |         | marked up as a block |
  102      |        |              |         | of text.             |
  103      |--------|--------------|---------|----------------------|
  104      | date-3 | long item #3 |  $99.00 |                      |
  105       -------------------------------------------------------- 
  106 
  107 It may now be shown by Lynx as
  108 
  109     .................................................
  110 
  111       date    item no.    price  remarks
  112      date-1 item #1        $0.00
  113      date-2 item #2      $101.99
  114 
  115      A longer annotation marked up as a block of
  116      text.
  117 
  118      date-3 long item #3  $99.00
  119 
  120     .................................................
  121 
  122 As can be seen, this is still quite far from the intended rendering,
  123 but it is better than without any tabular support.
  124 
  125 Whether the code does something sensible with "grey area" tables is up
  126 for testing.  Most of the typical tables in typical Web pages aren't
  127 used in a way that can benefit from the TRST approach.  Parts of such
  128 tables may still end up getting shifted left or right by the TRST code
  129 when that doesn't improve anything, but I haven't seen it make things
  130 really worse so far (with the current code).
  131 
  132 TRST and Partial Display
  133 ------------------------
  134 [ Partial display mode is the feature which allows viewing and scrolling
  135 of pages while they are loaded, without having to wait for a complete
  136 transfer. ]  During partial display rendering, table lines can sometimes
  137 be shown in the original formatting, i.e. with horizontal fixups not yet
  138 applied.  This is more likely for longer tables, and depends on the state
  139 in which partial display 'catches' the TRST code.  Sometimes the display
  140 may flicker: first the preliminary rendering of table lines is shown, then
  141 after loading is finished it is replaced by the fixed-up version.  I do
  142 not consider this a serious problem: if you have partial display mode
  143 enabled, presumably you want to be able to see as much data as possible,
  144 and scroll up and down through it, as early as possible.  In fact, the
  145 approach taken keeps Lynx free from a problem that may graphical browsers
  146 have: they often cannot render a table at all until it is received in full.
  147 
  148 ------------------------------------------------------------------------
  149 
  150 To summarize:
  151  - TRST is a solution that works in many cases where lack of tabular support
  152    was most annoying.
  153  - TRST doesn't implement a full table model, and it is extremely unlikely
  154    that it will ever be the basis for that.  Keep on exploring external
  155    solutions, or perhaps waiting for (better: working on) a more fundamental
  156    redesign of Lynx's rendering engine.
  157 
  158 Klaus Weide - kweide@enteract.com 1999-10-13