Add gfycat plugin.

This commit is contained in:
Brit Butler 2014-11-22 23:06:53 -05:00
parent 4fd195db19
commit 3490af0287
3 changed files with 33 additions and 0 deletions

View file

@ -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):

View file

@ -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

25
plugins/gfycat.lisp Normal file
View file

@ -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*
"<script>
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.src = 'http://assets.gfycat.com/js/gfyajax-0.517d.js';
s.parentNode.insertBefore(g, s);
}(document, 'script'));
</script>")
(defun enable ()
(flet ((inject-p (x)
(when (and (typep x 'content)
(tag-p "gfycat" x))
*gfycat-header*)))
(add-injection #'inject-p :head)))