commit - 59eabf3e4744859e2fd707b688425bd616d621bb
commit + 5d750cb8221cca83b8aeccd4405926b08fef3143
blob - b1d981d0047eddca3cb1ff8a71a620b9c2916602
blob + bbe76f528a0364ebb1880c80b3e1e2d7371e5d87
--- gemtext.lisp
+++ gemtext.lisp
(defclass paragraph (element)
())
+(defclass blockquote (element)
+ ())
+
(defclass verbatim (element)
((alt :initarg :alt)))
(match (cl-ppcre:split "\\s+" s :limit 2)
((list _ text) (make-instance 'item :text text))))
+(defun parse-blockquote (s)
+ "Parse a line into a blockquote."
+ (match (cl-ppcre:split "\\s+" s :limit 2)
+ ((list _ text) (make-instance 'blockquote :text text))))
+
(defun parse-line (s)
(if (string= s "")
(make-instance 'paragraph :text s)
(#\# (parse-title s))
(#\= (parse-link s))
(#\* (parse-item s))
+ (#\> (parse-blockquote s))
(otherwise (make-instance 'paragraph :text s)))))
(defmacro markerp (line)
(defmethod unparse ((v verbatim) stream)
(with-slots (alt text) v
(format stream "```~a~%~a```~%" alt text)))
+
+(defmethod unparse ((b blockquote) stream)
+ (with-slots (text) b
+ (format stream "> ~a~%" text)))