Start visualize the header
This commit is contained in:
parent
0afb8f9c14
commit
bacd2a2f5f
2 changed files with 24 additions and 0 deletions
|
@ -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"
|
||||
|
|
23
src/mailhead/visualize.clj
Normal file
23
src/mailhead/visualize.clj
Normal 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")
|
||||
|
Loading…
Reference in a new issue