~dieggsy/chalk

da310690f29c8e9f158983e6023e2a9619bae663 — dieggsy 3 years ago a6bffb2
Add support for multi-line script
1 files changed, 5 insertions(+), 3 deletions(-)

M chalk-bin.scm
M chalk-bin.scm => chalk-bin.scm +5 -3
@@ 192,18 192,20 @@
           (document-file (make-pathname file-relpath (cadr exp)))))))

(define (document-script script-exp)
  (let ((docstr (find-docstr script-exp))
  (let ((docstr (filter string? script-exp))
        (highlight (find-tag '@highlight script-exp))
        (pre (find-tag '@pre script-exp))
        (post (find-tag '@post script-exp)))
    (unless (not docstr)
    (unless (null? docstr)
      (when pre
        (printf "~a\n" (cadr pre)))
      (printf "<enscript~a>\n"
              (if highlight
                  (sprintf " highlight=\"~a\"" (cadr highlight))
                  ""))
      (printf "~a\n" (string-trim-both docstr))
      (for-each (lambda (s)
                  (printf "~a\n" s))
                docstr)
      (printf "</enscript>\n\n")
      (when post
        (printf "~a\n" (cadr post))))))