I have one more patch for the display code of html-parser (which again appears not to exist at all in Alex Shinn's code, hmm...).
html->sxml is able to parse attributes without a value, such as "popover" in this example: <button popovertarget="my-popover">Open Popover</button> <div popover id="my-popover">Greetings, one and all!</div> But sxml-display-as-html can't handle these. The attached patch fixes this. Diego
Index: html-parser.scm =================================================================== --- html-parser.scm (revision 46523) +++ html-parser.scm (working copy) @@ -691,9 +691,13 @@ (define (html-attr->string attr) (string-append - (symbol->string (car attr)) "=\"" - (html-escape-attr (if (pair? (cdr attr)) (cadr attr) (cdr attr))) - "\"")) + (symbol->string (car attr)) + (if (null? (cdr attr)) + "" + (string-append + "=\"" + (html-escape-attr (if (pair? (cdr attr)) (cadr attr) (cdr attr))) + "\"")))) (define (html-tag->string tag attrs) (let lp ((ls attrs) (res (list (symbol->string tag) "<"))) Index: tests/run.scm =================================================================== --- tests/run.scm (revision 46523) +++ tests/run.scm (working copy) @@ -105,6 +105,11 @@ (test-group "display" (test "<br/>" (sxml->html '(br))) (test "<img src=\"/pictures/test.png\"/>" - (sxml->html '(img (@ (src "/pictures/test.png")))))) + (sxml->html '(img (@ (src "/pictures/test.png"))))) + (test "empty attribute value" + "<button popovertarget=\"my-popover\">Open Popover</button> +<div popover id=\"my-popover\">Greetings, one and all!</div>" + (sxml->html (html->sxml "<button popovertarget=\"my-popover\">Open Popover</button> +<div popover id=\"my-popover\">Greetings, one and all!</div>")))) (test-end)
