#lang scribble/doc @; THIS FILE IS GENERATED @(require scribble/manual) @(require (for-label (planet neil/html-template:1:=1))) @(require (for-label racket)) @title[#:version "0.2"]{@bold{html-template}: HTML Writing Template Language based on SXML/xexp in Racket} @author{Neil Van Dyke} License: @seclink["Legal" #:underline? #f]{LGPL 3} @(hspace 1) Web: @link["http://www.neilvandyke.org/racket-html-template/" #:underline? #f]{http://www.neilvandyke.org/racket-html-template/} @defmodule[(planet neil/html-template:1:=1)] @section{Introduction} @emph{Note: This package is in a state of active development, and some interface changes, perhaps not backward-compatible, are expected. Documentation is gravely lacking.} The @bold{html-template} package implements an HTML-writing template language based on @link["http://www.neilvandyke.org/racket-xexp/"]{SXML/@emph{xexp}}. Compared to doing comparable work using the @link["http://www.neilvandyke.org/racket-html-writing/"]{html-writing} package, @bold{html-template} offers improved compile-time error-checking and improved run-time efficiency. !!! For example: @SCHEMEBLOCK[ (define (write-essay my-title) (html-template (html (head (title (% my-title))) (body (h1 (% my-title)) (p "Kittens claw." (br) "Puppies pee."))))) (write-essay "All About Kittens & Puppies") ] produces the output: @verbatim["All About Kittens &\nPuppies

All About\nKittens & Puppies

Puppies pee.

"] !!! Expanding the @tt{html-template} macro in this case results in something like: @SCHEMEBLOCK[ (define (write-essay my-title) (display "") (write-html my-title) (display "

") (write-html my-title) (display "

Kittens claw.
Puppies pee.

")) ] Note that much of the computation for HTML formatting is done at compile time rather than at run time. !!! @section{Interface} !!! @defproc[ (html-template (xexp any/c) (... any/c)) any/c]{ !!! } @defproc[ (html-template/port (port any/c) (xexp any/c) (... any/c)) any/c]{ Behaves as @tt{html-template}, with the addition that the @tt{current-output-port} parameter set to @schemevarfont{port} by @tt{parameterize} for the duration, including for run-time evaluations as a result of @tt{%eval/effects-only} and @tt{%eval} forms. } @defproc[ (html-template-to-string (xexp any/c) (... any/c)) any/c]{ !!! } @section{Debugging} @defproc[ (html-template-debug-expand (xexp any/c) (... any/c)) any/c]{ !!! } @section{History} @itemize[ @item{Version 0.2 --- 2011-08-22 -- PLaneT @tt{(1 1)} Added @tt{%} as alias for @tt{%eval}. } @item{Version 0.1 --- 2011-08-21 -- PLaneT @tt{(1 0)} Initial release. } ] @section[#:tag "Legal"]{Legal} Copyright (c) 2011 Neil Van Dyke. This program is Free Software; Software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License (LGPL 3), or (at your option) any later version. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See http://www.gnu.org/licenses/ for details. For other licenses and consulting, please contact the author. @italic{@smaller{Standard Documentation Format Note: The API signatures in this documentation are likely incorrect in some regards, such as indicating type @tt{any/c} for things that are not, and not indicating when arguments are optional. This is due to a transitioning from the Texinfo documentation format to Scribble, which the author intends to finish someday.}}