Fix env variables in templates

This commit is contained in:
Jaidyn Ann 2022-12-28 22:42:56 -06:00
parent 7c241aab44
commit d7b06e9af1

View File

@ -69,14 +69,10 @@
`((entry-template `((entry-template
,(string-append ,(string-append
"From: ~{{~A ||||from-name}}" "From: ~{{~A ||||from-name}}"
"<~{{~A||feedsnake||FROM_USER||author-user||feed-title}}" "<~{{~A||feedsnake@localhost||FROM_ADDRESS||author-address||feed-address}}>"
"@"
"~{{~A||localhost||FROM_HOST||author-domain||feed-domain}}>"
"\n" "\n"
"To:~{{ ~A ||You||TO_NAME||USER}}" "To: ~{{~A ||You||TO_NAME||USER}}"
"<~{{~A||you||TO_USER||USER}}" "<~{{~A||you@localhost||TO_ADDRESS}}>"
"@"
"~{{~A||localhost||TO_HOST||HOSTNAME}}>"
"\n" "\n"
"Subject: ~{{~A||Unnamed post||title}}\n" "Subject: ~{{~A||Unnamed post||title}}\n"
"Date: ~{{~A||||updated-rfc228||published-rfc228}}\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 ;; 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) (define (write-entry entry template-alist out-port)
(write-string (let ([env-variables
(entry->string (append (get-environment-variables) entry) (map (lambda (pair)
(alist-car-ref 'entry-template template-alist)) (list (string->symbol (car pair))
#f (cdr pair)))
out-port)) (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) ;; Write an entry to the given file (directory for multifile; normal file otherwise)