diff options
author | Ralph Amissah <ralph@amissah.com> | 2008-08-23 12:01:59 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2008-08-23 12:01:59 -0400 |
commit | 08c69d074001507d64cd5960c8679ec91a5a8353 (patch) | |
tree | af52d5986b3108abc5edbd943ea287455c89deb3 /lib/sisu/v0/html_segments.rb | |
parent | a bit of a cleanup, and change reference to null to ordinary (diff) |
pass Hash to Format classes; some match tuning in dal
Diffstat (limited to 'lib/sisu/v0/html_segments.rb')
-rw-r--r-- | lib/sisu/v0/html_segments.rb | 67 |
1 files changed, 40 insertions, 27 deletions
diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index 7a4a4fb6..b457fe5c 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -228,41 +228,45 @@ module SiSU_HTML_seg @@seg[:tocband_bannerless] << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) @@seg[:headers] << format_head_seg.seg_head_escript if SiSU_HTML_Format::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug @@seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@dc_creator).gsub(clean,'') - paranum=if @@header1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 + ocn=if @@header1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end - @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) - format_seg=SiSU_HTML_Format::Format_seg.new(@md,@@header1,@p_num.ocn_display) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + txt_obj={:txt =>@@header1,:ocn_display =>@p_num.ocn_display} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) @@seg[:headers] << format_seg.title_header1.gsub(clean,'') @@header1.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') end if @@is2 == 1 header2=@@header2 - paranum=if header2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 + ocn=if header2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end - @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) - format_seg=SiSU_HTML_Format::Format_seg.new(@md,header2,@p_num.ocn_display) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + txt_obj={:txt =>header2,:ocn_display =>@p_num.ocn_display} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) @@seg[:headers] << format_seg.title_header2.gsub(clean,'') @@header2.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') end if @@is3 == 1 header3=@@header3 - paranum=if header3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 + ocn=if header3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end - @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) - format_seg=SiSU_HTML_Format::Format_seg.new(@md,header3,@p_num.ocn_display) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + txt_obj={:txt =>header3,:ocn_display =>@p_num.ocn_display} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) @@seg[:headers] << format_seg.title_header3.gsub(clean,'') @@header3.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') end if @@is4 == 1 header4=@@header4 - paranum=if header4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 + ocn=if header4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end - @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) - format_seg=SiSU_HTML_Format::Format_seg.new(@md,header4,@p_num.ocn_display) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + txt_obj={:txt =>header4,:ocn_display =>@p_num.ocn_display} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) @@seg[:headers] << format_seg.title_header4.gsub(clean,'') end @@seg[:header_endnotes]=format_head_seg.title_endnote(@md.title,@md.subtitle,@dc_creator,@@seg[:dot_nav]) @@ -275,8 +279,8 @@ module SiSU_HTML_seg if para !~/^#{Rx[:meta]}/ m=para[/.+?#{Mx[:id_o]}~(\d+);(?:[ohm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] if m - paranum=m[1].to_s - @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) + ocn=m[1].to_s + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) end if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/m \ or @@flag_alt==true @@ -299,14 +303,18 @@ module SiSU_HTML_seg end if para !~/^#{Mx[:lv_o]}[1-9]:|#{Rx[:meta]}/ if para =~/(.*)#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/ - one,two=$1,$2 - format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) + cont="#{$1} #{$2}" #check where $2 is other than space + txt_obj={:txt =>cont} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) para=format_seg.no_paranum end end if para[/#{Mx[:id_o]}~(\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp)#{Mx[:id_c]}$/] @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).html_seg - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ #watch + if @sto.format =~/i[1-9]|ordinary/ #watch + txt_obj={:txt =>@sto.text} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) + end para=case @sto.format # work area 2003w29 ||@|def lev_segname_para_ocn| when /^4:/; @sto.seg_lev_para_ocn.header4 # work on see Split_text_object when /^5:/; @sto.seg_lev_para_ocn.header5 @@ -348,11 +356,13 @@ module SiSU_HTML_seg if para !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/ if para[/(.*)#{Mx[:id_o]}~0;(?:u|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/] #% watch u & m? one,two=$1,$2 - format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) + txt_obj={:txt =>$1.strip,:trailing =>$2.strip} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) end para.gsub!(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with <!e_!> #?? workpoint if para =~/<a name="_\d+" href="#-\d+"> <sup>/ #endnote- note- - format_seg=SiSU_HTML_Format::Format_seg.new(@md,para) + txt_obj={:txt =>para} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) para=format_seg.no_paranum end end @@ -444,12 +454,12 @@ module SiSU_HTML_seg para.gsub!(/ <\/a>/,' ') case para # series changed 2002w42 when /^#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*(.+)?#{Mx[:id_o]}~(\d+);(?:h|[56]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #remove [u]? req by pg texts, revist - one,two=$1,$2 - format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) + txt_obj={:txt =>$1.strip,:ocn =>$2} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) para=format_seg.subtoc_lev5 when /^#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*(.+)?#{Mx[:id_o]}~(\d+);(?:h|[56]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - one,two=$1,$2 - format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) + txt_obj={:txt =>$1.strip,:ocn =>$2} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) para=format_seg.subtoc_lev6 end @@seg_subtoc_array << para @@ -474,7 +484,8 @@ module SiSU_HTML_seg e_n=note_match_seg[/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,1] try=e_n.split(/<br \/>/) try.each do |e| - format_seg=SiSU_HTML_Format::Format_seg.new(@md,e) + txt_obj={:txt =>e} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) note_match=if e =~/#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}/ format_seg.endnote_body_indent else format_seg.endnote_body @@ -484,9 +495,11 @@ module SiSU_HTML_seg try.join('<br \/>') #% creation of separate end segment/page of all endnotes referenced back to reference segment m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(#-[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi - one=note_match_seg[m,1] #note~ [a name] - two=note_match_seg[m,2] #note- - format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) + endnote_part_a=note_match_seg[m,1] + endnote_part_b=note_match_seg[m,2] + txt_obj={:endnote_part_a =>endnote_part_a,:endnote_part_b =>endnote_part_b} + + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408 @@seg[:endnote_all] << note_match_all_seg end |