diff options
Diffstat (limited to 'lib/sisu/v3dv/html_format.rb')
-rw-r--r-- | lib/sisu/v3dv/html_format.rb | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/lib/sisu/v3dv/html_format.rb b/lib/sisu/v3dv/html_format.rb index be4427ac..fdf7f568 100644 --- a/lib/sisu/v3dv/html_format.rb +++ b/lib/sisu/v3dv/html_format.rb @@ -75,14 +75,14 @@ module SiSU_HTML_Format or @skin_no_ocn ocn_class='ocn_off' @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}"> </label>}) + %{<label class="#{ocn_class}"> </label>}) elsif @ocn.to_i==0 @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}"><a name="#{@ocn}"> </a></label>}) + %{<label class="#{ocn_class}"><a name="#{@ocn}"> </a></label>}) else ocn_class='ocn' @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}"><a name="#{@ocn}" href="##{@ocn}" class="lnk#{ocn_class}">\\1</a></label>}) + %{<label class="#{ocn_class}"><a name="#{@ocn}" href="##{@ocn}" class="lnk#{ocn_class}">\\1</a></label>}) end end def name @@ -653,7 +653,7 @@ WOK @file=SiSU_Env::FileOp.new(@md) if @md if @file.output_dir_structure.by_language_code? \ or @file.output_dir_structure.by_filetype? - nxt.gsub!(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}") + nxt=nxt.gsub(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}") end end %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> @@ -715,7 +715,7 @@ WOK @file=SiSU_Env::FileOp.new(@md) if @md if @file.output_dir_structure.by_language_code? \ or @file.output_dir_structure.by_filetype? - nxt.gsub!(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}") + nxt=nxt.gsub(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}") end end %{<table summary="segment navigation pre/next" border="0" cellpadding="3" cellspacing="0"> @@ -974,7 +974,7 @@ WOK end @headnamed= (@headname ? %{<a name="h#{@headname}" id="h#{@headname}"></a>} : nil) if @txt and not @txt.empty? - @txt.gsub!(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') + @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') end @p_num=ParagraphNumber.new(@md,@ocn) @vz=SiSU_Env::GetInit.instance.skin @@ -1081,8 +1081,8 @@ WOK para_form_css('p','norm') end def break - @txt.gsub!(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'<hr /><br />') - @txt.gsub!(/#{Mx[:br_obj]}/,'<hr style="width:30%" /><br />') + @txt=@txt.gsub(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'<hr /><br />'). + gsub(/#{Mx[:br_obj]}/,'<hr style="width:30%" /><br />') para_form_css('p','norm') end def format(tag,attrib) @@ -1141,7 +1141,7 @@ WOK '' end def seg_heading_sub(tag,attrib) - @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') + @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} @@ -1176,15 +1176,16 @@ WOK </div>' end def gsub_body #fix - case @txt + @txt=case @txt when /^\((i+|iv|v|vi+|ix|x|xi+)\)/ - @txt.gsub!(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>') + @txt.gsub(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>') when /^\(?(\d|[a-z])+\)/ - @txt.gsub!(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>') + @txt.gsub(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>') when /^\s*\d{1,3}\.\s/ - @txt.gsub!(/^\s*(\d+\.)/,'<b>\1</b>') + @txt.gsub(/^\s*(\d+\.)/,'<b>\1</b>') when /^\s*[A-Z]\.\s/ - @txt.gsub!(/^\s*([A-Z]\.)/,'<b>\1</b>') + @txt.gsub(/^\s*([A-Z]\.)/,'<b>\1</b>') + else @txt end end def bold_para @@ -1197,8 +1198,8 @@ WOK #{@vz.table_close}} end def bold_heading - @txt.gsub!(/[1-9]~(\S+)/,'<a name="\1"></a>') - @txt.gsub!(/[1-9]~/,'') + @txt=@txt.gsub(/[1-9]~(\S+)/,'<a name="\1"></a>'). + gsub(/[1-9]~/,'') %{<p class="bold"> #{@txt} </p> @@ -1286,8 +1287,8 @@ WOK } end def clean(txt) - txt.gsub!(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,'') - txt.gsub!(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'') + txt=txt.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,''). + gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'') txt end def subtoc_lev(tag,attrib) @@ -1300,9 +1301,9 @@ WOK 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.gsub!(/[\n\s]+/m,' ') - txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') - txt.gsub!(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+"> <sup>\d+<\/sup> /m,'') + note=note.gsub(/[\n\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[\n\s]+name="-\d+"[\n\s]+href="#_\d+"> <sup>\d+<\/sup> /m,'') end %{<#{tag} class="#{attrib}"> <a href="##{@ocn}"><i>#{txt}</i></a> #{note} @@ -1315,7 +1316,7 @@ WOK subtoc_lev('h6','subtoc') if @txt end def heading_sub(tag,attrib) - @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') + @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} @@ -1407,7 +1408,7 @@ WOK lev('h0','toc') end def strip_endnotes(txt) - txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') + txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') txt end def mini_lev1 |