     "subgraph " write [ id. ] [ statements. ] bi ;
 
 : attribute, ( attr value -- )
-    dup [ "%s=\"%s\"," printf ] [ 2drop ] if ;
+    dup [ quote-string "%s=%s," printf ] [ 2drop ] if ;
 
 : attributes. ( attrs -- )
     "[" write

! Copyright (C) 2012 Alex Vondrak.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors classes classes.tuple combinators formatting
graphviz graphviz.attributes io io.files kernel namespaces
sequences splitting strings words ;
IN: graphviz.dot


! option in case there's a keyword clash, spaces in the ID,
! etc.  This does mean that HTML labels aren't supported, but
! they don't seem to work using the Graphviz API anyway.
: quote-string ( str -- str' )
    "\"" "\"" unparse-string "\0" split "" join ;

M: string dot. quote-string "%s " printf ;

: id. ( obj -- ) id>> dot. ;

