;; lib/host/tests/htmlsx.sx — the pure-SX HTML → SX converter (host/html->sx). Covers text, ;; entities, void/nested tags, attributes, figure/iframe, and an end-to-end import round-trip. (define host-ht-pass 0) (define host-ht-fail 0) (define host-ht-fails (list)) (define host-ht-test (fn (name actual expected) (if (= actual expected) (set! host-ht-pass (+ host-ht-pass 1)) (begin (set! host-ht-fail (+ host-ht-fail 1)) (append! host-ht-fails {:name name :actual actual :expected expected}))))) ;; a paragraph with inline formatting — kept nested (decompose flattens to text later). (host-ht-test "a
with inline parses to (p \"…\" (strong \"…\") \"…\")"
(str (host/html->sx " Hello world now Tom & Jerry cost £5 ’n up keeps its attributes as keyword attrs.
(host-ht-test "a void
keeps :src/:alt attrs"
(str (host/html->sx "
"))
"(article (img :alt \"a photo\" :src \"a.jpg\"))")
;; a +
and a
