- ;; define the COMMAND-markup-list function
- ,(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
- (let ,(map (lambda (prop-spec)
- (let ((prop (car prop-spec))
- (default-value (if (null? (cdr prop-spec))
- #f
- (cadr prop-spec)))
- (props (cadr args)))
- `(,prop (chain-assoc-get ',prop ,props ,default-value))))
- (filter pair? properties))
- ,@real-body)))
- (set! (markup-command-signature ,command-name) (list ,@signature))
- ;; Used properties, for markup documentation
- (set! (markup-function-properties ,command-name)
- (list ,@(map (lambda (prop-spec)
- (cond ((symbol? prop-spec)
- prop-spec)
- ((not (null? (cdr prop-spec)))
- `(list ',(car prop-spec) ,(cadr prop-spec)))
- (else
- `(list ',(car prop-spec)))))
- properties)))
- ;; it's a markup-list command:
- (set! (markup-list-function? ,command-name) #t)
- ;; define the make-COMMAND-markup-list function
+ ,(if args
+ `(define-public ,command-name (markup-list-lambda ,args ,@definition))
+ `(define-public ,command-name ,@definition))