-(ns org.spootnik.om-warp.ansi)
+(ns org.spootnik.om-warp.ansi
+  (:require [clojure.string :as string]))
 
 (def colors
   ["black"


(defn escape
  [text]
  (clojure.string/replace
    text
    (re-pattern (str "[" (clojure.string/join "" (keys replacements)) "]"))
    #(replacements %1)))

(defn linkify
  [text]
  (clojure.string/replace
    text
    #"(https?://[^\s]+)"
    "<a href=\"$1\">$1</a>"))

    (let [text (-> text
                   (escape)
                   (linkify))
          parts (string/split text #"\033\[")]
      (process-parts {} parts ""))))
