scribble: fix regression in HTML rendering

Fixes a problem with 2d5884b26a.

original commit: 114ab498d68454c831e8e57be584caadda6039cd
This commit is contained in:
Matthew Flatt 2013-03-04 07:46:47 -07:00
parent 2db885e761
commit 4e188c38da
5 changed files with 53 additions and 7 deletions

View File

@ -566,7 +566,7 @@
blocks))
(table-blockss table)))
(define ps
((if (nearly-top? d) values cdr)
((if (nearly-top? d) values (lambda (p) (if (pair? p) (cdr p) null)))
(let flatten ([d d] [prefixes null] [top? #t])
(let ([prefixes (if (and (not top?) (part-tag-prefix d))
(cons (part-tag-prefix d) prefixes)

View File

@ -2,15 +2,22 @@
;; 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)
(require scribble/base-render
(prefix-in text: scribble/text-render)
(prefix-in html: scribble/html-render)
(prefix-in latex: scribble/latex-render)
(prefix-in markdown: scribble/markdown-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])]
(define (build-doc render% src-file dest-file)
(let* ([renderer (new 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)]
@ -19,6 +26,21 @@
(send renderer render docs fns r-info)
(send renderer get-undefined r-info)))
(define (build-text-doc src-file dest-file)
(build-doc (text:render-mixin render%) src-file dest-file))
(define (build-html-doc src-file dest-file)
(build-doc (html:render-mixin render%) src-file dest-file))
(define (build-htmls-doc src-file dest-file)
(build-doc (html:render-multi-mixin (html:render-mixin render%)) src-file dest-file))
(define (build-latex-doc src-file dest-file)
(build-doc (latex:render-mixin render%) src-file dest-file))
(define (build-markdown-doc src-file dest-file)
(build-doc (markdown:render-mixin render%) src-file dest-file))
(provide docs-tests)
(module+ main (docs-tests))
(define (docs-tests)
@ -49,5 +71,11 @@
(format
"mismatch for: \"~a\", expected text in: \"~a\", got:\n~a"
scrbl txt (contents generated-file))
(string=? (contents expect-file) (contents generated-file))))))
(string=? (contents expect-file) (contents generated-file)))
;; Make sure the document at least renders in other modes:
(void (build-html-doc src-file "gen.html"))
(void (build-htmls-doc src-file "gen"))
(void (build-latex-doc src-file "gen.tex"))
(void (build-markdown-doc src-file "gen.md")))))
(λ() (delete-directory/files work-dir))))

View File

@ -4,7 +4,8 @@
@(cond-element
[text "Text!"]
[html "HTML!"]
[latex "Latex!"])
[latex "Latex!"]
[markdown "Markdown!"])
@(cond-element
[(or text html) "Text or HTML!"]

View File

@ -0,0 +1,9 @@
#lang scribble/manual
@title[#:style '(unnumbered)]{Example}
Content.
@section[#:style '(toc unnumbered)]{X}
@subsection[#:style '(toc-hidden unnumbered)]{A}

View File

@ -0,0 +1,8 @@
Example
Content.
X
A