help: splitting $values into $inputs and $outputs.
This is an automatic conversion, so we can keep writing docs the way we have been.master
parent
27215982e6
commit
eded28cc74
|
@ -1,11 +1,10 @@
|
||||||
! Copyright (C) 2005, 2010 Slava Pestov.
|
! Copyright (C) 2005, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays assocs classes classes.error
|
USING: accessors arrays assocs classes classes.error combinators
|
||||||
classes.tuple combinators combinators.short-circuit
|
combinators.short-circuit continuations debugger effects fry
|
||||||
continuations debugger effects generic help.crossref help.markup
|
generic help.crossref help.markup help.stylesheet help.topics io
|
||||||
help.stylesheet help.topics io io.styles kernel locals make
|
io.styles kernel make namespaces prettyprint sequences sets
|
||||||
namespaces prettyprint sequences sets sorting vocabs words
|
sorting vocabs words words.symbol ;
|
||||||
words.symbol ;
|
|
||||||
IN: help
|
IN: help
|
||||||
|
|
||||||
GENERIC: word-help* ( word -- content )
|
GENERIC: word-help* ( word -- content )
|
||||||
|
@ -184,5 +183,22 @@ help-hook [ [ print-topic ] ] initialize
|
||||||
: remove-word-help ( word -- )
|
: remove-word-help ( word -- )
|
||||||
f "help" set-word-prop ;
|
f "help" set-word-prop ;
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
|
: inputs-and-outputs ( content word -- content' word )
|
||||||
|
over [ dup array? [ { $values } head? ] [ drop f ] if ] find drop [
|
||||||
|
'[ _ cut unclip rest ] dip [
|
||||||
|
stack-effect [ in>> ] [ out>> ] bi
|
||||||
|
[ [ dup pair? [ first ] when ] map ] bi@
|
||||||
|
[ '[ ?first _ member? ] filter ] bi-curry@
|
||||||
|
\ $inputs \ $outputs
|
||||||
|
[ '[ @ _ prefix ] ] bi-curry@ bi* bi
|
||||||
|
2array glue
|
||||||
|
] keep
|
||||||
|
] when* ;
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
: set-word-help ( content word -- )
|
: set-word-help ( content word -- )
|
||||||
|
inputs-and-outputs
|
||||||
[ swap "help" set-word-prop ] keep xref-article ;
|
[ swap "help" set-word-prop ] keep xref-article ;
|
||||||
|
|
|
@ -393,6 +393,16 @@ M: f ($instance) ($link) ;
|
||||||
unclip \ $snippet swap present 2array
|
unclip \ $snippet swap present 2array
|
||||||
swap dup first word? [ \ $instance prefix ] when 2array ;
|
swap dup first word? [ \ $instance prefix ] when 2array ;
|
||||||
|
|
||||||
|
: $inputs ( element -- )
|
||||||
|
"Inputs" $heading
|
||||||
|
[ [ "None" write ] ($block) ]
|
||||||
|
[ [ values-row ] map $table ] if-empty ;
|
||||||
|
|
||||||
|
: $outputs ( element -- )
|
||||||
|
"Outputs" $heading
|
||||||
|
[ [ "None" write ] ($block) ]
|
||||||
|
[ [ values-row ] map $table ] if-empty ;
|
||||||
|
|
||||||
: $values ( element -- )
|
: $values ( element -- )
|
||||||
"Inputs and outputs" $heading
|
"Inputs and outputs" $heading
|
||||||
[ values-row ] map $table ;
|
[ values-row ] map $table ;
|
||||||
|
|
Loading…
Reference in New Issue