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.



Reply via email to