From 3490af0287eda50f3d5e597fcd3ccab721aa7d0a Mon Sep 17 00:00:00 2001 From: Brit Butler Date: Sat, 22 Nov 2014 23:06:53 -0500 Subject: [PATCH] Add gfycat plugin. --- NEWS.md | 2 ++ docs/plugin-use.md | 6 ++++++ plugins/gfycat.lisp | 25 +++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 plugins/gfycat.lisp diff --git a/NEWS.md b/NEWS.md index bbc3b1d..74f09ad 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,6 +12,8 @@ Legend: * Coleslaw now handles **deploy-dir**, **repo**, and **staging-dir** config options more gracefully. Previously, various errors could be encountered if directory options lacked a trailing slash. +* **New Plugin**: Support for [embedded gfycats][http://gfycat.com/] has been added. + ## Changes for 0.9.6 (2014-09-27): diff --git a/docs/plugin-use.md b/docs/plugin-use.md index 1387ef5..dd3a302 100644 --- a/docs/plugin-use.md +++ b/docs/plugin-use.md @@ -21,6 +21,12 @@ **Example**: `(disqus :shortname "disqus-provided-unique-id")` +## HTML5 Gifs via Gfycat + +**Description**: Provides support for embedding [gfycat](http://gfycat.com/) gifs. + +**Example**: `(gfycat)` + ## Hosting via Github Pages **Description**: Allows hosting with CNAMEs via diff --git a/plugins/gfycat.lisp b/plugins/gfycat.lisp new file mode 100644 index 0000000..13d2f14 --- /dev/null +++ b/plugins/gfycat.lisp @@ -0,0 +1,25 @@ +(defpackage :coleslaw-gfycat + (:use :cl) + (:export #:enable) + (:import-from :coleslaw #:add-injection + #:content + #:tag-p)) + +(in-package :coleslaw-gfycat) + +(defvar *gfycat-header* + "") + +(defun enable () + (flet ((inject-p (x) + (when (and (typep x 'content) + (tag-p "gfycat" x)) + *gfycat-header*))) + (add-injection #'inject-p :head)))