(defn
results->html
"Returns HTML for the given eval results."
[results locations]
(loop
[i 0 evals (transient [])]
(let
[res (get results i) {:keys [top height]} (get locations i)]
(if
(and res top height)
(recur
(inc i)
(conj!
evals
(format
"<div class='%s' style='top: %spx; height: %spx; min-height: %spx'>%s</div>"
(if (array? res) "result error" "result")
top
height
height
(some-> (if (array? res) (first res) res) hs/escape-html-str))))
(join (persistent! evals))))))