add explicit word-break for hyphens in on-this-page navigation display

svn: r7913

original commit: d81c9a2836f1f871c71f1b4e19b6f218c5e05375
This commit is contained in:
Matthew Flatt 2007-12-07 15:59:19 +00:00
parent f68f07ec74
commit e2d5a5dd67

View File

@ -499,10 +499,16 @@
(define/override (render-other i part ri)
(cond
[(string? i) (let ([m (and (extra-breaking?)
(regexp-match-positions #rx"[:/]" i))])
(regexp-match-positions #rx"[-:/]" i))])
(if m
(list* (substring i 0 (cdar m))
`(span ((class "mywbr")) " ")
;; Most browsers wrap after a hyphen. The
;; one that doesn't, Firefox, pays attention
;; to wbr. Some browsers ignore wbr, but
;; at they don't do strange things with it.
(if (equal? #\- (string-ref i (caar m)))
'(wbr)
`(span ((class "mywbr")) " "))
(render-other (substring i (cdar m)) part ri))
(list i)))]
[(eq? i 'mdash) `(" " ndash " ")]