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) ⇒ MarkupParser

Returns a new instance of MarkupParser.



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

def initialize(paragraph)
    @paragraph = paragraph
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

#paragraphObject

Returns the value of attribute paragraph.



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

def paragraph
  @paragraph
end

Instance Method Details

#parseObject



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

def parse()
    result = paragraph.text
    if !paragraph.markups.nil? && paragraph.markups.length > 0
        markupRender = MarkupStyleRender.new(paragraph)

        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