@@ -16,26 +16,20 @@ def render(context)
1616 if ( tag_contents = determine_arguments ( @markup . strip ) )
1717 gist_id = tag_contents [ 0 ]
1818 filename = tag_contents [ 1 ]
19- if context_contains_key? ( context , gist_id )
20- gist_id = context [ gist_id ]
21- end
22- if context_contains_key? ( context , filename )
23- filename = context [ filename ]
24- end
19+ gist_id = context [ gist_id ] if context_contains_key? ( context , gist_id )
20+ filename = context [ filename ] if context_contains_key? ( context , filename )
2521 noscript_tag = gist_noscript_tag ( gist_id , filename )
2622 script_tag = gist_script_tag ( gist_id , filename )
2723 "#{ noscript_tag } #{ script_tag } "
2824 else
2925 raise ArgumentError , <<~ERROR
30- Syntax error in tag 'gist' while parsing the following markup:
31-
32- #{ @markup }
33-
34- Valid syntax:
35- {% gist user/1234567 %}
36- {% gist user/1234567 foo.js %}
37- {% gist 28949e1d5ee2273f9fd3 %}
38- {% gist 28949e1d5ee2273f9fd3 best.md %}
26+ Syntax error in tag 'gist' while parsing the following markup:
27+ #{ @markup }
28+ Valid syntax:
29+ {% gist user/1234567 %}
30+ {% gist user/1234567 foo.js %}
31+ {% gist 28949e1d5ee2273f9fd3 %}
32+ {% gist 28949e1d5ee2273f9fd3 best.md %}
3933
4034 ERROR
4135 end
@@ -48,8 +42,6 @@ def determine_arguments(input)
4842 [ matched [ 1 ] . strip , matched [ 2 ] . strip ] if matched && matched . length >= 3
4943 end
5044
51- private
52-
5345 def context_contains_key? ( context , key )
5446 if context . respond_to? ( :has_key? )
5547 context . has_key? ( key )
@@ -90,8 +82,8 @@ def fetch_raw_code(gist_id, filename = nil)
9082 url = "#{ url } /#{ filename } " unless filename . to_s . empty?
9183 uri = URI ( url )
9284 Net ::HTTP . start ( uri . host , uri . port ,
93- :use_ssl => uri . scheme == "https" ,
94- :read_timeout => 3 , :open_timeout => 3 ) do |http |
85+ :use_ssl => uri . scheme == "https" ,
86+ :read_timeout => 3 , :open_timeout => 3 ) do |http |
9587 request = Net ::HTTP ::Get . new uri . to_s
9688 response = http . request ( request )
9789 response . body
@@ -100,8 +92,6 @@ def fetch_raw_code(gist_id, filename = nil)
10092 nil
10193 end
10294
103- private
104-
10595 def code_from_api ( gist_id , filename = nil )
10696 gist = GistTag . client . gist gist_id
10797
0 commit comments