Просмотр исходного кода

Some last tweaks for Summary Cards before 0.9.6.

Brit Butler лет назад: 10
Родитель
Сommit
c7fc38b73c
3 измененных файлов с 53 добавлено и 41 удалено
  1. 4 1
      NEWS.md
  2. 7 0
      docs/plugin-use.md
  3. 42 40
      tests/plugins/twitter-summary-card.lisp

+ 4 - 1
NEWS.md

@@ -7,7 +7,7 @@ Legend:
7 7
     A change to Coleslaw's exported interface. Plugins or Themes that have
8 8
     not been upstreamed are effected and may require minor effort to fix.
9 9
 
10
-## Changes for 0.9.6 (2014-09-17):
10
+## Changes for 0.9.6 (2014-09-27):
11 11
 
12 12
 * **SITE-BREAKING CHANGE**: Coleslaw now defaults to a "basic" deploy
13 13
   instead of the previous symlinked, timestamped deploy strategy.
@@ -20,6 +20,8 @@ Legend:
20 20
 * **Incompatible Change**: The interface of the `add-injection` function
21 21
   has changed. If you have written a plugin which uses `add-injection`
22 22
   you should update it to conform to the [new interface][plg-api].
23
+* **New Plugin**: Support for [twitter summary cards][ts-cards] on blog
24
+  posts has been added thanks to @PuercoPop.
23 25
 * **Docs**: Improved README and Theming docs. New Config File docs.
24 26
 * Changes to `:routing` would previously break links in the templates
25 27
   but now work seamlessly due to the updated URL handling.
@@ -141,3 +143,4 @@ Legend:
141 143
 [example.rc]: https://github.com/redline6561/coleslaw/blob/master/examples/example.coleslawrc
142 144
 [plg-use]: https://github.com/redline6561/coleslaw/blob/master/docs/plugin-use.md
143 145
 [plg-api]: https://github.com/redline6561/coleslaw/blob/master/docs/plugin-api.md#extension-points
146
+[ts-cards]: https://dev.twitter.com/cards/types/summary

+ 7 - 0
docs/plugin-use.md

@@ -144,6 +144,13 @@ CL-USER> (chirp:complete-authentication "4173325")
144 144
 #<CHIRP-OBJECTS:USER PuercoPop #18405433>
145 145
 ```
146 146
 
147
+## Twitter Summary Cards
148
+
149
+**Description**: Add Summary Card metadata to blog posts
150
+  to enhance twitter links to that content.
151
+
152
+**Example**: `(twitter-summary-card :twitter-handle "@redline6561")
153
+
147 154
 ## Versioned Deploys
148 155
 
149 156
 **Description**: Originally, this was Coleslaw's only deploy behavior.

+ 42 - 40
tests/plugins/twitter-summary-card.lisp

@@ -1,59 +1,61 @@
1
-(stefil:define-test-package :twitter-summary-card-tests
2
-  (:use :cl :coleslaw
3
-             :cl-ppcre))
1
+(defpackage :summary-card-tests
2
+  (:use :cl :coleslaw :stefil))
4 3
 
5
-(in-package :twitter-summary-card-tests)
6
-;;;; 
7
-;; To run tests first eval the plugin code inside this package and then execute
8
-;; (twitter-summary-card-test:run-package-tests)
9
-;;;
4
+(in-package :summary-card-tests)
10 5
 
6
+(defsuite summary-cards)
7
+(in-suite summary-cards)
8
+
9
+;; TODO: Create a fixture to either load a mocked config or load set of plugins.
10
+;; Then wrap these tests to use that fixture. Then add these to defsystem, setup
11
+;; general test run with other packages.
12
+
13
+(coleslaw::enable-plugin :twitter-summary-card)
11 14
 
12 15
 (defvar *short-post*
13
-    (make-instance 'post :title "hai" :text "very greetings" :format "html"))
16
+  (make-instance 'post :title "hai" :text "very greetings" :format "html"))
14 17
 
15
-(defvar *long-post* 
16
-    (make-instance 'post :title "What a Wonderful World"
17
-                   :text "I see trees of green, red roses too.  I see them
18
+(defvar *long-post*
19
+  (make-instance 'post :title "What a Wonderful World"
20
+                       :text "I see trees of green, red roses too.  I see them
18 21
 bloom, for me and you.  And I think to myself, what a wonderful world.
19 22
 
20
-I see skies of blue, 
21
-And clouds of white. 
22
-The bright blessed day, 
23
-The dark sacred night. 
24
-And I think to myself, 
25
-What a wonderful world. 
26
-
27
-The colors of the rainbow, 
28
-So pretty in the sky. 
29
-Are also on the faces, 
30
-Of people going by, 
31
-I see friends shaking hands. 
32
-Saying, \"How do you do?\" 
33
-They're really saying, 
34
-\"I love you\". 
35
-
36
-I hear babies cry, 
37
-I watch them grow, 
38
-They'll learn much more, 
39
-Than I'll ever know. 
40
-And I think to myself, 
41
-What a wonderful world. 
42
-
43
-Yes, I think to myself, 
23
+I see skies of blue,
24
+And clouds of white.
25
+The bright blessed day,
26
+The dark sacred night.
27
+And I think to myself,
28
+What a wonderful world.
29
+
30
+The colors of the rainbow,
31
+So pretty in the sky.
32
+Are also on the faces,
33
+Of people going by,
34
+I see friends shaking hands.
35
+Saying, \"How do you do?\"
36
+They're really saying,
37
+\"I love you\".
38
+
39
+I hear babies cry,
40
+I watch them grow,
41
+They'll learn much more,
42
+Than I'll ever know.
43
+And I think to myself,
44
+What a wonderful world.
45
+
46
+Yes, I think to myself,
44 47
 What a wonderful world. " :format "html"))
45 48
 
46 49
 (deftest summary-card-sans-twitter-handle ()
47 50
   (let ((summary-card (summary-card *short-post* nil)))
48
-    (is (null (scan "twitter:author" summary-card)))))
51
+    (is (null (cl-ppcre:scan "twitter:author" summary-card)))))
49 52
 
50 53
 (deftest summary-card-with-twitter-handle ()
51 54
   (let ((summary-card (summary-card *short-post* "@PuercoPop")))
52
-    (is (scan "twitter:author" summary-card))))
55
+    (is (cl-ppcre:scan "twitter:author" summary-card))))
53 56
 
54 57
 (deftest summary-card-trims-long-post ()
55 58
   (let ((summary-card (summary-card *long-post* nil)))
59
+    (multiple-value-bind ())
56 60
     ;; (scan "twitter:description\" content=\"(.*)\"" summary-card)
57 61
     summary-card))
58
-
59
-