diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/hypnotisml.lisp | 18 | ||||
-rw-r--r-- | src/package.lisp | 4 |
2 files changed, 14 insertions, 8 deletions
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 "<!DOCTYPE html>") + +(defun <!doctype> (&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 "<!DOCTYPE html>" stream)) ;;; ELEM BUILDERS @@ -493,6 +502,7 @@ CONTENTS is a list of NODE instances." video wbr)) + ;;; CONVENIENCE ELEMENT BUILDERS (defun <checkbox> (&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 @@ #:<dialog> #:<div> #:<dl> + #:<!doctype> #:<dt> #:<em> #:<embed> @@ -170,8 +171,7 @@ ;; parenscript macros (:export - #:js.elem - #:js.replace) + #:js-elem) ;; transforms and structure editing (:export |