diff --git a/library/help/help.factor b/library/help/help.factor index 37b1c6aae1..7aced538f3 100644 --- a/library/help/help.factor +++ b/library/help/help.factor @@ -26,8 +26,8 @@ M: word article-content ] { } make ; : $title ( topic -- ) - title-style [ - title-style [ + title-style get [ + title-style get [ dup [ 1array $link ] ($block) $doc-path ] with-nesting ] with-style terpri ; @@ -43,7 +43,7 @@ M: word article-content : $subtopic ( element -- ) [ - subtopic-style [ + subtopic-style get [ unclip f rot [ print-content ] curry write-outliner ] with-style ] ($block) ; @@ -55,11 +55,11 @@ M: word article-content : $subsection ( element -- ) [ - subsection-style [ first ($subsection) ] with-style + subsection-style get [ first ($subsection) ] with-style ] ($block) ; : help-outliner ( seq quot -- ) - subsection-style [ + subsection-style get [ sort-articles [ ($subsection) ] [ terpri ] interleave ] with-style ; diff --git a/library/help/markup.factor b/library/help/markup.factor index 139a12c782..4a37798ace 100644 --- a/library/help/markup.factor +++ b/library/help/markup.factor @@ -49,7 +49,7 @@ M: f print-element drop ; [ print-element ] with-style ; : with-default-style ( quot -- ) - default-style [ + default-style get [ last-element off H{ } swap with-nesting ] with-style ; inline @@ -66,13 +66,13 @@ M: f print-element drop ; ! Some spans -: $snippet [ snippet-style print-element* ] ($span) ; +: $snippet [ snippet-style get print-element* ] ($span) ; -: $emphasis [ emphasis-style print-element* ] ($span) ; +: $emphasis [ emphasis-style get print-element* ] ($span) ; -: $strong [ strong-style print-element* ] ($span) ; +: $strong [ strong-style get print-element* ] ($span) ; -: $url [ url-style print-element* ] ($span) ; +: $url [ url-style get print-element* ] ($span) ; : $terpri terpri terpri drop ; @@ -81,13 +81,13 @@ M: f print-element drop ; last-element get [ terpri ] when ($block) ; inline : $heading ( element -- ) - [ heading-style print-element* ] ($heading) ; + [ heading-style get print-element* ] ($heading) ; : ($code) ( presentation quot -- ) [ - code-style [ + code-style get [ last-element off - >r presented associate code-style hash-union r> + >r presented associate code-style get hash-union r> with-nesting ] with-style ] ($block) ; inline @@ -117,7 +117,7 @@ M: f print-element drop ; : $example ( element -- ) 1 swap cut* swap "\n" join dup [ - input-style format terpri print-element + input-style get format terpri print-element ] ($code) ; : $markup-example ( element -- ) @@ -126,7 +126,7 @@ M: f print-element drop ; : $warning ( element -- ) [ - warning-style [ + warning-style get [ last-element off "Warning" $heading print-element ] with-nesting @@ -136,7 +136,7 @@ M: f print-element drop ; : >link ( obj -- obj ) dup link? [ ] unless ; : ($link) ( article -- ) - link-style [ + link-style get [ dup article-title swap >link write-object ] with-style ; @@ -144,7 +144,7 @@ M: f print-element drop ; first ($link) ; : $vocab-link ( element -- ) - first link-style [ + first link-style get [ dup write-object ] with-style ; @@ -166,7 +166,7 @@ M: f print-element drop ; drop ] [ [ - doc-path-style [ + doc-path-style get [ "Parent topics: " write $links ] with-style ] ($block) @@ -174,16 +174,16 @@ M: f print-element drop ; : $grid ( content style -- ) [ - table-content-style [ + table-content-style get [ [ last-element off print-element ] tabular-output ] with-style ] ($block) table last-element set ; : $list ( element -- ) - [ "-" swap 2array ] map list-style $grid ; + [ "-" swap 2array ] map list-style get $grid ; : $table ( element -- ) - table-style $grid ; + table-style get $grid ; : $values ( element -- ) "Inputs and outputs" $heading @@ -209,8 +209,8 @@ M: f print-element drop ; : ($see) ( word -- ) [ - code-style [ - code-style [ see ] with-nesting + code-style get [ + code-style get [ see ] with-nesting ] with-style ] ($block) ; diff --git a/library/help/stylesheet.factor b/library/help/stylesheet.factor index 605248b15f..493ce81a1b 100644 --- a/library/help/stylesheet.factor +++ b/library/help/stylesheet.factor @@ -1,99 +1,102 @@ ! Copyright (C) 2005, 2006 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. IN: help -USING: styles ; +USING: styles namespaces ; -: default-style - H{ - { font "sans-serif" } - { font-size 12 } - { font-style plain } - { wrap-margin 500 } - } ; +SYMBOL: default-style +H{ + { font "sans-serif" } + { font-size 12 } + { font-style plain } + { wrap-margin 500 } +} default-style set-global -: link-style - H{ - { foreground { 0 0 0.3 1 } } - { font-style bold } - } ; +SYMBOL: link-style +H{ + { foreground { 0 0 0.3 1 } } + { font-style bold } +} link-style set-global -: emphasis-style - H{ { font-style italic } } ; +SYMBOL: emphasis-style +H{ { font-style italic } } emphasis-style set-global -: strong-style - H{ { font-style bold } } ; +SYMBOL: strong-style +H{ { font-style bold } } strong-style set-global -: title-style - H{ - { font "sans-serif" } - { font-size 16 } - { font-style bold } - { wrap-margin 500 } - { page-color { 0.8 0.8 1 1 } } - { border-width 5 } - } ; +SYMBOL: title-style +H{ + { font "sans-serif" } + { font-size 16 } + { font-style bold } + { wrap-margin 500 } + { page-color { 0.8 0.8 1 1 } } + { border-width 5 } +} title-style set-global -: doc-path-style - H{ { font-size 10 } } ; +SYMBOL: doc-path-style +H{ { font-size 10 } } doc-path-style set-global -: heading-style - H{ - { font "sans-serif" } - { font-size 14 } - { font-style bold } - } ; +SYMBOL: heading-style +H{ + { font "sans-serif" } + { font-size 14 } + { font-style bold } +} heading-style set-global -: subsection-style - H{ - { font "sans-serif" } - { font-size 14 } - { font-style bold } - } ; +SYMBOL: subsection-style +H{ + { font "sans-serif" } + { font-size 14 } + { font-style bold } +} subsection-style set-global -: subtopic-style - H{ { font-style bold } } ; +SYMBOL: subtopic-style +H{ { font-style bold } } subtopic-style set-global -: snippet-style - H{ - { font "monospace" } - { foreground { 0.3 0.3 0.3 1 } } - } ; +SYMBOL: snippet-style +H{ + { font "monospace" } + { foreground { 0.3 0.3 0.3 1 } } +} snippet-style set-global -: code-style - H{ - { font "monospace" } - { font-size 12 } - { page-color { 0.8 0.8 0.8 0.5 } } - { border-width 5 } - { wrap-margin f } - } ; +SYMBOL: code-style +H{ + { font "monospace" } + { font-size 12 } + { page-color { 0.8 0.8 0.8 0.5 } } + { border-width 5 } + { wrap-margin f } +} code-style set-global -: input-style - H{ { font-style bold } } ; +SYMBOL: input-style +H{ { font-style bold } } input-style set-global -: url-style - H{ - { font "monospace" } - { foreground { 0.0 0.0 1.0 1.0 } } - } ; +SYMBOL: url-style +H{ + { font "monospace" } + { foreground { 0.0 0.0 1.0 1.0 } } +} url-style set-global -: warning-style - H{ - { page-color { 0.95 0.95 0.95 1 } } - { border-color { 1 0 0 1 } } - { border-width 5 } - } ; +SYMBOL: warning-style +H{ + { page-color { 0.95 0.95 0.95 1 } } + { border-color { 1 0 0 1 } } + { border-width 5 } +} warning-style set-global -: table-content-style - H{ - { wrap-margin 350 } - } ; +SYMBOL: table-content-style +H{ + { wrap-margin 350 } +} table-content-style set-global -: table-style - H{ - { table-gap { 5 5 } } - { table-border { 0.8 0.8 0.8 1.0 } } - } ; +SYMBOL: table-style +H{ + { table-gap { 5 5 } } + { table-border { 0.8 0.8 0.8 1.0 } } +} table-style set-global -: list-style - H{ { table-gap { 10 2 } } } ; +SYMBOL: list-style +H{ { table-gap { 10 2 } } } list-style set-global + +SYMBOL: bullet +"-" bullet set-global diff --git a/library/prettyprint/sections.facts b/library/prettyprint/sections.facts index 91278d022f..a9734fa991 100644 --- a/library/prettyprint/sections.facts +++ b/library/prettyprint/sections.facts @@ -1,4 +1,5 @@ -USING: help io kernel prettyprint prettyprint-internals words ; +IN: help +USING: io kernel prettyprint prettyprint-internals words ; : $prettyprinting-note drop {