Class: SiSU_HTML_Format::FormatSeg

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

Instance Attribute Summary

Attributes inherited from FormatTextObject

#banner, #format, #headname, #link, #linkname, #md, #ocn, #p_num, #paranum, #t_o, #table, #txt, #url

Instance Method Summary collapse

Methods inherited from FormatTextObject

#alt, #block, #bold, #bold_heading, #bold_para, #bullet, #center, #center_bold, #code, #dl, #endnote_body, #endnote_body_indent, #group, #gsub_body, #heading_body, #heading_body0, #heading_body1, #heading_body2, #heading_body3, #heading_body4, #heading_body5, #heading_body6, #heading_body7, #heading_normal, #nametags_scroll, #nametags_seg, #no_paranum, #para, #para_form_css, #seg_heading4, #seg_heading5, #seg_heading6, #seg_heading_sub, #table_css_end, #title_heading, #title_heading0, #title_heading1, #title_heading2, #title_heading3, #title_heading4, #toc_head_copy_at, #verse

Methods included from SiSU_Parts_HTML

#_url_path_image_base, #band1, #band2, #banner_band, #black, #blue_ink, #blue_tinge, #css, #grey, #grey_medium, #grey_pale, #home_button_only, #ico, #instrument_cover_band_scr, #instrument_cover_band_seg, #num, #num_css, #numless, #paragraph_font_small, #paragraph_font_tiny, #png_home, #png_home_button, #set_color, #set_face, #set_fonts, #set_size_endnote, #set_small, #set_tiny, #table1, #table2, #table_txt, #table_txt_r, #the_banner, #the_color, #the_font, #the_line_break, #the_margin, #the_nav, #the_png, #the_table_cellpad_box, #the_table_close, #the_url_decoration, #the_width, #txt_0, #txt_1, #txt_2, #txt_3, #txt_close, #txt_concordance, #txt_doc_link, #txt_homepage, #txt_manifest, #txt_open, #txt_toc_link, #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.



1130
1131
1132
# File 'lib/sisu/html_format.rb', line 1130

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

Instance Method Details

#clean(txt) ⇒ Object



1141
1142
1143
1144
# File 'lib/sisu/html_format.rb', line 1141

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 = '') ⇒ Object



1133
1134
1135
1136
1137
1138
1139
1140
# File 'lib/sisu/html_format.rb', line 1133

def endnote_seg_body(fn='')
  fn="../#{@md.fnb}" if fn.to_s.empty?
  %{
  <p class="endnote">
#{@endnote_part_a}#{fn}#{@md.lang_code_insert}#{Sfx[:html]}#{@endnote_part_b}
  </p>
}
end

#heading4Object



1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
# File 'lib/sisu/html_format.rb', line 1189

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

#heading5Object



1183
1184
1185
# File 'lib/sisu/html_format.rb', line 1183

def heading5
  heading_sub('p','bold')
end

#heading6Object



1186
1187
1188
# File 'lib/sisu/html_format.rb', line 1186

def heading6
  heading_sub('p','bold')
end

#heading_sub(tag, attrib) ⇒ Object



1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
# File 'lib/sisu/html_format.rb', line 1172

def heading_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} #{@headnamed}
#{@txt}
  </#{tag}>
</div>
}
end


1218
1219
1220
# File 'lib/sisu/html_format.rb', line 1218

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


1200
1201
1202
1203
1204
1205
1206
1207
# File 'lib/sisu/html_format.rb', line 1200

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


1208
1209
1210
1211
1212
# File 'lib/sisu/html_format.rb', line 1208

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


1213
1214
1215
1216
1217
# File 'lib/sisu/html_format.rb', line 1213

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

#subtoc_lev(tag, attrib) ⇒ Object



1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
# File 'lib/sisu/html_format.rb', line 1145

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[\s]+name="-\d+"[\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



1163
1164
1165
# File 'lib/sisu/html_format.rb', line 1163

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

#subtoc_lev6Object



1166
1167
1168
# File 'lib/sisu/html_format.rb', line 1166

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

#subtoc_lev7Object



1169
1170
1171
# File 'lib/sisu/html_format.rb', line 1169

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