Skip to content

Commit 78765a8

Browse files
committed
fix: macros and save function
1. The (save) function had to refer to spinneret:*html* 2. Some functions and parameters had to be available at macros time
1 parent 006f315 commit 78765a8

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

src/main.lisp

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,28 @@
2121

2222
;; SETUP LOCALIZATION
2323

24-
(defun read-lang-lisp (file-path)
25-
(with-open-file (in file-path)
26-
(with-standard-io-syntax
27-
(read in))))
28-
29-
(defparameter *lang* (read-lang-lisp "/home/davd/clisp/be-it/src/lang.en.lisp"))
30-
31-
(defun lang-get (key)
32-
"Get the translation for the given key."
33-
(getf *lang* key))
24+
(eval-when
25+
(:compile-toplevel
26+
:load-toplevel
27+
:execute)
28+
(defun read-lang-lisp (file-path)
29+
(with-open-file (in file-path)
30+
(with-standard-io-syntax
31+
(read in)))))
32+
33+
(eval-when
34+
(:compile-toplevel
35+
:load-toplevel
36+
:execute)
37+
(defparameter *lang* (read-lang-lisp "/home/davd/clisp/be-it/src/lang.en.lisp")))
38+
39+
(eval-when
40+
(:compile-toplevel
41+
:load-toplevel
42+
:execute)
43+
(defun lang-get (key)
44+
"Get the translation for the given key."
45+
(getf *lang* key)))
3446

3547
;; DEFINE WEB PAGE COMPONENTS
3648

@@ -176,10 +188,9 @@
176188
:initial-value (:p))))))
177189

178190
(defun save ()
179-
"Generate and write HTML into the desired system file."
180191
(let ((linode-html-file-path "/mnt/linode/my/var/www/localhost/htdocs/index.html")
181192
(project-html-file-path "/home/davd/clisp/be-it/src/my-cv.html"))
182-
(with-open-file (cv-file project-html-file-path :direction :output
183-
:if-exists :supersede)
184-
(let ((*html* cv-file))
185-
(index)))))
193+
(with-open-file (cv-file project-html-file-path :direction :output
194+
:if-exists :supersede)
195+
(let ((spinneret:*html* cv-file))
196+
(index)))))

0 commit comments

Comments
 (0)