X-Git-Url: http://git.kpe.io/?p=lml2.git;a=blobdiff_plain;f=files.lisp;h=db1a9b1827d2d76a33865d8fd4288cf8a9aa4d00;hp=7efb4e64a72db0bd2bcc4571817201c72d1c851c;hb=9829ac27ac1f612c99b259b0b1daefffb269691c;hpb=be1b61b9a1a19ea618b9cd854d6539957c4efd57 diff --git a/files.lisp b/files.lisp index 7efb4e6..db1a9b1 100644 --- a/files.lisp +++ b/files.lisp @@ -19,24 +19,26 @@ (defvar *sources-dir* nil) ) -(defmacro lml-file-name (file &optional (type :source)) - (let ((f file)) - (when (and (consp f) (eql (car f) 'cl:quote)) - (setq f (cadr f))) - (when (symbolp f) - (setq f (string-downcase (symbol-name f)))) - (when (stringp f) - (unless (position #\. f) - (setq f (concatenate 'string f ".html")))) - (if *sources-dir* - (make-pathname :defaults (ecase type - (:source *sources-dir*) - (:output *output-dir*)) - :name `,(pathname-name f) - :type `,(pathname-type f)) +(defun lml-file-name (f &optional (type :source)) + (when (and (consp f) (eql (car f) 'cl:quote)) + (setq f (cadr f))) + (when (symbolp f) + (setq f (string-downcase (symbol-name f)))) + (when (stringp f) + (unless (position #\. f) + (setq f (concatenate 'string f ".html")))) + (if (or (and (eq type :source) *sources-dir*) + (and (eq type :output) *output-dir*)) + (merge-pathnames + (make-pathname :name (pathname-name f) + :type (pathname-type f) + :directory (pathname-directory f)) + (ecase type + (:source *sources-dir*) + (:output *output-dir*))) (if (stringp f) (parse-namestring f) - f)))) + f))) (defmacro with-dir ((output &key sources) &body body) (let ((output-dir (gensym)) @@ -74,5 +76,5 @@ (defun lml-load (file) (lml-load-path (eval `(lml-file-name ,file :source)))) -(defun include-file (file) +(defun insert-file (file) (print-file-contents file *html-stream*))