32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/markdown-ui/content/parser.rb', line 32
def process(content)
content_type, actual_content = content[0], content[1]
klass = content[2] if content.size > 2
mode = OpenStruct.new(
:text? => !(content_type =~ /text/i).nil?,
:icon? => !(content_type =~ /icon/i).nil?,
:flag? => !(content_type =~ /flag/i).nil?,
:image? => !(content_type =~ /image/i).nil?,
:header? => !(content_type =~ /header/i).nil?,
:list? => !(content_type =~ /list/i).nil?,
:unordered? => !(content_type =~ /unordered/i).nil?,
:ordered? => !(content_type =~ /ordered/i).nil?
)
if mode.text?
MarkdownUI::Content::Text.new(actual_content, klass).render
elsif mode.icon?
MarkdownUI::Content::Icon.new(actual_content, klass).render
elsif mode.
MarkdownUI::Content::.new(actual_content, klass).render
elsif mode.list? && mode.ordered?
MarkdownUI::Content::List.new(actual_content, klass, :ordered).render
elsif mode.list? && mode.unordered?
MarkdownUI::Content::List.new(actual_content, klass, :unordered).render
elsif mode.list?
MarkdownUI::Content::List.new(actual_content, klass).render
else
MarkdownUI::Content::Custom.new(content.join(" "), klass).render
end
end
|