diff --git a/README.markdown b/README.markdown index 3497b63..e5e2d4e 100644 --- a/README.markdown +++ b/README.markdown @@ -3,13 +3,13 @@ JavaScript enabled or available. The resulting markup for the example below loo
- +
@@ -28,7 +28,7 @@ Add jekyll-gist-tag.rb to the _plugins directory of your Jekyll site Where: -gist_raw_url_with_filename is the gist's raw URL (e.g. https://gist.github.com/raw/885179/f030d8edd3e0cf45a9bfa6cea8979d7c006d7c4c/example.htaccess.txt) +gist_raw_url_with_filename is the gist's raw URL (e.g. https://gist.github.com/edelabar/885179/raw/f030d8edd3e0cf45a9bfa6cea8979d7c006d7c4c/example.htaccess.txt) [pygments_lexer] is the optionally provided name of the pygments lexer for highlighting the code. If omitted, the file extension from the gist will be passed to pygments as the lexer. @@ -36,7 +36,7 @@ The list of included lexers is available in the [Pygments documentation](http:// ## Example - {% render_gist https://gist.github.com/raw/885179/f030d8edd3e0cf45a9bfa6cea8979d7c006d7c4c/example.htaccess.txt apache %} + {% render_gist https://gist.github.com/edelabar/885179/raw/f030d8edd3e0cf45a9bfa6cea8979d7c006d7c4c/example.htaccess.txt apache %} ## Troubleshooting diff --git a/jekyll-gist-tag.rb b/jekyll-gist-tag.rb index b2a34e6..9815cb2 100644 --- a/jekyll-gist-tag.rb +++ b/jekyll-gist-tag.rb @@ -9,13 +9,14 @@ def initialize(tag_name, params, tokens) url, specified_language = params.split(' ') - if %r|https://gist.github.com/raw/(.*)/.*/(.*\.([a-zA-Z]+))| =~ url - @gist = $1 - @file = $2 - file_language = $3 + if %r|https://gist.github.com/(.*)/(.*)/raw/.*/(.*\.([a-zA-Z]+))| =~ url + @username = $1 + @gist = $2 + @file = $3 + file_language = $4 else $stderr.puts "Failed to parse gist URL '#{url}' from tag." - $stderr.puts "URL should be in the form 'https://gist.github.com/raw/1234/123456789abcdef/example.txt'" + $stderr.puts "URL should be in the form 'https://gist.github.com//12345/raw/4116128eb09ebc293bf9c11941dd1091671036b9/example.txt'" exit(1); end @@ -51,11 +52,11 @@ def render_pygments(context, code, language) def add_code_tags(code, language) # Add nested tags to code blocks - code = code.sub(/
/,"
") + code = code.sub(/
/,"
") end end end -Liquid::Template.register_tag('render_gist', Jekyll::RenderGist) +Liquid::Template.register_tag('render_gist', Jekyll::RenderGist) \ No newline at end of file