]> gitweb.factorcode.org Git - factor.git/blobdiff - contrib/furnace/tools/help.factor
More web framework work
[factor.git] / contrib / furnace / tools / help.factor
index 7257cc3f4b7bac022eed1f757404276272d53b4e..fe178b5a5d277202c0d113705f938858dc9caa94 100644 (file)
@@ -1,22 +1,19 @@
 ! Copyright (C) 2005, 2006 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 IN: furnace:help
-USING: furnace help html kernel sequences words strings ;
-
-: string>topic ( string -- topic )
-    " " split dup length 1 = [ first ] when ;
+USING: furnace help html kernel sequences words strings io ;
 
 : show-help ( topic -- )
     dup article-title [
         [ help ] with-html-stream
+        <br/>
+        <a "search" =href a> "Search" write </a>
     ] html-document ;
 
 \ show-help {
     { "topic" "handbook" v-default string>topic }
 } define-action
 
-"help" "show-help" "contrib/furnace/tools" web-app
-
 M: link browser-link-href
     link-name [ \ f ] unless* dup word? [
         browser-link-href
@@ -24,3 +21,14 @@ M: link browser-link-href
         dup [ string? ] all? [ " " join ] when
         [ show-help ] curry quot-link
     ] if ;
+
+TUPLE: search terms ;
+
+: search ( terms -- )
+    <search> "search" "Search" render-page ;
+
+\ search {
+    { "terms" }
+} define-action
+
+"help" "show-help" "contrib/furnace/tools" web-app