rfc-format / draft-iab-xml2rfc-v3-bis

-bis document for the RFC format xml2rfc v3 draft
6 stars 10 forks source link

describe the "default" whitespace preservation mode #198

Open reschke opened 3 years ago

reschke commented 3 years ago

We currently say that \ and \ preserve whitespace, but are vague abut what exactly applies to other elements.

My understanding is:

(note that this happens to be same model as in HTML)

We may also want to state in the preptool spec what that means for pretty printing (there are both reasons to do that normalization and not to do it).

jrlevine commented 3 years ago

Good point. We follow the HTML model outside of artwork, sourcecode. Do we preserve space anywhere else?

reschke commented 3 years ago

Do we preserve space anywhere else?

Nope.

stpeter commented 3 years ago

@reschke What's the best way to cite the whitespace handling model from the HTML spec?

reschke commented 3 years ago

Good question. It's possible that the HTML5 parsing algorith contains some info, but that's nothing I would refer to in order to explain things.

Turns out that the actual answer is CSS. See https://patrickbrosset.medium.com/when-does-white-space-matter-in-html-b90e8a7cdd33 for an intro which cites https://www.w3.org/TR/css-text-3/#white-space-property. The rules relevant for us would be "normal" (essentially all elements but \ and \) and "pre" (for \ and \).

stpeter commented 3 years ago

AIUI, currently in almost all contexts (mostly except artwork and sourcecode) we strip leading and trailing whitespace enclosed in an XML element, which matches Julian's note about "normal" and "pre" in the CSS spec. This will be documented more accurately.