implemented loading templates from specified template folder
updated old usage of force-log
This commit is contained in:
parent
895e54a44b
commit
bbdba72c8a
10
lspx.lisp
10
lspx.lisp
|
@ -84,6 +84,13 @@
|
|||
(translate-logical-pathname "web:static;"))
|
||||
(log:debug "Using ~A for templates."
|
||||
(translate-logical-pathname "web:template;"))
|
||||
|
||||
(log:info "loading templates...")
|
||||
(let ((*package* #.(find-package :lspx)))
|
||||
(uiop:collect-sub*directories
|
||||
"web:template;" (constantly t) (constantly t)
|
||||
#'(lambda (dir)
|
||||
(mapcar #'load (uiop:directory-files dir "*.lspt")))))
|
||||
|
||||
;; creates our server handler, fetching the port if provided
|
||||
(setf *server*
|
||||
|
@ -108,6 +115,7 @@
|
|||
(bt:thread-name th)))
|
||||
(bt:all-threads)))
|
||||
(error (e)
|
||||
(force-log "An Unexpected Error Occured:~%~A" e)))
|
||||
(log:fatal "!!ERROR ~A~%~%BACKTRACE: ~A"
|
||||
e (trivial-backtrace:print-backtrace e :output nil))))
|
||||
|
||||
(clack:stop *server*)))
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
(defpackage #:lspx
|
||||
(:use #:cl #:with-user-abort
|
||||
#:lspx.errors
|
||||
#:lspx.template)
|
||||
#:lspx.errors #:lspx.template)
|
||||
(:local-nicknames (:a :alexandria))
|
||||
(:import-from :unix-opts
|
||||
:define-opts
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
FORMAT is either a format-compatible string or a function that accepts one parameter (the inner-html)
|
||||
|
||||
if additional configuration is desired, html attributes of the form attr=\"value\" are converted into :ATTR \"value\" and applied to the function at render time"
|
||||
(log:info "defining new template for tag ~A" tag)
|
||||
(setf (gethash tag *custom-tags*)
|
||||
(typecase format
|
||||
(string (lambda (in &rest _)
|
||||
|
|
Loading…
Reference in New Issue