Refactor naming to match JSONML spec

This commit is contained in:
Daniel Compton 2017-11-16 13:49:52 +13:00
parent 1a8ba45cad
commit 7a8662edea
1 changed files with 8 additions and 8 deletions

View File

@ -90,17 +90,17 @@
[jsonml] [jsonml]
(if (number? jsonml) (if (number? jsonml)
jsonml jsonml
(let [[head & args] jsonml (let [[tag-name attributes & children] jsonml
tagnames #{"div" "span" "ol" "li" "table" "tr" "td"}] tagnames #{"div" "span" "ol" "li" "table" "tr" "td"}]
(cond (cond
(contains? tagnames head) (let [[style & children] args] (contains? tagnames tag-name) (into
(into [(keyword tag-name) {:style (-> (js->clj attributes)
[(keyword head) {:style (-> (js->clj style) (get "style")
(get "style") (string->css))}]
(string->css))}] (map jsonml->hiccup)
(map jsonml->hiccup children))) children)
(= head "object") [data-structure jsonml] (= tag-name "object") [data-structure jsonml]
:else jsonml)))) :else jsonml))))
(defn subtree [data title] (defn subtree [data title]