class SiSU_XHTML_EPUB2_Format::FormatSeg

Public Class Methods

new(md,txt) click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2122
def initialize(md,txt)
  super(md,txt)
end

Public Instance Methods

clean(txt) click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2133
def clean(txt)
  txt=txt.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,'').
    gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'')
end
endnote_seg_body(fn='') click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2125
    def endnote_seg_body(fn='')  #FIX                                                #url construction keep within single line... BUG WATCH 200408
      fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info
      %{
  <p class="endnote">
    #{@endnote_part_a}#{fn}#{Sfx[:epub_xhtml]}#{@endnote_part_b}
  </p>
}
    end
heading4() click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2176
    def heading4
      %{
<div class="substance">
  #{@p_num.ocn_display}
  <h1 class="norm" #{@p_num.id}>
    #{@t_o[:format]}
    #{@txt}
  </h1>
</div>
}
    end
heading5() click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2187
def heading5
  heading_sub('p','bold',@txt)
end
heading6() click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2190
def heading6
  heading_sub('p','bold',@txt)
end
heading7() click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2193
def heading7
  heading_sub('h7','bold',@txt)
end
heading_sub(tag,attrib,txt) click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2165
    def heading_sub(tag,attrib,txt)
      txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
      %{
<div class="substance">
  #{@p_num.ocn_display}
  <#{tag} class="#{attrib}" #{@p_num.id}> #{@headname}
    #{@txt}
  </#{tag}>
</div>
}
    end
navigation_center() click to toggle source
navigation_heading4() click to toggle source
navigation_heading5() click to toggle source
navigation_heading6() click to toggle source
navigation_heading7() click to toggle source
subtoc_lev(tag,attrib) click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2137
  def subtoc_lev(tag,attrib)
    @txt=clean(@txt)
    txt=if @txt \
    and @txt =~/<\/?i>|<a\s+name="\S+?">/mi
      @txt.gsub(/<\/?i>|<a\s+name="\S+?">/mi,'') #removes name markers from subtoc, go directly to substantive text
    else @txt
    end
    note=''
    if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m # had \s* at end
      note=$1
      note=note.gsub(/[\s]+/m,' ')
      txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ').
        gsub(/<a[\n\s]+"[\n\s]+href="##{Mx[:note_ref]}\d+">#{$ep[:hsp]}<sup id="#{Mx[:note]}\d+">\d+<\/sup>#{$ep[:hsp]}/m,'').
        gsub(/<a[\n\s]+"[\n\s]+href="##{Mx[:note_ref]}\d+">#{$ep[:hsp]}<sup id="#{Mx[:note]}\d+">\d+<\/sup>#{$ep[:hsp]}/m,'') #remove
    end
    %{<#{tag} class="#{attrib}">
  <a href="#o#{@ocn}"><i>#{txt}</i></a> #{note}
</#{tag}>}
  end
subtoc_lev5() click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2156
def subtoc_lev5
  subtoc_lev('h5','subtoc') if @txt
end
subtoc_lev6() click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2159
def subtoc_lev6
  subtoc_lev('h6','subtoc') if @txt
end
subtoc_lev7() click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2162
def subtoc_lev7
  subtoc_lev('h7','subtoc') if @txt
end