cl-dot
cl-dot copied to clipboard
Proposed modification of cl-dot:dot-graph
This modification automatically assigns to the output file a suffix dictated by the format, as indicated in the last line of the comment.
So you can simply say (dot-graph g :pdf) or (dot-graph g :svg), etc, and the output file will be g.pdf, g.svg, etc.
(defun dot-graph (graph outfile &key (format :ps) (directed t))
"Renders GRAPH to OUTFILE by running the program in \*DOT-PATH* or
*NEATO-PATH* depending on the value of the DIRECTED keyword
argument. The default is a directed graph. The default
FORMAT is Postscript.
The output file is assigned a suffix based on the FORMAT."
(when (null format) (setf format :ps))
(setf outfile (uiop:strcat (namestring outfile) "." (string-downcase format)))
(let ((dot-path (if directed *dot-path* *neato-path*))
(format (format nil "-T~(~a~)" format))
(dot-string (with-output-to-string (stream)
(print-graph graph :stream stream :directed directed))))
(uiop:run-program (list dot-path format "-o" outfile)
:input (make-string-input-stream dot-string) :output *standard-output*)))
To do this properly, instead of concatenating strings (which could lead to, e.g., g.pdf.pdf), should use merge-pathnames, something like:
(setf outfile (merge-pathnames (parse-namestring outfile) (make-pathname :type (string-downcase format))))
that will not overwrite or append to user-supplied filename suffix.
OK, agreed with the above. What's the next step?
OK, agreed with the above. What's the next step?
Next step would be to make the proposed change in your branch and push the change. Then we can merge it.
After that, the next step is to figure out who has the commit bit on this repo and get it merged.
Ah, I see:
- The next step is to make a Merge Request for this
- I'll review and -- it seems I have the commit bit -- I will merge the MR.
I'm trying to make a merge request, but not succeeding. According to what I see on the web, clicking on "Pull requests" at the top of this page should take you to a page at whose bottom you should find an option to merge. But if I follow this, I don't see such an option. Maybe I'm completely off-base here, git is not my friend :-)
I'm trying to make a merge request, but not succeeding. According to what I see on the web, clicking on "Pull requests" at the top of this page should take you to a page at whose bottom you should find an option to merge. But if I follow this, I don't see such an option. Maybe I'm completely off-base here, git is not my friend :-)
I think you should be able to navigate to the file you want to fix, and then choose the edit option. I believe that this will force you to fork the repo to your own GitHub account (which is fine). Do that, edit the file, commit it, and then you should be able to create a merge request.
I think this is fixed now.