-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
user configurable self closing tags #417
user configurable self closing tags #417
Conversation
Further notes:
|
I have added |
@inoas I was thinking maybe we should use |
@inoas and BTW, thanks for the PR! 💜 |
Do you mean like here? https://github.com/philss/floki/pull/417/files#diff-477200ed1da650829519cb2d3f87fdd9a8b3d5f8d786993494dbbeceb795445eR27 I mean sure I can switch this around and remove the tests. What are you concerned about: the If there are ways to do this the right way (tested + fast) via macros and you have an idea, just point me into the direction and I will see what I can do about it. |
@inoas let's keep it simple and go with your current version. We can iterate later and see if there is any gain to use the |
80c9df0
to
ad88c59
Compare
please trigger ci |
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.
Thank you! 💜
I sent a suggestion, but I'm going to commit it already.
Fixes issue 405.
Notice: Instead of just appending to the tag list, I have opted to expose the internal default tag list and replace it.
The reason for this is that in some specific xml dialects people would want to write they could replace
<img/>
with<img>...<img/>
and floki would not be able to support that.The trade-off here in terms of DX is that if you want to keep the standard html self closing tags you cannot just do:
but you need to do
I am willing to document this and I hope that this solution passes your checks.
Please let me know if the way I have added unit tests is the the right approach for you.
p.s.: I have tested the feature in my small real world application where I am using a custom XMl dialect to allow a subset of html and extend it by some specific tags of which some are self-closing: