diff --git a/contrib/cont-responder/cont-examples.factor b/contrib/cont-responder/cont-examples.factor index 2aa1688d65..1da63eb931 100644 --- a/contrib/cont-responder/cont-examples.factor +++ b/contrib/cont-responder/cont-examples.factor @@ -33,6 +33,7 @@ USE: strings USE: arithmetic USE: namespaces USE: prettyprint +USE: unparser : display-page ( title -- ) #! Display a page with some text to test the cont-responder. @@ -90,8 +91,8 @@ USE: prettyprint [ #! And we don't need the 'url' argument drop - "Counter: " over cat2 [ - dup

write

+ "Counter: " over unparse cat2 [ + dup

unparse write

"++" over unit [ f ] swap append [ 1 + counter-example ] append quot-href "--" over unit [ f ] swap append [ 1 - counter-example ] append quot-href drop @@ -106,17 +107,17 @@ USE: prettyprint [ #! We don't need the 'url' argument drop - "Counter: " "counter" get cat2 [ -

"counter" get write

+ "Counter: " "counter" get unparse cat2 [ +

"counter" get unparse write

"++" [ "counter" get 1 + "counter" set ] quot-href "--" [ "counter" get 1 - "counter" set ] quot-href ] html-document ] show drop ; -#! Install the examples -"counter1" [ drop 0 counter-example ] install-cont-responder -"counter2" [ drop counter-example2 ] install-cont-responder -"test1" [ drop test-cont-responder ] install-cont-responder -"test2" [ drop test-cont-responder2 ] install-cont-responder -"test3" [ drop test-cont-responder3 ] install-cont-responder +! Install the examples + "counter1" [ drop 0 counter-example ] install-cont-responder + "counter2" [ drop counter-example2 ] install-cont-responder + "test1" [ drop test-cont-responder ] install-cont-responder + "test2" [ drop test-cont-responder2 ] install-cont-responder + "test3" [ drop test-cont-responder3 ] install-cont-responder diff --git a/contrib/cont-responder/cont-html.factor b/contrib/cont-responder/cont-html.factor index 8018f4444c..61b767ed99 100644 --- a/contrib/cont-responder/cont-html.factor +++ b/contrib/cont-responder/cont-html.factor @@ -99,21 +99,21 @@ USE: logic ! Each closable HTML tag has four words defined. The example below is for !

: ! -!:

( -- ) +! :

( -- ) ! #! Writes the opening tag to standard output. ! "

" write ; -!:

) +! :

) ! #! Used for setting inline attributes. Prints out ! #! an unclosed opening tag. ! " >n ; ! -!: p> ( n: -- ) +! : p> ( n: -- ) ! #! Used to close off inline attribute version of word. ! #! Prints out attributes and closes opening tag. ! store-prev-attribute write-attributes n> drop ">" write ; ! -!:

( -- ) +! :

( -- ) ! #! Write out the closing tag. ! "" write ; ! @@ -135,7 +135,7 @@ USE: logic ! Each attribute word has the form xxxx= where 'xxxx' is the attribute ! name. The example below is for href: ! -!: href= ( n: optional-value -- ) +! : href= ( n: optional-value -- ) ! store-prev-attribute "href" "current-attribute" set ; : define-compound ( vocab name def -- ) diff --git a/contrib/cont-responder/cont-responder.factor b/contrib/cont-responder/cont-responder.factor index 456fbed366..1e6c878ba6 100644 --- a/contrib/cont-responder/cont-responder.factor +++ b/contrib/cont-responder/cont-responder.factor @@ -42,6 +42,7 @@ USE: logic USE: cont-html USE: logging USE: url-encoding +USE: unparser : expiry-timeout ( -- timeout-seconds ) #! Number of seconds to timeout continuations in @@ -58,7 +59,7 @@ USE: url-encoding : get-random-id ( -- id ) #! Generate a random id to use for continuation URL's - <% 16 [ random-digit % ] times %> ; + <% 16 [ random-digit unparse % ] times %> ; : continuation-table ( -- ) #! Return the global table of continuations