commit 9dd05abdae1a20284301259807c88763946276aa
parent da64fcb79723d3bcc9e32fcf2bb9ed24257ef8b5
Author: Eli Barzilay <eli@racket-lang.org>
Date: Sun, 22 Mar 2009 01:26:15 +0000
There is a problem with empty lines: having a line (= a row) in the
code tables with empty contents makes the row not appear. Usually,
we'd put an there so it does show, but that would be bad for
the preprocessor examples where I really want to have the table
contents reflect the exact file contents.
So another solution is to use a 'newline element, but then latex barfs
because it's not happy with a \\ inside a tt macro. The hacked
"solution" is to have the newline element not be inside a tt element
-- latex doesn't barf now, but it does have one extra newline as a
result since it doesn't hide the newline to begin with.
A better solution is to find a way to make table cells in html not be
hidden when they have no contents, maybe through some css magic.
svn: r14206
original commit: 2af626972de3041951ef9efdbdbb216b6031cc72
Diffstat:
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/collects/scribblings/scribble/utils.ss b/collects/scribblings/scribble/utils.ss
@@ -110,15 +110,17 @@
(define strs2 (split out-text))
(define strsm (map (compose split cdr) more))
(define (str->elts str)
+ (let ([spaces (regexp-match-positions #rx"(?:^| ) +" str)])
+ (if spaces
+ (list* (substring str 0 (caar spaces))
+ (hspace (- (cdar spaces) (caar spaces)))
+ (str->elts (substring str (cdar spaces))))
+ (list (make-element 'tt (list str))))))
+ (define (make-line str)
(if (equal? str "")
- (list (make-element 'newline (list "")))
- (let ([spaces (regexp-match-positions #rx"(?:^| ) +" str)])
- (if spaces
- (list* (substring str 0 (caar spaces))
- (hspace (- (cdar spaces) (caar spaces)))
- (str->elts (substring str (cdar spaces))))
- (list (make-element 'tt (list str)))))))
- (define (make-line str) (list (as-flow (make-element 'tt (str->elts str)))))
+ ;;FIXME: this works in html, but in latex it creates a redundant newline
+ (list (as-flow (make-element 'newline '())))
+ (list (as-flow (make-element 'tt (str->elts str))))))
(define (small-attr attr)
(make-with-attributes attr '([style . "font-size: 82%;"])))
(define (make-box strs)