Class: HParser::Block::FootnoteList

Inherits:
Object
  • Object
show all
Defined in:
lib/hparser/html.rb,
lib/hparser/text.rb,
lib/hparser/block/footnote_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(footnotes) ⇒ FootnoteList

Returns a new instance of FootnoteList.



10
11
12
# File 'lib/hparser/block/footnote_list.rb', line 10

def initialize(footnotes)
  @footnotes = footnotes
end

Instance Attribute Details

#footnotesObject (readonly)

Returns the value of attribute footnotes.



8
9
10
# File 'lib/hparser/block/footnote_list.rb', line 8

def footnotes
  @footnotes
end

Instance Method Details

#==(o) ⇒ Object



14
15
16
# File 'lib/hparser/block/footnote_list.rb', line 14

def ==(o)
  self.class == o.class and self.footnotes == o.footnotes
end

#html_contentObject



272
273
274
275
276
# File 'lib/hparser/html.rb', line 272

def html_content
  @footnotes.map {|f| 
    %(<p class="footnote"><a href="#fn#{f.index}" name="f#{f.index}">*#{f.index}</a>: #{f.text}</p>)
  }.join
end

#to_htmlObject



268
269
270
# File 'lib/hparser/html.rb', line 268

def to_html
  %(<div class="footnote">#{self.html_content}</div>)
end

#to_textObject



136
137
138
139
140
# File 'lib/hparser/text.rb', line 136

def to_text
  @footnotes.map {|f| 
    %((*#{f.index}) #{f.text})
  }.join("\n")
end