|
|
|
@ -162,18 +162,20 @@
|
|
|
|
|
|
|
|
|
|
(define (render-scribble-source source-path . _)
|
|
|
|
|
;((complete-path?) #:rest any/c . ->* . string?)
|
|
|
|
|
(define scribble-render (parameterize ([current-namespace (make-base-namespace)])
|
|
|
|
|
(dynamic-require 'scribble/render 'render)))
|
|
|
|
|
(time (parameterize ([current-directory (->complete-path (dirname source-path))])
|
|
|
|
|
;; if there's a compiled zo file for the Scribble file,
|
|
|
|
|
;; (as is usually the case in existing packages)
|
|
|
|
|
;; it will foul up the render
|
|
|
|
|
;; so recompile first to avoid "can't redefine a constant" errors.
|
|
|
|
|
(managed-compile-zo source-path)
|
|
|
|
|
(local-require scribble/core scribble/manual (prefix-in scribble- scribble/render))
|
|
|
|
|
(define source-dir (dirname source-path))
|
|
|
|
|
;; make fresh namespace for scribble rendering (avoids dep/zo caching)
|
|
|
|
|
(time (parameterize ([current-namespace (make-base-namespace)]
|
|
|
|
|
[current-directory (->complete-path source-dir)])
|
|
|
|
|
(namespace-attach-module (namespace-anchor->namespace render-module-ns) 'scribble/core)
|
|
|
|
|
(namespace-attach-module (namespace-anchor->namespace render-module-ns) 'scribble/manual)
|
|
|
|
|
|
|
|
|
|
;; scribble/lp files have their doc export in a 'doc submodule, so check both locations
|
|
|
|
|
(define doc (dynamic-require source-path 'doc
|
|
|
|
|
(λ () (dynamic-require `(submod ,source-path doc) 'doc
|
|
|
|
|
(λ () #f)))))
|
|
|
|
|
(define doc
|
|
|
|
|
[cond
|
|
|
|
|
[(dynamic-require source-path 'doc (λ () #f))]
|
|
|
|
|
[(dynamic-require `(submod ,source-path doc) 'doc (λ () #f))]
|
|
|
|
|
[else #f]])
|
|
|
|
|
;; BTW this next action has side effects: scribble will copy in its core files if they don't exist.
|
|
|
|
|
(when doc
|
|
|
|
|
(scribble-render (list doc) (list source-path)))))
|
|
|
|
|