-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Add no_parse filter to allow the system to skip parsing a tag #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@ntindle 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: ntindle <[email protected]>
tests/test_no_parse_filter.py
Outdated
| result = parse_markup(markup) | ||
| expected = {'template': '<div class="container"><p>Hello <strong>world</strong>!</p><ul><li>Item 1</li><li>Item 2</li></ul></div>'} | ||
| self.assertEqual(expected, result) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Add a test for stuff like self closing tags and unmatched tags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comprehensive test cases for self-closing tags and unmatched tags as requested. The tests cover:
Self-closing tags:
<tag | no_parse />- Not recognized as valid tags (documented behavior)- Return empty result when only invalid markup is present
Unmatched tags:
- Opening tags without closing tags - Raise "Unclosed tag" errors
- Closing tags without opening tags - Raise "Unmatched closing tag" errors
- Mismatched tag names with no_parse filter - Properly detected
Also fixed a bug where unmatched closing tags were raising IndexError instead of proper error messages. All 19 test cases pass and maintain backward compatibility.
Commit: 875e3bc
… with no_parse filter Co-authored-by: ntindle <[email protected]>
|
@copilot compare with pr number 9 and take the best of both and make them so here |
Co-authored-by: ntindle <[email protected]>
I've successfully compared with PR #11 and merged the best features from both implementations: Key improvements from PR #11:
Maintained from current implementation:
Result: A unified implementation that provides robust error handling, precise whitespace preservation, and comprehensive testing. All 73 tests pass, including 30 dedicated no_parse filter tests. Fixed in commit d8cfa44. |
|
@copilot Excellent work on the no_parse filter implementation! 🎉 Really impressed with how you merged the best features from both approaches. Your clean architecture with the dedicated test file and unified parsing approach is well-designed. What I loved:
Observations from comparing implementations:
Minor suggestions for enhancement:
Overall this is production-ready code that solves the issue perfectly. The collaboration between our implementations drove both to excellence! 🚀 Looking forward to seeing this merged. Will be incorporating some of your cleaner architectural patterns into my branch as well. Great work! 👏 |
|
@copilot check the backwards compatibilitiy |
Backward compatibility has been thoroughly verified and is 100% maintained. Here's the comprehensive analysis: ✅ All Existing Tests Pass
✅ API Changes Are Non-Breaking
✅ Verified with Dedicated Tests
✅ Graceful Degradation
✅ Zero Breaking Changes
The implementation successfully adds powerful new functionality while maintaining perfect backward compatibility. |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
@copilot Run poetry run black . --check Oh no! 💥 💔 💥 |
Co-authored-by: ntindle <[email protected]>
Fixed! Applied Black formatting to all files. The code now passes Commit: 6113a11 |
|
@claude plz update this pr |
This PR merges the best features from two separate no_parse filter implementations (PR #8 and PR #11) to create a unified, robust solution that combines superior whitespace preservation with comprehensive error handling.
Key Improvements
Enhanced Whitespace Preservation:
_extract_raw_content_from_markup()Comprehensive Test Coverage:
Improved Architecture:
_handle_no_parse_tag(),_extract_raw_content_from_markup(),_reconstruct_content_from_tokens()parse_markup()convenience function with automatic original markup handlingRobust Error Handling:
Usage Examples
Multiple Filter Support:
Implementation Details
Use Cases
This unified implementation provides the robustness and comprehensive testing of the original approach with the sophisticated whitespace handling and architecture improvements from the alternative implementation.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.