commit 8890f72c3a20198e2a25337b2569c41a643b922b
parent af3a99ae55c73f4af5bf9cff22ed2d605d4cc80b
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Thu, 18 Aug 2011 13:05:37 -0600
`scribble' reports broken cross references by default
original commit: 39edc5a5991d17c8becfc7a1b44665fb5cd9d622
Diffstat:
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/collects/scribble/render.rkt b/collects/scribble/render.rkt
@@ -39,7 +39,8 @@
#:xrefs [xrefs null]
#:info-in-files [info-input-files null]
#:info-out-file [info-output-file #f]
- #:quiet? [quiet? #t])
+ #:quiet? [quiet? #t]
+ #:warn-undefined? [warn-undefined? (not quiet?)])
(when dest-dir (make-directory* dest-dir))
(let ([renderer (new (render-mixin render%)
[dest-dir dest-dir]
@@ -73,5 +74,11 @@
(let ([s (send renderer serialize-info r-info)])
(with-output-to-file info-output-file
#:exists 'truncate/replace
- (lambda () (write s))))))
+ (lambda () (write s)))))
+ (when warn-undefined?
+ (let ([undef (send renderer get-undefined r-info)])
+ (unless (null? undef)
+ (eprintf "Warning: some cross references may be broken due to undefined tags:\n")
+ (for ([t (in-list undef)])
+ (eprintf " ~s\n" t))))))
(void))))
diff --git a/collects/scribble/run.rkt b/collects/scribble/run.rkt
@@ -91,7 +91,7 @@
(current-info-input-files
(cons file (current-info-input-files)))]
#:once-each
- [("--quiet") "suppress output-file reporting"
+ [("--quiet") "suppress output-file and undefined-tag reporting"
(current-quiet #t)]
#:args (file . another-file)
(let ([files (cons file another-file)])
diff --git a/collects/scribblings/scribble/renderer.scrbl b/collects/scribblings/scribble/renderer.scrbl
@@ -46,7 +46,8 @@ function to render a document.
[#:info-out-file info-out-file (or/c #f path-string?) #f]
[#:redirect redirect (or/c #f string?) #f]
[#:redirect-main redirect-main (or/c #f string?) #f]
- [#:quiet? quiet? any/c #f])
+ [#:quiet? quiet? any/c #t]
+ [#:warn-undefined? warn-undefined? any/c (not quiet?)])
void?]{
Renders the given @racket[docs], each with an output name derived from
@@ -78,8 +79,12 @@ to the @racket[set-external-tag-path] and
@racketmodname[scribble/html-render], so they should be
non-@racket[#f] only for HTML rendering.
-If @racket[quiet?] is a true value, output-file information is written
-to the current output port.}
+If @racket[quiet?] is a false value, output-file information is
+written to the current output port.
+
+If @racket[warn-undefined?] is a true value, then references to
+missing cross-reference targets trigger a warning message on the
+current error port.}
@section{Base Renderer}