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
65 stars 38 forks source link

fix(text): Render ol items correctly #1137

Open kesara opened 2 months ago

kesara commented 2 months ago

Fixes #1135

See changes made in https://github.com/ietf-tools/xml2rfc/commit/3712523cb325bb43b1b164e833dd436c1c62a295 for context.

This change can affect if ol is used inside a li as the first element and the li element is inside another ol element.

I could not find any published RFCs with XML that match the above condition.

These are the RFCs that I found that use ol as the first element in li:

I didn't notice any changes in text output due to this change. But there are a few minor changes (with spacing) due to changes over the years.

rjsparks commented 1 month ago

I think it's worth trying to change things such that generatiing

   4.  4.1  Sublist with '%p' parent counter element in the list
            counter, item one

       4.2  Item two.

       4.3  Item three.

we generate

   4. 

       4.1  Sublist with '%p' parent counter element in the list
            counter, item one

       4.2  Item two.

       4.3  Item three.

Unless that breaks the intended fix for the rfc-to-be.

cabo commented 1 month ago

What is better about that superfluous empty line?

(You can probably have one if you want with <br>)

rjsparks commented 1 month ago

Look at it in context with the rest of the nested <ol> above it in the test document: https://github.com/ietf-tools/xml2rfc/blob/fdb6fb8ad2024b3483f7480a07f8370e673c27e2/tests/valid/elements.bom.text#L366-L458 and consider what would happen if there were any text between the <li> and <ol> at https://github.com/ietf-tools/xml2rfc/blob/fdb6fb8ad2024b3483f7480a07f8370e673c27e2/tests/input/elements.xml#L472-L473

kesara commented 1 month ago

I have converted PR to a draft. The changes from https://github.com/ietf-tools/xml2rfc/pull/1137/commits/e889f930b982c9bc9045f8a6e653f25a6464ec58 add a new line when with the list style to both ol and ul. This was skipped previously. Specifically, this adds list style + new line when li contains an artwork, figure, or sourcecode as the first child. See how this changed test outputs in https://github.com/ietf-tools/xml2rfc/pull/1137/commits/ca8286a4126bc28bba095eb7e708c5a7424aadef Note that the test output has date changes and multiple content changes propagated because of the addition of new lines.

https://github.com/ietf-tools/xml2rfc/pull/1137/commits/e889f930b982c9bc9045f8a6e653f25a6464ec58 fixes #1138