[Pmwiki-users] Minor formatting suggestion: <p /> after lists

Joakim Erdfelt joakim
Tue Sep 23 06:50:11 CDT 2003


Nathan Jones wrote:

>[Repost - first attempt (on Friday) disappeared.]
>
>I have a minor suggestion to consider for a future release of this
>wonderful wiki software.
>
>This input:
>-----
>! Heading
>
>Paragraph one.
>
>* List item
>
>Paragraph two.
>-----
>
>Gives this output:
>-----
><p /><h1> Heading</h1>
><p />Paragraph one.
><p /><ul ><li> List item
><p /></li></ul>Paragraph two.
>-----
>
>Suggestion:
>Put the <p /> generated by the second blank line after the </ul> instead
>of before it.
>
>Reason:
>In the above sample, paragraph one is treated as a paragraph (<p>) by the
>browser, but paragraph two is not - it is just loose text owned by the
><body>, not by another element.
>
I'd like to add that the use of empty paragraph <p /> tags is
against web standards.

HTML Spec:
http://www.w3.org/TR/html4/struct/text.html#h-9.3.1

  The P element represents a paragraph. It cannot contain block-level
  elements (including P itself).

  We discourage authors from using empty P elements. User agents should
  ignore empty P elements.

Also, according to the XHTML spec:
http://www.w3.org/TR/xhtml1/#C_3

  C.3. Element Minimization and Empty Element Content

  Given an empty instance of an element whose content model is not
  EMPTY (for example, an empty title or paragraph) do not use the
  minimized form (e.g. use <p> </p> and not <p />).

See DTD definitions:
http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-strict.dtd_p
http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-transitional.dtd_p

Notice that the content is not labelled as "EMPTY"?

>Also, the same thing occurs with some other elements - so far I've
>noticed <pre> tags generated from:
>
> [=
>content
>=]
>
>...are immediately followed by the text of the next paragraph.
>
>When this makes a difference:
>If you have a style sheet that applies a style to the p element, it won't
>apply to the text following a list. In my case, I have added a
>margin-left style to indent all paragraphs slightly. "Paragraphs" after
>tables do not get indented.
>
I've noticed that the <pre></pre> tags also show up in preview mode, but
not in regular browse mode. 

See demo at: http://www.pmichaud.com/wiki/Demo/PreTagPreview

>Notes:
>I don't know if this would cause some problem I haven't thought of and I
>don't know how feasible/easy it is programming wise. I guess a kludgy
>workaround would be to output a <p /> after each </ul> or </ol>,
>resulting in: <p /></ul><p />
>
Looking at Patrick's code, it would seem to me that it would impact a good
portion of the code.  Patrick can comment better on this tho. ;-)

/* joakim */




More information about the pmwiki-users mailing list