! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors db.sqlite furnace.actions furnace.alloy furnace.redirection help.html help.topics html.components html.forms html.templates.chloe http.server http.server.dispatchers http.server.static io.directories io.files io.files.temp kernel locals namespaces sequences unicode.categories urls ; IN: webapps.help TUPLE: help-webapp < dispatcher ; M: result link-title title>> ; M: result link-href href>> ; :: ( help-dir -- action ) { help-webapp "search" } >>template [ "search" param [ blank? ] trim [ help-dir [ [ article-apropos "articles" set-value ] [ word-apropos "words" set-value ] [ vocab-apropos "vocabs" set-value ] tri ] with-directory ] unless-empty help-navbar "navbar" set-value { help-webapp "search" } ] >>display ; : help-url ( topic -- url ) topic>filename "$help-webapp/content/" prepend >url ; : ( -- action ) [ "handbook" >link help-url ] >>display ; :: ( help-dir -- webapp ) help-webapp new-dispatcher "" add-responder help-dir "search" add-responder help-dir "content" add-responder "resource:basis/definitions/icons/" "icons" add-responder ; : run-help-webapp ( -- ) "docs" cache-file main-responder set-global 8080 httpd drop ; MAIN: run-help-webapp