91b9b04d6914 v1.5.0

Merge
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 08 Feb 2023 21:42:58 -0500
parents f11da0d6a058 (diff) 63712529f020 (current diff)
children c8b94c57b283
branches/tags v1.5.0
files src/dot.lisp

Changes

--- a/docs/04-reference-dot.markdown	Tue Aug 24 21:15:58 2021 -0400
+++ b/docs/04-reference-dot.markdown	Wed Feb 08 21:42:58 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.
 
--- a/docs/05-changelog.markdown	Tue Aug 24 21:15:58 2021 -0400
+++ b/docs/05-changelog.markdown	Wed Feb 08 21:42:58 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
 ------
 
--- a/src/dot.lisp	Tue Aug 24 21:15:58 2021 -0400
+++ b/src/dot.lisp	Wed Feb 08 21:42:58 2023 -0500
@@ -19,21 +19,21 @@
 
 
 (defparameter *current-digraph* nil)
-(defparameter *vertex-shape* :circle
-  "The shape to use for vertex nodes.  Must be a valid cl-dot :shape node attribute.")
+(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 ,*vertex-shape*)))
+    :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