[araneida: integrate Parenscript into the HTML functions
Alan-Shields@omrf.ouhsc.edu**20051116000255
If you load Parenscript before loading Araneida, you can now use
Parenscript within the HTML generation functions.
(span :css (:color "black" :size "200%"))
will become
and
(css (* :border "1px solid black")
(div.bl0rg :font-family "serif")
(("a:active" "a:hoover") :color "black" :size "200%"))
will produce
(js-script) is the equivalent for Javascript,
and you can call #'JS-INLINE for inline Javascript, just like normal.
There will be some docs soon.
] {
hunk ./html.lisp 36
-(defun html-attr (attr)
- (with-output-to-string (o)
- (loop for (att val . rest) on attr by #'cddr do
- (if (symbolp att)
- (progn
- (princ " " o)
- (princ (string-downcase (symbol-name att)) o)
- (princ "=\"" o)
- (princ val o)
- (princ "\"" o))
- (error "attribute ~S is not a symbol in attribute list ~S" att attr)))))
+(macrolet ((html-attr-body ()
+ `(with-output-to-string (o)
+ (loop for (att val . rest) on attr by #'cddr do
+ (cond
+ #+parenscript((and (symbolp att) (equal (symbol-name 'css) (symbol-name att)))
+ (progn
+ (princ " " o)
+ (princ "style=\"" o)
+ (princ (val-printer (js::css-inline-func val)) o)
+ (princ "\"" o)))
+ ((symbolp att)
+ (progn
+ (princ " " o)
+ (princ (string-downcase (symbol-name att)) o)
+ (princ "=\"" o)
+ (princ (val-printer val) o)
+ (princ "\"" o)))
+ (t
+ (error "attribute ~S is not a symbol in attribute list ~S" att attr)))))))
+ (defun html-attr (attr)
+ (macrolet ((val-printer (val)
+ val))
+ (html-attr-body)))
+ (defun html-attr-escaped (attr)
+ (macrolet ((val-printer (val)
+ `(html-escape ,val)))
+ (html-attr-body))))
hunk ./html.lisp 64
-(defun html-attr-escaped (attr)
- (with-output-to-string (o)
- (loop for (att val . rest) on attr by #'cddr do
- (if (symbolp att)
- (progn
- (princ " " o)
- (princ (string-downcase (symbol-name att)) o)
- (princ "=\"" o)
- (princ (html-escape val) o)
- (princ "\"" o))
- (error "attribute ~S is not a symbol in attribute list ~S" att attr)))))
-
hunk ./html.lisp 116
+ #+parenscript((equal (symbol-name 'css) (symbol-name tag))
+ (printing
+ (format-out "")))
+ #+parenscript((equal (symbol-name 'js-script) (symbol-name tag))
+ (printing
+ (format-out "