factor/library/help/help.factor

28 lines
736 B
Factor
Raw Normal View History

2005-12-01 00:53:12 -05:00
IN: help
2005-12-01 01:09:52 -05:00
USING: arrays gadgets-presentations hashtables io kernel
namespaces parser sequences words ;
2005-12-01 00:53:12 -05:00
: help ( topic -- )
[
dup article-title $heading terpri terpri
article-content print-element terpri
] with-markup ;
2005-12-01 01:09:52 -05:00
: glossary ( name -- ) <term> help ;
2005-12-01 00:53:12 -05:00
: HELP:
2005-12-01 01:09:52 -05:00
scan-word [ >array "help" set-word-prop ] [ ] ; parsing
2005-12-01 00:53:12 -05:00
: ARTICLE:
2005-12-01 01:09:52 -05:00
[ >array [ first2 2 ] keep tail add-article ] [ ] ; parsing
: GLOSSARY:
[ >array [ first 1 ] keep tail add-term ] [ ] ; parsing
2005-12-01 00:53:12 -05:00
[ word? ] "Show word documentation" [ help ] define-command
[ term? ] "Show term definition" [ help ] define-command
[ link? ] "Show article" [ help ] define-command
2005-12-01 01:09:52 -05:00
H{ } clone articles global set-hash
H{ } clone terms global set-hash