help.markup: adding $sequence for describing sequence values.
parent
ed98332263
commit
b3ccdec660
|
@ -45,6 +45,7 @@ ARTICLE: "block-elements" "Block elements"
|
|||
$maybe
|
||||
$or
|
||||
$quotation
|
||||
$sequence
|
||||
}
|
||||
"Boilerplate paragraphs:"
|
||||
{ $subsections
|
||||
|
@ -409,6 +410,19 @@ HELP: $quotation
|
|||
{ $markup-example { $quotation ( obj -- ) } }
|
||||
} ;
|
||||
|
||||
HELP: $sequence
|
||||
{ $values { "element" "an array of element types" } }
|
||||
{ $description
|
||||
"Produces the text “a sequence of " { $emphasis "element types" } "”."
|
||||
}
|
||||
{ $examples
|
||||
{ $markup-example { $sequence number } }
|
||||
{ $markup-example { $sequence real complex } }
|
||||
{ $markup-example { $sequence rational float complex } }
|
||||
{ $markup-example { $sequence integer ratio float complex } }
|
||||
{ $markup-example { $sequence fixnum bignum ratio float complex } }
|
||||
} ;
|
||||
|
||||
HELP: $list
|
||||
{ $values { "element" "an array of markup elements" } }
|
||||
{ $description "Prints a bulleted list of markup elements." }
|
||||
|
|
|
@ -347,14 +347,11 @@ PRIVATE>
|
|||
|
||||
GENERIC: ($instance) ( element -- )
|
||||
|
||||
M: word ($instance)
|
||||
dup name>> a/an write bl ($link) ;
|
||||
M: word ($instance) dup name>> a/an write bl ($link) ;
|
||||
|
||||
M: string ($instance)
|
||||
write ;
|
||||
M: string ($instance) write ;
|
||||
|
||||
M: f ($instance)
|
||||
drop { f } $link ;
|
||||
M: f ($instance) ($link) ;
|
||||
|
||||
: $instance ( element -- ) first ($instance) ;
|
||||
|
||||
|
@ -379,6 +376,23 @@ M: f ($instance)
|
|||
{ "a " { $link quotation } " with stack effect " }
|
||||
print-element $snippet ;
|
||||
|
||||
: ($instances) ( element -- )
|
||||
dup word? [ ($link) "s" print-element ] [ print-element ] if ;
|
||||
|
||||
: $sequence ( element -- )
|
||||
{ "a " { $link sequence } " of " } print-element
|
||||
dup length {
|
||||
{ 1 [ first ($instances) ] }
|
||||
{ 2 [ first2 [ ($instances) " or " print-element ] [ ($instances) ] bi* ] }
|
||||
[
|
||||
drop
|
||||
unclip-last
|
||||
[ [ ($instances) ", " print-element ] each ]
|
||||
[ "or " print-element ($instances) ]
|
||||
bi*
|
||||
]
|
||||
} case ;
|
||||
|
||||
: values-row ( seq -- seq )
|
||||
unclip \ $snippet swap present 2array
|
||||
swap dup first word? [ \ $instance prefix ] when 2array ;
|
||||
|
|
Loading…
Reference in New Issue