chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] New awful


From: Mario Domenech Goulart
Subject: [Chicken-users] New awful
Date: Sat, 29 Sep 2012 16:31:11 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux)

Hi,

A new awful version (0.36) has been released today.  It begins a
transition to SXML.  The new version is still compatible with old
code, but the documentation has been updated to encourage the use
of SXML.

Here's a more detailed explanation: awful has been using
html-tags (http://wiki.call-cc.org/egg/html-tags) to generate
HTML.  The problem is that, by default, html-tags generates plain
strings.  That approach has several problems (Peter Bex nicely
explains them here:
http://sjamaan.ath.cx/posts/structurally-fixing-injection-bugs.html).
Even though the more recent versions of html-tags are able to
generate SXML code, awful still has to keep compatibility with
old code, so version 0.36 starts a transition phase: old code
still works, but there are settings to enable the operation in
SXML mode, and that mode is recommended.  In the future, only
SXML will be supported.

Porting "strings code" to SXML is not terribly painful, since
html-tags can generate SXML, but expect some warts.

Here's a simple example:

;; "Strings mode"
(use awful html-tags)

(define-page (main-page-path)
  (lambda ()
    (<div> id: "content"
           (<p> "Hi!"))))


;; SXML mode
(use awful html-tags)

(enable-sxml #t) ;; for awful
(generate-sxml? #t) ;; for html-tags

(define-page (main-page-path)
  (lambda ()
    (<div> id: "content"
           (<p> "Hi!"))))


Of course, you can use pure SXML instead of html-tags (recommended):

(use awful)

(enable-sxml #t)

(define-page (main-page-path)
  (lambda ()
    '(div (@ (id "content"))
          (p "Hi!"))))


The default `enable-sxml' value is `#f' at the moment, but in
future versions it will be set to `#t' (and that will break old
apps).

The documentation provides more information and code examples.

Please, let me know if you find bugs.

Best wishes.
Mario
-- 
http://parenteses.org/mario



reply via email to

[Prev in Thread] Current Thread [Next in Thread]