Skip to content

Web Standards #4

@darkleaf

Description

@darkleaf

I expect this code will return a valid html. And I don't care about which standard it will use.

#html
[:<>
   [:$ "<!DOCTYPE html>"]
   [:html {:lang "en"}
    [:head
     [:title "Hi"]]
    [:body
     [:div "ok"]
     [:br]]]]

HTML5 has void elements.

#html [:br] 

So in HTML5 it should return <br>, but now it returns <br></br>.

But there is XHTML and current implementation returns valid html.

I need an example how to use it with ring and render a valid html. Like this:

(defn- handler [req]
  (-> (ring.resp/ok
       (str #html
            [:<>
             [:$ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"]
             [:html {:xmlns "http://www.w3.org/1999/xhtml" :lang "en"}
              [:head
               [:title "Hi"]]
              [:body
               [:div "ok"]
               [:br]]]]))
      (ring.resp/content-type "application/xhtml+xml")))

I want #html to support only one standard, not like hiccup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions