diff --git a/collects/scribble/render.rkt b/collects/scribble/render.rkt index 1f8a139f..23adfe5f 100644 --- a/collects/scribble/render.rkt +++ b/collects/scribble/render.rkt @@ -14,6 +14,7 @@ (#:render-mixin (class? . -> . class?) #:dest-dir (or/c #f path-string?) + #:helper-file-prefix (or/c #f string?) #:prefix-file (or/c #f path-string?) #:style-file (or/c #f path-string?) #:style-extra-files (listof path-string?) @@ -30,6 +31,7 @@ names #:render-mixin [render-mixin html:render-mixin] #:dest-dir [dest-dir #f] + #:helper-file-prefix [helper-file-prefix #f] #:prefix-file [prefix-file #f] #:style-file [style-file #f] #:style-extra-files [style-extra-files null] @@ -47,7 +49,8 @@ [prefix-file prefix-file] [style-file style-file] [style-extra-files style-extra-files] - [extra-files extra-files])]) + [extra-files extra-files] + [helper-file-prefix helper-file-prefix])]) (when redirect (send renderer set-external-tag-path redirect)) (when redirect-main diff --git a/collects/scribble/run.rkt b/collects/scribble/run.rkt index 2e79e549..ed004a94 100644 --- a/collects/scribble/run.rkt +++ b/collects/scribble/run.rkt @@ -25,6 +25,7 @@ (define current-redirect (make-parameter #f)) (define current-redirect-main (make-parameter #f)) (define current-quiet (make-parameter #f)) +(define helper-file-prefix (make-parameter #f)) (define (read-one str) (let ([i (open-input-string str)]) @@ -58,6 +59,8 @@ (current-dest-directory dir)] [("--dest-name") name "write output as " (current-dest-name name)] + [("--dest-base") prefix "start support-file names with " + (helper-file-prefix prefix)] #:multi [("++style") file "add given .css/.tex file after others" (current-style-extra-files (cons file (current-style-extra-files)))] @@ -100,6 +103,9 @@ files)))) (define (build-docs docs files) + (when (and (current-dest-name) + ((length files) . > . 1)) + (raise-user-error 'scribble "cannot supply a destination name with multiple inputs")) (render docs (map (lambda (fn) (let-values ([(base name dir?) (split-path fn)]) @@ -111,6 +117,7 @@ #:style-file (current-style-file) #:style-extra-files (reverse (current-style-extra-files)) #:extra-files (reverse (current-extra-files)) + #:helper-file-prefix (helper-file-prefix) #:redirect (current-redirect) #:redirect-main (current-redirect-main) #:quiet? (current-quiet) diff --git a/collects/scribblings/scribble/renderer.scrbl b/collects/scribblings/scribble/renderer.scrbl index 26f16988..c4c9dd2b 100644 --- a/collects/scribblings/scribble/renderer.scrbl +++ b/collects/scribblings/scribble/renderer.scrbl @@ -43,6 +43,7 @@ function to render a document. [names (listof path-string?)] [#:render-mixin render-mixin (class? . -> . class?) @#,html:render-mixin] [#:dest-dir dest-dir (or/c #f path-string?) #f] + [#:helper-file-prefix helper-file-prefix (or/c #f string?) #f] [#:prefix-file prefix-file (or/c #f path-string?) #f] [#:style-file style-file (or/c #f path-string?) #f] [#:style-extra-files style-extra-files (listof path-string?) #f] @@ -68,9 +69,10 @@ The @racket[dest-dir] argument determines the output directory, which is created using @racket[make-directory*] if it is non-@racket[#f] and does not exist already. -The @racket[prefix-file], @racket[style-file], -@racket[extra-style-files], and @racket[extra-files] arguments are -passed on to the @racket[render%] constructor. +The @racket[helper-file-prefix], @racket[prefix-file], +@racket[style-file], @racket[extra-style-files], and +@racket[extra-files] arguments are passed on to the @racket[render%] +constructor. The @racket[xrefs] argument provides extra cross-reference information to be used during the documents' @tech{resolve pass}. The @@ -122,7 +124,8 @@ Represents a renderer. [prefix-file (or/c path-string? #f) #f] [style-file (or/c path-string? #f) #f] [style-extra-files (listof path-string?) null] - [extra-files (listof path-string?) null])]{ + [extra-files (listof path-string?) null] + [helper-file-prefix (or/c string? #f) #f])]{ Creates a renderer whose output will go to @racket[dest-dir]. For example, @racket[dest-dir] could name the directory containing the @@ -148,7 +151,13 @@ styles in a formal-specific way; see @secref["config-style"] for more information. The @racket[extra-files] argument names files to be copied to the -output location, such as image files or extra configuration files.} +output location, such as image files or extra configuration files. + +The @racket[helper-file-prefix] argument specifies a string that is +added as a prefix to the name of each support file that is generated +or copied to the destination---not including files specified in +@racket[extra-files], but including @racket[prefix-file], +@racket[style-file], and @racket[style-extra-files].} @defmethod[(traverse [srcs (listof part?)] diff --git a/collects/scribblings/scribble/running.scrbl b/collects/scribblings/scribble/running.scrbl index 7e2bc1e7..9302cbf8 100644 --- a/collects/scribblings/scribble/running.scrbl +++ b/collects/scribblings/scribble/running.scrbl @@ -45,7 +45,8 @@ its file suffix: Use @DFlag{dest-name} to specify a @|fn| other than the default name, but only when a single source file is provided. Use the @DFlag{dest} flag to specify a destination directory (for any number of source -files). +files). Use @DFlag{dest-base} to add a prefix to the name of each +support file that is generated or copied to the destination. After all flags, provide one or more document sources. When multiple documents are rendered at the same time, cross-reference information