diff --git a/basis/help/help.factor b/basis/help/help.factor index 75c2d7965c..91615449b3 100644 --- a/basis/help/help.factor +++ b/basis/help/help.factor @@ -1,11 +1,10 @@ ! Copyright (C) 2005, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays assocs classes classes.error -classes.tuple combinators combinators.short-circuit -continuations debugger effects generic help.crossref help.markup -help.stylesheet help.topics io io.styles kernel locals make -namespaces prettyprint sequences sets sorting vocabs words -words.symbol ; +USING: accessors arrays assocs classes classes.error combinators +combinators.short-circuit continuations debugger effects fry +generic help.crossref help.markup help.stylesheet help.topics io +io.styles kernel make namespaces prettyprint sequences sets +sorting vocabs words words.symbol ; IN: help GENERIC: word-help* ( word -- content ) @@ -184,5 +183,22 @@ help-hook [ [ print-topic ] ] initialize : remove-word-help ( word -- ) f "help" set-word-prop ; +> ] [ 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 -- ) + inputs-and-outputs [ swap "help" set-word-prop ] keep xref-article ; diff --git a/basis/help/markup/markup.factor b/basis/help/markup/markup.factor index fc1a17ce64..f8d5d0a709 100644 --- a/basis/help/markup/markup.factor +++ b/basis/help/markup/markup.factor @@ -393,6 +393,16 @@ M: f ($instance) ($link) ; unclip \ $snippet swap present 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 -- ) "Inputs and outputs" $heading [ values-row ] map $table ;