8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/jekyll-gist/gist_tag.rb', line 8
def render(context)
if tag_contents = determine_arguments(@markup.strip)
gist_id, filename = tag_contents[0], tag_contents[1]
if context.has_key?(gist_id)
gist_id = context[gist_id]
end
if context.has_key?(filename)
filename = context[filename]
end
noscript_tag = gist_noscript_tag(gist_id, filename)
script_tag = gist_script_tag(gist_id, filename)
"#{noscript_tag}#{script_tag}"
else
raise ArgumentError.new <<-eos
Syntax error in tag 'gist' while parsing the following markup:
#{@markup}
Valid syntax:
{% gist user/1234567 %}
{% gist user/1234567 foo.js %}
{% gist 28949e1d5ee2273f9fd3 %}
{% gist 28949e1d5ee2273f9fd3 best.md %}
eos
end
end
|