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.



629
630
631
# File 'lib/sisu/xml_format.rb', line 629

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



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

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



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

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



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

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

#header6Object



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

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

#header7Object



743
744
745
# File 'lib/sisu/xml_format.rb', line 743

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

#header_sub(tag, attrib) ⇒ Object

% para sisu



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

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


769
770
771
# File 'lib/sisu/xml_format.rb', line 769

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


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

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


754
755
756
757
758
# File 'lib/sisu/xml_format.rb', line 754

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


759
760
761
762
763
# File 'lib/sisu/xml_format.rb', line 759

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


764
765
766
767
768
# File 'lib/sisu/xml_format.rb', line 764

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


639
640
641
# File 'lib/sisu/xml_format.rb', line 639

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


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

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

change bold use css



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

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



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

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


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

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


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

def navigation_toc_lev5
end


678
679
# File 'lib/sisu/xml_format.rb', line 678

def navigation_toc_lev6
end

#subtoc_lev(tag, attrib) ⇒ Object



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

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



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

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

#subtoc_lev6Object



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

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

#subtoc_lev7Object



711
712
713
# File 'lib/sisu/xml_format.rb', line 711

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