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
This commit is contained in:
Eli Barzilay 2009-03-22 01:26:15 +00:00
parent da64fcb797
commit 9dd05abdae

View File

@ -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)