diff --git a/collects/scribble/lp-include.ss b/collects/scribble/lp-include.ss index 0dc35fb3..2c68e8c1 100644 --- a/collects/scribble/lp-include.ss +++ b/collects/scribble/lp-include.ss @@ -32,12 +32,18 @@ (if (n . > . 1) #'(void) (with-syntax ([tag str] - [str str]) + [str str] + [((for-label-mod ...) ...) + (map (lambda (expr) + (syntax-case expr (require) + [(require mod ...) + #'(mod ...)] + [else null])) + (syntax->list #'(expr ...)))]) #`(begin - ;; ---- This is the new part -------- (define-syntax name (make-element-id-transformer (lambda (stx) #'(chunkref name)))) - ;; ---------------------------------- + (require (for-label for-label-mod ... ...)) (make-splice (list (make-toc-element #f diff --git a/collects/scribble/lp/lang/lang.ss b/collects/scribble/lp/lang/lang.ss index f2559580..7911f772 100644 --- a/collects/scribble/lp/lang/lang.ss +++ b/collects/scribble/lp/lang/lang.ss @@ -68,7 +68,7 @@ chunk-mentions)]) #`(begin body ... (let ([b-id (void)]) b-use) ...))) -(define-syntax (module-begin stx) +(define-syntax (literate-begin stx) (syntax-case stx () [(module-begin expr ...) (with-syntax @@ -98,6 +98,12 @@ #%provide))) (cons expanded (loop (cdr exprs)))] [else (loop (cdr exprs))]))]))]) - #'(#%module-begin - body-code ... - (tangle)))])) + #'(begin + body-code ... + (tangle)))])) + +(define-syntax (module-begin stx) + (syntax-case stx () + [(_ id exprs . body) + #'(#%module-begin + (literate-begin id exprs . body))]))