style: consistent figure style (#3060)

Use a consistent style for the "good / bad" examples:

- start the code at the far left of each box
- keep a little space between the top of the box & the label
This commit is contained in:
Ben Greenman 2020-02-28 08:42:59 -05:00 committed by GitHub
parent 354dfbac04
commit 24cdc58951
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,21 +30,24 @@ your code.
(define (conversion f)
(* 5/9 (- f 32)))
]
@filebox[@tt{really bad}
@codeblock{#lang racket
@racketmod[#:file
@tt{really bad}
racket
(define (conversion f)
(* 5/9 (- f 32)
)
)
}]
]
]
You are allowed to place all closing parenthesis on a line by itself at the
end of long sequences, be those definitions or pieces of data.
@compare[
@filebox[@tt{acceptable}
@codeblock{#lang racket
@racketmod[#:file
@tt{acceptable}
racket
(define modes
'(edit
help
@ -53,9 +56,10 @@ end of long sequences, be those definitions or pieces of data.
trace
step
))
}]
@filebox[@tt{also acceptable}
@codeblock{#lang racket
]
@racketmod[#:file
@tt{also acceptable}
racket
(define turn%
(class object%
(init-field state)
@ -68,7 +72,7 @@ end of long sequences, be those definitions or pieces of data.
(define/public (is-placable? place)
(send state legal? place))
))
}]
]
]
Doing so is most useful when you expect to add, delete, or swap items in
such sequences.
@ -383,12 +387,13 @@ space between the two, even if theyre separated by parentheses.
(define (f x g)
[(< x 3) (g (g 3))])
]
@filebox[@tt{bad}
@codeblock{#lang racket
@racketmod[#:file
@tt{bad}
racket
(define(f x g)
[(< x 3)(g(g 3))])
}]
]
]