From 94a55281c1cfdd75b2db5248b36a02c40adb2a56 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 21 May 2010 07:15:39 -0600 Subject: [PATCH] fix problems with Scribble HTML and PDF buttons --- collects/scribble/run.rkt | 7 ++++++- collects/scribble/tools/drracket-buttons.rkt | 11 +++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/collects/scribble/run.rkt b/collects/scribble/run.rkt index 828cffaf52..31c4b8cc6d 100644 --- a/collects/scribble/run.rkt +++ b/collects/scribble/run.rkt @@ -27,6 +27,7 @@ (define current-extra-files (make-parameter null)) (define current-redirect (make-parameter #f)) (define current-redirect-main (make-parameter #f)) +(define current-quiet (make-parameter #f)) (define (read-one str) (let ([i (open-input-string str)]) @@ -85,6 +86,9 @@ 'scribble "bad procedure identifier for ++ref-in: ~s" proc-id)) (current-xref-input-modules (cons (cons mod id) (current-xref-input-modules))))] + #:once-each + [("--quiet") "suppress output-file reporting" + (current-quiet #t)] #:args (file . another-file) (let ([files (cons file another-file)]) (build-docs (map (lambda (file) (dynamic-require `(file ,file) 'doc)) @@ -104,7 +108,8 @@ (send renderer set-external-tag-path (current-redirect))) (when (current-redirect-main) (send renderer set-external-root-url (current-redirect-main))) - (send renderer report-output!) + (unless (current-quiet) + (send renderer report-output!)) (let* ([fns (map (lambda (fn) (let-values ([(base name dir?) (split-path fn)]) (let ([fn (path-replace-suffix diff --git a/collects/scribble/tools/drracket-buttons.rkt b/collects/scribble/tools/drracket-buttons.rkt index e1a33b954a..f2911c946e 100644 --- a/collects/scribble/tools/drracket-buttons.rkt +++ b/collects/scribble/tools/drracket-buttons.rkt @@ -34,15 +34,18 @@ (list->vector (append extra-cmdline - (list "--dest" (path->string base)) + (list "--dest" (path->string base) "--quiet") (list mode (if (path? fn) (path->string fn) fn))))]) (namespace-attach-module (namespace-anchor->empty-namespace anchor) 'setup/xref) (dynamic-require 'scribble/run #f) (cond - [(equal? label "HTML") + [(equal? suffix #".html") (send-url/file (path-replace-suffix fn suffix))] - [else (system (format "open ~a" (path-replace-suffix name suffix)))])) - (message-box "Scribble" (get-output-string p) drs-frame)) + [else + (system (format "open ~s" (path->string (path-replace-suffix fn suffix))))])) + (let ([s (get-output-string p)]) + (unless (equal? s "") + (message-box "Scribble" s drs-frame)))) (message-box "Not Named" "Cannot render unsaved file")))))) (define drracket-buttons