Class: MarkupParser

Inherits:
Object
  • Object
show all
Defined in:
lib/Parsers/MarkupParser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(paragraph, isForJekyll) ⇒ MarkupParser

Returns a new instance of MarkupParser.



12
13
14
15
# File 'lib/Parsers/MarkupParser.rb', line 12

def initialize(paragraph, isForJekyll)
    @paragraph = paragraph
    @isForJekyll = isForJekyll
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



10
11
12
# File 'lib/Parsers/MarkupParser.rb', line 10

def body
  @body
end

#isForJekyllObject

Returns the value of attribute isForJekyll.



10
11
12
# File 'lib/Parsers/MarkupParser.rb', line 10

def isForJekyll
  @isForJekyll
end

#paragraphObject

Returns the value of attribute paragraph.



10
11
12
# File 'lib/Parsers/MarkupParser.rb', line 10

def paragraph
  @paragraph
end

#usersPostURLsObject

Returns the value of attribute usersPostURLs.



10
11
12
# File 'lib/Parsers/MarkupParser.rb', line 10

def usersPostURLs
  @usersPostURLs
end

Instance Method Details

#parseObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/Parsers/MarkupParser.rb', line 17

def parse()
    result = paragraph.text
    if !paragraph.markups.nil? && paragraph.markups.length > 0
        markupRender = MarkupStyleRender.new(paragraph, isForJekyll)
        markupRender.usersPostURLs = usersPostURLs
        begin
            result = markupRender.parse()
        rescue => e
            puts e.backtrace
            Helper.makeWarningText("Error occurred during render markup text, please help to open an issue on github.")
        end
    end

    result
end