hyper-literate/collects/scribble/docreader.ss
Eli Barzilay 49d8aded99 stupid typo
svn: r6769

original commit: 1a27b9a1a9061cf0f3ec24f214d8a09b98c38e83
2007-06-29 15:13:26 +00:00

26 lines
787 B
Scheme

(module docreader mzscheme
(require (prefix scribble: "reader.ss")
(lib "kw.ss"))
(provide (rename *read read)
(rename *read-syntax read-syntax))
(define/kw (*read #:optional [inp (current-input-port)])
(wrap inp (scribble:read-inside inp)))
(define/kw (*read-syntax #:optional src [port (current-input-port)])
(wrap port (scribble:read-inside-syntax src port)))
(define (wrap port body)
(let* ([p-name (object-name port)]
[name (if (path? p-name)
(let-values ([(base name dir?) (split-path p-name)])
(string->symbol (path->string (path-replace-suffix name #""))))
'page)]
[id 'doc])
`(module ,name (lib "doclang.ss" "scribble")
(#%module-begin
,id ()
. ,body)))))