From a2c30e8b368a527a645f048648d1d2ca12593fb2 Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 26 Jun 2024 22:43:59 -0700 Subject: Change: s/dom-node/node --- src/hypnotisml.lisp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/hypnotisml.lisp') diff --git a/src/hypnotisml.lisp b/src/hypnotisml.lisp index b5d8823..ab06b6f 100644 --- a/src/hypnotisml.lisp +++ b/src/hypnotisml.lisp @@ -60,21 +60,21 @@ (defmethod print-object ((ob attribs) stream) (format stream "~{~a=~s~^ ~}" (attribs-list ob))) -(def:class dom-node () +(def:class node () (parent :type (or null elem)) :documentation "Root class for all dom-nodes") -(defun dom-node-p (x) (typep x 'dom-node)) +(defun node-p (x) (typep x 'node)) (defun node-list-p (es) (and (listp es) - (every #'dom-node-p es))) + (every #'node-p es))) (deftype node-list () '(satisfies node-list-p)) -(def:class elem (dom-node) +(def:class elem (node) (tag :prefix :type keyword :initform (error 'tag-required) @@ -126,7 +126,7 @@ uniquely quried in the dom by passing string to .querySelector()" (defun elemp (x) (typep x 'elem)) -(def:class text (dom-node) +(def:class text (node) (content :prefix :type string :initform "") :documentation "A DOM Node holding a string.") @@ -305,16 +305,16 @@ already present in the element." ;; the road. (defun ensure-node (thing) - "THING may be a DOM-NODE, a STRING, or a FUNCTION. + "THING may be a NODE, a STRING, or a FUNCTION. If THING is a STRING, then a TEXT instance is returned. If THING is a function, then it is called with no arguments with the -assumption that this will produce an instance of DOM-NODE. +assumption that this will produce an instance of NODE. Otherwise signals an error." (etypecase thing - (dom-node thing) + (node thing) (string (make-instance 'text :content thing)) (function (funcall thing)))) @@ -326,12 +326,12 @@ Otherwise signals an error." (defun filter-nodes (contents) "CONTENTS is a list. -FILTER-NODES returns a list of DOM-NODEs created -by passing any strings, dom-nodes, or functions in CONTENTS to +FILTER-NODES returns a list of NODEs created +by passing any strings, nodes, or functions in CONTENTS to ENSURE-NODE." (loop :for c :in contents - :when (or (stringp c) (dom-node-p c) (functionp c)) + :when (or (stringp c) (node-p c) (functionp c)) :collect (ensure-node c))) (defun parse-contents (contents) @@ -339,7 +339,7 @@ ENSURE-NODE." STYLES is either null or a STYLES instance. ATTRIBS is either null or an ATTRIBS instance. -CONTENTS is a list of DOM-NODE instances." +CONTENTS is a list of NODE instances." (when (<= 2 (count-if #'styles-p contents)) (warn "There should be at most 1 STYLES instance in your elem contents.")) (when (<= 2 (count-if #'attribs-p contents)) -- cgit v1.2.3