Class: Paragraph

Inherits:
DocItem show all
Defined in:
lib/almirah/doc_items/paragraph.rb

Direct Known Subclasses

ControlledParagraph, Heading

Instance Attribute Summary collapse

Attributes inherited from DocItem

#parent_doc, #parent_heading

Instance Method Summary collapse

Methods inherited from TextLine

add_lazy_doc_id, #bold, #bold_and_italic, #change_state, #format_string, #italic, #link

Constructor Details

#initialize(text) ⇒ Paragraph

Returns a new instance of Paragraph.



7
8
9
# File 'lib/almirah/doc_items/paragraph.rb', line 7

def initialize(text)
    @text = text
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



5
6
7
# File 'lib/almirah/doc_items/paragraph.rb', line 5

def text
  @text
end

Instance Method Details

#getTextWithoutSpacesObject



11
12
13
# File 'lib/almirah/doc_items/paragraph.rb', line 11

def getTextWithoutSpaces
    return @text.split.join('-').downcase
end

#to_htmlObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/almirah/doc_items/paragraph.rb', line 15

def to_html
    s = ''
    if @@htmlTableRenderInProgress
        s += "</table>"
        @@htmlTableRenderInProgress = false
    end

    s += "<p>" + format_string(@text)
    return s
end