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