Tweaked a few colors in the Factor UI.
: $navigation-table ( topic -- )
[
- [ help-path [ \ $links "Up:" $navigation-row ] unless-empty ]
[ prev-article [ 1array \ $long-link "Prev:" $navigation-row ] when* ]
[ next-article [ 1array \ $long-link "Next:" $navigation-row ] when* ]
- tri
+ bi
] { } make [ $table ] unless-empty ;
+: ($navigation) ( topic -- )
+ help-path-style get [
+ [ help-path [ reverse $breadcrumbs ] unless-empty ]
+ [ $navigation-table ] bi
+ ] with-style ;
+
: $title ( topic -- )
title-style get [
- title-style get [
- [ ($title) ]
- [ help-path-style get [ $navigation-table ] with-style ] bi
- ] with-nesting
- ] with-style nl ;
+ [ ($title) ] [ ($navigation) ] bi
+ ] with-nested-style nl ;
: print-topic ( topic -- )
>link
"Vocabulary" $heading nl dup ($vocab-link)
] when* ;
+: (textual-list) ( seq quot sep -- )
+ '[ _ print-element ] swap interleave ; inline
+
: textual-list ( seq quot -- )
- [ ", " print-element ] swap interleave ; inline
+ ", " (textual-list) ; inline
: $links ( topics -- )
[ [ ($link) ] textual-list ] ($span) ;
: $vocab-links ( vocabs -- )
[ vocab ] map $links ;
+: $breadcrumbs ( topics -- )
+ [ [ ($link) ] " > " (textual-list) ] ($span) ;
+
: $see-also ( topics -- )
"See also" $heading $links ;
SYMBOL: title-style
H{
{ font-name "sans-serif" }
- { font-size 18 }
+ { font-size 20 }
{ font-style bold }
{ wrap-margin 500 }
- { foreground COLOR: FactorDarkSlateBlue }
+ { foreground COLOR: gray20 }
{ page-color COLOR: FactorLightTan }
{ border-width 5 }
} title-style set-global
{ font-name "sans-serif" }
{ font-size 16 }
{ font-style bold }
+ { foreground COLOR: FactorDarkSlateBlue }
} heading-style set-global
SYMBOL: subsection-style
{ $notes "Details are in the documentation for " { $link make-span-stream } "." }
$io-error ;
+HELP: with-nested-style
+{ $values { "style" assoc } { "quot" quotation } }
+{ $description "Calls the quotation in a new dynamic scope where calls to " { $link write } ", " { $link format } " and other stream output words automatically inherit style settings from " { $snippet "style" } "." }
+$nl
+"This word is intended to be used when you have a single style assoc that contains both character and paragraph styles."
+$io-error ;
+
ARTICLE: "formatted-stream-protocol" "Formatted stream protocol"
"The " { $vocab-link "io.styles" } " vocabulary defines a protocol for output streams that support rich text."
{ $subsection stream-format }
[ output-stream get make-block-stream ] dip
with-output-stream ; inline
+: with-nested-style ( style quot -- )
+ over [ with-nesting ] with-style ; inline
+
TUPLE: filter-writer stream ;
CONSULT: output-stream-protocol filter-writer stream>> ;