Class: SiSU_XHTML_EPUB2::Source::ScrollHeadAndSegToc

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

Instance Method Summary collapse

Methods inherited from Toc

#songsheet

Constructor Details

#initialize(md = '', per = '', links_guide_toc = '') ⇒ ScrollHeadAndSegToc

Returns a new instance of ScrollHeadAndSegToc.



641
642
643
# 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

Instance Method Details

#in_commonObject



644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
# 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