class SiSU_XHTML_EPUB2::Source::ScrollHeadAndSegToc

Public Class Methods

new(md='',per='',links_guide_toc='') click to toggle source
# File lib/sisu/xhtml_epub2.rb, line 641
def initialize(md='',per='',links_guide_toc='')
  @md,@per,@links_guide_toc=md,per,links_guide_toc
end

Public Instance Methods

in_common() click to toggle source
# File lib/sisu/xhtml_epub2.rb, line 644
def in_common
  toc_shared=[]
  segtoc=[]
  if (@md.opt.act[:verbose][:set]==:on \
  || @md.opt.act[:verbose_plus][:set]==:on \
  || @md.opt.act[:maintenance][:set]==:on)
    SiSU_Screen::Ansi.new(
      @md.opt.act[:color_state][:set],
      'Scroll & Segtoc'
    ).txt_grey
  end
  format_head_toc=SiSU_XHTML_EPUB2_Format::HeadToc.new(@md)
  dochead=format_head_toc.head
  dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge
  toc_shared << dochead #<< ads.div.major
  segtoc << format_head_toc.head #<< ads.div.major
  if defined? @md.rights.all \
  and @md.rights.all
    rights=format_head_toc.rights.all
    rights=SiSU_XHTML_EPUB2_Tune::CleanXHTML.new(rights).clean
  end
  if defined? @md.notes.prefix_b \
  and @md.notes.prefix_b
    prefix_b=format_head_toc.prefix_b
    prefix_b=SiSU_XHTML_EPUB2_Tune::CleanXHTML.new(prefix_b).clean
  end
  tmp_head=nil
  doc_title_endnote=@md.title.full.gsub(/(\*+)/,'<sup><a href="#endnotes">\1</a></sup>')
  tmp_head=doc_title_endnote + "\n"
  txt_obj={ txt: tmp_head }
  format_txt_obj=SiSU_XHTML_EPUB2_Format::FormatTextObject.new(@md,txt_obj)
  toc_shared << format_txt_obj.center_bold
  segtoc << format_txt_obj.center_bold
  if defined? @md.creator.author \
  and @md.creator.author
    creator_endnote=@md.creator.author.gsub(/(\*+)/,%{#{$ep[:hsp]}<sup><a href="#notes">\\1</a></sup>})
    tmp_head=creator_endnote + "\n"
    txt_obj={ txt: tmp_head }
    format_txt_obj=SiSU_XHTML_EPUB2_Format::FormatTextObject.new(@md,txt_obj)
    toc_shared << format_txt_obj.center_bold
    segtoc << format_txt_obj.center_bold
  end
  tmp_head=nil
  if defined? @md.prefix_a \
  and @md.prefix_a
    tmp_head ||= %{#{@md.prefix_a}\n}
    toc_shared << tmp_head.dup
    segtoc << tmp_head.dup
  end
  tmp_head=nil
  toc_shared << @links_guide_toc
  if defined? @md.rights.all \
  and @md.rights.all
    toc_shared << rights
  end
  if defined? @md.prefix_b \
  and @md.prefix_b
    toc_shared << prefix_b
  end
  #Table of Contents added/appended here
  toc_shared << @per.scr
  segtoc << @links_guide_toc
  segtoc << @per.seg
  if defined? @md.rights.all \
  and @md.rights.all
    segtoc << rights
  end
  if defined? @md.prefix_b \
  and @md.prefix_b
    segtoc << prefix_b
  end
  #Segtoc tail added here
  segtoc << format_head_toc.xhtml_close
  segtoc=segtoc.flatten.compact #watch
  SiSU_XHTML_EPUB2::Source::Output.new(@md).make_cover_image
  SiSU_XHTML_EPUB2::Source::Output.new(@md,segtoc).make_segtoc
  segtoc=[]
  @per.scr,@per.seg=[],[]
  toc_shared
end