From 7bcf634c789c00a95237ad74e5f923a4214020c8 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Sun, 13 Mar 2022 14:21:33 -0500 Subject: can make, run, and publish drafts --- lib/oneliner.lisp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/oneliner.lisp') diff --git a/lib/oneliner.lisp b/lib/oneliner.lisp index 4828b2d..668a82c 100644 --- a/lib/oneliner.lisp +++ b/lib/oneliner.lisp @@ -94,3 +94,18 @@ (string-trim '(#\space) (alexandria-2:subseq* (oneliner-brief ol) x (+ x *term-width*))))) (format t "~%~a~%~%" (oneliner-oneliner ol)))) + +;;;; json serialization + +(defun oneliner-to-json-body (ol) + "Takes a oneliner structure and produces some json suitable for +sending to the server. ID and some other fields are omitted." + (jonathan:to-json + (list :oneliner (oneliner-oneliner ol) + :tags (oneliner-tags ol) + :brief (oneliner-brief ol) + :name (if (plusp (length (oneliner-name ol))) + (oneliner-name ol) + :null) + :explanation (oneliner-explanation ol) + :runstyle (oneliner-runstyle ol)))) -- cgit v1.2.3