From 73875cbaf7c01f978d217aff56606df9b392ae6c Mon Sep 17 00:00:00 2001 From: "Arthur A. Gleckler" Date: Tue, 11 Oct 2022 21:22:39 -0700 Subject: [PATCH] Fix bug: attributes without values didn't work. Before, it was necessary to do something like this: (option (@ (selected . #false) (value "any")) "any") instead of: (option (@ (selected) (value "any")) "any") Only the former is valid SXML, as far as I can tell from the SXML specification: --- lib/chibi/sxml.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/chibi/sxml.scm b/lib/chibi/sxml.scm index b6f3e239..c6e81599 100644 --- a/lib/chibi/sxml.scm +++ b/lib/chibi/sxml.scm @@ -40,11 +40,11 @@ (lambda (out) (html-display-escaped-attr (display-to-string str) out)))) (define (html-attr->string attr) - (if (cdr attr) + (if (null? (cdr attr)) + (symbol->string (car attr)) (let ((val (if (pair? (cdr attr)) (cadr attr) (cdr attr)))) (string-append (symbol->string (car attr)) - "=\"" (html-escape-attr val) "\"")) - (symbol->string (car attr)))) + "=\"" (html-escape-attr val) "\"")))) (define (html-tag->string tag attrs) (let lp ((ls attrs) (res (list (symbol->string tag) "<")))