2 USING: arrays assocs compiler.units
3 grouping help help.markup help.topics kernel lexer multiline
4 namespaces parser sequences splitting words
5 easy-help.expand-markup ;
9 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11 : parse-text-block ( -- array )
13 ".." parse-multiline-string
16 [ dup " " head? [ 4 tail ] [ ] if ] map
19 [ dup "" = [ drop { $nl } ] [ ] if ] map ;
21 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
23 : Text: parse-text-block parsed ; parsing
25 : Block: scan-word 1array parse-text-block append parsed ; parsing
27 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
29 : Notes: { $notes } parse-text-block append parsed ; parsing
30 : Description: { $description } parse-text-block append parsed ; parsing
31 : Contract: { $contract } parse-text-block append parsed ; parsing
32 : Checked-Example: { $example } parse-text-block append parsed ; parsing
35 { $class-description } parse-text-block append parsed ; parsing
37 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
42 parse-text-block [ dup array? [ drop "" ] [ ] if ] map
49 { $heading "Example" }
52 [ dup array? [ drop "" ] [ ] if ] map ! Each item in $code must be a string
54 2array parsed ; parsing
58 { $heading "Introduction" }
60 2array parsed ; parsing
64 { $heading "Summary" }
66 2array parsed ; parsing
68 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
72 ".." parse-multiline-string
75 [ dup " " head? [ 4 tail ] [ ] if ] map
76 [ " " split1 [ " " first = ] trim-left 2array ] map
82 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
86 scan current-vocab create dup old-definitions get
87 [ delete-at ] with each dup set-word
89 bootstrap-word dup set-word
90 dup >link save-location
91 \ ; parse-until >array swap set-word-help ; parsing
93 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
95 : Heading: { $heading } ".." parse-multiline-string suffix parsed ; parsing
97 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
103 ".." parse-multiline-string
106 [ dup " " head? [ 4 tail ] [ ] if ] map
107 [ expand-markup ] map