From 423ac382f9e73bf1ca7fc6b400f98db087cd7d22 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 5 Jun 2024 09:21:25 -0500 Subject: Write executable This involved moving `src' to `lib' and making `bin'. `bin' holds the program, which only imports `jimmy.main' from lib. --- src/wrap.scm | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 src/wrap.scm (limited to 'src/wrap.scm') diff --git a/src/wrap.scm b/src/wrap.scm deleted file mode 100644 index aa077d8..0000000 --- a/src/wrap.scm +++ /dev/null @@ -1,23 +0,0 @@ -(declare (module (jimmy wrap))) - -(import scheme (chicken base) - (jimmy emit) - (jimmy util) - (only (chicken io) read-string) - (only (chicken port) with-output-to-string) - (only (chicken string) string-translate* string-intersperse)) - -;; templates are strings with variables interpolated with "{{variables}}" - -(define-public (wrap document template) - (let* ((meta (map (lambda (el) - (cons (string-append "{{" (car el) "}}") - (string-intersperse (cdr el) " "))) - (alist-walk document 'meta))) - (body (cons "{{body}}" - (with-output-to-string - (lambda () (emit document)))))) - (string-translate* template (cons body meta)))) - -(define-public (wrap-with document file) - (wrap document (with-input-from-file file read-string))) -- cgit 1.4.1-21-gabe81