From e0a14fa28d1e477eb07586a074ca2bdaac024a4a Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 4 Aug 2015 09:44:36 -0600 Subject: [PATCH] tabular: fix insertion of separator before 'cont Use 'cont before a 'cont cell instead of adding a separator. --- scribble-doc/scribblings/scribble/base.scrbl | 8 ++++++-- scribble-lib/info.rkt | 2 +- scribble-lib/scribble/base.rkt | 13 ++++++++++++- scribble-test/tests/scribble/docs/table.scrbl | 4 ++++ scribble-test/tests/scribble/docs/table.txt | 3 +++ 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/scribble-doc/scribblings/scribble/base.scrbl b/scribble-doc/scribblings/scribble/base.scrbl index f428d858..177a4875 100644 --- 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 index 60688778..406b013d 100644 --- 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 index 5eb7ffcf..14102588 100644 --- 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 index 392c97bb..f2410b95 100644 --- 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 index c907d34e..2d5d2837 100644 --- 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