Class: Swordfish::Node::Footnote

Inherits:
Base
  • Object
show all
Defined in:
lib/swordfish/nodes/footnote.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#children, #content, #style

Instance Method Summary collapse

Methods inherited from Base

#append, #clear_children, #find_nodes_by_type, #inform!, #initialize, #replace, #replace_with, #stylize, #wrap_children

Constructor Details

This class inherits a constructor from Swordfish::Node::Base

Instance Attribute Details

#indexObject

Returns the value of attribute index.



7
8
9
# File 'lib/swordfish/nodes/footnote.rb', line 7

def index
  @index
end

Instance Method Details

#content_to_htmlObject



14
15
16
17
# File 'lib/swordfish/nodes/footnote.rb', line 14

def content_to_html
  return "" unless @index
  "<p><a id='footnote-#{@index}' href='#footnote-ref-#{@index}'>[#{@index}]</a> #{@children.map(&:to_html).join}</p>"
end

#to_htmlObject



9
10
11
12
# File 'lib/swordfish/nodes/footnote.rb', line 9

def to_html
  return "" unless @index
  "<a id='footnote-ref-#{@index}' href='#footnote-#{@index}'>[#{@index}]</a>"
end