diff options
author | Case Duckworth | 2023-08-28 23:28:40 -0500 |
---|---|---|
committer | Case Duckworth | 2023-08-28 23:28:40 -0500 |
commit | a1011cbac02b5187b79dd904493df7f0452638bd (patch) | |
tree | 3ede216754be4a1044d30307df58ec1117dc58ef | |
parent | Fix text width (diff) | |
download | schmaltz-main.tar.gz schmaltz-main.zip |
Update README main
-rw-r--r-- | README.md | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/README.md b/README.md index ff7f66b..b667597 100644 --- a/README.md +++ b/README.md | |||
@@ -1,15 +1,15 @@ | |||
1 | # Schmaltz | 1 | # Schmaltz |
2 | ## Render embedded scheme in texts | 2 | ## Render embedded Scheme in texts |
3 | 3 | ||
4 | Schmaltz is a way to embed scheme code in text files using escape characters. This makes it a decent templating language à la PHP or shell here-documents. | 4 | Schmaltz is a way to embed Scheme code in text files using escape characters. This makes it a decent templating language à la PHP or shell here-documents. |
5 | 5 | ||
6 | ## Rationale | 6 | ## Rationale |
7 | 7 | ||
8 | Schmaltz was inspired by shell here-documents as well as CHICKEN's extension to scheme string literals, which looks like this: | 8 | Schmaltz was inspired by shell here-documents as well as CHICKEN's extension to Scheme string literals, which looks like this: |
9 | 9 | ||
10 | ```scheme | 10 | ```scheme |
11 | (define some-string #<#end | 11 | (define some-string #<#end |
12 | Here is a multiline string literal with #(display "embedded") scheme code. | 12 | Here is a multiline string literal with #(display "embedded") Scheme code. |
13 | 1 + 2 = #(+ 1 2), etc. | 13 | 1 + 2 = #(+ 1 2), etc. |
14 | end | 14 | end |
15 | ) | 15 | ) |
@@ -33,7 +33,7 @@ EOF | |||
33 | 33 | ||
34 | In shell here-documents, however, every expanded form is executed in a sub-shell, meaning that variable assignments and function definitions are not persistent across the document. | 34 | In shell here-documents, however, every expanded form is executed in a sub-shell, meaning that variable assignments and function definitions are not persistent across the document. |
35 | 35 | ||
36 | Schmaltz attempts to fix all of these problems. In fact, within a schmaltz-powered document you should have all of the power of scheme within rendered forms, as well as persistence of environment and access to the rest of your scheme system. Here is a schmaltz document in the same format as the above for illustration: | 36 | Schmaltz attempts to fix all of these problems. In fact, within a schmaltz-powered document you should have all of the power of Scheme within rendered forms, as well as persistence of environment and access to the rest of your Scheme system. Here is a schmaltz document in the same format as the above for illustration: |
37 | 37 | ||
38 | ``` | 38 | ``` |
39 | #,(define word "expansion") | 39 | #,(define word "expansion") |
@@ -77,7 +77,7 @@ Perform `render`, returning a string with the output. Takes the same arguments | |||
77 | Perform `render-string`, returning a string with the output. Takes the same arguments as `render-string`. | 77 | Perform `render-string`, returning a string with the output. Takes the same arguments as `render-string`. |
78 | 78 | ||
79 | #### `render-specials` *parameter* | 79 | #### `render-specials` *parameter* |
80 | Special characters to trigger expansion. Every expansion begins with `#`, then another character, then a scheme form. `render-specials` is an alist where CARs is a character literal and CDRs are procedures of one parameter, an input port. | 80 | Special characters to trigger expansion. Every expansion begins with `#`, then another character, then a Scheme form. `render-specials` is an alist where CARs is a character literal and CDRs are procedures of one parameter, an input port. |
81 | 81 | ||
82 | `render-specials` defaults to | 82 | `render-specials` defaults to |
83 | 83 | ||
@@ -94,7 +94,7 @@ String results not to include in the rendered output. For example, `define` mig | |||
94 | #### `(unprintable/skip . _)`, `(unprintable/backtrack char)` *procedures* | 94 | #### `(unprintable/skip . _)`, `(unprintable/backtrack char)` *procedures* |
95 | Helper procedures for definitions in `render-unprintables`. See the example below for usage ideas. | 95 | Helper procedures for definitions in `render-unprintables`. See the example below for usage ideas. |
96 | 96 | ||
97 | `unprintable/skip` skips whatever output is given from the rendered scheme code and prints nothing. `unprintable/backtrack` skips the output, but backtracks to output the character triggering the expansion as well as the preceding `#`. | 97 | `unprintable/skip` skips whatever output is given from the rendered Scheme code and prints nothing. `unprintable/backtrack` skips the output, but backtracks to output the character triggering the expansion as well as the preceding `#`. |
98 | 98 | ||
99 | #### `render-environment` *parameter* | 99 | #### `render-environment` *parameter* |
100 | The environment to evaluate rendered forms in. Defaults to `interaction-environment`. | 100 | The environment to evaluate rendered forms in. Defaults to `interaction-environment`. |
@@ -134,7 +134,7 @@ It wraps the form in an implicit `quasiquote` so you can include (string) variab | |||
134 | (cons "#!eof" unprintable/backtrack)) | 134 | (cons "#!eof" unprintable/backtrack)) |
135 | ``` | 135 | ``` |
136 | 136 | ||
137 | The above skips printing unspecified values altogether, and the end-of-file marker backtracks to print the (non-)escaping `#` at the input's end. | 137 | The above skips printing unspecified values altogether, and the end-of-file marker backtracks to print the (non-)escaping `#` at the input's end. I'd recommend doing the same for any Scheme implementation, but I don't know how they might display unspecified, void, or end-of-file characters. |
138 | 138 | ||
139 | ### License | 139 | ### License |
140 | 140 | ||