7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/furikake/formatters/markdown.rb', line 7
def self.write(c)
contents = <<EOS
### <%= c[:title] %>
<%- c[:resources].each do |r| -%>
<%- if r[:subtitle] != '' -%>
#### <%= r[:subtitle] %>
<%- end -%>
<%- if ! r[:resource].empty? -%>
<%= MarkdownTables.make_table(r[:header], r[:resource], is_rows: true, align: 'l') %>
<%- else -%>
<%= 'N/A' %>
<%- end -%>
<%- end -%>
EOS
erb = ERB.new(contents, nil, '-')
erb.result(binding).chomp
end
|