Shinmera / plump

Practically Lenient and Unimpressive Markup Parser for Common Lisp
https://shinmera.github.io/plump
zlib License
119 stars 21 forks source link

`plump` doesn't handle self closing tags #50

Open aadcg opened 1 year ago

aadcg commented 1 year ago

Example:

PLUMP> (children (parse "<p>one <p>two"))
#(#<ELEMENT p {100955CA83}>)
PLUMP> (children (parse "<p>one</p> <p>two</p>"))
#(#<ELEMENT p {100955CBC3}> #<TEXT-NODE {100955CC23}> #<ELEMENT p {100955CC63}>)

I'm wondering if supporting self closing tags is a non-goal of the project. Thanks.

Shinmera commented 1 year ago

Plump specifically does not adhere to the HTML5 specification on such ambiguous cases.

aartaka commented 1 year ago

But those cases are not ambiguous, they are pretty well-documented and restricted: https://html.spec.whatwg.org/multipage/parsing.html#closing-elements-that-have-implied-end-tags

Am I misenterpreting something?

Shinmera commented 1 year ago

Let's put it this way: they are ambiguous until the end of the document or another context block is parsed that then forces backtracking and reparsing. I'm personally not really interested in these cases, but if someone else does the work, I'll merge it, why not.