Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update in Gist matching regex

Supports:
 - Gists with no extension
 - Gists with no http:// or https://:
  • Loading branch information...
commit 488a587f9ba09c646f30d1ed8c38f4f95f9de044 1 parent b19a554
Henrik Enggaard authored
Showing with 1 addition and 3 deletions.
  1. +1 −3 lib/gollum/markup.rb
4 lib/gollum/markup.rb
View
@@ -235,9 +235,7 @@ def parse_image_tag_options(tag)
# Returns the String HTML if the tag is a valid gist link tag or nil
# if it is not.
def process_gist_link_tag(tag)
- if tag =~ /^https?:\/\/gist\.github\.com\/\d+(?:\.js)?(?:\?file=\w+(?:\.\w+)*)?$/
- %{<script src="#{tag}"></script>}
- end
+ tag.sub!(/^(?:https?:\/\/)?(gist\.github\.com\/\d+)(?:\.js)?((?:\?file=\w+(?:\.\w+)*)?)$/, '<script src="http://\1.js\2"></script>')
end
# Attempt to process the tag as a file link tag.
Please sign in to comment.
Something went wrong with that request. Please try again.