Class: Kitabu::Footnotes::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/kitabu/footnotes/base.rb

Direct Known Subclasses

HTML, PDF

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Base

Returns a new instance of Base.



24
25
26
27
28
# File 'lib/kitabu/footnotes/base.rb', line 24

def initialize(content)
  @content = content
  @html = Nokogiri::HTML(content)
  @footnote_index = 1
end

Instance Attribute Details

#contentObject

Set the content that will be modified.



7
8
9
# File 'lib/kitabu/footnotes/base.rb', line 7

def content
  @content
end

#footnote_indexObject (readonly)

Set the footnote index.



13
14
15
# File 'lib/kitabu/footnotes/base.rb', line 13

def footnote_index
  @footnote_index
end

#htmlObject

Set the Nokogiri html object.



10
11
12
# File 'lib/kitabu/footnotes/base.rb', line 10

def html
  @html
end

Class Method Details

.process(content) ⇒ Object

Process content, fixing footnotes numbering. Returns a string representing the new markup.



18
19
20
21
22
# File 'lib/kitabu/footnotes/base.rb', line 18

def self.process(content)
  footnotes = new(content)
  footnotes.process
  footnotes
end

Instance Method Details

#increment_footnote_index!Object



30
31
32
# File 'lib/kitabu/footnotes/base.rb', line 30

def increment_footnote_index!
  @footnote_index += 1
end