From d7b06e9af112c1b98b8ea44a8996a6c9366e2517 Mon Sep 17 00:00:00 2001 From: Jaidyn Levesque <10477760+JadedCtrl@users.noreply.github.com> Date: Wed, 28 Dec 2022 22:42:56 -0600 Subject: [PATCH] Fix env variables in templates --- feedsnake.scm | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/feedsnake.scm b/feedsnake.scm index 186cd89..ab3de9f 100644 --- a/feedsnake.scm +++ b/feedsnake.scm @@ -69,14 +69,10 @@ `((entry-template ,(string-append "From: ~{{~A ||||from-name}}" - "<~{{~A||feedsnake||FROM_USER||author-user||feed-title}}" - "@" - "~{{~A||localhost||FROM_HOST||author-domain||feed-domain}}>" + "<~{{~A||feedsnake@localhost||FROM_ADDRESS||author-address||feed-address}}>" "\n" - "To:~{{ ~A ||You||TO_NAME||USER}}" - "<~{{~A||you||TO_USER||USER}}" - "@" - "~{{~A||localhost||TO_HOST||HOSTNAME}}>" + "To: ~{{~A ||You||TO_NAME||USER}}" + "<~{{~A||you@localhost||TO_ADDRESS}}>" "\n" "Subject: ~{{~A||Unnamed post||title}}\n" "Date: ~{{~A||||updated-rfc228||published-rfc228}}\n" @@ -189,11 +185,16 @@ ;; Writes a given feed entry to the out-port, as per the feedsnake-unix-format template alist (define (write-entry entry template-alist out-port) - (write-string - (entry->string (append (get-environment-variables) entry) - (alist-car-ref 'entry-template template-alist)) - #f - out-port)) + (let ([env-variables + (map (lambda (pair) + (list (string->symbol (car pair)) + (cdr pair))) + (get-environment-variables))]) + (write-string + (entry->string (append env-variables entry) + (alist-car-ref 'entry-template template-alist)) + #f + out-port))) ;; Write an entry to the given file (directory for multifile; normal file otherwise)