From aae175e6b9febf3fb80ca3e683af2e6227307079 Mon Sep 17 00:00:00 2001 From: colin Date: Thu, 7 Nov 2024 06:16:27 -0800 Subject: doctype --- src/hypnotisml.lisp | 18 ++++++++++++------ src/package.lisp | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/hypnotisml.lisp b/src/hypnotisml.lisp index a009835..846e30f 100644 --- a/src/hypnotisml.lisp +++ b/src/hypnotisml.lisp @@ -66,6 +66,13 @@ (parent :type (or null elem)) :documentation "Root class for all dom-nodes") +(def:class doctype-html (node) + :documentation "") + +(defun (&rest ignore) + (declare (ignore ignore)) + (make-instance 'doctype-html)) + (defun node-p (x) (typep x 'node)) (defun node-list-p (es) @@ -313,6 +320,8 @@ already present in the element." (indent stream) (write-string (text-content text) stream)) +(defmethod html ((doctype-html doctype-html) stream) + (write-string "" stream)) ;;; ELEM BUILDERS @@ -493,6 +502,7 @@ CONTENTS is a list of NODE instances." video wbr)) + ;;; CONVENIENCE ELEMENT BUILDERS (defun (&key checked name) @@ -609,13 +619,9 @@ E.g. :1/2, :1, :3/4" ;;; PARENSCRIPT -(ps:defpsmacro js.elem (elem) +(ps:defpsmacro js-elem (elem) `(ps:chain document (query-selector (ps:lisp (elem-query-selector ,elem))))) -(ps:defpsmacro js.replace (elem innerhtml) - (let ((template (ps:ps-gensym))) - `(let ((,template (ps:chain document (create-element "template")))) - (setf (ps:@ ,template inner-h-t-m-l) ,innerhtml) - (ps:chain ($$ ,elem) (replace-with (ps:@ ,template content)))))) + diff --git a/src/package.lisp b/src/package.lisp index 4c0c94f..648788a 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -43,6 +43,7 @@ #: #:
#:
+ #: #:
#: #: @@ -170,8 +171,7 @@ ;; parenscript macros (:export - #:js.elem - #:js.replace) + #:js-elem) ;; transforms and structure editing (:export -- cgit v1.2.3