arclanguage / anarki

Community-managed fork of the Arc dialect of Lisp; for commit privileges submit a pull request.
http://arclanguage.github.io
Other
1.17k stars 160 forks source link

Para always has a closing tag, add sctag. #180

Closed zck closed 4 years ago

zck commented 4 years ago

Also add a few tests around html generation.

I'm making this a PR so I can look at it when it's not late, and also because this slightly changes the para function. Previously, it never put an ending tag.

(para "hi there")
=>
<p>hi there

Now, it results in:

<p>hi there</p>

Closing tags are sometimes required by the html spec. Anarki never put them in, even when required. Now it always will.

This also adds self-closed tags, like

<br />

This is allowed in void elements, and required in foreign elements (see the spec). Even though they are optional in void elements, I find it much more readable to know that these elements do not have a body.

akkartik commented 4 years ago

Looks good. I'm curious why you aren't emitting <p/>.

zck commented 4 years ago

As it turns out, according to the spec, only void elements or foreign elements are allowed to self-close. And <p> is neither of these. The closing </p> is allowed to be sometimes omitted, but you can't ever self-close the tag.

akkartik commented 4 years ago

Huh! Good to know, thanks.