scml  Check-in [32b0e979b1]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:jfjkakljahdjhkjh
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA3-256: 32b0e979b14cc0a26550081258f3f7694e5199776482a1c157f1fe94df4e75a1
User & Date: lexi 2019-05-25 06:57:06
Context
2019-05-25
06:57
jfjkakljahdjhkjh Leaf check-in: 32b0e979b1 user: lexi tags: trunk
06:56
fdhjkashflksdh docs dfhjkadsklf check-in: bc95a35c86 user: lexi tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to README.md.

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
there are three special forms that allow us to embed scheme code that is evaluated when the scml is translated to html. the simplest form is `(% …)` which will execute arbitrary scheme code. this code can mutate the execution environment, but its output will be ignored. a good use for this form is to define functions or globals

    (% (define page-title "index")
       (define path '(root list index))
       (define (emit-form target prompt)
              `((form (action . ,target) (method . "POST"))
                (div ,prompt "? " (- input (type . "text")
                                          (name . "field"))
                                 (- input (type . "submit"))))))

the next form, `(@ …)` is designed to make it as easy as possibly to use scheme functions from within the template body. simply write a normal scheme function call but with the atom `@` preceding the function name to dump its result into the page. the following example uses the defined functions to succinctly generate multiple simple forms. (note that `(% …)` can be implemented in terms of `(@ …)` as `(@ begin … '())`)

    (- !doctype html)
    (html (head (title "form example"))
          (body (p "here is a form")
                (@ emit-form "/cgi-bin/submit.pl"







|
|







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
there are three special forms that allow us to embed scheme code that is evaluated when the scml is translated to html. the simplest form is `(% …)` which will execute arbitrary scheme code. this code can mutate the execution environment, but its output will be ignored. a good use for this form is to define functions or globals

    (% (define page-title "index")
       (define path '(root list index))
       (define (emit-form target prompt)
              `((form (action . ,target) (method . "POST"))
                (div ,prompt "? " (- input (type . "text")
                                           (name . "field"))
                                  (- input (type . "submit"))))))

the next form, `(@ …)` is designed to make it as easy as possibly to use scheme functions from within the template body. simply write a normal scheme function call but with the atom `@` preceding the function name to dump its result into the page. the following example uses the defined functions to succinctly generate multiple simple forms. (note that `(% …)` can be implemented in terms of `(@ …)` as `(@ begin … '())`)

    (- !doctype html)
    (html (head (title "form example"))
          (body (p "here is a form")
                (@ emit-form "/cgi-bin/submit.pl"