oreillymedia / docbook2asciidoc

XSL for transforming DocBook to AsciiDoc
MIT License
61 stars 33 forks source link

Bug with conversion of <varlistentry>s with multiple paras per entry and ids on the para #61

Open sandersk opened 10 years ago

sandersk commented 10 years ago

This is a real edge case brought to my attention in MakerPress/atlas-public-feedback#353, but there is a bug in the DocBook-to-AsciiDoc XSL logic that affects <varlistentry> elements that contain multiple paras in the <listitem> child when the paras have ids.

For example, the following source markup:

<variablelist id="para_scala_characteristics">
<varlistentry id="varlistentry-statically-typed">
<term>Statically typed</term>
<listitem>
<para>
As we described in the previous section, a statically typed language binds the type to a
<emphasis>variable</emphasis>
for the lifetime of that variable. In contrast,
<emphasis>dynamically typed</emphasis>
languages bind the type to the actual
<emphasis>value</emphasis>
referenced by a variable, meaning that the type of a
<emphasis>variable</emphasis>
can change along with the value it references.
</para>
<para id="para_of_the_set_of_newer_jvm_langua">
Of the set of newer JVM languages, Scala is one of the few that is statically typed, and it is the best known among them.
</para>
</listitem>
</varlistentry>
...
</variablelist>

Gets converted to:

[[para_scala_characteristics]]
Statically typed:: As we described in the previous section, a statically typed language binds the type to a _variable_ for the lifetime of that variable. In contrast, _dynamically typed_ languages bind the type to the actual _value_ referenced by a variable, meaning that the type of a _variable_ can change along with the value it references.
[[para_of_the_set_of_newer_jvm_langua]]
+
Of the set of newer JVM languages, Scala is one of the few that is statically typed, and it is the best known among them.

The + line and the id line should be flip-flopped:

[[para_scala_characteristics]]
Statically typed:: As we described in the previous section, a statically typed language binds the type to a _variable_ for the lifetime of that variable. In contrast, _dynamically typed_ languages bind the type to the actual _value_ referenced by a variable, meaning that the type of a _variable_ can change along with the value it references.
+
[[para_of_the_set_of_newer_jvm_langua]]
Of the set of newer JVM languages, Scala is one of the few that is statically typed, and it is the best known among them.

I don't know if this issue also affects <orderedlist> and <itemizedlist> blocks that contain multiple paras with ids per <listitem>, so we may want to look into that as well.

Thanks, Sanders