# HG changeset patch # User Steve Losh # Date 1675910386 18000 # Node ID f11da0d6a058484c457f545348df842988c4b529 # Parent 4518e61a96c6c49ca63cb112c1f45c306bdd1e47 Add `:shape` arg to `digraph.dot:draw` diff -r 4518e61a96c6 -r f11da0d6a058 docs/04-reference-dot.markdown --- a/docs/04-reference-dot.markdown Mon Apr 05 22:03:42 2021 -0400 +++ b/docs/04-reference-dot.markdown Wed Feb 08 21:39:46 2023 -0500 @@ -9,7 +9,7 @@ ### `DRAW` (function) - (DRAW DIGRAPH &KEY (FILENAME digraph.png) (FORMAT :PNG)) + (DRAW DIGRAPH &KEY (FILENAME digraph.png) (FORMAT :PNG) (SHAPE :CIRCLE)) Draw `digraph` with cl-dot. diff -r 4518e61a96c6 -r f11da0d6a058 docs/05-changelog.markdown --- a/docs/05-changelog.markdown Mon Apr 05 22:03:42 2021 -0400 +++ b/docs/05-changelog.markdown Wed Feb 08 21:39:46 2023 -0500 @@ -5,6 +5,11 @@ [TOC] +v1.5.0 +------ + +Added `shape` argument to `digraph.dot:draw` to change the shape of the nodes. + v1.4.0 ------ diff -r 4518e61a96c6 -r f11da0d6a058 src/dot.lisp --- a/src/dot.lisp Mon Apr 05 22:03:42 2021 -0400 +++ b/src/dot.lisp Wed Feb 08 21:39:46 2023 -0500 @@ -19,19 +19,21 @@ (defparameter *current-digraph* nil) +(defparameter *shape* nil) (defmethod cl-dot:graph-object-node ((graph (eql 'digraph)) (vertex t)) (make-instance 'cl-dot:node - :attributes `(:label ,(format nil "~A" vertex) :shape :circle))) + :attributes `(:label ,(format nil "~A" vertex) :shape ,*shape*))) (defmethod cl-dot:graph-object-points-to ((graph (eql 'digraph)) (vertex t)) (successors *current-digraph* vertex)) -(defun draw (digraph &key (filename "digraph.png") (format :png)) +(defun draw (digraph &key (filename "digraph.png") (format :png) (shape :circle)) "Draw `digraph` with cl-dot." - (let ((*current-digraph* digraph)) + (let ((*current-digraph* digraph) + (*shape* shape)) (cl-dot:dot-graph (cl-dot:generate-graph-from-roots 'digraph (find-dot-roots digraph)) filename