commit e0a14fa28d1e477eb07586a074ca2bdaac024a4a
parent 0ea99227844c651e5c9c6deac1c73d489560f2b2
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Tue, 4 Aug 2015 09:44:36 -0600
tabular: fix insertion of separator before 'cont
Use 'cont before a 'cont cell instead of adding a separator.
Diffstat:
5 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/scribble-doc/scribblings/scribble/base.scrbl b/scribble-doc/scribblings/scribble/base.scrbl
@@ -265,7 +265,9 @@ If @racket[sep] is not @racket[#f], it is inserted as a new column
between every column in the table; note that any
@racket[table-columns] or @racket[table-cells] property in
@racket[style] must take the added columns into account. Otherwise,
-the default style places no space between table columns.
+the default style places no space between table columns. When @racket[sep]
+would be placed before a @racket['cont], a @racket['cont] is inserted,
+instead.
The @racket[column-properties], @racket[row-properties], and
@racket[cell-properties] arguments specify @tech{style properties} for
@@ -324,7 +326,9 @@ properties will be used from the merger into @racket[table-cells].}
@history[#:changed "1.1" @elem{Added the @racket[#:column-properties],
@racket[#:row-properties],
- and @racket[#:cell-properties] arguments.}]
+ and @racket[#:cell-properties] arguments.}
+ #:changed "1.12" @elem{Changed @racket[sep] insertion before a
+ @racket['cont].}]
Examples:
@codeblock[#:keep-lang-line? #f]|{
diff --git a/scribble-lib/info.rkt b/scribble-lib/info.rkt
@@ -24,4 +24,4 @@
(define pkg-authors '(mflatt eli))
-(define version "1.11")
+(define version "1.12")
diff --git a/scribble-lib/scribble/base.rkt b/scribble-lib/scribble/base.rkt
@@ -554,10 +554,21 @@
[else (make-paragraph plain cell)]))
(define l (map cvt row))
(if sep
- (add-between l (cvt sep))
+ (add-between/cont l (cvt sep))
l))
cells)))
+;; Like `add-between`, but change `sep` to 'cont when
+;; adding before a 'cont:
+(define (add-between/cont l sep)
+ (cond
+ [(null? l) null]
+ [(null? (cdr l)) l]
+ [else
+ (list* (car l)
+ (if (eq? 'cont (cadr l)) 'cont sep)
+ (add-between/cont (cdr l) sep))]))
+
;; ----------------------------------------
(provide/contract
diff --git a/scribble-test/tests/scribble/docs/table.scrbl b/scribble-test/tests/scribble/docs/table.scrbl
@@ -18,3 +18,7 @@
#:sep "-"
(list (list "A" "B" "C" "D")
(list "apple" "banana" "coconut" "donut")))
+
+@(tabular #:sep "-"
+ (list (list "A" 'cont "C" 'cont 'cont)
+ (list "apple" "banana" "coconut" "donut" "eclair")))
diff --git a/scribble-test/tests/scribble/docs/table.txt b/scribble-test/tests/scribble/docs/table.txt
@@ -7,3 +7,6 @@ a -b -c -d
A- B -C -D
apple-banana-coconut-donut
+
+A -C
+apple-banana-coconut-donut-eclair