Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for [[/eggref/4/hart|the CHICKEN 4 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[https://wiki.call-cc.org/chicken-projects/egg-index-4.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. [[tags:eggs]] [[toc:]] == hart The {{hart}} egg provides an SXML-inspired syntax for HTML generation. == Authors [[Graham Fawcett]] == Requirements * [[http://code.call-cc.org/legacy-eggs/3/vector-lib.html|vector-lib]] == Examples <enscript highlight=scheme> (use hart) (define people '((Fred fred@example.net 25) (Mary mary@example.net 33))) (hart (html (head (title "People")) (body (h1 (fmt: "A list of ~a people" (length people))) (if: (null? people) (h2 "No people!") (ol (for: ((name email age) people) (li (a (@ (href (conc "mailto:" email))) (text: name)) (fmt: ", who is ~a years old." age)))))))) </enscript> which produces <enscript highlight=html> <html><head><title>People</title></head><body> <h1>A list of 2 people</h1> <ol><li><a href="mailto:fred@example.net">Fred</a>, who is 25 years old.</li> <li><a href="mailto:mary@example.net">Mary</a>, who is 33 years old.</li> </ol></body></html> </enscript> == Syntax [syntax] (hart hart-expr ...) [syntax] (hart->string hart-expr ...) Compiles hart-expr, an expression in the Hart syntax. In short, Hart is SXML syntax plus a set of "keyword expressions" which handle flow-control, iteration, escaping, etc. (hart) outputs to (current-output-port) and returns an undefined value. (hart->string) returns a string value. Multiple expressions can be passed to (hart) and (hart->string): there is an implicit (let: () ...) enclosing the expressions (see let: below). === Keyword expressions [syntax] (if: expr hart-true hart-false) [syntax] (when: expr hart-true*) [syntax] (unless: expr hart-false*) These are like their Scheme counterparts, except hart-true and hart-false are expressions in Hart syntax. [syntax] (for: (iter-expr list-or-vec) . hart-body) A looping construct. The iter-expr is a match-expression which is matched to each successive value in list-or-vec. Hart-body is a list of Hart expressions, evaluated for each value of iter-expr. [syntax] (let: let-forms . hart-body) [syntax] (let*: let-forms . hart-body) [syntax] (letrec: let-forms . hart-body) Like a (let ...) expression, but hart-body is a list of Hart expressions. === Formatting keywords [syntax] (raw: . expr) The Scheme expressions (not Hart!) are evaluated to strings and outputted, without HTML/XML escaping. [syntax] (text: . exprs) or (t: . exprs) The Scheme expressions are evaluated to strings, HTML-escaped, and outputted. [syntax] (fmt: format-string . args) The result of (apply format format-string args) is HTML-escaped and outputted. [syntax] (scheme: . exprs) The Scheme expressions are evaluated. If they produce output, that output will be inserted into the HTML. == Attributes Note that attributes (such as the "href" in an A tag) are of the form (name value), where "name" is a string or symbol, and "value" is a Scheme expression (literal or otherwise). No escaping is done on these expressions at the current time. === Optional Attributes An attribute whose value evaluates to #f will be omitted from the HTML output. This provides a mechanism for specifying optional attributes. == Utility functions [procedure] (hart-html-escape string) A fast, basic HTML-escaping routine. == History * Version 1.3.0 (2008-03-15): 'syntax-case' support [Kon Lovett] * Version 1.2.1 (2008-02-22): bugfix release (removed bad build dependency) * Version 1.2 (2008-02-20): bugfix in hart.setup; added -O1 optimization * Version 1.1.2 (February 2008): bugfix releae == License {{hart}} is licensed under the BSD License. Copyright (C) 2008 Graham Fawcett <graham.fawcett@gmail.com>
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 13 to 16?