File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,10 @@ def render(context)
1414 @settings = context . registers [ :site ] . config [ 'gist' ]
1515 if tag_contents = determine_arguments ( @markup . strip )
1616 gist_id , filename = tag_contents [ 0 ] , tag_contents [ 1 ]
17- if context . has_key? ( gist_id )
17+ if context_contains_key? ( context , gist_id )
1818 gist_id = context [ gist_id ]
1919 end
20- if context . has_key? ( filename )
20+ if context_contains_key? ( context , filename )
2121 filename = context [ filename ]
2222 end
2323 noscript_tag = gist_noscript_tag ( gist_id , filename )
@@ -45,6 +45,16 @@ def determine_arguments(input)
4545 [ matched [ 1 ] . strip , matched [ 2 ] . strip ] if matched && matched . length >= 3
4646 end
4747
48+ private
49+
50+ def context_contains_key? ( context , key )
51+ if context . respond_to? ( :has_key? )
52+ context . has_key? ( key )
53+ else
54+ context . key? ( key )
55+ end
56+ end
57+
4858 def gist_script_tag ( gist_id , filename = nil )
4959 url = "https://gist.github.com/#{ gist_id } .js"
5060 url = "#{ url } ?file=#{ filename } " unless filename . to_s . empty?
You can’t perform that action at this time.
0 commit comments