瀏覽代碼

Merge pull request #45 from redline6561/minor-cleanups

Minor cleanups
Brit Butler 11 年之前
父節點
當前提交
3692c57123
共有 3 個文件被更改,包括 8 次插入12 次删除
  1. 1 2
      src/coleslaw.lisp
  2. 6 7
      src/config.lisp
  3. 1 3
      src/posts.lisp

+ 1 - 2
src/coleslaw.lisp

22
                        (page-ext *config*))))
22
                        (page-ext *config*))))
23
     (if (pathname-type result)
23
     (if (pathname-type result)
24
         result
24
         result
25
-        (make-pathname :type extension :defaults result)
26
-        )))
25
+        (make-pathname :type extension :defaults result))))
27
 
26
 
28
 (defun page-path (object)
27
 (defun page-path (object)
29
   "The path to store OBJECT at once rendered."
28
   "The path to store OBJECT at once rendered."

+ 6 - 7
src/config.lisp

41
         (apply 'enable-plugin (plugin-path name) args)))))
41
         (apply 'enable-plugin (plugin-path name) args)))))
42
 
42
 
43
 (defun discover-config-path (&optional (path ""))
43
 (defun discover-config-path (&optional (path ""))
44
-  "Checks the project directory for a coleslawrc and if one
45
-doesn't exist, uses the coleslawrc in the home directory."
46
-  (let ((rel-path (make-pathname :directory path :name ".coleslawrc")))
47
-    (if (file-exists-p rel-path)
48
-        rel-path
49
-        (make-pathname :directory (namestring (user-homedir-pathname)) :name ".coleslawrc"))))
44
+  "Check the supplied PATH for a .coleslawrc and if one
45
+doesn't exist, use the .coleslawrc in the home directory."
46
+  (let ((custom-path (rel-path path ".coleslawrc")))
47
+    (if (file-exists-p custom-path)
48
+        custom-path
49
+        (rel-path (user-homedir-pathname) ".coleslawrc"))))
50
 
50
 
51
 (defun load-config (config-key)
51
 (defun load-config (config-key)
52
   "Load the coleslaw configuration from DIR/.coleslawrc, using CONFIG-KEY
52
   "Load the coleslaw configuration from DIR/.coleslawrc, using CONFIG-KEY
53
 if necessary. DIR is ~ by default."
53
 if necessary. DIR is ~ by default."
54
-
55
   (with-open-file (in (discover-config-path config-key))
54
   (with-open-file (in (discover-config-path config-key))
56
     (let ((config-form (read in)))
55
     (let ((config-form (read in)))
57
       (if (symbolp (car config-form))
56
       (if (symbolp (car config-form))

+ 1 - 3
src/posts.lisp

13
       (setf (content-slug object) (slugify title)
13
       (setf (content-slug object) (slugify title)
14
             format (make-keyword (string-upcase format))
14
             format (make-keyword (string-upcase format))
15
             text (render-content text format)
15
             text (render-content text format)
16
-            author (if author
17
-                       author
18
-                       (author *config*)))))
16
+            author (or author (author *config*)))))
19
 
17
 
20
 (defmethod render ((object post) &key prev next)
18
 (defmethod render ((object post) &key prev next)
21
   (funcall (theme-fn 'post) (list :config *config*
19
   (funcall (theme-fn 'post) (list :config *config*