summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html-jen.lisp12
1 files changed, 7 insertions, 5 deletions
diff --git a/html-jen.lisp b/html-jen.lisp
index fdae7ed..41bc1c0 100644
--- a/html-jen.lisp
+++ b/html-jen.lisp
@@ -4,15 +4,17 @@
(defparameter *indent-increment* 2)
(defparameter *yeni-satır* t)
-(defgeneric node->html (node stream)
+(defgeneric node->html (node &optional stream)
+ (:method (node &optional (stream *standard-output*))
+ (write-string node stream))
(:documentation "NODE u STREAM e yazar"))
(defun tag-yeni-satır? (tag)
(case tag
((:html :head :body) t)
- ((:title :p) nil)))
+ ((:title :p :b :i :code) nil)))
-(defmethod node->html :before (node stream)
+(defmethod node->html :before ((node node) &optional (stream *standard-output*))
(loop :for i :from 0 :below *indent*
:do (write-char #\Space stream))
(setf *yeni-satır* nil)
@@ -26,14 +28,14 @@
(write-char #\Newline stream)
(setf *yeni-satır* t)))
-(defmethod node->html (node stream)
+(defmethod node->html ((node node) &optional (stream *standard-output*))
(if (null (children node))
(format stream "~a" (value node))
(let ((*indent* (+ *indent* *indent-increment*)))
(loop :for child :in (children node)
:do (node->html child stream)))))
-(defmethod node->html :after (node stream)
+(defmethod node->html :after ((node node) &optional (stream *standard-output*))
(unless (null *yeni-satır*)
(loop :for i :from 0 :below *indent*
:do (write-char #\Space stream)))