Re: strange para/programlisting pattern in sgml docs

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: strange para/programlisting pattern in sgml docs
Date: 2023-11-27 10:16:46
Message-ID: 352b408d-d2f2-4d67-8510-d61f363958b2@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 25.11.23 21:44, Tomas Vondra wrote:
> while working on a patch I noticed we do this in the SGML docs (for
> example in indexam.sgml and a bunch of other files):
>
> <para>
> ... some text ...
> </para>
>
> <para>
> <programlisting>
> some code
> </programlisting>
> ... description of the code.
> </para>
>
> That is, the program listing is in a paragraph that starts immediately
> before it. I just noticed this ends up like this in the HTML:
>
> <p>... some text ...</p>
>
> <p></p>
>
> <pre>some code</pre>
>
> <p>... description of the code.</p>
>
> That is, there's an empty <p></p> before <pre>, which seems a bit weird,
> but it seems to render fine (at least in Firefox), so maybe it looks
> weird but is not a problem in practice ...

This is because in HTML you can't have <pre> inside <p> but in DocBook
you can have <programlisting> inside <para> (and other similar cases).
So the DocBook XSLT stylesheets fix that up by splitting the <p> into
separate <p> elements before and after the <pre>. It's just a
coincidence that one of them is empty in this case.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2023-11-27 10:19:01 Re: New instability in stats regression test
Previous Message Amit Kapila 2023-11-27 10:13:14 Re: logical decoding and replication of sequences, take 2