forked from sendgrid/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparameter.rb
More file actions
31 lines (26 loc) · 715 Bytes
/
Copy pathparameter.rb
File metadata and controls
31 lines (26 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require 'kramdown'
module Jekyll
class ParameterTag < Liquid::Tag
def initialize(tag_name, markup, tokens)
parameters = markup.shellsplit
@name = parameters[0]
@required = parameters[1]
@requirements = parameters[2]
@description = parameters[3]
super
end
def render(context)
output=<<HTML
<tr>
<td markdown="span">#{@name}</td>
<td markdown="span">#{@required}</td>
<td markdown="span">#{@requirements}</td>
<td markdown="span">#{@description}</td>
</tr>
HTML
html = Kramdown::Document.new(output).to_html
return Liquid::Template.parse(html).render context
end
end
end
Liquid::Template.register_tag('parameter', Jekyll::ParameterTag)