Sha256: 8a8c33f7803667f9edc56da575b0c2159255df1a8eec1cb9c6d17627445f254f

Contents?: true

Size: 752 Bytes

Versions: 5

Compression:

Stored size: 752 Bytes

Contents

# frozen_string_literal: true

module Kitabu
  module Footnotes
    class Base
      # Set the content that will be modified.
      attr_accessor :content

      # Set the Nokogiri html object.
      attr_accessor :html

      # Set the footnote index.
      attr_reader :footnote_index

      # Process content, fixing footnotes numbering.
      # Returns a string representing the new markup.
      #
      def self.process(content)
        footnotes = new(content)
        footnotes.process
        footnotes
      end

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

      def increment_footnote_index!
        @footnote_index += 1
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kitabu-3.1.0 lib/kitabu/footnotes/base.rb
kitabu-3.0.3 lib/kitabu/footnotes/base.rb
kitabu-3.0.2 lib/kitabu/footnotes/base.rb
kitabu-3.0.1 lib/kitabu/footnotes/base.rb
kitabu-3.0.0 lib/kitabu/footnotes/base.rb