prop-strings))
(define (doc-markup-function func)
- (let* ((doc-str (procedure-documentation func))
+ (let* ((full-doc (procedure-documentation func))
+ (match-args (and full-doc (string-match "^\\([^)]*\\)\n" full-doc)))
+ (arg-names (if match-args
+ (with-input-from-string (match:string match-args) read)
+ (circular-list "arg")))
+ (doc-str (if match-args (match:suffix match-args) full-doc))
(f-name (symbol->string (procedure-name func)))
(c-name (regexp-substitute/global #f "-markup(-list)?$" f-name 'pre "" 'post))
(sig (object-property func 'markup-signature))
- (arg-names (let ((arg-list (cadr (procedure-source func))))
- (if (list? arg-list)
- (map symbol->string (cddr arg-list))
- (make-list (length sig) "arg"))))
(sig-type-names (map type-name sig))
(signature-str
(string-join
- (map (lambda (x y) (string-append
- "@var{" x "} (" y ")" ))
+ (map (lambda (x y)
+ (format #f "@var{~a} (~a)" x y))
arg-names sig-type-names)
" " )))
(set! body (cddr body)))
`(begin
;; define the COMMAND-markup function
- ,(let* ((documentation (if (string? (car body))
- (list (car body))
- '()))
- (real-body (if (or (null? documentation)
+ ,(let* ((documentation
+ (format #f "~a\n~a" (cddr args)
+ (if (string? (car body)) (car body) "")))
+ (real-body (if (or (not (string? (car body)))
(null? (cdr body)))
body (cdr body))))
`(define-public (,command-name ,@args)
- ,@documentation
+ ,documentation
(let ,(map (lambda (prop-spec)
(let ((prop (car prop-spec))
(default-value (if (null? (cdr prop-spec))
(set! body (cddr body)))
`(begin
;; define the COMMAND-markup-list function
- ,(let* ((documentation (if (string? (car body))
- (list (car body))
- '()))
- (real-body (if (or (null? documentation)
+ ,(let* ((documentation
+ (format #f "~a\n~a" (cddr args)
+ (if (string? (car body)) (car body) "")))
+ (real-body (if (or (not (string? (car body)))
(null? (cdr body)))
body (cdr body))))
`(define-public (,command-name ,@args)
- ,@documentation
+ ,documentation
(let ,(map (lambda (prop-spec)
(let ((prop (car prop-spec))
(default-value (if (null? (cdr prop-spec))