diff --git a/lib/jekyll-gist/gist_tag.rb b/lib/jekyll-gist/gist_tag.rb index 2633692..a6ebb0b 100644 --- a/lib/jekyll-gist/gist_tag.rb +++ b/lib/jekyll-gist/gist_tag.rb @@ -11,6 +11,7 @@ module Jekyll module Gist class GistTag < Liquid::Tag def render(context) + @special_characters = "#" @encoding = context.registers[:site].config["encoding"] || "utf-8" @settings = context.registers[:site].config["gist"] if (tag_contents = determine_arguments(@markup.strip)) @@ -18,6 +19,7 @@ def render(context) filename = tag_contents[1] gist_id = context[gist_id] if context_contains_key?(context, gist_id) filename = context[filename] if context_contains_key?(context, filename) + filename.delete!(@special_characters) noscript_tag = gist_noscript_tag(gist_id, filename) script_tag = gist_script_tag(gist_id, filename) "#{noscript_tag}#{script_tag}" diff --git a/spec/gist_tag_spec.rb b/spec/gist_tag_spec.rb index f04618c..beaac34 100644 --- a/spec/gist_tag_spec.rb +++ b/spec/gist_tag_spec.rb @@ -49,17 +49,25 @@ end context "with file specified" do - before { stub_request(:get, "https://gist.githubusercontent.com/#{gist}/raw/#{filename}").to_return(:body => http_output) } + before { stub_request(:get, %r!https://gist.githubusercontent.com/#{gist}/raw/.*!).to_return(:body => http_output) } let(:gist) { "mattr-/24081a1d93d2898ecf0f" } let(:filename) { "myfile.ext" } let(:content) { "{% gist #{gist} #{filename} %}" } it "produces the correct script tag" do - expect(output).to match(%r!!) + end + end end context "with variable gist id" do