(Arne Babenhauserheide)
2014-11-19: nicer sxml test using quasiquote. nicer sxml test using quasiquote.
diff --git a/.bugs/bugs b/.bugs/bugs --- a/.bugs/bugs +++ b/.bugs/bugs @@ -19,6 +19,7 @@ wisp-guile.w does not yet remove the lea inline ' : should be '( | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:72d534a8b23b4cb168017f1bb7d8816f0ea170c4, time:1366497335.26 failing test tests/shebang.w | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:74a851f83af8996465a7b24d8453161beb0f0fd5, time:1379106761.57 non-nested multiline comments with #! !#. Requires restructuring. | owner:, open:False, id:7a57614fa920b2ddad002d044b144d0bb7c34f84, time:1389364108.01 +wisp-scheme: interpret , : as ,() similar to : , | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:85e150dcb10c49d8f51db525e07d24e83bdba0f1, time:1416432201.21 wisp-guile: support nested multi-line comments with #| ... |#: multiline comments (srfi-30). Requires restructuring. | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:8cf6202873d4454f57813dd17cf60432059f7c62, time:1389569421.6 wisp-guile: the repl does not require 3 returns when you use a single char as function, or rather only does so every second time | owner:, open:True, id:9cedd0bdbf4a3b17add4bfe86ad5a23e500cfc6c, time:1379064870.78 wisp-guile.w breaks on ";" and complex brackets with bracket char literals. See wisp-guile.w::91 | owner:, open:False, id:9d8b6f87fa5365733fc8655614dbf2a9ba5bd054, time:1377533321.27 diff --git a/tests/sxml.scm b/tests/sxml.scm --- a/tests/sxml.scm +++ b/tests/sxml.scm @@ -1,16 +1,34 @@ (use-modules (sxml simple)) +(use-modules (ice-9 match)) -; write xml to the output port -(sxml->xml +; define a template +(define template (quote (html (head (title "test")) (body (h1 "test") + (message "the header") (p "it " (em "works!") (br) (" it actually works!")))))) +; transform it +(define template2 + (let loop + ((l template)) + (match l + (('message a ...) + `(p (@ (style "margin-left: 2em")) + (strong ,(map loop a)))) + ((a ...) + (map loop a )) + (a + a)))) + +; write xml to the output port +(sxml->xml template2) + (newline) diff --git a/tests/sxml.w b/tests/sxml.w --- a/tests/sxml.w +++ b/tests/sxml.w @@ -8,7 +8,7 @@ define template head : title "test" body h1 "test" - header-foo "the header" + message "the header" p "it " : em "works!" br " it actually works!" @@ -18,8 +18,9 @@ define template2 let loop : l template match l - : 'header-foo a ... - list 'p '(@ (style "margin-left: 2em")) : list 'strong : map loop a + : 'message a ... + ` p : @ : style "margin-left: 2em" + strong ,(map loop a) : a ... map loop a a