diff options
author | riton <riton@riton.home> | 2025-03-23 19:47:39 +0300 |
---|---|---|
committer | riton <riton@riton.home> | 2025-03-23 19:47:39 +0300 |
commit | 99571117b7be94581afe6668daf56ecec04985ba (patch) | |
tree | 33d14b548a98a2d55f7ce9dcecbb559383052dc0 | |
parent | 2b6760e54bf294275d652ab53b91ad90c2809d27 (diff) |
varsayılan olarak standard outputa yaz
-rw-r--r-- | html-jen.lisp | 12 |
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))) |