diff options
| -rw-r--r-- | üretim.lisp | 12 | 
1 files changed, 11 insertions, 1 deletions
| diff --git a/üretim.lisp b/üretim.lisp index 51d75e0..2ae81f4 100644 --- a/üretim.lisp +++ b/üretim.lisp @@ -23,6 +23,16 @@    (write-char #\Newline stream)    (setf *satır-başı* t)) +;;;; https://stackoverflow.com/questions/7381974/which-characters-need-to-be-escaped-in-html +;;; TODO geliştirme mümkün... ama şimdilik yeter (#\" """) (#\' "'") +(defun kaçışlı-içerik-yazdır (metin stream) +  (loop :for karakter :across metin +        :do (case karakter +              (#\< (write-string "<" stream)) +              (#\> (write-string ">" stream)) +              (#\& (write-string "&" stream)) +              (t (write-char karakter stream))))) +  (defmethod node->html :before ((node node) &optional (stream *standard-output*))    (unless (not *satır-başı*)      (loop :for i :from 0 :below *indent* @@ -39,7 +49,7 @@  (defmethod node->html ((node node) &optional (stream *standard-output*))    (if (null (children node)) -      (format stream "~a" (value node)) +      (kaçışlı-içerik-yazdır (value node) stream)        (let ((*indent* (+ *indent* *indent-increment*)))          (loop :for child :in (children node)                :do (node->html child stream))))) | 
