Bladeren bron

Export title-of, author-of, and find-content-by-path. Cleanup twitter plugin.

Brit Butler 11 jaren geleden
bovenliggende
commit
7326e31479
5 gewijzigde bestanden met toevoegingen van 25 en 17 verwijderingen
  1. 1 1
      plugins/static-pages.lisp
  2. 11 9
      plugins/twitter.lisp
  3. 1 1
      src/indexes.lisp
  4. 8 2
      src/packages.lisp
  5. 4 4
      src/posts.lisp

+ 1 - 1
plugins/static-pages.lisp

@@ -15,7 +15,7 @@
15 15
 (in-package :coleslaw-static-pages)
16 16
 
17 17
 (defclass page (content)
18
-  ((title :initarg :title :reader page-title)
18
+  ((title :initarg :title :reader title-of)
19 19
    (url :initarg :url :reader page-url)))
20 20
 
21 21
 (defmethod initialize-instance :after ((object page) &key)

+ 11 - 9
plugins/twitter.lisp

@@ -3,12 +3,14 @@
3 3
 
4 4
 (defpackage :coleslaw-twitter
5 5
   (:use :cl)
6
-  (:import-from :coleslaw
7
-                :*config*
8
-                :deploy
9
-                :get-updated-files
10
-                :page-url
11
-                :plugin-conf-error)
6
+  (:import-from :coleslaw #:*config*
7
+                          #:deploy
8
+                          #:get-updated-files
9
+                          #:find-content-by-path
10
+                          #:title-of
11
+                          #:author-of
12
+                          #:page-url
13
+                          #:plugin-conf-error)
12 14
   (:export #:enable))
13 15
 
14 16
 (in-package :coleslaw-twitter)
@@ -20,8 +22,8 @@
20 22
 coleslaw:post and returns the tweet content.")
21 23
 
22 24
 (defvar *tweet-format-dsl-mapping*
23
-  '((:title . coleslaw::post-title)
24
-    (:author . coleslaw::post-author)))
25
+  '((:title . title-of)
26
+    (:author . author-of)))
25 27
 
26 28
 (define-condition malformed-tweet-format (error)
27 29
   ((item :initarg :item :reader item))
@@ -87,7 +89,7 @@ coleslaw:post and returns the tweet content.")
87 89
 
88 90
 (defun tweet-new-post (file)
89 91
   "Retrieve content matching FILE from in memory DB and publish it."
90
-  (let ((post (coleslaw::find-content-by-path file)))
92
+  (let ((post (find-content-by-path file)))
91 93
     (chirp:statuses/update (%format-post 0 post))))
92 94
 
93 95
 (defun %format-post (offset post)

+ 1 - 1
src/indexes.lisp

@@ -2,7 +2,7 @@
2 2
 
3 3
 (defclass index ()
4 4
   ((slug :initarg :slug :reader index-slug)
5
-   (title :initarg :title :reader index-title)
5
+   (title :initarg :title :reader title-of)
6 6
    (content :initarg :content :reader index-content)))
7 7
 
8 8
 (defmethod render ((object index) &key prev next)

+ 8 - 2
src/packages.lisp

@@ -10,14 +10,20 @@
10 10
   (:export #:main
11 11
            #:preview
12 12
            #:*config*
13
+           ;; Core Classes
13 14
            #:content
14 15
            #:post
15 16
            #:index
17
+           ;; Content Helpers
18
+           #:title-of
19
+           #:author-of
20
+           #:find-content-by-path
21
+           ;; Plugin API + Theming
22
+           #:plugin-conf-error
16 23
            #:render-text
17 24
            #:add-injection
18
-           #:theme-fn
19 25
            #:get-updated-files
20
-           #:plugin-conf-error
26
+           #:theme-fn
21 27
            ;; The Document Protocol
22 28
            #:add-document
23 29
            #:find-all

+ 4 - 4
src/posts.lisp

@@ -1,13 +1,13 @@
1 1
 (in-package :coleslaw)
2 2
 
3 3
 (defclass post (content)
4
-  ((title :initform nil :initarg :title :accessor post-title)
5
-   (author :initform nil :initarg :author :accessor post-author)
4
+  ((title :initform nil :initarg :title :accessor title-of)
5
+   (author :initform nil :initarg :author :accessor author-of)
6 6
    (format :initform nil :initarg :format :accessor post-format)))
7 7
 
8 8
 (defmethod initialize-instance :after ((object post) &key)
9
-  (with-accessors ((title post-title)
10
-                   (author post-author)
9
+  (with-accessors ((title title-of)
10
+                   (author author-of)
11 11
                    (format post-format)
12 12
                    (text content-text)) object
13 13
       (setf (content-slug object) (slugify title)