diff options
| -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) | 
