Skip to content

define whitespace handling - #205

Draft
vagenas wants to merge 3 commits into
field-heading-contentfrom
whitespace-handling
Draft

vagenas wants to merge 3 commits into
field-heading-contentfrom
whitespace-handling

Conversation

@vagenas

@vagenas vagenas commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Defines whitespace handling similarly to HTML: outside <content>, whitespace collapses to one space, also across inline tags. So far the spec left whitespace to applications, and producers and consumers disagreed, especially between raw text and nested elements.

Spec

  • Terms: a structural rule for when an element that allows raw text is inline or block-level. A virtual <text> is block-level, and the spoken text of a transcript turn is handled like a block-level body.
  • Whitespace handling: four rules (ignore whitespace outside block-level bodies and at their start and end, read the rest as a single space across inline tags, attribute the space to the element holding its first character), plus <content> read literally. Includes an example.
  • Tracks: the "crossing the hour mark" example is retitled, since its two lines now read as one unattributed turn.
  • Examples whose meaning would change are fixed (head and body, cross-references, hyperlinks), and code and formula <content> no longer starts with a line break and indentation.
  • Annex C: recommendation on line breaks, indentation and the minimized canonical form.

Migration between 0.8 and 0.9

  • doclang migrate --to 0.9 reads 0.8 documents as 0.8 guaranteed: only <content> keeps whitespace, every other text is stripped and the pieces joined directly. It removes the whitespace that 0.9 would read as a space (next to inline tags) and keeps what 0.9 ignores (element head, body edges, list/cell delimiters, elements without raw text) and whitespace between words, so layout stays as far as possible.
  • <content> that is no longer needed (a single space next to an inline tag) is unwrapped where 0.9 reads the plain text the same.
  • doclang migrate --to 0.8 keeps the reading under 0.8's rules: each space that 0.8 would strip (whitespace at the edge of a text, next to an inline tag) becomes <content> </content>, where its first character is, so it keeps its formatting. Whitespace that 0.8 ignores and whitespace between words stays. In 0.8, <field_heading> cannot hold <content>, so there the space goes into the neighbouring formatting element (recorded as mapped).
  • Tests for how transcript turns read (edges, cue block and <voice> boundaries, line breaks).
  • Test cases in pretty, minified and hybrid layouts, in both directions; a test reader of the 0.8 rules checks that downgrading keeps the reading of the cases and fixtures, and upgrading again removes the added <content>; a test reader of the 0.9 rules checks that unwrapping never changes the reading of the cases and fixtures.

BEHAVIOR CHANGE: whitespace in raw text, previously left to applications, now collapses to a single space as in HTML; <content> is read literally.

@vagenas
vagenas force-pushed the whitespace-handling branch from 411ad8b to 6fa0e42 Compare October 28, 2026 10:17
@vagenas
vagenas added this pull request to stack #206 October 28, 2026 10:45
@vagenas
vagenas marked this pull request as draft October 28, 2026 10:46
@vagenas
vagenas force-pushed the whitespace-handling branch 2 times, most recently from acf2058 to 2bed657 Compare October 29, 2026 10:24
@vagenas
vagenas removed this pull request from stack #206 October 29, 2026 10:26
@vagenas
vagenas changed the base branch from reference-sync-check to migration-upgrades October 29, 2026 10:29
@vagenas
vagenas added this pull request to stack #208 October 29, 2026 10:29
@vagenas
vagenas force-pushed the whitespace-handling branch 2 times, most recently from 11e1069 to c4904e8 Compare October 29, 2026 12:50
@vagenas
vagenas removed this pull request from stack #208 October 29, 2026 12:53
@vagenas
vagenas changed the base branch from migration-upgrades to transcript-turns October 29, 2026 12:53
@vagenas
vagenas force-pushed the whitespace-handling branch from c4904e8 to d00f18b Compare October 29, 2026 13:00
@vagenas
vagenas force-pushed the whitespace-handling branch from d00f18b to 0ee2be9 Compare October 29, 2026 13:13
@vagenas
vagenas force-pushed the whitespace-handling branch from 0ee2be9 to 67722d9 Compare October 29, 2026 15:31
Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
@vagenas
vagenas changed the base branch from transcript-turns to field-heading-content October 29, 2026 15:56
@vagenas
vagenas force-pushed the whitespace-handling branch from 67722d9 to da6f3a0 Compare October 29, 2026 15:57
@vagenas
vagenas added this pull request to stack #217 October 29, 2026 16:38
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.

1 participant