diff options
Diffstat (limited to 'lib/sisu/v3dv/html_segments.rb')
-rw-r--r-- | lib/sisu/v3dv/html_segments.rb | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/sisu/v3dv/html_segments.rb b/lib/sisu/v3dv/html_segments.rb index 75c9b90f..ba825ae4 100644 --- a/lib/sisu/v3dv/html_segments.rb +++ b/lib/sisu/v3dv/html_segments.rb @@ -61,7 +61,7 @@ module SiSU_HTML_Seg require_relative 'html' # html.rb require_relative 'html_promo' # html_promo.rb require_relative 'shared_metadata' # shared_metadata.rb - class SegOutput + class Output def initialize(md,outputfile,seg,minitoc,type='') @md,@output_seg_file,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type @title_banner_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_seg_title_banner? @@ -106,12 +106,12 @@ module SiSU_HTML_Seg filename_seg << @minitoc << @seg[:headings] << @seg[:main] << "\n</div>\n" end filename_seg << @seg[:tail] << @seg[:tocband_bannerless] << @seg[:credits] - filename_seg.flatten!.compact! + filename_seg=filename_seg.flatten.compact #watch filename_seg.each do |str| unless str =~/\A\s*\Z/ - str.strip! - str.gsub!(Xx[:html_relative2],@file.path_rel_links.html_seg_2) - str.gsub!(Xx[:html_relative1],@file.path_rel_links.html_seg_1) + str=str.strip. + gsub(Xx[:html_relative2],@file.path_rel_links.html_seg_2). + gsub(Xx[:html_relative1],@file.path_rel_links.html_seg_1) @output_seg_file << str end end @@ -147,7 +147,7 @@ module SiSU_HTML_Seg @minitoc=SiSU_HTML::Source::Toc.new(@md,@data).minitoc data=get_subtoc_endnotes(@data) data=articles(data) - Seg.new.cleanup # (((( added )))) + SiSU_HTML_Seg::Seg.new.cleanup # (((( added )))) #### (((( END )))) #### rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure @@ -234,7 +234,7 @@ module SiSU_HTML_Seg unless FileTest.directory?(@file.output_path.html_seg.dir) FileUtils::mkdir_p(@file.output_path.html_seg.dir) if File.writable?("#{@file.output_path.base.dir}/.") end - Seg.new(@md).tail + SiSU_HTML_Seg::Seg.new(@md).tail segfilename="#{@file.output_path.html_seg.dir}/#{@@seg_name_html[tracking-1]}#{@md.lang_code_insert}#{Sfx[:html]}" output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1] minitoc=(@env.html_minitoc?) \ @@ -242,27 +242,27 @@ module SiSU_HTML_Seg : '' if dob.is=='heading' \ or @@seg_name_html[tracking-1] !~/endnotes|book_index|metadata/ - SegOutput.new(@md,output_seg_file,@@seg,minitoc).output + SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc).output elsif dob.is=='heading_insert' if @@seg_name_html[tracking-1]=='endnotes' - SegOutput.new(@md,output_seg_file,@@seg,minitoc,'endnotes').output + SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'endnotes').output elsif @@seg_name_html[tracking-1]=='book_index' - SegOutput.new(@md,output_seg_file,@@seg,minitoc,'idx').output + SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'idx').output @@seg[:idx]=[] elsif @@seg_name_html[tracking-1]=='metadata' - SegOutput.new(@md,output_seg_file,@@seg,minitoc,'metadata').output + SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'metadata').output else puts "#{__FILE__}::#{__LINE__}" end else puts "#{__FILE__}::#{__LINE__}" end - Seg.new.reinitialise + SiSU_HTML_Seg::Seg.new.reinitialise heading_art(dob) head(dob) #keep use for last segment, eg if metadata is last segment #if @@seg_name_html[tracking] =~/metadata/ # this is for metadata # segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}" # output_seg_file=File.new(segfilename,'w') - # SegOutput.new(@md,output_seg_file,@@seg,minitoc,'metadata').output + # SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'metadata').output # Seg.new.reinitialise #end end @@ -331,7 +331,7 @@ module SiSU_HTML_Seg txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading1.gsub(clean,'') - @@heading1.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') + @@heading1=@@heading1.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') end if @@is2==1 heading2=@@heading2 @@ -342,7 +342,7 @@ module SiSU_HTML_Seg txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading2.gsub(clean,'') - @@heading2.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') + @@heading2=@@heading2.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') end if @@is3==1 heading3=@@heading3 @@ -353,7 +353,7 @@ module SiSU_HTML_Seg txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading3.gsub(clean,'') - @@heading3.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') + @@heading3=@@heading3.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') end if @@is4==1 heading4=@@heading4 @@ -421,13 +421,13 @@ module SiSU_HTML_Seg sto.break end if @md.flag_separate_endnotes - dob.obj.gsub!(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type + dob.obj=dob.obj.gsub(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type end if dob.obj !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/ if dob.is =~/heading|para/ and (not dob.ocn or dob.ocn.to_s.empty?) format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob) end - dob.obj.gsub!(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with <!e_!> #?? workpoint + dob.obj=dob.obj.gsub(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with <!e_!> #?? workpoint if dob.obj =~/<a name="_\d+" href="#-\d+"> <sup>/ #endnote- note- format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob) dob=format_seg.no_paranum @@ -471,7 +471,7 @@ module SiSU_HTML_Seg end def get_subtoc_endnotes(data) #get endnotes & sub-table of contents subtoc data.each do |dob| - dob.obj.gsub!(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1') + dob.obj=dob.obj.gsub(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1') if @md.flag_auto_endnotes if (dob.is=='heading' or dob.is=='heading_insert') \ and dob.ln.to_s =~/^[1234]/ \ @@ -523,7 +523,7 @@ module SiSU_HTML_Seg if dob.obj=~/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m endnote_array << dob.obj.scan(/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m) end - endnote_array.flatten!.compact! #check compacting + endnote_array=endnote_array.flatten.compact #watch, check compacting endnote_array.each do |note| note_match=note.dup note_match_seg=note.dup @@ -548,7 +548,7 @@ module SiSU_HTML_Seg note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408 @@seg[:endnote_all] << note_match_all_seg end - dob.obj.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') + dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') end end end |