Class: Kitabu::Footnotes::Base
- Inherits:
-
Object
- Object
- Kitabu::Footnotes::Base
- Defined in:
- lib/kitabu/footnotes/base.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Set the content that will be modified.
-
#footnote_index ⇒ Object
readonly
Set the footnote index.
-
#html ⇒ Object
Set the Nokogiri html object.
Class Method Summary collapse
-
.process(content) ⇒ Object
Process content, fixing footnotes numbering.
Instance Method Summary collapse
- #increment_footnote_index! ⇒ Object
-
#initialize(content) ⇒ Base
constructor
A new instance of Base.
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
#content ⇒ Object
Set the content that will be modified.
7 8 9 |
# File 'lib/kitabu/footnotes/base.rb', line 7 def content @content end |
#footnote_index ⇒ Object (readonly)
Set the footnote index.
13 14 15 |
# File 'lib/kitabu/footnotes/base.rb', line 13 def footnote_index @footnote_index end |
#html ⇒ Object
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 |