diff --git a/app/demo/etc/config.lisp b/app/demo/etc/config.lisp index 63459db..4dec5ca 100644 --- a/app/demo/etc/config.lisp +++ b/app/demo/etc/config.lisp @@ -12,7 +12,7 @@ :port "8800" :address "0.0.0.0" :routes - `((("api") server:message-handler :html-responder cs-hx:response) + `((("hx") server:message-handler :html-responder cs-hx:response) (() server:fileserver :doc-root ,(config:path "/var/www/html/" :env-key :docroot)))) (config:add-action '(:test :data) #'core:echo) diff --git a/test/etc/config-web.lisp b/test/etc/config-web.lisp index 29ddce1..f9b4f37 100644 --- a/test/etc/config-web.lisp +++ b/test/etc/config-web.lisp @@ -14,7 +14,7 @@ :class 'server:config :port "8899" :routes - `((("api") server:message-handler :html-responder cs-hx:response) + `((("hx") server:message-handler :html-responder cs-hx:response) (() server:fileserver :doc-root ,(t:test-path "" "docs")))) (config:add-action '(:test :data) #'core:echo) @@ -22,4 +22,4 @@ (config:add :client :class 'client:config :base-url "http://localhost:8899" - :doc-path "/" :api-path "/api/") + :doc-path "/" :api-path "/hx/") diff --git a/test/test-web.lisp b/test/test-web.lisp index e88fe76..ca5da74 100644 --- a/test/test-web.lisp +++ b/test/test-web.lisp @@ -38,9 +38,9 @@ (deftest test-dom () (== (dom:render - (dom:element :a '(:href "https://example.com" - :title "Demo" :class (:demo-link :plain)) - "Link to example.com")) + (dom:a '(:href "https://example.com" + :title "Demo" :class (:demo-link :plain)) + "Link to example.com")) "Link to example.com")) (deftest test-server-config (server) diff --git a/testing.lisp b/testing.lisp index 3a00079..24a6346 100644 --- a/testing.lisp +++ b/testing.lisp @@ -56,6 +56,9 @@ ;;;; utilities +(defmacro normalize (&rest xs) + ) + (defun test-path (name &rest dirs) (apply #'scopes/util:system-path *current-system* name "test" dirs)) diff --git a/util.lisp b/util.lisp index 4964792..e86ae40 100644 --- a/util.lisp +++ b/util.lisp @@ -11,8 +11,10 @@ ;;;; strings, symbols, keywords, ... -(defun flatten-str (s &key (with " ")) - (str:join with (str:lines s))) +(defun flatten-str (s &key (sep " ")) + (str:join sep + (mapcar (lambda (x) (str:trim x)) + (str:lines s)))) (defun to-string (k &key (sep " ") lower-case) (let ((pattern (if lower-case "~(~a~)" "~a"))) diff --git a/web/dom.lisp b/web/dom.lisp index 4579a15..3678760 100644 --- a/web/dom.lisp +++ b/web/dom.lisp @@ -39,7 +39,7 @@ (put c)) (end tag)))) -;;;; element = HTML element - no self-closing (<... />) of empty elements +;;;; element = HTML element - no self-closing of empty elements (defclass element (xml-element) ()) @@ -58,6 +58,8 @@ ;;;; void element (e.g. ): no body, no explicit closing of tag +(defclass void-element (xml-element) ()) + (defun void-element (tag attrs) (make-instance 'void-element :tag tag :attrs attrs))