diff --git a/collects/scribble/run.rkt b/collects/scribble/run.rkt index 7d116842f0..526ddb3664 100644 --- a/collects/scribble/run.rkt +++ b/collects/scribble/run.rkt @@ -105,7 +105,11 @@ (current-quiet #t)] #:args (file . another-file) (let ([files (cons file another-file)]) - (build-docs (map (lambda (file) (dynamic-require `(file ,file) 'doc)) + (build-docs (map (lambda (file) + ;; Try `doc' submodule, first: + (if (module-declared? `(submod (file ,file) doc) #t) + (dynamic-require `(submod (file ,file) doc) 'doc) + (dynamic-require `(file ,file) 'doc))) files) files)))) diff --git a/collects/scribblings/scribble/running.scrbl b/collects/scribblings/scribble/running.scrbl index 74e94a1fc0..c762370eb6 100644 --- a/collects/scribblings/scribble/running.scrbl +++ b/collects/scribblings/scribble/running.scrbl @@ -51,9 +51,16 @@ flag to specify a destination directory (for any number of source 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 -in one document is visible to the other documents. See +After all flags, provide one or more document sources, where each +source declares a module. The module should either have a @racket[doc] +@tech[#:doc '(lib "scribblings/reference/reference.scrbl")]{submodule} +that exports @racket[doc] as a @racket[part], or it should directly +export @racket[doc] as a @racket[part]. (The submodule is tried first, +and the main module is not directly loaded or evaluated if the +submodule can be loaded on its own.) + +When multiple documents are rendered at the same time, cross-reference +information in one document is visible to the other documents. See @secref["xref-flags"] for information on references that cross documents that are built separately. diff --git a/collects/setup/scribble.rkt b/collects/setup/scribble.rkt index 06c9e5fd12..930d330bab 100644 --- a/collects/setup/scribble.rkt +++ b/collects/setup/scribble.rkt @@ -1072,7 +1072,15 @@ ;; hard-wiring the "manual.rkt" library: (namespace-attach-module ns 'scribble/manual p) (parameterize ([current-namespace p]) - (call-in-nested-thread (lambda () (dynamic-require mod-path 'doc))))))) + (call-in-nested-thread (lambda () + (define sub + (if (and (pair? mod-path) + (eq? (car mod-path) 'submod)) + (append mod-path '(doc)) + `(submod ,mod-path doc))) + (if (module-declared? sub #t) + (dynamic-require sub 'doc) + (dynamic-require mod-path 'doc)))))))) (define (write- latex-dest vers doc name datas prep!) (let* ([filename (sxref-path latex-dest doc name)])