From 54621da8d698194a968167276bdfaac2ea6b7713 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 18 Dec 2017 11:11:56 -0500 Subject: [PATCH] Render each node and edge alone on a line. --- src/Rendering/DOT.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Rendering/DOT.hs b/src/Rendering/DOT.hs index 11beb7030..2fcf41441 100644 --- a/src/Rendering/DOT.hs +++ b/src/Rendering/DOT.hs @@ -56,14 +56,14 @@ data Edge = Edge { edgeFrom :: Int, edgeTo :: Int } renderGraph :: Graph -> B.ByteString -renderGraph Graph{..} = "digraph " <> maybe "" quote graphName <> " {" <> foldr ((<>) . renderNode) "" graphNodes <> foldr ((<>) . renderEdge) "" graphEdges <> "}" +renderGraph Graph{..} = "digraph " <> maybe "" quote graphName <> " {\n" <> foldr ((<>) . renderNode) "" graphNodes <> foldr ((<>) . renderEdge) "" graphEdges <> "}" where quote a = "\"" <> a <> "\"" renderNode :: Node -> B.ByteString -renderNode Node{..} = B.pack (show nodeID) <> " [ " <> foldr (\ (key, value) rest -> key <> " = \"" <> value <> "\" " <> rest) "" (Map.toList nodeAttributes) <> "];" +renderNode Node{..} = "\t" <> B.pack (show nodeID) <> " [ " <> foldr (\ (key, value) rest -> key <> " = \"" <> value <> "\" " <> rest) "" (Map.toList nodeAttributes) <> "];\n" renderEdge :: Edge -> B.ByteString -renderEdge Edge{..} = B.pack (show edgeFrom) <> " -> " <> B.pack (show edgeTo) <> ";" +renderEdge Edge{..} = "\t" <> B.pack (show edgeFrom) <> " -> " <> B.pack (show edgeTo) <> ";\n" instance Semigroup Graph where