Start visualize the header

This commit is contained in:
Aaron Fischer 2015-12-05 23:01:54 +01:00
parent 0afb8f9c14
commit bacd2a2f5f
2 changed files with 24 additions and 0 deletions

View File

@ -24,6 +24,7 @@
[clj-time "0.11.0"]
[io.forward/clojure-mail "1.0.3"]
[macroz/tangle "0.1.9"]
[rhizome "0.2.5"]
[org.immutant/web "2.1.1" :exclusions [ch.qos.logback/logback-classic]]]
:min-lein-version "2.0.0"

View File

@ -0,0 +1,23 @@
(ns mailhead.visualize
(:use [tangle.core])
(:require [mailhead.parser :as parser]))
(defn nodes [receive-path] [:a :b :c])
(defn edges [receive-path] [[:a :b {:label "200ms"}]
[:b :c {:label "50min"}]])
(defn draw-path [receive-path]
(-> (graph->dot
(nodes receive-path)
(edges receive-path)
{:node {:shape :box}
:directed? true
:graph {:rankdir :LR}})
(dot->image "png")))
(defn draw [filename]
(draw-path (parser/parse-from-file filename)))
(draw "/home/aaron/workbench/clojurecup2015/sample-data/header1.eml")