Some last tweaks for Summary Cards before 0.9.6.

This commit is contained in:
Brit Butler 2014-09-23 11:47:46 -04:00
parent c286fc1e33
commit c7fc38b73c
3 changed files with 50 additions and 38 deletions

View file

@ -7,7 +7,7 @@ Legend:
A change to Coleslaw's exported interface. Plugins or Themes that have A change to Coleslaw's exported interface. Plugins or Themes that have
not been upstreamed are effected and may require minor effort to fix. 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 * **SITE-BREAKING CHANGE**: Coleslaw now defaults to a "basic" deploy
instead of the previous symlinked, timestamped deploy strategy. instead of the previous symlinked, timestamped deploy strategy.
@ -20,6 +20,8 @@ Legend:
* **Incompatible Change**: The interface of the `add-injection` function * **Incompatible Change**: The interface of the `add-injection` function
has changed. If you have written a plugin which uses `add-injection` has changed. If you have written a plugin which uses `add-injection`
you should update it to conform to the [new interface][plg-api]. 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. * **Docs**: Improved README and Theming docs. New Config File docs.
* Changes to `:routing` would previously break links in the templates * Changes to `:routing` would previously break links in the templates
but now work seamlessly due to the updated URL handling. 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 [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-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 [plg-api]: https://github.com/redline6561/coleslaw/blob/master/docs/plugin-api.md#extension-points
[ts-cards]: https://dev.twitter.com/cards/types/summary

View file

@ -144,6 +144,13 @@ CL-USER> (chirp:complete-authentication "4173325")
#<CHIRP-OBJECTS:USER PuercoPop #18405433> #<CHIRP-OBJECTS:USER PuercoPop #18405433>
``` ```
## 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 ## Versioned Deploys
**Description**: Originally, this was Coleslaw's only deploy behavior. **Description**: Originally, this was Coleslaw's only deploy behavior.

View file

@ -1,59 +1,61 @@
(stefil:define-test-package :twitter-summary-card-tests (defpackage :summary-card-tests
(:use :cl :coleslaw (:use :cl :coleslaw :stefil))
:cl-ppcre))
(in-package :twitter-summary-card-tests) (in-package :summary-card-tests)
;;;;
;; To run tests first eval the plugin code inside this package and then execute
;; (twitter-summary-card-test:run-package-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* (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* (defvar *long-post*
(make-instance 'post :title "What a Wonderful World" (make-instance 'post :title "What a Wonderful World"
:text "I see trees of green, red roses too. I see them :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. bloom, for me and you. And I think to myself, what a wonderful world.
I see skies of blue, I see skies of blue,
And clouds of white. And clouds of white.
The bright blessed day, The bright blessed day,
The dark sacred night. The dark sacred night.
And I think to myself, And I think to myself,
What a wonderful world. What a wonderful world.
The colors of the rainbow, The colors of the rainbow,
So pretty in the sky. So pretty in the sky.
Are also on the faces, Are also on the faces,
Of people going by, Of people going by,
I see friends shaking hands. I see friends shaking hands.
Saying, \"How do you do?\" Saying, \"How do you do?\"
They're really saying, They're really saying,
\"I love you\". \"I love you\".
I hear babies cry, I hear babies cry,
I watch them grow, I watch them grow,
They'll learn much more, They'll learn much more,
Than I'll ever know. Than I'll ever know.
And I think to myself, And I think to myself,
What a wonderful world. What a wonderful world.
Yes, I think to myself, Yes, I think to myself,
What a wonderful world. " :format "html")) What a wonderful world. " :format "html"))
(deftest summary-card-sans-twitter-handle () (deftest summary-card-sans-twitter-handle ()
(let ((summary-card (summary-card *short-post* nil))) (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 () (deftest summary-card-with-twitter-handle ()
(let ((summary-card (summary-card *short-post* "@PuercoPop"))) (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 () (deftest summary-card-trims-long-post ()
(let ((summary-card (summary-card *long-post* nil))) (let ((summary-card (summary-card *long-post* nil)))
(multiple-value-bind ())
;; (scan "twitter:description\" content=\"(.*)\"" summary-card) ;; (scan "twitter:description\" content=\"(.*)\"" summary-card)
summary-card)) summary-card))