From b728c961666c3be079d5ea2524d5a0dba217166e Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Wed, 16 Dec 2015 13:41:01 -0800 Subject: [PATCH] make Scribble rendering compatible with `scribble/lp` --- render.rkt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/render.rkt b/render.rkt index adb6c99..681d7c3 100644 --- a/render.rkt +++ b/render.rkt @@ -156,8 +156,13 @@ ;; it will foul up the render ;; so recompile first to avoid "can't redefine a constant" errors. (managed-compile-zo source-path) + ;; 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))))) ;; BTW this next action has side effects: scribble will copy in its core files if they don't exist. - (scribble-render (list (dynamic-require source-path 'doc)) (list source-path)))) + (when doc + (scribble-render (list doc) (list source-path))))) (define result (file->string (->output-path source-path))) (delete-file (->output-path source-path)) ; because render promises the data, not the side effect result)