1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
;; Copyright 2007-2011, Matthew Welland.
;;
;; This program is made available under the GNU GPL version 2.0 or
;; greater. See the accompanying file COPYING for details.
;;
;; This program is distributed WITHOUT ANY WARRANTY; without even the
;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE.
;; stml is a list of html strings
(declare (unit stml))
(declare (uses misc-stml))
(require-extension regex)
;; extract various tokens from the parameter list
;; 'key val => put in the params list
;; strings => maintain order and add to the datalist <<== IMPORTANT
(define (s:extract inlst)
(if (null? inlst) inlst
(let loop ((data '())
|
|
>
>
>
>
>
>
>
>
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
;; Copyright 2007-2011, Matthew Welland.
;;
;; This program is made available under the GNU GPL version 2.0 or
;; greater. See the accompanying file COPYING for details.
;;
;; This program is distributed WITHOUT ANY WARRANTY; without even the
;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE.
;; stml is a list of html strings
;; (declare (unit stml))
(module stml2
*
(import chicken scheme data-structures extras srfi-13 ports )
(use stmlcommon cookie misc-stml formdat session sqltbl keystore)
;; (declare (uses misc-stml))
(use regex)
;; extract various tokens from the parameter list
;; 'key val => put in the params list
;; strings => maintain order and add to the datalist <<== IMPORTANT
(define (s:extract inlst)
(if (null? inlst) inlst
(let loop ((data '())
|
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
((list? x)
(s:print (+ indent 1) x))
(else
;; (print "ERROR: Bad input 01") ;; why do anything with junk?
)))
inlst))
(define (s:cgi-out inlst)
(s:output (current-output-port) inlst))
(define (s:output port inlst)
(map (lambda (x)
(cond
((string? x) (print x)) ;; (print x))
((symbol? x) (print x)) ;; (print x))
((list? x) (s:output port x))
(else ""
;; (print "ERROR: Bad input 02") ;; why do anything? don't output junk.
)))
inlst))
; (if (> (length inlst) 2)
; (print)))
(define (s:output-new port inlst)
(with-output-to-port port
(lambda ()
(map (lambda (x)
(cond
((string? x) (print x))
((symbol? x) (print x))
((list? x) (s:output port x))
(else
;; (print "ERROR: Bad input 03")
)))
inlst))))
|
>
>
|
|
|
>
>
|
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
((list? x)
(s:print (+ indent 1) x))
(else
;; (print "ERROR: Bad input 01") ;; why do anything with junk?
)))
inlst))
;; Moved to misc-stml
;;
#;(define (s:cgi-out inlst)
(s:output (current-output-port) inlst))
#;(define (s:output port inlst)
(map (lambda (x)
(cond
((string? x) (print x)) ;; (print x))
((symbol? x) (print x)) ;; (print x))
((list? x) (s:output port x))
(else ""
;; (print "ERROR: Bad input 02") ;; why do anything? don't output junk.
)))
inlst))
; (if (> (length inlst) 2)
; (print)))
#;(define (s:output-new port inlst)
(with-output-to-port port
(lambda ()
(map (lambda (x)
(cond
((string? x) (print x))
((symbol? x) (print x))
((list? x) (s:output port x))
(else
;; (print "ERROR: Bad input 03")
)))
inlst))))
)
|