diff --git a/basis/help/help-docs.factor b/basis/help/help-docs.factor index 4a06235c69..a699747048 100644 --- a/basis/help/help-docs.factor +++ b/basis/help/help-docs.factor @@ -327,7 +327,7 @@ HELP: $table HELP: $values { $values { "element" "an array of pairs of markup elements" } } -{ $description "Prints the description of arguments and values found on every word help page. The first element of a pair is the argument name and is output with " { $link $snippet } ". The remainder is either a single class word, or an element. If it is a class word " { $snippet "class" } ", it is intereted as if it were shorthand for " { $snippet "{ $instance class }" } "." } +{ $description "Prints the description of arguments and values found on every word help page. The first element of a pair is the argument name and is output with " { $link $snippet } ". The remainder is either a single class word, or an element. If it is a class word " { $snippet "class" } ", it is inserted as if it were shorthand for " { $snippet "{ $instance class }" } "." } { $see-also $maybe $instance $quotation } ; HELP: $instance diff --git a/extra/easy-help/easy-help.factor b/extra/easy-help/easy-help.factor index 824a638fd4..151e66380d 100644 --- a/extra/easy-help/easy-help.factor +++ b/extra/easy-help/easy-help.factor @@ -8,47 +8,62 @@ IN: easy-help ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: Description: - +: parse-text-block ( -- array ) + ".." parse-multiline-string string-lines 1 tail - [ dup " " head? [ 4 tail ] [ ] if ] map - [ dup "" = [ drop { $nl } ] [ ] if ] map - \ $description prefix + [ dup " " head? [ 4 tail ] [ ] if ] map + [ expand-markup ] map + concat + [ dup "" = [ drop { $nl } ] [ ] if ] map ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: Text: parse-text-block parsed ; parsing + +: Block: scan-word 1array parse-text-block append parsed ; parsing + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: Notes: { $notes } parse-text-block append parsed ; parsing +: Description: { $description } parse-text-block append parsed ; parsing +: Contract: { $contract } parse-text-block append parsed ; parsing +: Checked-Example: { $example } parse-text-block append parsed ; parsing + +: Class-Description: + { $class-description } parse-text-block append parsed ; parsing + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: Code: + + { $code } + parse-text-block [ dup array? [ drop "" ] [ ] if ] map + append parsed ; parsing -! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - : Example: + { $heading "Example" } + { $code } + parse-text-block + [ dup array? [ drop "" ] [ ] if ] map ! Each item in $code must be a string + append + 2array parsed ; parsing - { $heading "Example" } parsed +: Introduction: - ".." parse-multiline-string - string-lines - [ dup " " head? [ 4 tail ] [ ] if ] map - [ "" = not ] filter - ! \ $example prefix - \ $code prefix - parsed - - ; parsing - -! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + { $heading "Introduction" } + parse-text-block + 2array parsed ; parsing : Summary: - ".." parse-multiline-string - string-lines - 1 tail - [ dup " " head? [ 4 tail ] [ ] if ] map - [ dup "" = [ drop { $nl } ] [ ] if ] map - { $heading "Summary" } prefix - parsed - - ; parsing + { $heading "Summary" } + parse-text-block + 2array parsed ; parsing ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -57,7 +72,7 @@ IN: easy-help ".." parse-multiline-string string-lines 1 tail - [ dup " " head? [ 4 tail ] [ ] if ] map + [ dup " " head? [ 4 tail ] [ ] if ] map [ " " split1 [ " " first = ] trim-left 2array ] map \ $values prefix parsed @@ -77,35 +92,20 @@ IN: easy-help ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: Contract: +: Heading: { $heading } ".." parse-multiline-string suffix parsed ; parsing + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: List: + + { $list } ".." parse-multiline-string string-lines 1 tail - [ dup " " head? [ 4 tail ] [ ] if ] map + [ dup " " head? [ 4 tail ] [ ] if ] map [ expand-markup ] map - concat - [ dup "" = [ drop { $nl } ] [ ] if ] map - \ $contract prefix - parsed - + + append parsed + ; parsing - -! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -: Notes: - - ".." parse-multiline-string - string-lines - 1 tail - [ dup " " head? [ 4 tail ] [ ] if ] map - [ expand-markup ] map - concat - [ dup "" = [ drop { $nl } ] [ ] if ] map - \ $notes prefix - parsed - - ; parsing - -! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -