make scribble' (and raco scribble') use a `doc' submodule when present

This commit is contained in:
Matthew Flatt 2013-05-05 10:19:41 -06:00
parent 1e0625bd39
commit f60803c300
3 changed files with 24 additions and 5 deletions

View File

@ -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))))

View File

@ -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.

View File

@ -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)])