From 9839681eca41ddb5148fea07ca25fb22b6ab1b18 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 3 Mar 2010 22:07:23 -0500 Subject: [PATCH] added gist shortcoder --- .../plugins/github-gist-shortcode/CHANGELOG | 3 ++ .../github-gist-shortcode-plugin.php | 45 +++++++++++++++++ .../plugins/github-gist-shortcode/readme.txt | 49 +++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 blog/wp-content/plugins/github-gist-shortcode/CHANGELOG create mode 100644 blog/wp-content/plugins/github-gist-shortcode/github-gist-shortcode-plugin.php create mode 100644 blog/wp-content/plugins/github-gist-shortcode/readme.txt diff --git a/blog/wp-content/plugins/github-gist-shortcode/CHANGELOG b/blog/wp-content/plugins/github-gist-shortcode/CHANGELOG new file mode 100644 index 0000000..1742281 --- /dev/null +++ b/blog/wp-content/plugins/github-gist-shortcode/CHANGELOG @@ -0,0 +1,3 @@ +0.2: Added ability to include text inside gist. + +0.1 : First release \ No newline at end of file diff --git a/blog/wp-content/plugins/github-gist-shortcode/github-gist-shortcode-plugin.php b/blog/wp-content/plugins/github-gist-shortcode/github-gist-shortcode-plugin.php new file mode 100644 index 0000000..020489b --- /dev/null +++ b/blog/wp-content/plugins/github-gist-shortcode/github-gist-shortcode-plugin.php @@ -0,0 +1,45 @@ +GitHub Gists in a post or page. +Version: 0.2 +Author: Paul William +Author URI: http://www.entropytheblog.com/blog/ + +Copyright 2008 Paul William + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + +// [gist id="gist-id-number"] +function gist_shortcode_func($atts, $content = null) { + extract(shortcode_atts(array( + 'id' => '30948' + ), $atts)); + + $html = ""; + + if($content != null){ + $html = $html.""; + } + + return $html; + +} +add_shortcode('gist', 'gist_shortcode_func'); + +?> \ No newline at end of file diff --git a/blog/wp-content/plugins/github-gist-shortcode/readme.txt b/blog/wp-content/plugins/github-gist-shortcode/readme.txt new file mode 100644 index 0000000..3477a45 --- /dev/null +++ b/blog/wp-content/plugins/github-gist-shortcode/readme.txt @@ -0,0 +1,49 @@ +=== GitHub Gist Shortcode Plugin === +Contributors: paul1999 +Requires at least: 2.5.1 +Tested up to: 2.8 +Stable tag: trunk +Tags: github, gist, shortcode, embed, git, code, script + +Allows the use of a simple shortcode to embed GitHub Gists in a post or page. + +== Description == + +Instead of embedding a [GitHub Gist](http://gist.github.com) (a [pastie](http://pastie.org/) like service on steroids) by copying and pasting HTML you can simple embed it with a [gist] shortcode. + +For example, to embed the [gist: 30948](http://gist.github.com/30948) enter this in a post or page: + + [gist id=30948] + +It is that simple. + +One problem with gists is that a search engine spiders (and users with javascript disabled) will not see your code in a blog entry. This plugin allows you to get around this by including text, such as content of the gist inside the shortcode. The text is wrapped inside these tags: + +