-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Support implied end tags. #51
Conversation
Thanks for your work. Unfortunately I cannot merge this as-is, as it interferes in xml parsing modes that do not have the same HTML self-closing behaviour. |
Okay, what if the doctype is dynamically bound during parsing? Maybe make a toggle to force HTML/XML parsing? What's the default parsing mode for Plump, actually? Is it XML? |
There already is a toggle, it's binding the The default parsing mode is a mix between the two, but that really doesn't matter for this. |
If I'm reading it right, then checking for XML tag presence in |
Something like: (unless (any (lambda (dispatcher)
(find (tag-dispatcher-name dispatcher) *tag-dispatchers* :key #'tag-dispatcher-name))
*xml-tags*)
#|...|#) |
No, that would be an extremely ugly and leaky hack that would break custom dispatcher tables. The fundamental approach of this PR is not mergable. |
Okay, what about defining a fully custom default dispatcher (whatever that means, I don't yet understand all this infrastructure of dispatchers) for HTML tags, making it absolutely separate from XML? |
I suppose you could install a custom default parser in the dispatch table for html. |
Closing this. Thanks for feedback and pointers! |
This is a somewhat frivolous interpretation of HTML Standard sections mentioning implied end tags (the respective section numbers are listed in coments). The implementation is hacking into the parser (
read-tag
) and throwing catch tags for closed tags up the stack.Performance (not the least important thing, as I guessed) is preserved in 1.5-2 range from Plump without this PR. Tested on SBCL with
Without implicit end tags:
With implied end tags:
To me, the improved correctness is well worth the slowdown. I've only tested correctness on simple examples, mostly generated by Spinneret for my own website. So it might actually break on some more complex cases. Hopefully it doesn't.
Fixes #50.