node tanımı, tanım dosyasına taşındı

This commit is contained in:
riton
2025-03-18 15:38:40 +03:00
parent ecda6371c0
commit b005e986c0
2 changed files with 20 additions and 21 deletions

View File

@@ -1,26 +1,5 @@
(in-package :html-jen) (in-package :html-jen)
(defun dosya-metni-oku (dosya)
(let* ((uzunluk 0)
(metin
(with-output-to-string (out)
(with-open-file (in dosya :external-format :utf-8)
(loop :with arabellek := (make-array 8192 :element-type 'character)
:for n := (read-sequence arabellek in)
:while (< 0 n)
:do (incf uzunluk n)
(write-sequence arabellek out :start 0 :end n))))))
(values metin uzunluk)))
(defclass node ()
((tag :initarg :tag :accessor tag :initform nil)
(children :initarg :children :accessor children :initform nil)
(props :initarg :props :accessor props :initform nil)
(value :initarg :value :accessor value :initform nil)))
(defun node! (tag children props value)
(make-instance 'node :tag tag :children children :props props :value value))
(defparameter *indent* 0) (defparameter *indent* 0)
(defparameter *indent-increment* 2) (defparameter *indent-increment* 2)
(defparameter *yeni-satır* t) (defparameter *yeni-satır* t)

20
tanım.lisp Normal file
View File

@@ -0,0 +1,20 @@
(in-package :html-jen)
(defclass node ()
((tag :initarg :tag :accessor tag :initform nil
:documentation "HTML element tag keyword'ü")
(children :initarg :children :accessor children :initform nil
:documentation "Bu node'un altındaki node'lar")
(props :initarg :props :accessor props :initform nil
:documentation "HTML element attribute'ları ve değerleri")
(value :initarg :value :accessor value :initform nil
:documentation "HTML element metin içeriği")))
(defun node! (tag children props value)
(make-instance 'node :tag tag :children children :props props :value value))
(defun ebeveyn-node! (tag children &optional props)
(make-instance 'node :tag tag :children children :props props))
(defun çocuk-node! (tag value &optional props)
(make-instance 'node :tag tag :props props :value value))