#lang scheme

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

(require srfi/19)

(define (one)
  (xml:output (xml:join (xml:element "p" (xml:element "a" (xml:element "img" #:src (string-append "images" "/" "synx.jpg")) #:href "http://synx.us.to"))))

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

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

(define (three)
   p a img)

  (define (a-document)
        html head title link body h1)]
        (title "XML Maker")
        (link #:rel "stylesheet" #:href "style.css" #:type "text/css"))
        (h1 "XML Maker")
        (p "This document is an example of an XML document (not /quite/ XHTML) being generated not from a s-expression, but from normal scheme function calls.")
        (p "That allows you to create documents in the same language you program in, without any need for unfriendly concepts like quasiquoting. It avoids using quasiquote syntaxes to haphazardly mix two languages together, which though currently popular as HTML templates, is very error prone and hard to read by computers and humans alike.")
        (p "Also being scheme, using this module will make certain errors completely impossible, such as mismatched tags, unclosed tags, or unquoted attribute values.")
        (p "No escaping is needed, since these are just functions. " (date->string (current-date)))
        (p "It should be a simple abstraction, and you either get a full, valid document, or you get an error. Doing that means you can't stream the document, but that allows you to send a (full, valid) error document instead if an error is raised. Most documents are pretty small anyway, enough to fit it a reasonable sized 'chunk'")))))
  (xml:output a-document))

(define (main)
  (display "\n---\n")
  (display "\n---\n")
(provide main)