diff --git a/NEWS.md b/NEWS.md index f5ef759..ac55843 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,7 +7,7 @@ Legend: A change to Coleslaw's exported interface. Plugins or Themes that have not been upstreamed are effected and may require minor effort to fix. -## Changes for 0.9.6 (2014-09-17): +## Changes for 0.9.6 (2014-09-27): * **SITE-BREAKING CHANGE**: Coleslaw now defaults to a "basic" deploy instead of the previous symlinked, timestamped deploy strategy. @@ -20,6 +20,8 @@ Legend: * **Incompatible Change**: The interface of the `add-injection` function has changed. If you have written a plugin which uses `add-injection` you should update it to conform to the [new interface][plg-api]. +* **New Plugin**: Support for [twitter summary cards][ts-cards] on blog + posts has been added thanks to @PuercoPop. * **Docs**: Improved README and Theming docs. New Config File docs. * Changes to `:routing` would previously break links in the templates but now work seamlessly due to the updated URL handling. @@ -141,3 +143,4 @@ Legend: [example.rc]: https://github.com/redline6561/coleslaw/blob/master/examples/example.coleslawrc [plg-use]: https://github.com/redline6561/coleslaw/blob/master/docs/plugin-use.md [plg-api]: https://github.com/redline6561/coleslaw/blob/master/docs/plugin-api.md#extension-points +[ts-cards]: https://dev.twitter.com/cards/types/summary diff --git a/docs/plugin-use.md b/docs/plugin-use.md index b614a1f..1387ef5 100644 --- a/docs/plugin-use.md +++ b/docs/plugin-use.md @@ -144,6 +144,13 @@ CL-USER> (chirp:complete-authentication "4173325") # ``` +## Twitter Summary Cards + +**Description**: Add Summary Card metadata to blog posts + to enhance twitter links to that content. + +**Example**: `(twitter-summary-card :twitter-handle "@redline6561") + ## Versioned Deploys **Description**: Originally, this was Coleslaw's only deploy behavior. diff --git a/tests/plugins/twitter-summary-card.lisp b/tests/plugins/twitter-summary-card.lisp index 7bb607f..e5faf60 100644 --- a/tests/plugins/twitter-summary-card.lisp +++ b/tests/plugins/twitter-summary-card.lisp @@ -1,59 +1,61 @@ -(stefil:define-test-package :twitter-summary-card-tests - (:use :cl :coleslaw - :cl-ppcre)) +(defpackage :summary-card-tests + (:use :cl :coleslaw :stefil)) -(in-package :twitter-summary-card-tests) -;;;; -;; To run tests first eval the plugin code inside this package and then execute -;; (twitter-summary-card-test:run-package-tests) -;;; +(in-package :summary-card-tests) +(defsuite summary-cards) +(in-suite summary-cards) + +;; TODO: Create a fixture to either load a mocked config or load set of plugins. +;; Then wrap these tests to use that fixture. Then add these to defsystem, setup +;; general test run with other packages. + +(coleslaw::enable-plugin :twitter-summary-card) (defvar *short-post* - (make-instance 'post :title "hai" :text "very greetings" :format "html")) + (make-instance 'post :title "hai" :text "very greetings" :format "html")) -(defvar *long-post* - (make-instance 'post :title "What a Wonderful World" - :text "I see trees of green, red roses too. I see them +(defvar *long-post* + (make-instance 'post :title "What a Wonderful World" + :text "I see trees of green, red roses too. I see them bloom, for me and you. And I think to myself, what a wonderful world. -I see skies of blue, -And clouds of white. -The bright blessed day, -The dark sacred night. -And I think to myself, -What a wonderful world. +I see skies of blue, +And clouds of white. +The bright blessed day, +The dark sacred night. +And I think to myself, +What a wonderful world. -The colors of the rainbow, -So pretty in the sky. -Are also on the faces, -Of people going by, -I see friends shaking hands. -Saying, \"How do you do?\" -They're really saying, -\"I love you\". +The colors of the rainbow, +So pretty in the sky. +Are also on the faces, +Of people going by, +I see friends shaking hands. +Saying, \"How do you do?\" +They're really saying, +\"I love you\". -I hear babies cry, -I watch them grow, -They'll learn much more, -Than I'll ever know. -And I think to myself, -What a wonderful world. +I hear babies cry, +I watch them grow, +They'll learn much more, +Than I'll ever know. +And I think to myself, +What a wonderful world. -Yes, I think to myself, +Yes, I think to myself, What a wonderful world. " :format "html")) (deftest summary-card-sans-twitter-handle () (let ((summary-card (summary-card *short-post* nil))) - (is (null (scan "twitter:author" summary-card))))) + (is (null (cl-ppcre:scan "twitter:author" summary-card))))) (deftest summary-card-with-twitter-handle () (let ((summary-card (summary-card *short-post* "@PuercoPop"))) - (is (scan "twitter:author" summary-card)))) + (is (cl-ppcre:scan "twitter:author" summary-card)))) (deftest summary-card-trims-long-post () (let ((summary-card (summary-card *long-post* nil))) + (multiple-value-bind ()) ;; (scan "twitter:description\" content=\"(.*)\"" summary-card) summary-card)) - -