From 21f5e220b738add01c19c2b15a76f2d240b2c0d5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 23 Jan 2012 21:42:25 -0500 Subject: v3dv: replace use of most ruby exclamation (!) method actions --- lib/sisu/v3dv/epub_segments.rb | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'lib/sisu/v3dv/epub_segments.rb') diff --git a/lib/sisu/v3dv/epub_segments.rb b/lib/sisu/v3dv/epub_segments.rb index e8bc3f20..1119d8c8 100644 --- a/lib/sisu/v3dv/epub_segments.rb +++ b/lib/sisu/v3dv/epub_segments.rb @@ -114,11 +114,10 @@ WOK filename_seg << @seg[:headings] << @seg[:main] << "\n\n" end filename_seg << @seg[:tail] << @seg[:nav] << @seg[:close] - filename_seg.flatten!.compact! + filename_seg=filename_seg.flatten.compact #watch filename_seg.each do |str| unless str =~/\A\s*\Z/ - str.strip! - @output_epub_cont_seg << str + @output_epub_cont_seg << str.strip end end @output_epub_cont_seg.close @@ -187,10 +186,10 @@ WOK # #while dob.obj =~/href="#{Xx[:segment]}#+(\S+?)"/ # # m=$1 # # if map_nametags[m][:segname] - # # dob.obj.sub!(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#{map_nametags[m][:segname]}#{Sfx[:html]}#\\1"}) + # # dob.obj=dob.obj.sub(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#{map_nametags[m][:segname]}#{Sfx[:html]}#\\1"}) # # else # # p "NOT FOUND name_tags: #{m}" - # # dob.obj.sub!(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#\\1"}) # not satisfactory + # # dob.obj=dob.obj.sub(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#\\1"}) # not satisfactory # # end # #end #end @@ -329,7 +328,7 @@ WOK txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display } format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading1.gsub(clean,'') - @@heading1.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') + @@heading1=@@heading1.gsub(/  [\d*+]+<\/sup> <\/a>/,'') end if @@is2==1 heading2=@@heading2 @@ -340,7 +339,7 @@ WOK txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display } format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading2.gsub(clean,'') - @@heading2.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') + @@heading2=@@heading2.gsub(/  [\d*+]+<\/sup> <\/a>/,'') end if @@is3==1 heading3=@@heading3 @@ -351,7 +350,7 @@ WOK txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display } format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading3.gsub(clean,'') - @@heading3.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') + @@heading3=@@heading3.gsub(/  [\d*+]+<\/sup> <\/a>/,'') end if @@is4==1 heading4=@@heading4 @@ -413,7 +412,7 @@ WOK sto.break end if @md.flag_separate_endnotes # may need to revisit, check - dob.obj.gsub!(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">}) #endnote- twice #removed file type + dob.obj=dob.obj.gsub(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">}) #endnote- twice #removed file type end if dob.is =~/heading|para/ \ and (not dob.ocn or dob.ocn.to_s.empty?) @@ -464,7 +463,7 @@ WOK end def get_subtoc_endnotes(data) #get endnotes & sub-table of contents subtoc data.each do |dob| - dob.obj.gsub!(/(.+?)<\/a>/mi,'\1') + dob.obj=dob.obj.gsub(/(.+?)<\/a>/mi,'\1') if @md.flag_auto_endnotes if (dob.is=='heading' \ || dob.is=='heading_insert') \ @@ -516,7 +515,7 @@ WOK if dob.obj=~/#{Mx[:en_b_o]}#{pls}\d+\s.+?#{Mx[:en_b_c]}/m endnote_array << dob.obj.scan(/#{Mx[:en_b_o]}#{pls}\d+\s.+?#{Mx[:en_b_c]}/m) end - endnote_array.flatten! #.compact! #check compacting + endnote_array=endnote_array.flatten #.compact #check compacting endnote_array.each do |note| note_match=note.dup note_match_seg=note.dup @@ -541,7 +540,7 @@ WOK 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 -- cgit v1.2.3