diff --git a/collects/scribble/eval.rkt b/collects/scribble/eval.rkt index 4d6da7a2..de9e834d 100644 --- a/collects/scribble/eval.rkt +++ b/collects/scribble/eval.rkt @@ -113,7 +113,7 @@ #f (map (lambda (l) (list (make-flow (list l)))) - flow-accum))))))))] + (reverse flow-accum)))))))))] [(equal? #\newline v) (loop #f #f (add-line (add-string string-accum line-accum) flow-accum))] diff --git a/collects/scribble/latex-render.rkt b/collects/scribble/latex-render.rkt index f88f3042..81a7cc32 100644 --- a/collects/scribble/latex-render.rkt +++ b/collects/scribble/latex-render.rkt @@ -468,7 +468,7 @@ (loop (cdr flows) (add1 n))] [else n]))]) (unless (= cnt 1) (printf "\\multicolumn{~a}{l}{" cnt)) - (render-table-cell (car flows) part ri twidth (car cell-styles)) + (render-table-cell (car flows) part ri (/ twidth cnt) (car cell-styles)) (unless (= cnt 1) (printf "}")) (unless (null? (list-tail flows cnt)) (printf " &\n")))) (unless (null? (cdr flows)) (loop (cdr flows) diff --git a/collects/scribble/private/manual-code.rkt b/collects/scribble/private/manual-code.rkt index 1ad662ad..6c083517 100644 --- a/collects/scribble/private/manual-code.rkt +++ b/collects/scribble/private/manual-code.rkt @@ -121,7 +121,7 @@ [else null]))] [has-hash-lang? (regexp-match? #rx"^#lang " bstr)] [language (if has-hash-lang? - (let ([m (regexp-match #rx"^#lang ([-a-zA-Z/._+]+)" bstr)]) + (let ([m (regexp-match #rx"^#lang ([-0-9a-zA-Z/._+]+)" bstr)]) (if m (link-mod #:orig? #t diff --git a/collects/scribblings/scribble/manual.scrbl b/collects/scribblings/scribble/manual.scrbl index cdf1288b..c3baaea8 100644 --- a/collects/scribblings/scribble/manual.scrbl +++ b/collects/scribblings/scribble/manual.scrbl @@ -208,7 +208,7 @@ without insetting the code.} @defform[(RACKETRESULTBLOCK0 datum ...)] )]{ -Like @racketblock[racketblock], etc., but colors the typeset text as a +Like @racket[racketblock], etc., but colors the typeset text as a result (i.e., a single color with no hyperlinks) instead of code.} @deftogether[( diff --git a/collects/scribblings/scribble/srcdoc.scrbl b/collects/scribblings/scribble/srcdoc.scrbl index a5048c36..5968c39d 100644 --- a/collects/scribblings/scribble/srcdoc.scrbl +++ b/collects/scribblings/scribble/srcdoc.scrbl @@ -9,7 +9,7 @@ The @racketmodname[scribble/srcdoc] and @racketmodname[scribble/extract] libraries support writing -documentation withing the documentation code along with an export +documentation within the documentation code along with an export contract, similar to using @as-index{JavaDoc}. With this approach, a single contract specification is used both for the run-time contract and the documentation of an exported binding. diff --git a/collects/tests/scribble/collect.rkt b/collects/tests/scribble/collect.rkt index ef4b2333..1c414a9b 100644 --- a/collects/tests/scribble/collect.rkt +++ b/collects/tests/scribble/collect.rkt @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (require tests/eli-tester scribble/text/syntax-utils) diff --git a/collects/tests/scribble/docs.rkt b/collects/tests/scribble/docs.rkt new file mode 100644 index 00000000..6071b12c --- /dev/null +++ b/collects/tests/scribble/docs.rkt @@ -0,0 +1,43 @@ +#lang racket/base + +;; Use text renderer to check some Scribble functionality + +(require scribble/base-render (prefix-in text: scribble/text-render) + racket/file racket/class racket/runtime-path tests/eli-tester) + +(define-runtime-path source-dir "docs") +(define work-dir (build-path (find-system-path 'temp-dir) + "scribble-docs-tests")) + +(define (build-text-doc src-file dest-file) + (let* ([renderer (new (text:render-mixin render%) [dest-dir work-dir])] + [docs (list (dynamic-require src-file 'doc))] + [fns (list (build-path work-dir dest-file))] + [fp (send renderer traverse docs fns)] + [info (send renderer collect docs fns fp)] + [r-info (send renderer resolve docs fns info)]) + (send renderer render docs fns r-info))) + +(define (check-text-build src-file expect-file) + (build-text-doc src-file "gen.txt") + (define (contents file) (regexp-replace #rx"\n+$" (file->string file) "")) + (string=? (contents expect-file) (contents (build-path work-dir "gen.txt")))) + +(provide docs-tests) +(define (docs-tests) + (when (or (file-exists? work-dir) (directory-exists? work-dir)) + (delete-directory/files work-dir)) + (make-directory work-dir) + (dynamic-wind void + (lambda () + (define files (map path-element->string (directory-list source-dir))) + (for ([scrbl (in-list files)] + #:when (regexp-match? #rx"\\.scrbl$" scrbl) + [txt (in-value (regexp-replace #rx"\\.scrbl$" scrbl ".txt"))] + #:when (member txt files)) + ;; (printf "Testing ~s -> ~s\n" scrbl txt) + (test #:failure-message + (format "mismatch from: \"~a\" expected: \"~a\"" scrbl txt) + (check-text-build (build-path source-dir scrbl) + (build-path source-dir txt))))) + (lambda () (delete-directory/files work-dir)))) diff --git a/collects/tests/scribble/docs/print-lines.scrbl b/collects/tests/scribble/docs/print-lines.scrbl new file mode 100644 index 00000000..20f4fc99 --- /dev/null +++ b/collects/tests/scribble/docs/print-lines.scrbl @@ -0,0 +1,21 @@ +#lang scribble/manual + +@(require scribble/eval) + +@title{Pretty-Print-Handler Bug Example} + +@(define the-eval (make-base-eval)) +@(interaction-eval + #:eval the-eval + (begin + (require racket/pretty) + (current-print pretty-print-handler))) + +@examples[#:eval the-eval +'((x "positional 1") + (rest ("positional 2" "positional 3")) + (a ()) + (b ("b-arg")) + (c (("first c1" "second c1") ("first c2" "second c2"))) + (d #f) + (e ()))] diff --git a/collects/tests/scribble/docs/print-lines.txt b/collects/tests/scribble/docs/print-lines.txt new file mode 100644 index 00000000..89fb1867 --- /dev/null +++ b/collects/tests/scribble/docs/print-lines.txt @@ -0,0 +1,18 @@ + +Pretty-Print-Handler Bug Example + +Example: + > '((x "positional 1") + (rest ("positional 2" "positional 3")) + (a ()) + (b ("b-arg")) + (c (("first c1" "second c1") ("first c2" "second c2"))) + (d #f) + (e ())) + '((x "positional 1") + (rest ("positional 2" "positional 3")) + (a ()) + (b ("b-arg")) + (c (("first c1" "second c1") ("first c2" "second c2"))) + (d #f) + (e ())) diff --git a/collects/tests/scribble/main.rkt b/collects/tests/scribble/main.rkt index f94a956a..7ff28b44 100644 --- a/collects/tests/scribble/main.rkt +++ b/collects/tests/scribble/main.rkt @@ -1,7 +1,9 @@ -#lang scheme/base +#lang racket/base -(require tests/eli-tester "reader.ss" "preprocessor.ss" "collect.ss") +(require tests/eli-tester + "reader.rkt" "preprocessor.rkt" "collect.rkt" "docs.rkt") (test do (reader-tests) do (begin/collect-tests) - do (preprocessor-tests)) + do (preprocessor-tests) + do (docs-tests)) diff --git a/collects/tests/scribble/preprocessor.rkt b/collects/tests/scribble/preprocessor.rkt index 84eae3e0..aa2f894f 100644 --- a/collects/tests/scribble/preprocessor.rkt +++ b/collects/tests/scribble/preprocessor.rkt @@ -1,6 +1,6 @@ -#lang scheme/base +#lang racket/base -(require tests/eli-tester scheme/runtime-path scheme/port scheme/sandbox +(require tests/eli-tester racket/runtime-path racket/port racket/sandbox (prefix-in doc: (lib "scribblings/scribble/preprocessor.scrbl"))) (provide preprocessor-tests) diff --git a/collects/tests/scribble/reader.rkt b/collects/tests/scribble/reader.rkt index 41997d20..5987b78a 100644 --- a/collects/tests/scribble/reader.rkt +++ b/collects/tests/scribble/reader.rkt @@ -1,6 +1,6 @@ -#lang scheme/base +#lang racket/base -(require tests/eli-tester (prefix-in scr: scribble/reader) scheme/list) +(require tests/eli-tester (prefix-in scr: scribble/reader) racket/list) (provide reader-tests)