scribble/base: fix problem with macro-introduced `include-section'

original commit: 4fd0d7454bd6392d97e2c5d1b917de34c13c6c48
This commit is contained in:
Matthew Flatt 2013-08-30 15:31:47 -06:00
parent 41af75965d
commit 10af84fa62
3 changed files with 15 additions and 2 deletions

View File

@ -118,14 +118,14 @@
(define-syntax (include-section stx)
(syntax-case stx ()
[(_ mod)
(with-syntax ([mod (syntax-local-introduce #'mod)])
(with-syntax ([doc-from-mod (datum->syntax #'mod 'doc)])
(unless (module-path? (syntax->datum #'mod))
(raise-syntax-error #f
"not a module path"
stx
#'mod))
#'(begin
(require (only-in mod doc))
(require (only-in mod [doc-from-mod doc]))
doc))]))
;; ----------------------------------------

View File

@ -0,0 +1,6 @@
#lang scribble/base
@; Check that a macro-introduced `include-section' works:
@(define-syntax-rule (inc) (include-section "diamond.scrbl"))
@(inc)

View File

@ -0,0 +1,7 @@
1.
This example checks that @ is not an escape character if we make a
reader that uses a different escape character.
It also makes sure that a non-ASCII character like diamond is ok as an
escape character.