: test-cont-responder ( - )
#! Test the cont-responder responder by displaying a few pages in a row.
"Page one" display-page
- "Hello " display-get-name-page cat2 display-page
+ "Hello " display-get-name-page append display-page
"Page three" display-page ;
: test-cont-responder2 ( - )
[
#! And we don't need the 'url' argument
drop
- "Counter: " over unparse cat2 [
+ "Counter: " over unparse append [
dup <h2> unparse write </h2>
"++" over unit [ f ] swap append [ 1 + counter-example ] append quot-href
"--" over unit [ f ] swap append [ 1 - counter-example ] append quot-href
[
#! We don't need the 'url' argument
drop
- "Counter: " "counter" get unparse cat2 [
+ "Counter: " "counter" get unparse append [
<h2> "counter" get unparse write </h2>
"++" [ "counter" get 1 + "counter" set ] quot-href
"--" [ "counter" get 1 - "counter" set ] quot-href
: escape-quotes ( string -- string )
#! Replace occurrences of single quotes with
#! backslash quote.
- [ dup [ [[ CHAR: ' "\\'" ]] [[ CHAR: " "\\\"" ]] ] assoc dup rot ? ] map ;
+ [
+ [ dup [ [[ CHAR: ' "\\'" ]] [[ CHAR: " "\\\"" ]] ] assoc [ , ] [ , ] ?ifte ] each
+ ] make-string ;
: make-eval-javascript ( string -- string )
#! Give a string return some javascript that when
: user-exists? ( db-path name password -- <todo> )
#! Returns a <todo> if a user with the given name exists
#! otherwise returns false.
- -rot ".todo" cat3 dup exists? [
+ -rot ".todo" append3 dup exists? [
load-todo password-matches?
] [
2drop f