Adding procedure-docs and print-procedure-docs.

This commit is contained in:
Alex Shinn 2013-06-10 22:11:09 +09:00
parent d6b6ce955b
commit e74319cad3
2 changed files with 18 additions and 1 deletions

View file

@ -615,3 +615,19 @@ div#footer {padding-bottom: 50px}
(extract-module-docs mod-name #t (list var)) (extract-module-docs mod-name #t (list var))
(make-module-doc-env mod-name)) (make-module-doc-env mod-name))
out))) out)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (procedure-docs proc)
(let ((mod (and (procedure? proc) (containing-module proc))))
(and mod
(generate-docs
(extract-module-docs (car mod) #t (list (procedure-name proc)))
(make-module-doc-env (car mod))))))
(define (print-procedure-docs proc . o)
(let ((out (if (pair? o) (car o) (current-output-port)))
(render (or (and (pair? o) (pair? (cdr o)) (cadr o))
sxml-display-as-text))
(docs (procedure-docs proc)))
(if docs (render docs out))))

View file

@ -6,7 +6,8 @@
(chibi time) (chibi filesystem) (chibi process) (chibi time) (chibi filesystem) (chibi process)
(chibi scribble) (chibi sxml) (chibi highlight) (chibi scribble) (chibi sxml) (chibi highlight)
(chibi type-inference)) (chibi type-inference))
(export print-module-docs print-module-binding-docs (export procedure-docs print-procedure-docs
print-module-docs print-module-binding-docs
generate-docs expand-docs fixup-docs generate-docs expand-docs fixup-docs
extract-module-docs extract-file-docs extract-module-docs extract-file-docs
make-default-doc-env make-module-doc-env) make-default-doc-env make-module-doc-env)