     h
     nil))
 
-(defn has-om-if? [h] (-> h like-html-vec? second :om-lette :om-if))
-(defn has-om-repeat? [h] (-> h like-html-vec? second :om-lette :om-repeat))
-(defn is-om-text? [h] (and (vector? h) (= (first h) :om-text)))
-(defn is-om-code? [h] (and (vector? h) (= (first h) :om-code)))
+(defn has-om-lette? [h kw] (if-let [v (-> h like-html-vec? second :om-lette kw)] [h v] nil))
+(defn has-om-if? [h] (has-om-lette? h :om-if))
+(defn has-om-repeat? [h] (has-om-lette? h :om-repeat))
+(defn is-om-text? [h] (and (vector? h) (= (first h) :om-text) (second h)))
+(defn is-om-code? [h] (and (vector? h) (= (first h) :om-code) (second h)))
 
 (defn strip-attrs [tag & xattrs]
   (let [[name attrs & rest] tag] (vec (concat [name (apply dissoc attrs xattrs)] rest))))

              (get-html-template %))
        names))

(defn template->hiccup
  [tmplt state]
  (walk/prewalk (fn [x]
                  (cond (is-om-text? x) (second x)
                        (is-om-code? x) (get state (second x) "")
                        (has-om-if? x) (if (get state (second x))
                                         x
                                         nil)
                        :else x))
                tmplt))

(defn cached-template->hiccup
  [tname state]
  (template->hiccup (get @template-cache tname) state))

#_ (-> "<div>{{a}}</div" html->template (template->hiccup {"a" 33}))


                  (assoc :om-lette (select-keys a ks)))
              a))]
    r))

(defn eval-om-if-expr
  [x state]
  (get state (apply str (mapcat second x))))

(defn html->template
  [h]
