From b2336626fa8492a4e020befa145c482aca669493 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Mon, 18 Feb 2008 09:36:40 +0000 Subject: [PATCH] made verbatim take any number of arguments (and reformat code) svn: r8698 original commit: 7e736230321ff6625327b51a31950e653faed2bb --- collects/scribble/manual.ss | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/collects/scribble/manual.ss b/collects/scribble/manual.ss index 515bc141..a065ff15 100644 --- a/collects/scribble/manual.ss +++ b/collects/scribble/manual.ss @@ -187,21 +187,19 @@ (make-element "schemeinput" (list (substring s (cdar spaces) (caar end-spaces)))) (hspace (- (cdar end-spaces) (caar end-spaces))))))))) - (define (verbatim s) - (let ([strs (regexp-split #rx"\n" s)]) - (make-table - #f - (map (lambda (s) - (list (make-flow (list (make-paragraph - (let loop ([s s]) - (let ([spaces (regexp-match-positions #rx"(?:^| ) +" s)]) - (if spaces - (append - (loop (substring s 0 (caar spaces))) - (list (hspace (- (cdar spaces) (caar spaces)))) - (loop (substring s (cdar spaces)))) - (list (make-element 'tt (list s))))))))))) - strs)))) + (define (verbatim s . more) + (define strs (regexp-split #rx"\n" (apply string-append s 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) + (list (make-flow (list (make-paragraph + (list (make-element 'tt (str->elts str)))))))) + (make-table #f (map make-line strs))) (define-syntax indexed-scheme (syntax-rules ()