better Scribble support for disabling line breaks

- make 'no-break element style work consistently
 - document 'no-break
 - add `nonbreaking' to `scribble/base'

original commit: 315fdf071a2905ff4d634c7b8004e32c0d6a1b58
This commit is contained in:
Matthew Flatt 2011-01-07 08:59:02 -07:00
parent acd72493f3
commit 6c51ec9a9c
4 changed files with 12 additions and 1 deletions

View File

@ -276,6 +276,7 @@
(provide/contract
[linebreak (-> element?)]
[nonbreaking elem-like-contract]
[hspace (-> exact-nonnegative-integer? element?)]
[elem (->* ()
(#:style element-style?)
@ -311,6 +312,9 @@
(define (linebreak)
(make-element 'newline '("\n")))
(define (nonbreaking . str)
(make-element 'no-break (decode-content str)))
(define (elem #:style [style plain] . str)
(make-element style (decode-content str)))

View File

@ -272,7 +272,7 @@
[(bold) (wrap e "textbf" tt?)]
[(tt) (wrap e "Scribtexttt" #t)]
[(url) (wrap e "nolinkurl" 'exact)]
[(no-break) (core-render e tt?)]
[(no-break) (wrap e "mbox" tt?)]
[(sf) (wrap e "textsf" #f)]
[(subscript) (wrap e "textsub" #f)]
[(superscript) (wrap e "textsuper" #f)]

View File

@ -346,6 +346,10 @@ See also @racket[verbatim].}
Produces an element that forces a line break.}
@def-elem-proc[nonbreaking]{Like @racket[elem], but line breaks are
suppressed while rendering the content.}
@defproc[(hspace [n exact-nonnegative-integer?]) element?]{
Produces an element containing @racket[n] spaces and style

View File

@ -646,6 +646,9 @@ recognized:
@item{@racket['newline] --- Renders a line break independent of
the @racket[content].}
@item{@racket['no-break] --- Prevents line breaks when rendering
@racket[content].}
]
The following @tech{style properties} are currently recognized: