src/microformats/parser.clj (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | (ns microformats.parser (:require [net.cgrand.enlive-html :as html])) ;;; Turn string into stream (defn parse-p "Parse p-* classes within HTML element." [element] (hash-map :properties (hash-map :name (first (:content (first (html/select element [:.p-name]))))))) (defn parse-h "Parse h-* classes within a HTML document." [html] (mapv parse-p (html/select html [:.h-card]))) (defn parse "Parse a HTML string with microformats" [html] (let [document (html/html-snippet html)] {:items (parse-h document) :rels {}})) |