revisions to configuration option patch in response to code review

This commit is contained in:
tycho garen 2014-03-22 12:53:49 -04:00
parent 25891fb7ca
commit 795ddf5f1b
3 changed files with 12 additions and 13 deletions

View file

@ -17,11 +17,9 @@
(defmethod page-url :around ((object t))
(let ((result (call-next-method))
(extension (if (string-equal (pageext *config*) "/")
(extension (if (string= (page-ext *config*) "/")
"html"
(pageext *config*))))
(when (string= (char extension 0) ".")
(setf extension (string-trim "." extension)))
(page-ext *config*))))
(if (pathname-type result)
result
(make-pathname :type extension :defaults result)

View file

@ -10,9 +10,9 @@
(repo :initarg :repo :accessor repo)
(sitenav :initarg :sitenav :accessor sitenav)
(staging-dir :initarg :staging-dir :accessor staging-dir)
(postsdir :initarg :postsdir :accessor postsdir :initform "posts")
(separator :initarg :separator :accessor separator :initform ";;;;;")
(pageext :initarg :pageext :accessor pageext :initform ".html")
(posts-dir :initarg :posts-dir :accessor posts-dir :initform "posts")
(separator :initarg :separator :accessor separator :initform ";;;;;")
(page-ext :initarg :page-ext :accessor page-ext :initform "html")
(title :initarg :title :accessor title)
(theme :initarg :theme :accessor theme)))
@ -41,11 +41,12 @@ are in the plugins folder in coleslaw's source directory."
(apply 'enable-plugin (plugin-path name) args)))))
(defun discover-config-path (&optional (path ""))
(let ((default-path (make-pathname :directory (namestring (user-homedir-pathname)) :name ".coleslawrc"))
(custom-path (make-pathname :directory path :name ".coleslawrc")))
(cond
((file-exists-p custom-path) custom-path)
((file-exists-p default-path) default-path))))
"Checks the project directory for a coleslawrc and if one
doesn't exist, uses the coleslawrc in the home directory."
(let ((rel-path (make-pathname :directory path :name ".coleslawrc")))
(if (file-exists-p rel-path)
rel-path
(make-pathname :directory (namestring (user-homedir-pathname)) :name ".coleslawrc"))))
(defun load-config (config-key)
"Load the coleslaw configuration from DIR/.coleslawrc, using CONFIG-KEY

View file

@ -24,7 +24,7 @@
:next next)))
(defmethod page-url ((object post))
(format nil "~a/~a" (postsdir *config*) (content-slug object)))
(format nil "~a/~a" (posts-dir *config*) (content-slug object)))
(defmethod publish ((content-type (eql :post)))
(loop for (next post prev) on (append '(nil) (by-date (find-all 'post)))