 (ns seri.html
-
-;; Third Party ;;;;;
+  (:import [clojure.lang IPersistentVector])
 
   (:require [clojure.core.match :as match])
-  (:import [clojure.lang IPersistentVector])
-
-;; Local Library ;;;
 
   (:use [seri.escape :only [safe]]
         [seri.escape.html :only [escape-html]])

    contents]])

;;; test
 
#_(to-html
   [" match tag: " [:p "Paragraph&" [1 2 "34" 'bar] " Foo"]
    " match tag: " [:p {:id "bar" :ti&tle "fo\"o"} "Paragraph" " Foo"]


(defn visit-vector [v w]
  (let [named? (fn [x] (instance? clojure.lang.Named x))]
    (match/match [v]
      [([(tag :when named?) (attrs :when map?) & content] :seq)]
      (w (DomNode. tag attrs content))

      [([(tag :when named?) & content] :seq)]
      (w (DomNode. tag {} content))

      [_] (seri.defaults/visit-seq v w))))

(extend IPersistentVector HtmlSerializable {:visit visit-vector})

