Skip to content

Commit 87b93ed

Browse files
committed
allways be backwards compatibling
1 parent 63a6ef7 commit 87b93ed

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/jekyll-gist/gist_tag.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ def gist_noscript_tag(gist_id, filename = nil)
5454
code = fetch_raw_code(gist_id, filename)
5555
if !code.nil?
5656
code = code.force_encoding(@encoding)
57-
"<noscript><pre>#{CGI.escapeHTML(code)}</pre></noscript>"
57+
code = CGI.escapeHTML(code)
58+
59+
# CGI.escapeHTML behavior differs in Ruby < 2.0
60+
# See https://github.com/jekyll/jekyll-gist/pull/28
61+
code = code.gsub("'", "&#39;") if RUBY_VERSION < "2.0"
62+
63+
"<noscript><pre>#{code}</pre></noscript>"
5864
else
5965
Jekyll.logger.warn "Warning:", "The <noscript> tag for your gist #{gist_id} could not"
6066
Jekyll.logger.warn "", "be generated. This will affect users who do not have"

0 commit comments

Comments
 (0)