ietf-tools / xml2rfc

Generate RFCs and IETF drafts from document source in XML according to the IETF xml2rfc v2 and v3 vocabularies
https://ietf-tools.github.io/xml2rfc/
BSD 3-Clause "New" or "Revised" License
69 stars 38 forks source link

HTML styles for compact lists are not compact #964

Open martinthomson opened 1 year ago

martinthomson commented 1 year ago

Describe the issue

The compact styling on definition lists (<dl spacing="compact">) does not appear to function properly.

https://www.ietf.org/archive/id/draft-ietf-ohai-ohttp-06.html#section-9.1 includes a large definition list that uses the compact spacing, however it does not render very differently from the normal one. My expectation is that the compact spacing approximates the inter-line spacing of a regular paragraph, but this appears to be half-way between that and the full spacing.

(Separately, the full spacing is extremely wide, which might have the same cause.)

My investigation shows that this is due to the content of the <dd> element including elements (<p> in this case) that have their own margins. These margins still apply, but it appears to expand the spacing between items.

I found that the following works, even if it is a little clunky:

:is(dl.compact, .dlCompact) > dd > :is(:first-child, .break:first-child + *) {
  margin-top: 0;
}
:is(dl.compact, .dlCompact) > dd > :last-child {
  margin-bottom: 0;
}

(The .break elements that are scattered throughout are a little annoying to style around; I just set them to display: none but then I need to do this hack here. The dl.compact rule is for Julian's XSLT output, but it's been a while since I checked how that renders; ignore that one.)

Code of Conduct