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)
14
14
@settings = context . registers [ :site ] . config [ 'gist' ]
15
15
if tag_contents = determine_arguments ( @markup . strip )
16
16
gist_id , filename = tag_contents [ 0 ] , tag_contents [ 1 ]
17
- if context . has_key? ( gist_id )
17
+ if context_contains_key? ( context , gist_id )
18
18
gist_id = context [ gist_id ]
19
19
end
20
- if context . has_key? ( filename )
20
+ if context_contains_key? ( context , filename )
21
21
filename = context [ filename ]
22
22
end
23
23
noscript_tag = gist_noscript_tag ( gist_id , filename )
@@ -45,6 +45,16 @@ def determine_arguments(input)
45
45
[ matched [ 1 ] . strip , matched [ 2 ] . strip ] if matched && matched . length >= 3
46
46
end
47
47
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
+
48
58
def gist_script_tag ( gist_id , filename = nil )
49
59
url = "https://gist.github.com/#{ gist_id } .js"
50
60
url = "#{ url } ?file=#{ filename } " unless filename . to_s . empty?
You can’t perform that action at this time.
0 commit comments