help.markup: word link stack effect is now clickable
parent
16cf080393
commit
bdd47b9991
|
@ -4,3 +4,4 @@
|
|||
172 167 147 FactorDarkTan
|
||||
81 91 105 FactorLightSlateBlue
|
||||
55 62 72 FactorDarkSlateBlue
|
||||
0 51 0 FactorDarkGreen
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2005, 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays assocs classes colors.constants
|
||||
USING: accessors arrays assocs classes colors colors.constants
|
||||
combinators definitions definitions.icons effects fry generic
|
||||
hashtables help.stylesheet help.topics io io.styles kernel make
|
||||
math namespaces parser present prettyprint
|
||||
|
@ -154,6 +154,9 @@ ALIAS: $slot $snippet
|
|||
1array \ $image prefix ;
|
||||
|
||||
! Some links
|
||||
|
||||
<PRIVATE
|
||||
|
||||
: write-link ( string object -- )
|
||||
link-style get [ write-object ] with-style ;
|
||||
|
||||
|
@ -163,38 +166,35 @@ ALIAS: $slot $snippet
|
|||
: link-text ( topic -- )
|
||||
[ article-name ] keep write-link ;
|
||||
|
||||
: link-effect ( topic -- )
|
||||
dup word? [
|
||||
stack-effect [ effect>string ] [ effect-style ] bi
|
||||
[ write ] with-style
|
||||
] [ drop ] if ;
|
||||
GENERIC: link-long-text ( topic -- )
|
||||
|
||||
: inter-cleave ( x seq between -- )
|
||||
[ [ call( x -- ) ] with ] dip swap interleave ; inline
|
||||
M: topic link-long-text
|
||||
[ article-title ] keep write-link ;
|
||||
|
||||
: (($link)) ( topic words -- )
|
||||
[ dup topic? [ >link ] unless ] dip
|
||||
[ [ bl ] inter-cleave ] ($span) ; inline
|
||||
M: word link-long-text
|
||||
dup presented associate [
|
||||
[ article-name link-style get format ]
|
||||
[ drop bl ]
|
||||
[ stack-effect effect>string stack-effect-style get format ]
|
||||
tri
|
||||
] with-nesting ;
|
||||
|
||||
: ($link) ( topic -- )
|
||||
{ [ link-text ] } (($link)) ;
|
||||
: >topic ( obj -- topic ) dup topic? [ >link ] unless ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: ($link) ( topic -- ) >topic link-text ;
|
||||
: $link ( element -- ) first ($link) ;
|
||||
|
||||
: ($long-link) ( topic -- )
|
||||
{ [ link-text ] [ link-effect ] } (($link)) ;
|
||||
|
||||
: ($long-link) ( topic -- ) >topic link-long-text ;
|
||||
: $long-link ( element -- ) first ($long-link) ;
|
||||
|
||||
: ($pretty-link) ( topic -- )
|
||||
{ [ link-icon ] [ link-text ] } (($link)) ;
|
||||
|
||||
>topic [ link-icon ] [ drop bl ] [ link-text ] tri ;
|
||||
: $pretty-link ( element -- ) first ($pretty-link) ;
|
||||
|
||||
: ($long-pretty-link) ( topic -- )
|
||||
{ [ link-icon ] [ link-text ] [ link-effect ] } (($link)) ;
|
||||
|
||||
: $long-pretty-link ( element -- ) first ($long-pretty-link) ;
|
||||
>topic [ link-icon ] [ drop bl ] [ link-long-text ] tri ;
|
||||
|
||||
: <$pretty-link> ( definition -- element )
|
||||
1array \ $pretty-link prefix ;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
! Copyright (C) 2005, 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: hashtables io io.streams.plain io.streams.string
|
||||
colors summary make accessors splitting math.order
|
||||
kernel namespaces assocs destructors strings sequences
|
||||
present fry strings.tables delegate delegate.protocols ;
|
||||
USING: accessors assocs colors colors.constants delegate
|
||||
delegate.protocols destructors fry hashtables io
|
||||
io.streams.plain io.streams.string kernel make math.order
|
||||
namespaces present sequences splitting strings strings.tables
|
||||
summary ;
|
||||
IN: io.styles
|
||||
|
||||
GENERIC: stream-format ( str style stream -- )
|
||||
|
@ -162,3 +163,9 @@ M: input summary
|
|||
: write-object ( str obj -- ) presented associate format ;
|
||||
|
||||
: write-image ( image -- ) [ "" ] dip image associate format ;
|
||||
|
||||
SYMBOL: stack-effect-style
|
||||
H{
|
||||
{ foreground COLOR: FactorDarkGreen }
|
||||
{ font-style plain }
|
||||
} stack-effect-style set-global
|
||||
|
|
|
@ -43,5 +43,4 @@ PRIVATE>
|
|||
dim-color colored-presentation-style ;
|
||||
|
||||
: effect-style ( effect -- style )
|
||||
0 0.2 0 1 <rgba> colored-presentation-style
|
||||
{ { font-style plain } } assoc-union ;
|
||||
presented associate stack-effect-style get assoc-union ;
|
||||
|
|
Loading…
Reference in New Issue