Skip to content

Html sanitize - #1384

Closed
LAfricain wants to merge 3 commits into
crosswire:masterfrom
LAfricain:HtmlSanitize
Closed

Html sanitize#1384
LAfricain wants to merge 3 commits into
crosswire:masterfrom
LAfricain:HtmlSanitize

Conversation

@LAfricain

@LAfricain LAfricain commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Section headings (<h2 class="chapterHeader">) inherit the italic styling from the rule
“.introMaterial { font-style: italic; }” that applies to them, even though
they should remain normal—only the narrative introductory text
should be italicized, not its headings.

Add a targeted CSS rule that removes the italics only for .introMaterial h2.chapterHeader, without affecting the rest of the
intro text or other italic rules elsewhere in the document (notably the existing “h3 { font-style: %s }” rule, controlled by the “Italic headings” user preference, which remains unchanged—
it never applies to these <h2> anyway, a preexisting CSS/HTML discrepancy unrelated to this fix).

lafricain79 and others added 3 commits August 20, 2026 21:55
Discovered while investigating crosswire#921: wrapping the chapter title and
intro material (which legitimately contain block-level <div>/<h2>
elements) inside an inline <a name=...> tag is invalid HTML. WebKit's
HTML5 parser silently fragments/duplicates the <a> element via the
adoption agency algorithm to recover, which can leak inline styles
(e.g. italics) past their intended scope in some chapters.

Does not fully resolve the italics-leak issue on its own (a deeper
cause was also found in cross-chapter OSIS section boundaries and in
getVerseBefore()'s tag-crossing markup); tracked separately.
(<h2 class=chapterHeader>) inherit the italic styling from the rule
“.introMaterial { font-style: italic; }” that applies to them, even though
they should remain normal—only the narrative introductory text
should be italicized, not its headings.

Add a targeted CSS rule that removes the italics only for
“.introMaterial h2.chapterHeader”, without affecting the rest of the
intro text or other italic rules elsewhere in the document
(notably the existing “h3 { font-style: %s }” rule, controlled by
the “Italic headings” user preference, which remains unchanged—
it never applies to these <h2> anyway, a preexisting
CSS/HTML discrepancy unrelated to this fix).
@karlkleinpaste

Copy link
Copy Markdown
Contributor

I don't know what you did, but I won't merge this one with this kind of failure to patch cleanly.

patch -p1 < ~/Desktop/1384.patch
patching file src/main/display.cc
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file src/main/display.cc.rej
patching file src/main/display.cc
Hunk #1 succeeded at 95 (offset -1 lines).
Hunk #2 succeeded at 1222 (offset -1 lines).
patching file src/webkit/wk-html.c
Hunk #1 succeeded at 36 (offset -1 lines).
Hunk #2 succeeded at 346 (offset 26 lines).
Hunk #3 succeeded at 410 with fuzz 2 (offset 29 lines).
Hunk #4 succeeded at 445 (offset 29 lines).

Whatever you did w/master seems to have caused significant grief/error.

@LAfricain

Copy link
Copy Markdown
Contributor Author

Actually, that's exactly what I was afraid of. Either you cherry-pick the goods commits, or you wait until tomorrow when I'll start from scratch by importing to a new branch.

@karlkleinpaste

Copy link
Copy Markdown
Contributor

I'll wait. No rush.

@LAfricain LAfricain closed this Aug 21, 2026
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.

2 participants