#lang scheme

(require (prefix-in xml: "writer.ss"))

(require srfi/19)

((xml:writer "p" (xml:writer "a" (xml:writer "img" #:src (string-append "images" "/" "synx.jpg")) #:href "http://synx.us.to")) display)

(display "\n---\n")

   (a #:href "http://synx.us.to" (img #:src ,(string-join '("" "images" "synx.jpg") "/")))))

(display "\n---\n")

(define xml 
     (title "Generative Generic XML")
     (link #:rel "stylesheet" #:href "style.css" #:type "text/css"))
     (h1 "Generative Generic XML")
     (p "This document is an example of an XML document (not /quite/ XHTML) being generated not from a s-expression, but from a generative XML function.")
     (p "That allows you to specify keyword arguments, among other things. Syntax aside from the fake tag function placeholders
is messed with as minimally as possible.")
     (p "You can escape stuff naturally. " ,(date->string (current-date)))
     (p "It should be a simple abstraction, and because it is generative it should allow for"
         ,(λ (write)
            (map (λ (item)
                   (sleep 1)
                   ((xml:gen (li ,(xml:encode item))) write))
         ,@(map (λ (item) 
                  (xml:gen (li item)))
                (list "Lists" "Of" "Generators"))
         ,@(list "Lists" " Of " "Lists")))
     (p "Or maybe..."
        ,(λ (write)
           (let loop ([count 10])
             (if (< count 1) (void)
                   (write (xml:encode count))
                   (write "\n")
                   (sleep 1)
                   (loop (- count 1))))))
        "tail recursion! :D")))))

(xml display)