Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Respect newline attr on dl tag #1047

Merged
merged 5 commits into from Oct 12, 2023

Conversation

jennifer-richards
Copy link
Member

Fixes #1045

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.

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

@jennifer-richards
Copy link
Member Author

Bleah - the commit comment on a39b20a should probably say <dd> rather than <dt> (though it's sort of true either way).

@rjsparks rjsparks merged commit cb10344 into ietf-tools:main Oct 12, 2023
13 checks passed
@jennifer-richards jennifer-richards deleted the dl-newlines branch October 12, 2023 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xml2rfc v3.18.1: Even with <dl newline="false">, get new line
2 participants