Class: SiSU_XHTML_EPUB2::Source::Endnotes

Inherits:
Object
  • Object
show all
Includes:
SiSU_XHTML_EPUB2_Format
Defined in:
lib/sisu/xhtml_epub2.rb

Instance Method Summary collapse

Constructor Details

#initialize(md, data) ⇒ Endnotes

Returns a new instance of Endnotes.



172
173
174
# File 'lib/sisu/xhtml_epub2.rb', line 172

def initialize(md,data)
  @md,@data=md,data
end

Instance Method Details

#scrollObject



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/sisu/xhtml_epub2.rb', line 175

def scroll
  @scr_endnotes=[]
  @data.each do |dob|
    pg=dob.dup
    unless pg.is ==:code
      if pg.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ /
        endnote_array=[]
        if pg.obj=~/#{Mx[:en_a_o]}[\d*+].+?#{Mx[:en_a_c]}/m
          endnote_array = pg.obj.scan(/#{Mx[:en_a_o]}[\d*+]+(.+?)#{Mx[:en_a_c]}/m)
        end
        if pg.obj=~/#{Mx[:en_b_o]}[\d*]+\s.+?#{Mx[:en_b_c]}/m
          endnote_array = pg.obj.scan(/#{Mx[:en_b_o]}[\d*]+(.+?)#{Mx[:en_b_c]}/m)
        end
        if pg.obj=~/#{Mx[:en_b_o]}[\d+]+\s.+?#{Mx[:en_b_c]}/m
          endnote_array = pg.obj.scan(/#{Mx[:en_b_o]}[\d+]+(.+?)#{Mx[:en_b_c]}/m)
        end
        endnote_array.flatten.each do |note|
          txt_obj={ txt: note }
          format_scroll=SiSU_XHTML_EPUB2_Format::FormatScroll.new(@md,txt_obj)
          @scr_endnotes << format_scroll.endnote_body
        end
      end
    end
  end
  @scr_endnotes
end