Skip to content

fix: preserve XHTML content order in RSS feeds#304

Open
MossabArektout wants to merge 1 commit intorbren:masterfrom
MossabArektout:fix/xhtml-content-order
Open

fix: preserve XHTML content order in RSS feeds#304
MossabArektout wants to merge 1 commit intorbren:masterfrom
MossabArektout:fix/xhtml-content-order

Conversation

@MossabArektout
Copy link

This PR Fixes #275

Summary

Fixes issue where XHTML content elements were parsed out of order, causing concatenated text without proper separation between elements.

Problem

When parsing RSS feeds with XHTML content, elements like <strong> tags and <small> tags were being concatenated without proper separation, resulting in malformed output like:

Solution

  • Added buildOrderedContent() function in lib/utils.js to preserve element sequence
  • Integrated ordered XML parser using xml2js preserveChildrenOrder option
  • Updated both Atom and RSS parsers to use ordered content when available
  • Added comprehensive test case to verify the fix

Files Changed

  • lib/utils.js: Added buildOrderedContent() function
  • lib/parser.js: Added ordered XML parser and integration
  • test/parser.js: Added test case for XHTML content order preservation
  • test/input/xhtml-content-order.rss: Test fixture
  • test/output/xhtml-content-order.json: Expected test output

Testing

  • All existing tests pass
  • New test case "should preserve XHTML content order" passes
  • Content ordering is maintained properly in both Atom and RSS feeds

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.

XHTML content is parsed out of order?

1 participant