lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev strict SortaSGML rules for <PRE>...</PRE> content


From: Leonid Pauzner
Subject: lynx-dev strict SortaSGML rules for <PRE>...</PRE> content
Date: Fri, 6 Aug 1999 14:02:53 +0400 (MSD)

Many documents on the Web use <pre>...</pre> tags to include prepormatted
text with end-of-lines. Unfortunately, they also use some html decorations
like <em>..</em> or <h2>..</h2>, the latter break PRE mode (by forcing </PRE>)
which was not happen for TagSoup mode or Big Two browsers.

The question is what does the list of restricted tags under PRE looks like?

HTML 4.0 said the following (and <Hx> does not listed in the exclusions):
========


  9.3.4 Preformatted text: The PRE element

<!ENTITY % pre.exclusion "IMG|OBJECT|APPLET|BIG|SMALL|SUB|SUP|FONT|BASEFONT">

<!ELEMENT PRE - - (%inline;)* -(%pre.exclusion;) -- preformatted text -->
<!ATTLIST PRE
  %attrs;                          -- %coreattrs, %i18n, %events --
  width       NUMBER     #IMPLIED
  >

   Start tag: required, End tag: required

   Attribute definitions

   width = number [CN]
          This attribute provides a hint to visual user agents about the
          desired width of the formatted block. The user agent can use
          this information to select an appropriate font size or to
          indent the content appropriately. The desired width is
          expressed in number of characters. This attribute is not widely
          supported currently.

   Attributes defined elsewhere
     * id, class (document-wide identifiers)
     * lang (language information), dir (text direction)
     * title (element titles)
     * style (inline style information )
     * onclick, ondblclick, onmousedown, onmouseup, onmouseover,
       onmousemove, onmouseout, onkeypress, onkeydown, onkeyup (intrinsic
       events )

   The PRE element tells visual user agents that the enclosed text is
   "preformatted". Visual user agents must treat preformatted text as
   follows:
     * They may leave white space intact.
     * They may render text with a fixed-pitch font.
     * They may disable automatic word wrap.
     * They must not disable bidirectional processing.

   Non-visual user agents may ignore the spacing and line breaks in this
   element's content.

   Note that the SGML standard requires that the parser remove a newline
   immediately following the start tag or immediately preceding the end
   tag of the PRE.

   The DTD fragment above indicates which elements may not appear within
   a PRE declaration. This is the same as in HTML 3.2, and is intended to
   preserve constant line spacing and column alignment for text rendered
   in a fixed pitch font. Authors are discouraged from altering this
   behavior through style sheets.

   The following example shows a preformatted verse from Shelly's poem To
   a Skylark:
<PRE>
       Higher still and higher
         From the earth thou springest
       Like a cloud of fire;
         The blue deep thou wingest,
And singing still dost soar, and soaring ever singest.
</PRE>

   Here is the same verse as rendered by your user agent:
       Higher still and higher
         From the earth thou springest
       Like a cloud of fire;
         The blue deep thou wingest,
And singing still dost soar, and soaring ever singest.

   The horizontal tab character
   The horizontal tab character (decimal 9 in [ISO10646] and [ISO88591] )
   is usually interpreted by visual user agents as the smallest non-zero
   number of spaces necessary to line characters up along tab stops that
   are every 8 characters. We strongly discourage using horizontal tabs
   in preformatted text since it is common practice, when editing, to set
   the tab-spacing to other values, leading to misaligned documents.




reply via email to

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