From 95a4fbb25f399b11c2ad635a01dac08b4a635317 Mon Sep 17 00:00:00 2001 From: Chris Double Date: Mon, 25 Jul 2005 22:34:59 +0000 Subject: [PATCH] Various changes to get cont-responder examples working with 0.76 --- contrib/cont-responder/live-updater.factor | 2 +- contrib/cont-responder/todo-example.factor | 118 ++++++++++----------- contrib/cont-responder/todo.factor | 13 +-- 3 files changed, 67 insertions(+), 66 deletions(-) diff --git a/contrib/cont-responder/live-updater.factor b/contrib/cont-responder/live-updater.factor index 1e4ca45178..d4355948cd 100644 --- a/contrib/cont-responder/live-updater.factor +++ b/contrib/cont-responder/live-updater.factor @@ -34,7 +34,7 @@ USE: lists : get-live-updater-js* ( stream -- string ) #! Read all lines from the stream, creating a string of the result. - dup stream-readln dup [ , "\n" , get-live-updater-js* ] [ drop stream-close ] ifte ; + dup stream-readln dup [ % "\n" % get-live-updater-js* ] [ drop stream-close ] ifte ; : get-live-updater-js ( filename -- string ) #! Return the liveUpdater javascript code as a string. diff --git a/contrib/cont-responder/todo-example.factor b/contrib/cont-responder/todo-example.factor index 287e22b5ac..128dc80900 100644 --- a/contrib/cont-responder/todo-example.factor +++ b/contrib/cont-responder/todo-example.factor @@ -45,63 +45,63 @@ USE: sequences : todo-stylesheet ( -- string ) #! Return the stylesheet for the todo list [ - "table.list {" , - " text-align:center;" , - " font-family: Verdana;" , - " font-weight: normal;" , - " font-size: 11px;" , - " color: #404040;" , - " background-color: #fafafa;" , - " border: 1px #6699cc solid;" , - " border-collapse: collapse;" , - " boder-spacing: 0px;" , - "}" , - "tr.heading {" , - " border-bottom: 2px solid #6699cc;" , - " border-left: 1px solix #6699cc;" , - " background-color: #BEC8D1;" , - " text-align: left;" , - " text-indent: 0px;" , - " font-family: verdana;" , - " font-weight: bold;" , - " color: #404040;" , - "}" , - "tr.item {" , - " border-bottom: 1px solid #9cf;" , - " border-top: 0px;" , - " border-left: 1px solid #9cf;" , - " border-right: 0px;" , - " text-align: left;" , - " text-indent: 2px;" , - " font-family: verdana, sans-serif, arial;" , - " font-weight: normal;" , - " color: #404040;" , - " background-color: #fafafa;" , - "}" , - "tr.complete {" , - " border-bottom: 1px solid #9cf;" , - " border-top: 0px;" , - " border-left: 1px solid #9cf;" , - " border-right: 0px;" , - " text-align: left;" , - " text-indent: 2px;" , - " font-family: verdana, sans-serif, arial;" , - " font-weight: normal;" , - " color: #404040;" , - " background-color: #ccc;" , - "}" , - "td.lbl {" , - " font-weight: bold; text-align: right;" , - "}" , - "tr.required {" , - " background: #FCC;" , - "}" , - "input:focus {" , - " background: yellow;" , - "}" , - "textarea:focus {" , - " background: yellow;" , - "}" , + "table.list {" % + " text-align:center;" % + " font-family: Verdana;" % + " font-weight: normal;" % + " font-size: 11px;" % + " color: #404040;" % + " background-color: #fafafa;" % + " border: 1px #6699cc solid;" % + " border-collapse: collapse;" % + " boder-spacing: 0px;" % + "}" % + "tr.heading {" % + " border-bottom: 2px solid #6699cc;" % + " border-left: 1px solix #6699cc;" % + " background-color: #BEC8D1;" % + " text-align: left;" % + " text-indent: 0px;" % + " font-family: verdana;" % + " font-weight: bold;" % + " color: #404040;" % + "}" % + "tr.item {" % + " border-bottom: 1px solid #9cf;" % + " border-top: 0px;" % + " border-left: 1px solid #9cf;" % + " border-right: 0px;" % + " text-align: left;" % + " text-indent: 2px;" % + " font-family: verdana, sans-serif, arial;" % + " font-weight: normal;" % + " color: #404040;" % + " background-color: #fafafa;" % + "}" % + "tr.complete {" % + " border-bottom: 1px solid #9cf;" % + " border-top: 0px;" % + " border-left: 1px solid #9cf;" % + " border-right: 0px;" % + " text-align: left;" % + " text-indent: 2px;" % + " font-family: verdana, sans-serif, arial;" % + " font-weight: normal;" % + " color: #404040;" % + " background-color: #ccc;" % + "}" % + "td.lbl {" % + " font-weight: bold; text-align: right;" % + "}" % + "tr.required {" % + " background: #FCC;" % + "}" % + "input:focus {" % + " background: yellow;" % + "}" % + "textarea:focus {" % + " background: yellow;" % + "}" % ] make-string ; : todo-stylesheet-url ( -- url ) @@ -234,7 +234,7 @@ USE: sequences : get-todo-filename ( database-path -- filename ) #! Get the filename containing the todo list details. - [ swap , todo-username , ".todo" , ] make-string ; + [ swap % todo-username % ".todo" % ] make-string ; : add-default-todo-item ( -- ) #! Add a default todo item. This is a workaround for the @@ -473,7 +473,7 @@ USE: sequences : show-todo-list ( -- ) #! Show the current todo list. [ - [ "todo" get todo-username , "'s To Do list" , ] make-string + [ "todo" get todo-username % "'s To Do list" % ] make-string [ include-todo-stylesheet ] [ "todo" get write-item-table diff --git a/contrib/cont-responder/todo.factor b/contrib/cont-responder/todo.factor index 44507cec33..ad3a0473a0 100644 --- a/contrib/cont-responder/todo.factor +++ b/contrib/cont-responder/todo.factor @@ -36,6 +36,7 @@ USE: prettyprint USE: hashtables USE: sequences USE: http +USE: unparser : ( user password -- ) #! Create an empty todo list @@ -93,13 +94,13 @@ USE: http : read-todo ( -- ) #! Read a todo list from the current input stream. - read-line url-decode read-line url-decode - read-line str>number [ + readln url-decode readln url-decode + readln str>number [ dup [ - read-line url-decode "yes" = "complete?" set - read-line url-decode "priority" set - read-line url-decode "description" set + readln url-decode "yes" = "complete?" set + readln url-decode "priority" set + readln url-decode "description" set ] extend add-todo-item ] times ; @@ -149,7 +150,7 @@ USE: http : priority-comparator ( item1 item2 -- bool ) #! Return true if item1 is a higher priority than item2 - >r item-priority r> item-priority string> ; + >r item-priority r> item-priority lexi> ; : todo-items ( -- alist ) #! Return a list of items for the given todo list.