Merge pull request #785 from glowing-bear/gist-trailing-slash
Gist plugin: ignore trailing slashes and anchors
This commit is contained in:
commit
863298a0eb
|
@ -435,11 +435,12 @@ plugins.factory('userPlugins', function() {
|
||||||
|
|
||||||
// Embed GitHub gists
|
// Embed GitHub gists
|
||||||
var gistPlugin = new UrlPlugin('Gist', function(url) {
|
var gistPlugin = new UrlPlugin('Gist', function(url) {
|
||||||
var regexp = /^https:\/\/gist\.github.com\/[^.?]+/i;
|
// ignore trailing slashes and anchors
|
||||||
|
var regexp = /^(https:\/\/gist\.github.com\/(?:.*?))[\/]?(?:\#.*)?$/i;
|
||||||
var match = url.match(regexp);
|
var match = url.match(regexp);
|
||||||
if (match) {
|
if (match) {
|
||||||
// get the URL from the match to trim away pseudo file endings and request parameters
|
// get the URL from the match to trim away pseudo file endings and request parameters
|
||||||
url = match[0] + '.json';
|
url = match[1] + '.json';
|
||||||
// load gist asynchronously -- return a function here
|
// load gist asynchronously -- return a function here
|
||||||
return function() {
|
return function() {
|
||||||
var element = this.getElement();
|
var element = this.getElement();
|
||||||
|
|
Loading…
Reference in New Issue