diff options
Diffstat (limited to 'lib/sisu/v0/html_scroll.rb')
-rw-r--r-- | lib/sisu/v0/html_scroll.rb | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/lib/sisu/v0/html_scroll.rb b/lib/sisu/v0/html_scroll.rb index 97a1a02e..0bbac4fa 100644 --- a/lib/sisu/v0/html_scroll.rb +++ b/lib/sisu/v0/html_scroll.rb @@ -84,39 +84,39 @@ module SiSU_HTML_scroll @rcdc=false @scr={ :body=>[],:metadata=>[],:owner_details=>[] } data.each do |para| - if para =~/^\d~endnotes\s+Endnotes/ - para.gsub!(/Endnotes.+/,'') - end - if para =~/^\d~meta\s+Document Information/ + #if para =~/^#{Mx[:lv_o]}\d:endnotes#{Mx[:lv_c]}\s*Endnotes/ + ## para.gsub!(/Endnotes.+/,'') + #end + if para =~/^#{Mx[:lv_o]}\d:meta#{Mx[:lv_c]}\s*Document Information/ para.gsub!(/(Document Information(?: \(metadata\))?)/,'\1<a name="docinfo"></a>') end - if para =~/^\d~metadata\s+Metadata/ + if para =~/^#{Mx[:lv_o]}\d:metadata#{Mx[:lv_c]}\s*Metadata/ para.gsub!(/(Metadata)/,'\1<a name="metadata"></a>') end if @rcdc==false \ - and (para =~/^\d~metadata/ or para =~/^1~meta\s+Document Information/) + and (para =~/^#{Mx[:lv_o]}:metadata#{Mx[:lv_c]}/ or para =~/^#{Mx[:lv_o]}1:meta#{Mx[:lv_c]}\s*Document Information/) @rcdc=true end - if para !~/(^0~|<ENDNOTES>|<EOF>)/ - unless para =~/^<:code>/; para.gsub!(/~[{\[].+?[}\]]~\s+/m,' ') + if para !~/(^#{Rx[:meta]}|#{Mx[:br_endnotes]}|#{Mx[:br_eof]})/ + unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/; para.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') end - if para =~/.+?<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - paranum=para[/.+?<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,1] + if para =~/.+?#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + paranum=para[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,1] @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) end - @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).lev_segname_para_ocn - m=/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).html_scroll + m=/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|_[1-9]?\*|<:i[1-9]>\s*_\*|null/ + format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ #watch case @sto.format - when /^1~\S*/; para=@sto.scroll_lev_para_ocn.heading_body1 - when /^2~\S*/; para=@sto.scroll_lev_para_ocn.heading_body2 - when /^3~\S*/; para=@sto.scroll_lev_para_ocn.heading_body3 - when /^4~\S+/; para=@sto.scroll_lev_para_ocn.heading_body4 # work on see Split_text_object4 - when /^5~\S*/; para=@sto.scroll_lev_para_ocn.heading_body5 - when /^6~\S*/; para=@sto.scroll_lev_para_ocn.heading_body6 - when /^_\*$/; para=@sto.scroll_lev_para_ocn.bullet - when /^_([1-9])\*$/ #indent with bullet + when /^1:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body1 + when /^2:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body2 + when /^3:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body3 + when /^4:\S+?/; para=@sto.scroll_lev_para_ocn.heading_body4 # work on see Split_text_object4 + when /^5:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body5 + when /^6:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body6 + when /^#{Mx[:gl_bullet]}/; para=@sto.scroll_lev_para_ocn.bullet + when /^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}#{Mx[:gl_bullet]}/ #indent with bullet format_txt_obj.gsub_body para=@sto.scroll_lev_para_ocn.format('li',"i#{$1}") when /^i([1-9])$/ #indent @@ -130,26 +130,26 @@ module SiSU_HTML_scroll if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ format_txt_obj.gsub_body para=@sto.scroll_lev_para_ocn.para - if para =~/<!Th?.+/ # tables come as single block + if para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block table=SiSU_HTML_shared::Table.new(para) para=table.table_split end end end - elsif para =~/^[1-9]~\S*/ \ - and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/^#{Mx[:lv_o]}[1-9]:/ \ + and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_c]}#@dp:#@dp#{Mx[:id_c]}$/ format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,para) para=format_txt_obj.bold_header elsif para =~/Endnotes?/ \ - and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,'<br /><a name="notes">Note</a>') para=format_txt_obj.bold_para elsif para =~/Owner Details/ \ - and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,'<br /><a name="owner.details">Owner Details</a>') @scr[:owner_details]=format_txt_obj.bold_para para='' - elsif para =~/(.*)<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>(.*)/ #watch + elsif para =~/(.*)#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/ #watch one,two=$1,$2 format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) para=format_seg.no_paranum @@ -162,9 +162,8 @@ module SiSU_HTML_scroll one,two=/(.*)<:center>(.*)/.match(para).captures format_scroll=SiSU_HTML_Format_type::Format_scroll.new(@md,one,two) end - para.gsub!(/<!.+!>/,' ') - para.gsub!(/^<:\S?>/,'') - para.gsub!(/<:\S?>/,' ') + para.gsub!(/^#{Rx[:mx_fa_clean]}/,' '); para.gsub!(/^<:\S?>/,'') + para.gsub!(/#{Rx[:mx_fa_clean]}/,' '); para.gsub!(/<:\S?>/,' '); para.gsub!(/<!.+!>/,' ') para.strip! unless @rcdc; @scr[:body] << para unless para =~/\A\s*\Z/ else @scr[:metadata] << para |