Commit 8ef92206 authored by Cheshire Yang's avatar Cheshire Yang
Browse files

Merge branch 'fix-pathnames' into 'master'

Fix pathnames to use the asd defintion as the root

See merge request !1
parents 5c3d2896 d6f23fb6
;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
(in-package :cl-site) (in-package :cl-site)
(require :asdf)
;; Locations for various files ;; Locations for various files
(defparameter *PAGES-DIR* "content/") (defparameter *PAGES-DIR* (asdf:system-relative-pathname :cl-site "content/"))
(defparameter *LAYOUT-DIR* "layout/templates/") (defparameter *LAYOUT-DIR* (asdf:system-relative-pathname :cl-site "layout/templates/"))
(defparameter *OUTPUT-DIR* "output/") (defparameter *OUTPUT-DIR* (asdf:system-relative-pathname :cl-site "output/"))
(defparameter *PRIVATE-KEYS* '(:slug :content)) (defparameter *PRIVATE-KEYS* '(:slug :content))
(defparameter *PAGES* (defparameter *PAGES*
...@@ -18,8 +19,11 @@ ...@@ -18,8 +19,11 @@
(defun make-path (prefix page) (defun make-path (prefix page)
(let ((path (cdr (assoc :content page))))
(if (pathnamep prefix)
(merge-pathnames path prefix)
(pathname (concatenate 'string (pathname (concatenate 'string
prefix (cdr (assoc :content page))))) prefix path)))))
(defun file-to-string (filepath) (defun file-to-string (filepath)
(with-open-file (stream filepath) (with-open-file (stream filepath)
...@@ -40,7 +44,6 @@ ...@@ -40,7 +44,6 @@
(mustache:render template-path page-context output-stream)))) (mustache:render template-path page-context output-stream))))
(defun make-site () (defun make-site ()
(let (let ((template-path (pathname (merge-pathnames *LAYOUT-DIR* *DEFAULT-PAGE-TEMPLATE*))))
((template-path (pathname (concatenate 'string *LAYOUT-DIR* *DEFAULT-PAGE-TEMPLATE*))))
(loop for page in *PAGES* (loop for page in *PAGES*
do (render-page page template-path)))) do (render-page page template-path))))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment