: $title ( topic -- )
title-style get [
- [ ($title) ] [ ($navigation) ] bi
- ] with-nested-style nl ;
+ title-style get [
+ [ ($title) ] [ ($navigation) ] bi
+ ] with-nesting
+ ] with-style nl ;
: print-topic ( topic -- )
>link
{ $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>> ;