Balance chapter HTML and fix intro-material italics leaking into text - #1385
Merged
Conversation
Follow-up to crosswire#921: while chapter intro material (book/section headings) is meant to render in italics via ".introMaterial { font- style: italic; }", two related bugs let that styling — and malformed markup in general — leak into the rest of the chapter on modules with rich introductions (e.g. FreCrampon). - GTKChapDisp::introMaterial() (src/main/display.cc): SWORD's OSIS filter can emit an opening <div type="subSection" ...> for a section heading with no matching closing </div> anywhere in the fetched text. Now counts <div>/</div> occurrences and appends any missing closing tags before closing our own wrapper, so the block is always self-balanced regardless of what the filter provides. - wk_html_sanitize() (src/webkit/wk-html.c): parses the final assembled HTML with libxml2 (HTML_PARSE_RECOVER) and re-serializes it before handing it to WebKit, rather than letting WebKit's own parser silently repair mismatched tags unpredictably. General safety net for similar cases we may not have found yet. - CSS: added ".introMaterial h2.chapterHeader { font-style: normal; }" so section/chapter titles stay upright — only the narrative intro text should be italic, not its headings.
Contributor
Contributor
Author
|
Let me work on it. Tomorrow or Monday. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Follow-up to #921: while chapter intro material (book/section headings) is meant to render in italics via ".introMaterial { font- style: italic; }", two related bugs let that styling — and malformed markup in general — leak into the rest of the chapter on modules with rich introductions (e.g. FreCrampon).
GTKChapDisp::introMaterial() (src/main/display.cc): SWORD's OSIS filter can emit an opening <div type="subSection" ...> for a section heading with no matching closing anywhere in the fetched text. Now counts
wk_html_sanitize() (src/webkit/wk-html.c): parses the final assembled HTML with libxml2 (HTML_PARSE_RECOVER) and re-serializes it before handing it to WebKit, rather than letting WebKit's own parser silently repair mismatched tags unpredictably. General safety net for similar cases we may not have found yet.
CSS: added ".introMaterial h2.chapterHeader { font-style: normal; }" so section/chapter titles stay upright — only the narrative intro text should be italic, not its headings.