scribble: fix regression in HTML rendering
Fixes a problem with 2d5884b26a. original commit: 114ab498d68454c831e8e57be584caadda6039cd
This commit is contained in:
parent
2db885e761
commit
4e188c38da
|
@ -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)
|
||||
|
|
|
@ -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))))
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
@(cond-element
|
||||
[text "Text!"]
|
||||
[html "HTML!"]
|
||||
[latex "Latex!"])
|
||||
[latex "Latex!"]
|
||||
[markdown "Markdown!"])
|
||||
|
||||
@(cond-element
|
||||
[(or text html) "Text or HTML!"]
|
||||
|
|
9
collects/tests/scribble/docs/empty-onthispage.scrbl
Normal file
9
collects/tests/scribble/docs/empty-onthispage.scrbl
Normal file
|
@ -0,0 +1,9 @@
|
|||
#lang scribble/manual
|
||||
|
||||
@title[#:style '(unnumbered)]{Example}
|
||||
|
||||
Content.
|
||||
|
||||
@section[#:style '(toc unnumbered)]{X}
|
||||
|
||||
@subsection[#:style '(toc-hidden unnumbered)]{A}
|
8
collects/tests/scribble/docs/empty-onthispage.txt
Normal file
8
collects/tests/scribble/docs/empty-onthispage.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
Example
|
||||
|
||||
Content.
|
||||
|
||||
X
|
||||
|
||||
A
|
||||
|
Loading…
Reference in New Issue
Block a user