Subject: Why no <IMG> inside <PRE>?
From:	Gerald Oskoboiny <[email protected]>
To:	[email protected]
Date:	Tue, 9 Jan 1996 23:26:44 -0700 (MST)
Message-Id: <[email protected]>


My HTML validator, <URL:http://ugweb.cs.ualberta.ca/~gerald/validate.cgi>,
uses <IMG>'s inside <PRE>-formatted text to show where errors occur within
the HTML source text. To see a sample validation run with errors, look at
<URL:http://ugweb.cs.ualberta.ca/~gerald/validate.cgi?url=http://www.w3.org/
pub/WWW/MarkUp/>. :-)

Much to my chagrin, it turns out that it's invalid to use <IMG> inside
<PRE> in HTML 2.0. Is there some reason for this? (I guess I'm not asking
if there's some reason it's like this in HTML 2.0, but rather is there
some reason it "should" be this way in HTML?)

I managed to come up with a non-PRE-formatted version of my validator, at
<URL:http://ugweb.cs.ualberta.ca/~gerald/validate/>, but I prefer the old,
invalid version.

Would it be possible to get this changed for the next version of HTML
(whatever that turns out to be)? I've never heard of a browser that doesn't
support this (does anyone know of one?), and I think using <PRE> to align
things is now and will continue to be "current practice" until table support
is more widespread. (see, for example, <URL:http://sunsite.unc.edu/>.)

Uh, wait a minute... I just poked around the HTML 2.0 DTD a little bit,
and realized that:

   <PRE> ... <A NAME="foo"> <IMG SRC="bar"> </A> ... </PRE>

is valid, while

   <PRE> ...                <IMG SRC="bar">      ... </PRE>

is not. Argh. I wish I would've figured that out about a month ago before
wasting all that time redesigning the output of my validator.

I still think <IMG> should be made to be valid inside <PRE>, since it seems
silly to have to put <A NAME="..."> around each <IMG> as a hack around the
content models or whatever.

Gerald
-- 
Gerald Oskoboiny  <[email protected]>  http://ugweb.cs.ualberta.ca/~gerald/


Message-Id: <[email protected]> To: Gerald Oskoboiny <[email protected]> Cc: [email protected] Subject: Re: Why no <IMG> inside <PRE>? Date: Wed, 10 Jan 1996 03:26:35 -0500 From: "Daniel W. Connolly" <[email protected]> In message <[email protected]>, Gerald Os koboiny writes: >My HTML validator, <URL:http://ugweb.cs.ualberta.ca/~gerald/validate.cgi>, >uses <IMG>'s inside <PRE>-formatted text to show where errors occur within >the HTML source text. To see a sample validation run with errors, look at ><URL:http://ugweb.cs.ualberta.ca/~gerald/validate.cgi?url=http://www.w3.org/ >pub/WWW/MarkUp/>. :-) > >Much to my chagrin, it turns out that it's invalid to use <IMG> inside ><PRE> in HTML 2.0. Is there some reason for this? (I guess I'm not asking >if there's some reason it's like this in HTML 2.0, but rather is there >some reason it "should" be this way in HTML?) No -- no good reason, anyway. I think this was on the "to-do" list during the HTML 2.0 review, and I just forgot to do it. I was surprised myself when I went back and realized this change never got made. >Would it be possible to get this changed for the next version of HTML Yes. In fact, if anybody feels like cooking up DTDs as candidates for new versions of HTML, please put them on the web and send a note including the address to this list. For example, see: http://ogopogo.nttc.edu/spec/html/modular-dtd.html Dan
From: Abigail <[email protected]> Message-Id: <[email protected]> Subject: Re: Why no <IMG> inside <PRE>? To: [email protected] Date: Wed, 10 Jan 1996 09:35:33 +0100 (MET) You, Daniel W. Connolly wrote: ++ ++ In message <[email protected]>, Gerald Os ++ koboiny writes: ++ >Much to my chagrin, it turns out that it's invalid to use <IMG> inside ++ ><PRE> in HTML 2.0. Is there some reason for this? (I guess I'm not asking ++ >if there's some reason it's like this in HTML 2.0, but rather is there ++ >some reason it "should" be this way in HTML?) ++ ++ No -- no good reason, anyway. I think this was on the "to-do" list ++ during the HTML 2.0 review, and I just forgot to do it. I was surprised ++ myself when I went back and realized this change never got made. Hmm, I always thought it was because the unit in <PRE> is characters, and the unit of images is pixels. If I have: <pre> a b <img src = "foo.gif" alt = "xxx"> d 1 2 3 4 </pre> to which should the 4 (vertically) align? I fail to see how something can be "preformatted" (but using my font size) and yet include images whose size bears no relation which the choosen font size. ++ >Would it be possible to get this changed for the next version of HTML ++ ++ Yes. ++ ++ In fact, if anybody feels like cooking up DTDs as candidates for new ++ versions of HTML, please put them on the web and send a note including ++ the address to this list. Well, the 28 March 1995 HTML 3.0 specifically excludes <IMG> from <PRE>: <!ENTITY % pre.exclusion "TAB|MATH|IMG|BIG|SMALL|SUB|SUP"> <!ELEMENT PRE - - (%text)* -(%pre.exclusion)> It always made sense to me... (that is, the exclusion of <IMG> in <PRE>). Abigail
Message-Id: <[email protected]> From: Stephen Turner <[email protected]> Subject: Re: Why no <IMG> inside <PRE>? To: [email protected] Date: Wed, 10 Jan 1996 10:02:37 +0000 (GMT) A shorter kludge is <pre><tt><img></tt></pre>. I agree with Abigail that there are good reasons to disallow it, though I think images can be used fairly safely at the ends of <pre> lines. -- Stephen R. E. Turner Stochastic Networks Group, Statistical Laboratory, University of Cambridge e-mail: [email protected] WWW: http://www.statslab.cam.ac.uk/~sret1/home.html
Subject: Re: Why no <IMG> inside <PRE>? From: Gerald Oskoboiny <[email protected]> To: [email protected] Date: Wed, 10 Jan 1996 10:06:13 -0700 (MST) Message-Id: <[email protected]> Abigail writes: > Daniel W. Connolly wrote: > ++ > ++ Gerald Oskoboiny writes: > ++ >Much to my chagrin, it turns out that it's invalid to use <IMG> inside > ++ ><PRE> in HTML 2.0. Is there some reason for this? (I guess I'm not asking > ++ >if there's some reason it's like this in HTML 2.0, but rather is there > ++ >some reason it "should" be this way in HTML?) > ++ > ++ No -- no good reason, anyway. I think this was on the "to-do" list > ++ during the HTML 2.0 review, and I just forgot to do it. I was surprised > ++ myself when I went back and realized this change never got made. > > Hmm, I always thought it was because the unit in <PRE> is characters, > and the unit of images is pixels. If I have: > > <pre> > a b <img src = "foo.gif" alt = "xxx"> d > 1 2 3 4 > </pre> > > to which should the 4 (vertically) align? I guess that would be "undefined", but, if you have: <pre> a b <img src = "foo.gif" alt = "xxx"> d 1 2 <img src = "bar.gif" alt = "yyy"> 4 </pre> and "foo.gif" is exactly as wide as "bar.gif", the behavior is well-defined, and extremely useful. (as in, for instance, <URL:http://sunsite.unc.edu/>.) Gerald p.s. anyone know why this is being echoed on www-talk? -- Gerald Oskoboiny <[email protected]> http://ugweb.cs.ualberta.ca/~gerald/