scml  Check-in [d08ee0edd6]

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

Overview
Comment:fix docs
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d08ee0edd6afd1827888140a53f3145d131be48f1ffc13e3abc197d470659f47
User & Date: lexi 2019-05-25 06:43:48
Context
2019-05-25
06:44
fix docs AGAIN check-in: b839592894 user: lexi tags: trunk
06:43
fix docs check-in: d08ee0edd6 user: lexi tags: trunk
06:42
fix docs check-in: ee67540c4a user: lexi tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to README.md.

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
this should be fairly straightforward to understand. there are three exceptions, and these both have to do with how scml handles attributes, which have no straightforward s-exp equivalent.

we'll start with the easier one. the form `(- …)` is used to create tags that do not have bodies. the `<meta>` tag is one such tag. attributes and values are supplied after the name of the tag consed together, e.g. `(key . "value")`. for instance, `<input name="user" type="text">` translates to `(- input (name . "user") (type . "text"))`.

> **note:** the Chicken Scheme reader (the function that transforms text into s-expressions),
> along with many other Scheme readers, allows the use of brackets beyond mere parentheses.
> while it is less strictly portable, you can use your choice of brackets to make code more
> readable, perhaps setting off attribute lists with [ ] and code blocks as {% … } {@ … }
> {= …}, or any other style that works best for you. e.g.:
>     {% (initial-setup-code) }
>     (html ((body [lang . "sp"]) (h1 "hola" {= "compadres"})
>                                 (p {@ string-append "qué " "pasa"})))

normal tags can take attributes too; in fact, the `(- …)` form is simply syntactic sugar for the full form. consider the HTML element `<textarea name="desc">description</textarea>` - we can express this in scml as `((textarea (name . "desc")) "description")`. in other words, if the first term of a list is another list, the compiler interprets it as the tag followed by an attribute list.

"boolean" attributes can also be encoded this way. rather than using a cons pair, you can simply enter them into the attribute list as symbols. this enables us to write a `<!doctype html>` declaration using one of two constructs

    ((!doctype html)) ; no semantic sugar
	(- !doctype html) ; with semantic sugar







|
|
<
<
<







37
38
39
40
41
42
43
44
45



46
47
48
49
50
51
52
this should be fairly straightforward to understand. there are three exceptions, and these both have to do with how scml handles attributes, which have no straightforward s-exp equivalent.

we'll start with the easier one. the form `(- …)` is used to create tags that do not have bodies. the `<meta>` tag is one such tag. attributes and values are supplied after the name of the tag consed together, e.g. `(key . "value")`. for instance, `<input name="user" type="text">` translates to `(- input (name . "user") (type . "text"))`.

> **note:** the Chicken Scheme reader (the function that transforms text into s-expressions),
> along with many other Scheme readers, allows the use of brackets beyond mere parentheses.
> while it is less strictly portable, you can use your choice of brackets to make code more
> readable, perhaps setting off attribute lists with `[ … ]` and code blocks as `{% … } {@ … }`
> `{= …}`, or any other style that works best for you. e.g.:




normal tags can take attributes too; in fact, the `(- …)` form is simply syntactic sugar for the full form. consider the HTML element `<textarea name="desc">description</textarea>` - we can express this in scml as `((textarea (name . "desc")) "description")`. in other words, if the first term of a list is another list, the compiler interprets it as the tag followed by an attribute list.

"boolean" attributes can also be encoded this way. rather than using a cons pair, you can simply enter them into the attribute list as symbols. this enables us to write a `<!doctype html>` declaration using one of two constructs

    ((!doctype html)) ; no semantic sugar
	(- !doctype html) ; with semantic sugar