Re: Why no <IMG> inside <PRE>?

Stephen Turner (S.R.E.Turner@statslab.cam.ac.uk)
Wed, 10 Jan 1996 10:51:17 +0000 (GMT)


Message-Id: <m0tZy7h-000PrkC@lion.statslab.cam.ac.uk>
From: Stephen Turner <S.R.E.Turner@statslab.cam.ac.uk>
Subject: Re: Why no <IMG> inside <PRE>?
To: klute@nads.de
Date: Wed, 10 Jan 1996 10:51:17 +0000 (GMT)
Cc: S.R.E.Turner@statslab.cam.ac.uk, www-html@w3.org
In-Reply-To: <199601101035.LAA21463@heike.nads.de> from "Rainer Klute" at Jan 10, 96 11:35:13 am

Rainer Klute wrote:
-> 
-> >A shorter kludge is <pre><tt><img></tt></pre>.
-> 
-> No, sorry. Since in the PRE element declaration IMG occurs as an
-> exception, it is not permitted anywhere down in the element
-> hierarchy inside a PRE element.
-> 

That's not true in HTML2. The DTD only lists:

<!ENTITY % pre.content "#PCDATA | A | HR | BR | %font | %phrase">
<!ENTITY % pre.content "#PCDATA | A | HR | BR">
<!ELEMENT PRE - - (%pre.content)*>

Why there are two definitions of pre.content I have no idea, though it seems
the first one should be the correct one -- I want <b> and <i> in <pre> for
example. (Oh, I could have said that <pre><i><img></i></pre> was an even
shorter kludge, but it can mess up the interline spacing on Netscape even
when the image is only 1 pixel high, so I prefer to use two extra characters).

The (now expired) March '95 HTML3 draft DTD listed IMG as a pre.exclusion
so what I wrote would not be valid under that DTD (despite the claim that
"HTML 3.0 builds upon HTML 2.0 and provides full backwards compatibility").
Something like FIG might have worked instead under HTML3 though.

-- 
Stephen R. E. Turner
  Stochastic Networks Group, Statistical Laboratory, University of Cambridge
  e-mail: sret1@cam.ac.uk  WWW: http://www.statslab.cam.ac.uk/~sret1/home.html