2006-03-24 13:19:14 -05:00
|
|
|
! Copyright (C) 2005, 2006 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2005-12-01 00:53:12 -05:00
|
|
|
IN: help
|
2006-06-17 01:03:56 -04:00
|
|
|
USING: arrays io kernel namespaces prettyprint sequences words ;
|
|
|
|
|
|
|
|
M: word article-title
|
|
|
|
dup word-name swap stack-effect [ " " swap append3 ] when* ;
|
|
|
|
|
|
|
|
M: word article-content
|
|
|
|
[
|
2006-06-17 01:18:46 -04:00
|
|
|
\ $vocabulary over 2array ,
|
2006-06-17 01:03:56 -04:00
|
|
|
dup "help" word-prop [
|
|
|
|
%
|
|
|
|
] [
|
|
|
|
"predicating" word-prop [
|
|
|
|
\ $predicate swap 2array ,
|
|
|
|
] when*
|
|
|
|
] ?if
|
|
|
|
] { } make ;
|
2006-06-16 23:12:40 -04:00
|
|
|
|
|
|
|
: with-default-style ( quot -- )
|
2006-06-17 15:59:44 -04:00
|
|
|
default-style [
|
|
|
|
H{ } [ last-block on call ] with-nesting
|
2006-06-16 23:12:40 -04:00
|
|
|
] with-style ; inline
|
|
|
|
|
2006-06-17 01:03:56 -04:00
|
|
|
: print-title ( article -- )
|
|
|
|
[ dup article-title $title $where ] with-default-style
|
|
|
|
terpri ;
|
|
|
|
|
2006-06-16 23:12:40 -04:00
|
|
|
: print-content ( element -- )
|
|
|
|
[ print-element ] with-default-style ;
|
|
|
|
|
|
|
|
: (help) ( topic -- ) article-content print-content terpri ;
|
2005-12-01 00:53:12 -05:00
|
|
|
|
2006-06-16 23:12:40 -04:00
|
|
|
: help ( topic -- ) dup print-title (help) ;
|
2005-12-28 20:25:17 -05:00
|
|
|
|
2006-06-17 01:03:56 -04:00
|
|
|
: see-help ( word -- )
|
|
|
|
dup help [ $definition terpri ] with-default-style ;
|
|
|
|
|
2006-01-19 03:28:10 -05:00
|
|
|
: handbook ( -- ) "handbook" help ;
|
2006-06-17 01:03:56 -04:00
|
|
|
|
|
|
|
: $subtopic ( object -- )
|
|
|
|
[
|
|
|
|
subtopic-style [
|
|
|
|
unclip f rot [ print-content ] curry write-outliner
|
|
|
|
] with-style
|
|
|
|
] ($block) ;
|
|
|
|
|
|
|
|
: $subsection ( object -- )
|
|
|
|
[ first [ (help) ] swap ($subsection) ] ($block) ;
|
|
|
|
|
|
|
|
: $outliner ( content -- )
|
|
|
|
first call [ (help) ] help-outliner ;
|