Skip to content

Keep each rule match's own tags in the extracted content - #114

Merged
paskal merged 1 commit into
masterfrom
fix/rule-keep-tags
Dec 1, 2026
Merged

paskal merged 1 commit into
masterfrom
fix/rule-keep-tags

Conversation

@paskal

@paskal paskal commented Dec 1, 2026

Copy link
Copy Markdown
Member

Previously, the rule path joined the inner HTML of every element the selector matched. A rule that selects headings and paragraph blocks, such as the www.apple.com newsroom rule (.article-subhead, .pagebody-header, .pagebody-copy), lost the <h2> and <div> around them: section titles became bare <strong> text and the paragraphs ran together into one block, which an e-reader shows as a single paragraph.

After this change, each match keeps its own element, so headings stay headings and paragraph blocks stay blocks. A match with no inner HTML is still skipped. TestExtractWithSelectorKeepsTags covers it, and the existing selector tests now expect each match's wrapper.

The rule path joined the inner HTML of every match, so a rule that
selects headings and paragraph blocks, such as Apple's newsroom rule
with .pagebody-header and .pagebody-copy, lost the h2 and div around
them: section titles became bare bold text and the paragraphs ran
together. Each match now keeps its own element.
@paskal
paskal merged commit 644e6f9 into master Dec 1, 2026
2 checks passed
@paskal
paskal deleted the fix/rule-keep-tags branch December 1, 2026 08:00
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