docpad-plugin-gist
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -19,5 +19,19 @@ // Generated by CoffeeScript 1.4.0 | ||
getGist = function(opts, next) { | ||
var content; | ||
var content, gist, gistScript, gists, _i, _len; | ||
content = opts.content; | ||
opts.content = content.replace(/<gist>/g, "<script src='https://gist.github.com/").replace(/<\/gist>/g, ".js'></script>"); | ||
gists = content.match(/<gist>.+<\/gist>/g); | ||
if (gists == null) { | ||
return next(); | ||
} | ||
for (_i = 0, _len = gists.length; _i < _len; _i++) { | ||
gist = gists[_i]; | ||
gistScript = gist.replace(/<gist>/g, "<script src='https://gist.github.com/"); | ||
if (gistScript.indexOf('.js') !== -1) { | ||
gistScript = gistScript.replace(/<\/gist>/g, "'></script>"); | ||
} else { | ||
gistScript = gistScript.replace(/<\/gist>/g, ".js'></script>"); | ||
} | ||
content = content.replace(gist, gistScript); | ||
} | ||
opts.content = content; | ||
return next(); | ||
@@ -24,0 +38,0 @@ }; |
{ | ||
"name": "docpad-plugin-gist", | ||
"version": "2.0.0", | ||
"description": "Adds support for reading gist to DocPad", | ||
"version": "2.1.0", | ||
"description": "Allows you to easily embed GitHub Gists into your DocPad documents", | ||
"homepage": "http://docpad.org/plugin/gist", | ||
@@ -19,3 +19,4 @@ "keywords": [ | ||
"Takeharu Oshida (https://github.com/georgeOsdDev)", | ||
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)" | ||
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)", | ||
"Joe Fleming (https://github.com/w33ble)" | ||
], | ||
@@ -36,3 +37,4 @@ "bugs": { | ||
"devDependencies": { | ||
"coffee-script": "~1.4.0" | ||
"coffee-script": "~1.4.0", | ||
"docpad": ">=6.37 <7" | ||
}, | ||
@@ -39,0 +41,0 @@ "main": "./out/gist.plugin.js", |
@@ -1,6 +0,17 @@ | ||
# gist Plugin for DocPad | ||
Adds support for [gist](https://gist.github.com/) render to [DocPad](https://github.com/bevry/docpad) | ||
# Gist Plugin for [DocPad](http://docpad.org) | ||
element`<gist>your gist id</gist>` in the document will render as embeded gist. | ||
[![Build Status](https://secure.travis-ci.org/docpad/docpad-plugin-gist.png?branch=master)](http://travis-ci.org/docpad/docpad-plugin-gist "Check this project's build status on TravisCI") | ||
[![NPM version](https://badge.fury.io/js/docpad-plugin-gist.png)](https://npmjs.org/package/docpad-plugin-gist "View this project on NPM") | ||
[![Flattr donate button](https://raw.github.com/balupton/flattr-buttons/master/badge-89x18.gif)](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr") | ||
[![PayPayl donate button](https://www.paypalobjects.com/en_AU/i/btn/btn_donate_SM.gif)](https://www.paypal.com/au/cgi-bin/webscr?cmd=_flow&SESSION=IHj3DG3oy_N9A9ZDIUnPksOi59v0i-EWDTunfmDrmU38Tuohg_xQTx0xcjq&dispatch=5885d80a13c0db1f8e263663d3faee8d14f86393d55a810282b64afed84968ec "Donate once-off to this project using Paypal") | ||
Allows you to easily embed [Github Gists](https://gist.github.com/) into your [DocPad](http://docpad.org) documents | ||
## Usage | ||
Add `<gist>your-gist-id</gist>` to your document and it will be rendered with the embedded gist in its place! :) | ||
You can also use `<gist>your-gist-id?file=filename</gist>` to embed just a particular file of the gist! | ||
## Install | ||
@@ -13,8 +24,13 @@ | ||
## History | ||
You can discover the history inside the `History.md` file | ||
[You can discover the history inside the `History.md` file](https://github.com/bevry/docpad-plugin-gist/blob/master/History.md#files) | ||
## Contributing | ||
[You can discover the contributing instructions inside the `Contributing.md` file](https://github.com/bevry/docpad-plugin-gist/blob/master/Contributing.md#files) | ||
## License | ||
Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://creativecommons.org/licenses/MIT/) | ||
<br/>Copyright © 2012 [Takeharu.Oshida](http://georgeosddev.github.com) |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6471
6
44
35
0
2