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
64 stars 35 forks source link

Numbering in <ol> not correct after <aside> and <artwork> #1054

Closed rvanrheenen closed 7 months ago

rvanrheenen commented 8 months ago

In the pdf output, numbering for an <ol> does not continue correctly after <aside> or <artwork>. The txt and html outputs are correct.

The "start" attribute of <ol> is used after the <aside> or <artwork> element (with the appropriate value of "start" to continue the numbering):

<ol spacing="compact" start="4">

A workaround for the misnumbering following <artwork> is to nest the <artwork> within <li> and not start a new <ol> with the start attribute. This doesn’t help after <aside> though, as <aside> is not allowed in <li> or <ol>.

For examples, see Sections 4.3.1, 4.3.2, 4.3.4, 5.3.1, 5.3.2, and 5.3.4 in the pdf output in these files:

https://www.rfc-editor.org/v3test/rfc9496.pdf https://www.rfc-editor.org/v3test/rfc9496.txt https://www.rfc-editor.org/v3test/rfc9496.html https://www.rfc-editor.org/v3test/rfc9496.xml

One example of incorrect numbering in pdf output (should be numbered 1, 2, 3, 4 rather than 1, 1, 2, 1):

   1.  Interpret the string as an unsigned integer s in little-endian
       representation.  If the length of the string is not 32 bytes or
       if the resulting value is >= p, decoding fails.

      |  Note: Unlike the field element decoding described in [RFC7748],
      |  the most significant bit is not masked, and non-canonical
      |  values are rejected.  The test vectors in Appendix A.2 exercise
      |  these edge cases.

   1.  If IS_NEGATIVE(s) returns TRUE, decoding fails.
   2.  Process s as follows:

   ss = s^2
   u1 = 1 - ss
   u2 = 1 + ss
   u2_sqr = u2^2

   v = -(D * u1^2) - u2_sqr

   (was_square, invsqrt) = SQRT_RATIO_M1(1, v * u2_sqr)

   den_x = invsqrt * u2
   den_y = invsqrt * den_x * v

   x = CT_ABS(2 * s * den_x)
   y = u1 * den_y
   t = x * y

   1.  If was_square is FALSE, IS_NEGATIVE(t) returns TRUE, or y = 0,
       decoding fails.  Otherwise, return the group element represented
       by the internal representation (x, y, 1, t) as the result of
       decoding.

Code of Conduct

kesara commented 8 months ago

This is caused by a bug in WeasyPrint. See https://github.com/Kozea/WeasyPrint/issues/2003

Edit: This is not a WeasyPrint but. This happened because WeasyPrint has a flag to follow HTML presentational hints. And xml2rfc doesn't set that flag. See https://github.com/Kozea/WeasyPrint/issues/2003#issuecomment-1815336697

cabo commented 8 months ago

This doesn’t help after <aside> though, as <aside> is not allowed in <li> or <ol>.

Which is a bug in v3.rnc and should be fixed.