]> gitweb.factorcode.org Git - factor.git/blob - libs/furnace/tools/help.factor
15771d115c52e4da950e93ec4dc6caebb8aa4da5
[factor.git] / libs / furnace / tools / help.factor
1 ! Copyright (C) 2005, 2006 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 IN: furnace:help
4 USING: furnace help httpd html kernel sequences words strings
5 io ;
6
7 : show-help ( topic -- )
8     serving-html
9     dup article-title [
10         [ help ] with-html-stream
11     ] html-document ;
12
13 : string>topic ( string -- topic )
14     " " split dup length 1 = [ first ] when ;
15
16 \ show-help {
17     { "topic" "handbook" v-default string>topic }
18 } define-action
19
20 M: link browser-link-href
21     link-name [ \ f ] unless* dup word? [
22         browser-link-href
23     ] [
24         dup [ string? ] all? [ " " join ] when
25         [ show-help ] curry quot-link
26     ] if ;
27
28 "help" "show-help" "libs/furnace/tools" web-app