Fix some style nesting issues

darcs
slava 2006-06-17 19:59:44 +00:00
parent a5cc32ed15
commit 26e6ac7477
7 changed files with 20 additions and 15 deletions

View File

@ -8,7 +8,6 @@
+ help:
- double 'presented' for the block & char style
- refactor style stack code so that nested styles are handled at a lower-level
- with-style & with-stream-style
- in HTML, we can nest div tags, etc

View File

@ -19,8 +19,8 @@ M: word article-content
] { } make ;
: with-default-style ( quot -- )
default-char-style [
default-para-style [ last-block on call ] with-nesting
default-style [
H{ } [ last-block on call ] with-nesting
] with-style ; inline
: print-title ( article -- )

View File

@ -144,7 +144,7 @@ M: link summary "Link: " swap link-name append ;
"Notes" $heading print-element ;
: $see ( content -- )
code-style [ dup array? [ first ] when see ] with-nesting ;
code-style [ H{ } [ first see ] with-nesting ] with-style ;
: $definition ( content -- )
"Definition" $heading $see ;

View File

@ -3,14 +3,10 @@
IN: help
USING: styles ;
: default-char-style
: default-style
H{
{ font "serif" }
{ font-size 12 }
} ;
: default-para-style
H{
{ wrap-margin 500 }
} ;

View File

@ -30,8 +30,10 @@ M: nested-style-stream stream-write1
>r ch>string r> H{ } swap do-nested-style stream-format ;
: do-nested-quot ( quot style stream -- quot style stream )
do-nested-style
>r [ swap \ with-style 3array >quotation ] keep r> ;
tuck >r >r
nested-style-stream-style swap \ with-style
3array >quotation
r> r> do-nested-style ;
M: nested-style-stream with-nested-stream
do-nested-quot with-nested-stream ;

View File

@ -57,8 +57,8 @@ HELP: with-nesting "( style quot -- )"
{ $notes "Details are in the documentation for " { $link stream-format } "." }
$io-error ;
HELP: print "( style quot -- )"
{ $values { "style" "a hashtable" } { "quot" "a quotation" } }
HELP: print "( style -- )"
{ $values { "style" "a hashtable" } }
{ $description "Writes a newline-terminated string to the " { $link stdio } " stream." }
$io-error ;

View File

@ -1,8 +1,6 @@
IN: temporary
USING: io kernel math namespaces styles test ;
! Make sure everything here works...
[ ">> + <<" ] [
[
[
@ -12,3 +10,13 @@ USING: io kernel math namespaces styles test ;
] string-out
] with-scope
] unit-test
[ "+" ] [
[
[
H{ } [
H{ { highlight t } } [ "+" write ] with-nesting
] with-style
] string-out
] with-scope
] unit-test