Re: <p> ... </p>

William C. Cheng (william@cs.columbia.edu)
Tue, 19 Dec 1995 17:41:56 -0500


Chuck Foster <chuck@pipex.net> wrote:
> At 12:53 19/12/95 +0000, you wrote:
> >Hi,
> >
> >I seem to have started an argument over the definition of paragraphs - oops!
> >
> >However, nobody actually answered my query about where the <p> / </p>
> >should be used, in relation to things like <ul>, <ol>, even <form> etc!
>
> Have you looked at the charts HALSoft has prepared? For example, with the
> 2.0 DTD, http://www.halsoft.com/sgml/html-2.0/html-2.0-index.html , they show:
>
> P
>
> Required Parts
> <P>characters...
> All Parts
> <P>characters... <A> <IMG> <BR> <EM> <STRONG> <CODE> <SAMP> <KBD>
> <VAR> <CITE> <TT> <B> <I> </P>
> Allowed In Content Of...
> <ADDRESS> <BLOCKQUOTE> <BODY> <DD> <FORM> <LI>
>
> >I try to use </P> generally, though I know it is optional - I might
> >start to omit it in order to make some documents smaller (well its
> >four bytes shorter per paragraph!). However, its where it *is* needed
> >and where <p> should be used that confuses me.
>
> One thing which confuses the issue is that certain popular browsers (eg.
> Netscape) often render their display diffently depending on whether the </P>
> is explicitly stated or is omitted. Sadly, pragmatic considerations confuse
> the issue.
>
> Another thought is that while the location of an implied </P> can be
> determined, such a parser is hardly a trivial matter. I can envision a
> number of applications where a prepass parser might insert all the implied
> paragraph end tags. This "normalized" format could then allow much easier
> subsequent manipulation.

The DTD should be the place to look to clear up confusion! In the HTML-2.0
DTD, the <P> tag is specified as:

<!ELEMENT P - O (%text)*>

and %text is defined as (this is where I'm confused):

<![ %HTML.Highlighting [
<!ENTITY % font " TT | B | I ">
<!ENTITY % phrase " EM | STRING | CODE | SAMP | KBD | VAR | CITE ">
<!ENTITY % text "#PCDATA | A | IMG | BR | %phrase | %font">
...
]]>

<!ENTITY % text "#PCDATA | A | IMG | BR">

Apparently, the %text in %HTML.Highlighting is used! Could someone
explain to me why this is the case?

--
Bill Cheng // Guest at Columbia Unversity Computer Science Department
william@CS.COLUMBIA.EDU      ...!{uunet|ucbvax}!cs.columbia.edu!william
WWW Home Page: <URL:http://www.cs.columbia.edu/~william>