Przeglądaj źródła

Merge pull request #45 from redline6561/minor-cleanups

Minor cleanups
Brit Butler 11 lat temu
rodzic
commit
3692c57123
3 zmienionych plików z 8 dodań i 12 usunięć
  1. 1 2
      src/coleslaw.lisp
  2. 6 7
      src/config.lisp
  3. 1 3
      src/posts.lisp

+ 1 - 2
src/coleslaw.lisp

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

+ 6 - 7
src/config.lisp

@@ -41,17 +41,16 @@ are in the plugins folder in coleslaw's source directory."
41 41
         (apply 'enable-plugin (plugin-path name) args)))))
42 42
 
43 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 51
 (defun load-config (config-key)
52 52
   "Load the coleslaw configuration from DIR/.coleslawrc, using CONFIG-KEY
53 53
 if necessary. DIR is ~ by default."
54
-
55 54
   (with-open-file (in (discover-config-path config-key))
56 55
     (let ((config-form (read in)))
57 56
       (if (symbolp (car config-form))

+ 1 - 3
src/posts.lisp

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