Opens and loads fileref with (read-entity); returns the content of fileref as a (literal). Trims the last trailing newline off the file so that "the right thing" happens in asis environments.
(define (include-file fileref)
;; Return the literal content of fileref
(let* ((newline #\U-000D)
(file-content (read-entity fileref))
(file-length (string-length file-content))
;; If the last char is a newline, drop it, otherwise print it...
(content (if (equal? newline (string-ref file-content
(- file-length 1)))
(substring file-content 0 (- file-length 1))
file-content)))
(literal content)))