Merge branch 'ui' of git://github.com/klazuka/factor
commit
54de7f09f6
|
@ -1,4 +1,5 @@
|
||||||
! Factor UI theme colors
|
! Factor UI theme colors
|
||||||
|
243 242 234 FactorLightLightTan
|
||||||
227 226 219 FactorLightTan
|
227 226 219 FactorLightTan
|
||||||
172 167 147 FactorDarkTan
|
172 167 147 FactorDarkTan
|
||||||
81 91 105 FactorLightSlateBlue
|
81 91 105 FactorLightSlateBlue
|
||||||
|
|
|
@ -99,19 +99,26 @@ M: word set-article-parent swap "help-parent" set-word-prop ;
|
||||||
: $navigation-row ( content element label -- )
|
: $navigation-row ( content element label -- )
|
||||||
[ prefix 1array ] dip prefix , ;
|
[ prefix 1array ] dip prefix , ;
|
||||||
|
|
||||||
|
: ($navigation-table) ( element -- )
|
||||||
|
help-path-style get table-style set [ $table ] with-scope ;
|
||||||
|
|
||||||
: $navigation-table ( topic -- )
|
: $navigation-table ( topic -- )
|
||||||
[
|
[
|
||||||
[ help-path [ \ $links "Up:" $navigation-row ] unless-empty ]
|
|
||||||
[ prev-article [ 1array \ $long-link "Prev:" $navigation-row ] when* ]
|
[ prev-article [ 1array \ $long-link "Prev:" $navigation-row ] when* ]
|
||||||
[ next-article [ 1array \ $long-link "Next:" $navigation-row ] when* ]
|
[ next-article [ 1array \ $long-link "Next:" $navigation-row ] when* ]
|
||||||
tri
|
bi
|
||||||
] { } make [ $table ] unless-empty ;
|
] { } make [ ($navigation-table) ] unless-empty ;
|
||||||
|
|
||||||
|
: ($navigation) ( topic -- )
|
||||||
|
help-path-style get [
|
||||||
|
[ help-path [ reverse $breadcrumbs ] unless-empty ]
|
||||||
|
[ $navigation-table ] bi
|
||||||
|
] with-style ;
|
||||||
|
|
||||||
: $title ( topic -- )
|
: $title ( topic -- )
|
||||||
title-style get [
|
title-style get [
|
||||||
title-style get [
|
title-style get [
|
||||||
[ ($title) ]
|
[ ($title) ] [ ($navigation) ] bi
|
||||||
[ help-path-style get [ $navigation-table ] with-style ] bi
|
|
||||||
] with-nesting
|
] with-nesting
|
||||||
] with-style nl ;
|
] with-style nl ;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
a:link { text-decoration: none; color: #00004c; }
|
a:link { text-decoration: none; color: #104e8b; }
|
||||||
a:visited { text-decoration: none; color: #00004c; }
|
a:visited { text-decoration: none; color: #104e8b; }
|
||||||
a:active { text-decoration: none; color: #00004c; }
|
a:active { text-decoration: none; color: #104e8b; }
|
||||||
a:hover { text-decoration: underline; color: #00004c; }
|
a:hover { text-decoration: underline; color: #104e8b; }
|
||||||
|
|
|
@ -205,8 +205,11 @@ ALIAS: $slot $snippet
|
||||||
"Vocabulary" $heading nl dup ($vocab-link)
|
"Vocabulary" $heading nl dup ($vocab-link)
|
||||||
] when* ;
|
] when* ;
|
||||||
|
|
||||||
|
: (textual-list) ( seq quot sep -- )
|
||||||
|
'[ _ print-element ] swap interleave ; inline
|
||||||
|
|
||||||
: textual-list ( seq quot -- )
|
: textual-list ( seq quot -- )
|
||||||
[ ", " print-element ] swap interleave ; inline
|
", " (textual-list) ; inline
|
||||||
|
|
||||||
: $links ( topics -- )
|
: $links ( topics -- )
|
||||||
[ [ ($link) ] textual-list ] ($span) ;
|
[ [ ($link) ] textual-list ] ($span) ;
|
||||||
|
@ -214,6 +217,9 @@ ALIAS: $slot $snippet
|
||||||
: $vocab-links ( vocabs -- )
|
: $vocab-links ( vocabs -- )
|
||||||
[ vocab ] map $links ;
|
[ vocab ] map $links ;
|
||||||
|
|
||||||
|
: $breadcrumbs ( topics -- )
|
||||||
|
[ [ ($link) ] " > " (textual-list) ] ($span) ;
|
||||||
|
|
||||||
: $see-also ( topics -- )
|
: $see-also ( topics -- )
|
||||||
"See also" $heading $links ;
|
"See also" $heading $links ;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
! Copyright (C) 2005, 2009 Slava Pestov.
|
! Copyright (C) 2005, 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: io.styles namespaces colors colors.constants ;
|
USING: colors colors.constants io.styles literals namespaces ;
|
||||||
IN: help.stylesheet
|
IN: help.stylesheet
|
||||||
|
|
||||||
SYMBOL: default-span-style
|
SYMBOL: default-span-style
|
||||||
|
@ -30,22 +30,27 @@ H{ { font-style bold } } strong-style set-global
|
||||||
SYMBOL: title-style
|
SYMBOL: title-style
|
||||||
H{
|
H{
|
||||||
{ font-name "sans-serif" }
|
{ font-name "sans-serif" }
|
||||||
{ font-size 18 }
|
{ font-size 20 }
|
||||||
{ font-style bold }
|
{ font-style bold }
|
||||||
{ wrap-margin 500 }
|
{ wrap-margin 500 }
|
||||||
{ foreground COLOR: FactorDarkSlateBlue }
|
{ foreground COLOR: gray20 }
|
||||||
{ page-color COLOR: FactorLightTan }
|
{ page-color COLOR: FactorLightLightTan }
|
||||||
{ border-width 5 }
|
{ inset { 5 5 } }
|
||||||
} title-style set-global
|
} title-style set-global
|
||||||
|
|
||||||
SYMBOL: help-path-style
|
SYMBOL: help-path-style
|
||||||
H{ { font-size 10 } } help-path-style set-global
|
H{
|
||||||
|
{ font-size 10 }
|
||||||
|
{ table-gap { 5 5 } }
|
||||||
|
{ table-border $ transparent }
|
||||||
|
} help-path-style set-global
|
||||||
|
|
||||||
SYMBOL: heading-style
|
SYMBOL: heading-style
|
||||||
H{
|
H{
|
||||||
{ font-name "sans-serif" }
|
{ font-name "sans-serif" }
|
||||||
{ font-size 16 }
|
{ font-size 16 }
|
||||||
{ font-style bold }
|
{ font-style bold }
|
||||||
|
{ foreground COLOR: FactorDarkSlateBlue }
|
||||||
} heading-style set-global
|
} heading-style set-global
|
||||||
|
|
||||||
SYMBOL: subsection-style
|
SYMBOL: subsection-style
|
||||||
|
@ -70,8 +75,8 @@ H{
|
||||||
|
|
||||||
SYMBOL: code-style
|
SYMBOL: code-style
|
||||||
H{
|
H{
|
||||||
{ page-color COLOR: FactorLightTan }
|
{ page-color COLOR: FactorLightLightTan }
|
||||||
{ border-width 5 }
|
{ inset { 5 5 } }
|
||||||
{ wrap-margin f }
|
{ wrap-margin f }
|
||||||
} code-style set-global
|
} code-style set-global
|
||||||
|
|
||||||
|
@ -88,7 +93,7 @@ SYMBOL: warning-style
|
||||||
H{
|
H{
|
||||||
{ page-color COLOR: gray90 }
|
{ page-color COLOR: gray90 }
|
||||||
{ border-color COLOR: red }
|
{ border-color COLOR: red }
|
||||||
{ border-width 5 }
|
{ inset { 5 5 } }
|
||||||
{ wrap-margin 500 }
|
{ wrap-margin 500 }
|
||||||
} warning-style set-global
|
} warning-style set-global
|
||||||
|
|
||||||
|
@ -96,7 +101,7 @@ SYMBOL: deprecated-style
|
||||||
H{
|
H{
|
||||||
{ page-color COLOR: gray90 }
|
{ page-color COLOR: gray90 }
|
||||||
{ border-color COLOR: red }
|
{ border-color COLOR: red }
|
||||||
{ border-width 5 }
|
{ inset { 5 5 } }
|
||||||
{ wrap-margin 500 }
|
{ wrap-margin 500 }
|
||||||
} deprecated-style set-global
|
} deprecated-style set-global
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ SYMBOL: tip-of-the-day-style
|
||||||
|
|
||||||
H{
|
H{
|
||||||
{ page-color COLOR: lavender }
|
{ page-color COLOR: lavender }
|
||||||
{ border-width 5 }
|
{ inset { 5 5 } }
|
||||||
{ wrap-margin 500 }
|
{ wrap-margin 500 }
|
||||||
} tip-of-the-day-style set-global
|
} tip-of-the-day-style set-global
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,8 @@ M: html-span-stream dispose
|
||||||
: border-css, ( border -- )
|
: border-css, ( border -- )
|
||||||
"border: 1px solid #" % hex-color, "; " % ;
|
"border: 1px solid #" % hex-color, "; " % ;
|
||||||
|
|
||||||
: padding-css, ( padding -- ) "padding: " % # "px; " % ;
|
: padding-css, ( padding -- )
|
||||||
|
first2 "padding: " % # "px " % # "px; " % ;
|
||||||
|
|
||||||
CONSTANT: pre-css "white-space: pre; font-family: monospace;"
|
CONSTANT: pre-css "white-space: pre; font-family: monospace;"
|
||||||
|
|
||||||
|
@ -108,7 +109,7 @@ CONSTANT: pre-css "white-space: pre; font-family: monospace;"
|
||||||
{
|
{
|
||||||
{ page-color bg-css, }
|
{ page-color bg-css, }
|
||||||
{ border-color border-css, }
|
{ border-color border-css, }
|
||||||
{ border-width padding-css, }
|
{ inset padding-css, }
|
||||||
} make-css
|
} make-css
|
||||||
] [
|
] [
|
||||||
wrap-margin swap at
|
wrap-margin swap at
|
||||||
|
|
|
@ -133,7 +133,7 @@ ARTICLE: "paragraph-styles" "Paragraph styles"
|
||||||
"Paragraph styles for " { $link with-nesting } ":"
|
"Paragraph styles for " { $link with-nesting } ":"
|
||||||
{ $subsection page-color }
|
{ $subsection page-color }
|
||||||
{ $subsection border-color }
|
{ $subsection border-color }
|
||||||
{ $subsection border-width }
|
{ $subsection inset }
|
||||||
{ $subsection wrap-margin }
|
{ $subsection wrap-margin }
|
||||||
{ $subsection presented } ;
|
{ $subsection presented } ;
|
||||||
|
|
||||||
|
@ -243,10 +243,10 @@ HELP: border-color
|
||||||
{ $code "H{ { border-color T{ rgba f 1 0 0 1 } } }\n[ \"A border\" write ] with-nesting nl" }
|
{ $code "H{ { border-color T{ rgba f 1 0 0 1 } } }\n[ \"A border\" write ] with-nesting nl" }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
HELP: border-width
|
HELP: inset
|
||||||
{ $description "Paragraph style. Pixels between edge of text and border, an integer." }
|
{ $description "Paragraph style. A pair of integers representing the number of pixels that the content should be inset from the border. The first number is the horizontal inset, and the second is the vertical inset." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $code "H{ { border-width 10 } }\n[ \"Some inset text\" write ] with-nesting nl" }
|
{ $code "H{ { inset { 10 10 } } }\n[ \"Some inset text\" write ] with-nesting nl" }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
HELP: wrap-margin
|
HELP: wrap-margin
|
||||||
|
|
|
@ -132,7 +132,7 @@ SYMBOL: image
|
||||||
! Paragraph styles
|
! Paragraph styles
|
||||||
SYMBOL: page-color
|
SYMBOL: page-color
|
||||||
SYMBOL: border-color
|
SYMBOL: border-color
|
||||||
SYMBOL: border-width
|
SYMBOL: inset
|
||||||
SYMBOL: wrap-margin
|
SYMBOL: wrap-margin
|
||||||
|
|
||||||
! Table styles
|
! Table styles
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
! Copyright (C) 2009 Your name.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: help.markup help.syntax kernel words ;
|
||||||
|
IN: prettyprint.stylesheet
|
||||||
|
|
||||||
|
HELP: effect-style
|
||||||
|
{ $values
|
||||||
|
{ "effect" "an effect" }
|
||||||
|
{ "style" "a style assoc" }
|
||||||
|
}
|
||||||
|
{ $description "The styling hook for stack effects" } ;
|
||||||
|
|
||||||
|
HELP: string-style
|
||||||
|
{ $values
|
||||||
|
{ "str" "a string" }
|
||||||
|
{ "style" "a style assoc" }
|
||||||
|
}
|
||||||
|
{ $description "The styling hook for string literals" } ;
|
||||||
|
|
||||||
|
HELP: vocab-style
|
||||||
|
{ $values
|
||||||
|
{ "vocab" "a vocabulary specifier" }
|
||||||
|
{ "style" "a style assoc" }
|
||||||
|
}
|
||||||
|
{ $description "The styling hook for vocab names" } ;
|
||||||
|
|
||||||
|
HELP: word-style
|
||||||
|
{ $values
|
||||||
|
{ "word" "a word" }
|
||||||
|
{ "style" "a style assoc" }
|
||||||
|
}
|
||||||
|
{ $description "The styling hook for word names" } ;
|
||||||
|
|
||||||
|
ARTICLE: "prettyprint.stylesheet" "Prettyprinter Formatted Output"
|
||||||
|
{ $vocab-link "prettyprint.stylesheet" }
|
||||||
|
$nl
|
||||||
|
"Control the way that the prettyprinter formats output based on object type. These hooks form a basic \"syntax\" highlighting system."
|
||||||
|
{ $subsection word-style }
|
||||||
|
{ $subsection string-style }
|
||||||
|
{ $subsection vocab-style }
|
||||||
|
{ $subsection effect-style }
|
||||||
|
;
|
||||||
|
|
||||||
|
ABOUT: "prettyprint.stylesheet"
|
|
@ -1,34 +1,46 @@
|
||||||
! Copyright (C) 2009 Your name.
|
! Copyright (C) 2009 Keith Lazuka.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: colors.constants hashtables io.styles kernel namespaces
|
USING: assocs colors.constants combinators
|
||||||
words words.symbol ;
|
combinators.short-circuit hashtables io.styles kernel literals
|
||||||
|
namespaces sequences words words.symbol ;
|
||||||
IN: prettyprint.stylesheet
|
IN: prettyprint.stylesheet
|
||||||
|
|
||||||
: word-style ( word -- style )
|
<PRIVATE
|
||||||
dup "word-style" word-prop >hashtable [
|
|
||||||
[
|
|
||||||
[ presented set ] [
|
|
||||||
[ parsing-word? ] [ delimiter? ] [ symbol? ] tri
|
|
||||||
or or [ COLOR: DarkSlateGray ] [ COLOR: black ] if
|
|
||||||
foreground set
|
|
||||||
] bi
|
|
||||||
] bind
|
|
||||||
] keep ;
|
|
||||||
|
|
||||||
: string-style ( obj -- style )
|
CONSTANT: dim-color COLOR: gray35
|
||||||
[
|
|
||||||
presented set
|
{ POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
|
||||||
COLOR: LightSalmon4 foreground set
|
[
|
||||||
] H{ } make-assoc ;
|
{ { foreground $ dim-color } }
|
||||||
|
"word-style" set-word-prop
|
||||||
|
] each
|
||||||
|
|
||||||
|
PREDICATE: highlighted-word < word [ parsing-word? ] [ delimiter? ] bi or ;
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
|
GENERIC: word-style ( word -- style )
|
||||||
|
|
||||||
|
M: word word-style
|
||||||
|
[ presented associate ]
|
||||||
|
[ "word-style" word-prop >hashtable ] bi assoc-union ;
|
||||||
|
|
||||||
|
M: highlighted-word word-style
|
||||||
|
call-next-method COLOR: DarkSlateGray foreground associate
|
||||||
|
swap assoc-union ;
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
|
: colored-presentation-style ( obj color -- style )
|
||||||
|
[ presented associate ] [ foreground associate ] bi* assoc-union ;
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
|
: string-style ( str -- style )
|
||||||
|
COLOR: LightSalmon4 colored-presentation-style ;
|
||||||
|
|
||||||
: vocab-style ( vocab -- style )
|
: vocab-style ( vocab -- style )
|
||||||
[
|
dim-color colored-presentation-style ;
|
||||||
presented set
|
|
||||||
COLOR: cornsilk4 foreground set
|
|
||||||
] H{ } make-assoc ;
|
|
||||||
|
|
||||||
: effect-style ( effect -- style )
|
: effect-style ( effect -- style )
|
||||||
[
|
COLOR: DarkGreen colored-presentation-style ;
|
||||||
presented set
|
|
||||||
COLOR: DarkGreen foreground set
|
|
||||||
] H{ } make-assoc ;
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
prettyprinter syntax highlighting and formatted output
|
|
@ -242,11 +242,11 @@ MEMO: specified-font ( assoc -- font )
|
||||||
: apply-page-color-style ( style gadget -- style gadget )
|
: apply-page-color-style ( style gadget -- style gadget )
|
||||||
page-color [ <solid> >>interior ] apply-style ;
|
page-color [ <solid> >>interior ] apply-style ;
|
||||||
|
|
||||||
: apply-border-width-style ( style gadget -- style gadget )
|
: apply-inset-style ( style gadget -- style gadget )
|
||||||
border-width [ dup 2array <border> ] apply-style ;
|
inset [ <border> ] apply-style ;
|
||||||
|
|
||||||
: style-pane ( style pane -- pane )
|
: style-pane ( style pane -- pane )
|
||||||
apply-border-width-style
|
apply-inset-style
|
||||||
apply-border-color-style
|
apply-border-color-style
|
||||||
apply-page-color-style
|
apply-page-color-style
|
||||||
apply-presentation-style
|
apply-presentation-style
|
||||||
|
|
|
@ -4,6 +4,7 @@ USING: accessors arrays assocs colors colors.constants fry io
|
||||||
io.styles kernel make math.order namespaces parser
|
io.styles kernel make math.order namespaces parser
|
||||||
prettyprint.backend prettyprint.sections prettyprint.stylesheet
|
prettyprint.backend prettyprint.sections prettyprint.stylesheet
|
||||||
sequences sets sorting vocabs vocabs.parser ;
|
sequences sets sorting vocabs vocabs.parser ;
|
||||||
|
FROM: io.styles => inset ;
|
||||||
IN: vocabs.prettyprint
|
IN: vocabs.prettyprint
|
||||||
|
|
||||||
: pprint-vocab ( vocab -- )
|
: pprint-vocab ( vocab -- )
|
||||||
|
@ -86,7 +87,10 @@ PRIVATE>
|
||||||
"To avoid doing this in the future, add the following forms" print
|
"To avoid doing this in the future, add the following forms" print
|
||||||
"at the top of the source file:" print nl
|
"at the top of the source file:" print nl
|
||||||
] with-style
|
] with-style
|
||||||
{ { page-color COLOR: FactorLightTan } }
|
{
|
||||||
[ manifest get pprint-manifest ] with-nesting
|
{ page-color COLOR: FactorLightLightTan }
|
||||||
|
{ border-color COLOR: FactorDarkTan }
|
||||||
|
{ inset { 5 5 } }
|
||||||
|
} [ manifest get pprint-manifest ] with-nesting
|
||||||
nl nl
|
nl nl
|
||||||
] print-use-hook set-global
|
] print-use-hook set-global
|
Loading…
Reference in New Issue