]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/webapps/help/help.factor
webapps.help: whoops, fix using
[factor.git] / extra / webapps / help / help.factor
index 73066f5ec7446e30395f34dd6a9cabd8ec4dd940..f51f7f9dc6778fd575d8636145c782f1bb03962c 100644 (file)
@@ -1,10 +1,11 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs furnace.actions furnace.boilerplate
-furnace.redirection help.html help.topics html.components
-html.forms http.server http.server.dispatchers
+USING: accessors arrays assocs continuations furnace.actions
+furnace.boilerplate furnace.redirection help.html help.topics
+html.components html.forms http.server http.server.dispatchers
 http.server.static io.directories io.files.temp io.servers
-kernel namespaces sequences splitting unicode urls ;
+kernel namespaces sequences simple-tokenizer splitting unicode
+urls ;
 IN: webapps.help
 
 TUPLE: help-webapp < dispatcher ;
@@ -21,6 +22,9 @@ TUPLE: help-webapp < dispatcher ;
 : ?links ( has-links? apropos -- has-links? seq/f )
     links [ f ] [ nip t swap ] if-empty ;
 
+: ?tokenize ( str -- str' )
+    [ tokenize ] [ drop 1array ] recover ;
+
 :: <search-action> ( help-dir -- action )
     <page-action>
         { help-webapp "search" } >>template
@@ -28,12 +32,13 @@ TUPLE: help-webapp < dispatcher ;
             f "search" param [ unicode:blank? ] trim
             dup "search" set-value [
                 help-dir [
+                    ?tokenize concat
                     [ article-apropos ?links "articles" set-value ]
                     [ word-apropos ?links "words" set-value ]
                     [ vocab-apropos ?links "vocabs" set-value ] tri
                 ] with-directory
             ] unless-empty not "empty" set-value
-            help-navbar "navbar" set-value
+            help-nav "nav" set-value
 
             { help-webapp "search" } <chloe-content>
         ] >>display