Skip to content

Fix GH-181: Empty title swallows sibling content#243

Open
lacatoire wants to merge 1 commit intophp:masterfrom
lacatoire:fix/GH-181-empty-title-swallows-sibling
Open

Fix GH-181: Empty title swallows sibling content#243
lacatoire wants to merge 1 commit intophp:masterfrom
lacatoire:fix/GH-181-empty-title-swallows-sibling

Conversation

@lacatoire
Copy link
Contributor

Summary

  • When a self-closing <title/> element appeared in DocBook XML, transformFromMap() generated invalid HTML like <h3 class="title"/>. HTML5 parsers treat this as an unclosed <h3>, swallowing all sibling content.
  • Changed transformFromMap() to emit a proper open+close pair (<h3 class="title"></h3>) for empty elements, fixing all map-based elements in one place.
  • Added a test verifying empty <title/> renders correctly with sibling content placed outside the heading.

Test plan

  • New test tests/package/generic/empty_title_001.phpt passes
  • All existing tests continue to pass (no regressions)
  • Manual verification with real DocBook docs containing <title/>

Fixes #181

When a self-closing <title/> element appeared in DocBook XML,
transformFromMap() generated invalid HTML like <h3 class="title"/>
which browsers parse as an unclosed <h3>, swallowing all sibling content.

Emit a proper open+close pair (<h3 class="title"></h3>) instead.
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.

Empty title change rendering of siblings

1 participant