Skip to content

fix(HTML): promote inline elements with block descendants to blocks - #588

Draft
OGKevin wants to merge 2 commits into
masterfrom
ogkevin/push/xzxzsxmxvtxu
Draft

fix(HTML): promote inline elements with block descendants to blocks#588
OGKevin wants to merge 2 commits into
masterfrom
ogkevin/push/xzxzsxmxvtxu

Conversation

@OGKevin

@OGKevin OGKevin commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Add a test that re-produces baskerville/plato#426 and cherry pick the fix from baskerville/plato#427

@OGKevin OGKevin self-assigned this Jun 12, 2026
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 12, 2026 11:58 — with GitHub Actions Inactive
@OGKevin
OGKevin force-pushed the ogkevin/push/xzxzsxmxvtxu branch 2 times, most recently from 3800e97 to ed55de5 Compare June 12, 2026 12:06
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 12, 2026 12:09 — with GitHub Actions Inactive
@OGKevin
OGKevin force-pushed the ogkevin/push/xzxzsxmxvtxu branch from ed55de5 to 6966582 Compare June 12, 2026 12:41
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 12, 2026 12:44 — with GitHub Actions Inactive
@OGKevin
OGKevin force-pushed the ogkevin/push/xzxzsxmxvtxu branch from 6966582 to 524931b Compare June 18, 2026 15:18
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 18, 2026 15:22 — with GitHub Actions Inactive

OGKevin commented Jun 18, 2026

Copy link
Copy Markdown
Owner Author

@OGKevin
OGKevin force-pushed the ogkevin/push/xzxzsxmxvtxu branch 2 times, most recently from e395f8a to 1157152 Compare June 23, 2026 09:49
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 23, 2026 09:53 — with GitHub Actions Inactive
@OGKevin OGKevin added this to Cadmus Jul 9, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Cadmus Jul 9, 2026
@OGKevin
OGKevin force-pushed the ogkevin/push/xzxzsxmxvtxu branch from 1157152 to 2b252d7 Compare July 13, 2026 19:40
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview July 13, 2026 19:45 — with GitHub Actions Inactive
OGKevin and others added 2 commits July 13, 2026 22:40
Change-Id: 7e3d38a0c96bff76e1278d669589601e
Change-Id-Short: slwmwrpznqto
Some EPUB converters produce invalid block-in-inline markup, e.g.
`<span><div class="title">…</div><p>…</p></span>`. The engine only
checks direct children for blocks, so once wrap_lost_inlines wraps
such spans, gather_inline_material flattens the nested blocks into
a single inline run and body text is silently dropped.

Promote any inline element with a block-level descendant to a block
before wrapping lost inlines, so its content is laid out normally.

- Add `force_block: bool` to `ElementData`; `is_block()` checks it first
- Add `promote_blockish_inlines()` on `XmlTree`, called at the start
  of `wrap_lost_inlines()`
- Update `element()` constructor to initialise `force_block: false`
- Fix regression test assertion to match space-free DrawCommand tokens

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>


Change-Id: 202072d24625a472814d6d8137f49584
Change-Id-Short: xzxzsxmxvtxu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant