Class: SiSU_XML_Format::FormatSeg

Inherits:
FormatTextObject show all
Defined in:
lib/sisu/xml_format.rb

Instance Attribute Summary

Attributes inherited from FormatTextObject

#banner, #dob, #font, #format, #headname, #link, #linkname, #md, #ocn, #p_num, #para_id, #paranum, #table, #txt, #url

Instance Method Summary collapse

Methods inherited from FormatTextObject

#bold, #bold_header, #bold_para, #bullet, #center, #center_bold, #code, #dl, #endnote_body, #endnote_body_indent, #gsub_body, #heading_body, #heading_body0, #heading_body1, #heading_body2, #heading_body3, #heading_body4, #heading_body5, #heading_body6, #heading_body7, #heading_normal, #no_paranum, #para, #para_form_css, #scr_endnote_body, #table_css_end, #title_header, #title_header1, #title_header2, #title_header3, #title_header4, #title_header4_old, #toc_head_copy_at

Methods included from SiSU_Parts_XML

#_url_path_image_base, #band1, #band2, #banner_band, #black, #blue_ink, #blue_tinge, #grey, #grey_medium, #grey_pale, #home_button_only, #ico, #png_home, #png_home_button, #set_face, #set_fonts, #table1, #table2, #the_banner, #the_color, #the_font, #the_line_break, #the_png, #the_table_close, #the_url_decoration, #txt_close, #txt_open, #white, #xml_close, #xml_open, #yellow_light

Methods included from SiSU_Parts_Generic

#footer_signature, #home, #home_txt, #i_choice, #i_home_button, #i_ico, #i_new, #rl_root, #root_http, #sisu, #sisu_txt, #sisudoc, #site, #the_icon, #the_text, #the_url, #txt_home, #txt_hp, #txt_hp_alias, #txt_signature, #urify, #url_close, #url_open

Constructor Details

#initialize(md, txt) ⇒ FormatSeg

Returns a new instance of FormatSeg.



627
628
629
# File 'lib/sisu/xml_format.rb', line 627

def initialize(md,txt)
  super(md,txt)
end

Instance Method Details

#endnote_seg_body(fn = '') ⇒ Object

FIX #url construction keep within single line… BUG WATCH 200408



678
679
680
681
682
683
684
685
# File 'lib/sisu/xml_format.rb', line 678

def endnote_seg_body(fn='')  #FIX                                                #url construction keep within single line... BUG WATCH 200408
  fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info # Sfx[:html] or Sfx[:xhtml] ?
  %{
  <p class="endnote">
#{@endnote_part_a}#{fn}#{@md.lang_code_insert}#{Sfx[:html]}#{@endnote_part_b}
  </p>
}
end

#header4Object



724
725
726
727
728
729
730
731
732
733
734
# File 'lib/sisu/xml_format.rb', line 724

def header4
  %{
<div class="substance">
  #{@p_num.ocn_display}
  <h1 class="norm" #{@p_num.id}>#{@p_num.name}
#{@t_o[:format]}
#{@txt}
  </h1>
</div>
}
end

#header5Object



735
736
737
# File 'lib/sisu/xml_format.rb', line 735

def header5
  header_sub('p','bold')
end

#header6Object



738
739
740
# File 'lib/sisu/xml_format.rb', line 738

def header6
  header_sub('p','bold')
end

#header7Object



741
742
743
# File 'lib/sisu/xml_format.rb', line 741

def header7
  header_sub('p','bold')
end

#header_sub(tag, attrib) ⇒ Object

% para sisu



713
714
715
716
717
718
719
720
721
722
723
# File 'lib/sisu/xml_format.rb', line 713

def header_sub(tag,attrib)
  @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}>#{@p_num.name} #{@headname}
#{@txt}
  </#{tag}>
</div>
}
end


767
768
769
# File 'lib/sisu/xml_format.rb', line 767

def navigation_center
  "<center>#{@txt}</center>"
end


744
745
746
747
748
749
750
751
# File 'lib/sisu/xml_format.rb', line 744

def navigation_header4
  %{<table summary="navigation segment header 4" width=100% bgcolor="#08163f" border="0">
<tr><td align="center">
<p class="bold">
  #{@txt}
</p>
#{the_table_close}}
end


752
753
754
755
756
# File 'lib/sisu/xml_format.rb', line 752

def navigation_header5
  %{<p class="bold">
  #{@txt}
</p>}
end


757
758
759
760
761
# File 'lib/sisu/xml_format.rb', line 757

def navigation_header6
  %{<p class="bold">
  #{@txt}
</p>}
end


762
763
764
765
766
# File 'lib/sisu/xml_format.rb', line 762

def navigation_header7
  %{<p class="bold">
  #{@txt}
</p>}
end


637
638
639
# File 'lib/sisu/xml_format.rb', line 637

def navigation_toc_lev1
  %{#{@banner.nav_toc}}
end


630
631
632
633
634
635
636
# File 'lib/sisu/xml_format.rb', line 630

def navigation_toc_lev1_advert
  %{#{@banner.home_button}\n
<center>
#{@txt}
#{@two}
</a></center><p />}
end

change bold use css



640
641
642
643
644
645
646
647
648
649
650
651
# File 'lib/sisu/xml_format.rb', line 640

def navigation_toc_lev2                                                      #change bold use css
  %{<p />
<table summary="navigation segment level 2">
<tr><td width ="20">
</td>
<td>
  <font size="3" #{the_font.set_face}>
<b>#{@txt}</b>
  </font>
  </p>
#{the_table_close}}
end

change bold use css



652
653
654
655
656
657
658
659
660
661
662
663
# File 'lib/sisu/xml_format.rb', line 652

def navigation_toc_lev3                                                      #change bold use css
  %{<p />
<table summary="navigation segment level 3">
<tr><td width ="20">
</td>
<td>
  <font size="3" #{the_font.set_face}>
<b>#{@txt}</b>
  </font>
  </p>
#{the_table_close}}
end


664
665
666
667
668
669
670
671
672
673
# File 'lib/sisu/xml_format.rb', line 664

def navigation_toc_lev4
  %{<table summary="navigation segment level 4">
<tr><td width ="80">
</td>
<td>
<p>
  #{@txt}
</p>
#{the_table_close}}
end


674
675
# File 'lib/sisu/xml_format.rb', line 674

def navigation_toc_lev5
end


676
677
# File 'lib/sisu/xml_format.rb', line 676

def navigation_toc_lev6
end

#subtoc_lev(tag, attrib) ⇒ Object



686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
# File 'lib/sisu/xml_format.rb', line 686

def subtoc_lev(tag,attrib)
  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]}\s*)/m
    note=$1
    note=note.gsub(/[\n\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]+name="-\d+"[\n\s]+href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;/m,'')
  end
  %{<#{tag} class="#{attrib}">
<a href="##{@ocn}"><i>#{txt}</i></a> #{note}
  </#{tag}>}
end

#subtoc_lev5Object



703
704
705
# File 'lib/sisu/xml_format.rb', line 703

def subtoc_lev5
  subtoc_lev('h5','subtoc') if @txt
end

#subtoc_lev6Object



706
707
708
# File 'lib/sisu/xml_format.rb', line 706

def subtoc_lev6
  subtoc_lev('h6','subtoc') if @txt
end

#subtoc_lev7Object



709
710
711
# File 'lib/sisu/xml_format.rb', line 709

def subtoc_lev7
  subtoc_lev('h7','subtoc') if @txt
end