Bug was expecting split(stripspace...) to treat its argument the same way as strip(stripspace). The latter strips any of the individual characters in stripspace. The former splits on exactly the full string, not any of its characters. As a result, when calculating whether the first word of <dd> would fit alongside the <dt> text, the entire <dd> text was used. This was introduced in #1023.
A second bug caused the calculation actually to compare the length of the <dd> text to the full output width without actually accounting for the length of the <dt> text already on the line. This bug was present for a long time but would only manifest if the <dt> text plus the first word of <dd> should have overflowed the width, which would not be common.
Fixes #1045
Bug was expecting
split(stripspace...)
to treat its argument the same way asstrip(stripspace)
. The latter strips any of the individual characters instripspace
. The former splits on exactly the full string, not any of its characters. As a result, when calculating whether the first word of<dd>
would fit alongside the<dt>
text, the entire<dd>
text was used. This was introduced in #1023.A second bug caused the calculation actually to compare the length of the
<dd>
text to the full output width without actually accounting for the length of the<dt>
text already on the line. This bug was present for a long time but would only manifest if the<dt>
text plus the first word of<dd>
should have overflowed the width, which would not be common.This patch fixes both bugs and refactors the code to be more clear in its intention. The
newline
attribute should now match what's described at https://www.ietf.org/archive/id/draft-rswg-xml2rfcv3-implemented-02.html#section-3.20.3