From ce0e8e7fc59e6a1f7ed6038370bdc1de096cdc01 Mon Sep 17 00:00:00 2001 From: Ferruccio Guidi Date: Sun, 11 Apr 2010 17:13:56 +0000 Subject: [PATCH] the edges must be quoted as well (not only the nodes) From: fguidi --- helm/software/components/extlib/graphvizPp.ml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/helm/software/components/extlib/graphvizPp.ml b/helm/software/components/extlib/graphvizPp.ml index ed5bbdc54..464328837 100644 --- a/helm/software/components/extlib/graphvizPp.ml +++ b/helm/software/components/extlib/graphvizPp.ml @@ -49,10 +49,16 @@ module Dot = struct let attribute fmt (k, v) = fprintf fmt "@[%s=@,\"%s\",@]" k v let attributes attrs fmt = List.iter (attribute fmt) attrs + let quote_string quote s = if quote then "\"" ^s ^ "\"" else s let node name ~quote ?(attrs = []) fmt = - let quote_string = if quote then "\"" else "" in - fprintf fmt "@[%s%s%s@ [" quote_string name quote_string; + fprintf fmt "@[%s@ [" (quote_string quote name); + attributes attrs fmt; + fprintf fmt "];@]@," + + let edge ~quote name1 name2 ?(attrs = []) fmt = + fprintf fmt "@[%s ->@ %s@ [" + (quote_string quote name1) (quote_string quote name2); attributes attrs fmt; fprintf fmt "];@]@," @@ -68,10 +74,7 @@ module Dot = | None -> ()) let node = node ~quote:true - let edge name1 name2 ?(attrs = []) fmt = - fprintf fmt "@[%s ->@ %s@ [" name1 name2; - attributes attrs fmt; - fprintf fmt "];@]@," + let edge = edge ~quote:true let raw s fmt = pp_print_string fmt s let trailer fmt = fprintf fmt "@,}@]%!" end -- 2.39.2