diff --git a/lib/chibi/doc.scm b/lib/chibi/doc.scm index 637fe6cb..d46d3d66 100644 --- a/lib/chibi/doc.scm +++ b/lib/chibi/doc.scm @@ -615,3 +615,19 @@ div#footer {padding-bottom: 50px} (extract-module-docs mod-name #t (list var)) (make-module-doc-env mod-name)) 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)))) diff --git a/lib/chibi/doc.sld b/lib/chibi/doc.sld index cb3a2e6e..db1ad15a 100644 --- a/lib/chibi/doc.sld +++ b/lib/chibi/doc.sld @@ -6,7 +6,8 @@ (chibi time) (chibi filesystem) (chibi process) (chibi scribble) (chibi sxml) (chibi highlight) (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 extract-module-docs extract-file-docs make-default-doc-env make-module-doc-env)