diff options
author | riton <riton@riton.home> | 2025-03-23 22:38:37 +0300 |
---|---|---|
committer | riton <riton@riton.home> | 2025-03-23 22:38:37 +0300 |
commit | 58b05733c113b3f6f3e32212e50d33f9b9dc7b25 (patch) | |
tree | bc59163ce67b973c925e333a93b7aa4c82614a8d | |
parent | 041740e761f16bccc24701b2af26c840c9750e77 (diff) |
html üretiminde yeni satırlar düzenlendi
-rw-r--r-- | html-jen.lisp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/html-jen.lisp b/html-jen.lisp index 4bcf680..6074888 100644 --- a/html-jen.lisp +++ b/html-jen.lisp @@ -11,19 +11,25 @@ (defun tag-yeni-satır? (tag) (case tag - ((:html :head :body) t) - ((:title :p :b :i :code) nil))) + ((:html :head :body :div :ol :ul) t) + ((:title :p :b :i :code :li) nil))) + +(defun tag-inline? (tag) + (case tag + ((:html :head :body :div :ol :ul :li :p) nil) + ((:title :b :i :code) t))) (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) + (unless (not *yeni-satır*) + (loop :for i :from 0 :below *indent* + :do (write-char #\Space stream))) (if (null (props node)) (format stream "<~a>" (tag node)) (loop :initially (format stream "<~a" (tag node)) :for (k v) :on (props node) :by #'cddr :do (format stream " ~a=\"~a\"" k v) :finally (write-char #\> stream))) + (setf *yeni-satır* nil) (when (tag-yeni-satır? (tag node)) (write-char #\Newline stream) (setf *yeni-satır* t))) @@ -36,11 +42,13 @@ :do (node->html child stream))))) (defmethod node->html :after ((node node) &optional (stream *standard-output*)) - (unless (null *yeni-satır*) + (unless (not *yeni-satır*) (loop :for i :from 0 :below *indent* :do (write-char #\Space stream))) - (format stream "</~a>~%" (tag node)) - (setf *yeni-satır* t)) + (if (tag-inline? (tag node)) + (format stream "</~a>" (tag node)) + (progn (format stream "</~a>~%" (tag node)) + (setf *yeni-satır* t)))) (defun node->cons (node) |