Skip to content
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

html-default applies to all elements #37

Closed
Yehouda opened this issue Oct 11, 2021 · 1 comment
Closed

html-default applies to all elements #37

Yehouda opened this issue Oct 11, 2021 · 1 comment

Comments

@Yehouda
Copy link

Yehouda commented Oct 11, 2021

In special-tags.lisp, there is this form:

(define-wildcard-dispatcher html-default *tag-dispatchers* *html-tags*)

As far as I can tell, that means html-default is applicable to all elements, because the method serialize-object for element (inside the defegenric in dom.lisp) check tag-descriptors (using plump-parser:do-tag-printers). Is that intentional?

It means that

(plump:serialize (plump-parser:parse "<test/>") t)

returns "<test></test">" rather than "<test/>". The longer string is the result of the printer of html-default. The shorter one is what the serialize-object method for element would output if it didn't find a tag-printer.

I encountered that because in the system scriba that uses plump, there is a test that fails in
https://github.com/CommonDoc/scriba/blob/master/t/plump.lisp
that uses plump:serialize on the result of its own parser which is the same as the result of plump-parser:parse above. and expects to get "<test/>".

(test tag
  (test-equal "@test()"
              "<test/>")
  (test-equal "@test(a)"
              "<test>a</test>"))
@Shinmera
Copy link
Owner

You are meant to bind *tag-dispatchers* to the format you require, using either *html-tags* or *xml-tags*. The default is a mix between the two. If you want XML-style closing tags like <test/> you need to bind the tags appropriately.

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

No branches or pull requests

2 participants