tested and fixed
parent
1d4cf649bf
commit
e91bd1a3ac
|
@ -62,4 +62,13 @@ TUPLE: term entry ;
|
||||||
|
|
||||||
M: term article-title term-entry ;
|
M: term article-title term-entry ;
|
||||||
|
|
||||||
M: term article-content terms get hash ;
|
M: term article-content
|
||||||
|
term-entry terms get hash
|
||||||
|
[ "No such glossary entry" ] unless* ;
|
||||||
|
|
||||||
|
: add-term ( term element -- ) swap terms get set-hash ;
|
||||||
|
|
||||||
|
! Missing topics
|
||||||
|
M: f article-title drop "No such topic" ;
|
||||||
|
|
||||||
|
M: f article-content drop "No such topic" ;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
IN: help
|
IN: help
|
||||||
USING: arrays gadgets-presentations io kernel namespaces parser
|
USING: arrays gadgets-presentations hashtables io kernel
|
||||||
sequences words ;
|
namespaces parser sequences words ;
|
||||||
|
|
||||||
: help ( topic -- )
|
: help ( topic -- )
|
||||||
[
|
[
|
||||||
|
@ -8,22 +8,20 @@ sequences words ;
|
||||||
article-content print-element terpri
|
article-content print-element terpri
|
||||||
] with-markup ;
|
] with-markup ;
|
||||||
|
|
||||||
: glossary ( name -- )
|
: glossary ( name -- ) <term> help ;
|
||||||
<term> help ;
|
|
||||||
|
|
||||||
: HELP:
|
: HELP:
|
||||||
scan-word
|
scan-word [ >array "help" set-word-prop ] [ ] ; parsing
|
||||||
[ >array reverse "help" set-word-prop ] ; parsing
|
|
||||||
|
|
||||||
: ARTICLE:
|
: ARTICLE:
|
||||||
[
|
[ >array [ first2 2 ] keep tail add-article ] [ ] ; parsing
|
||||||
>array reverse [ first2 2 ] keep
|
|
||||||
tail add-article
|
: GLOSSARY:
|
||||||
] ; parsing
|
[ >array [ first 1 ] keep tail add-term ] [ ] ; parsing
|
||||||
|
|
||||||
[ word? ] "Show word documentation" [ help ] define-command
|
[ word? ] "Show word documentation" [ help ] define-command
|
||||||
[ term? ] "Show term definition" [ help ] define-command
|
[ term? ] "Show term definition" [ help ] define-command
|
||||||
[ link? ] "Show article" [ help ] define-command
|
[ link? ] "Show article" [ help ] define-command
|
||||||
|
|
||||||
H{ } clone articles set
|
H{ } clone articles global set-hash
|
||||||
H{ } clone terms set
|
H{ } clone terms global set-hash
|
||||||
|
|
Loading…
Reference in New Issue