diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-07-01 01:00:30 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-07-01 01:00:30 -0400 |
commit | f3832f0acc5b335fc820287ce2530435ad651202 (patch) | |
tree | ecd2004aecd2b706316291a98645ed98a5a25a75 /lib/sisu/v6/ao_endnotes.rb | |
parent | debian/changelog (5.4.2-1) (diff) | |
parent | v5 v6: sysenv, developer _CONSTRUCTION_ZONE warning setup modified (diff) |
Merge tag 'sisu_5.4.3' into debian/sid
SiSU 5.4.3
Diffstat (limited to 'lib/sisu/v6/ao_endnotes.rb')
-rw-r--r-- | lib/sisu/v6/ao_endnotes.rb | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/lib/sisu/v6/ao_endnotes.rb b/lib/sisu/v6/ao_endnotes.rb index 21509098..dbc8b214 100644 --- a/lib/sisu/v6/ao_endnotes.rb +++ b/lib/sisu/v6/ao_endnotes.rb @@ -63,8 +63,12 @@ module SiSU_AO_Endnotes class Endnotes def initialize(md,data,endnote_array=nil) - @md,@data,@endnote_array=md,data,endnote_array - @endnote_counter,@endnote_counter_asterisk,@endnote_counter_dag=1,1,1 + @md,@data,@endnote_array= + md, data, endnote_array + @endnote_counter, + @endnote_counter_asterisk, + @endnote_counter_dag= + 1,1,1 end def endnotes data=@data @@ -73,17 +77,20 @@ module SiSU_AO_Endnotes data.each do |dob| # manually numbered endnotes <!e(\d)!> <!e_(\d)!> --> if @md.opt.mod.inspect =~/--no-asterisk|--no-annotate/ - dob.obj=dob.obj.gsub(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'') + dob.obj=dob.obj. + gsub(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'') end if @md.opt.mod.inspect =~/--no-dagger|--no-annotate/ - dob.obj=dob.obj.gsub(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'') + dob.obj=dob.obj. + gsub(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'') end if (defined? dob.obj) \ && (defined? dob.is) \ && dob.is !=:code case dob.obj # auto-numbered endnotes <!e!> <!e_!> --> when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/ - dob.obj=dob.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'\1') + dob.obj=dob.obj. + gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'\1') word_mode=dob.obj.scan(/\S+/m) word_mode=endnote_call_number(word_mode) dob.obj=word_mode.join(' ') @@ -97,7 +104,10 @@ module SiSU_AO_Endnotes end @tuned_file << dob end - @endnote_counter,@endnote_counter_asterisk,@endnote_counter_dag=1,1,1 + @endnote_counter, + @endnote_counter_asterisk, + @endnote_counter_dag= + 1,1,1 @tuned_file=@tuned_file.flatten end def endnote_call_number(words) @@ -105,20 +115,24 @@ module SiSU_AO_Endnotes case word when /#{Mx[:en_a_o]}/ unless word =~/#{Mx[:en_a_o]}[*+]+/ - word.gsub!(/#{Mx[:en_a_o]}/,"#{Mx[:en_a_o]}#{@endnote_counter} ") + word.gsub!(/#{Mx[:en_a_o]}/, + "#{Mx[:en_a_o]}#{@endnote_counter} ") @endnote_counter+=1 end when /#{Mx[:en_b_o]}/ if word =~/#{Mx[:en_b_o]}[+]/ - word.gsub!(/#{Mx[:en_b_o]}[+]/,"#{Mx[:en_b_o]}\+#{@endnote_counter_dag} ") + word.gsub!(/#{Mx[:en_b_o]}[+]/, + "#{Mx[:en_b_o]}\+#{@endnote_counter_dag} ") @endnote_counter_dag+=1 else - word.gsub!(/#{Mx[:en_b_o]}[*]?/,"#{Mx[:en_b_o]}\*#{@endnote_counter_asterisk} ") + word.gsub!(/#{Mx[:en_b_o]}[*]?/, + "#{Mx[:en_b_o]}\*#{@endnote_counter_asterisk} ") @endnote_counter_asterisk+=1 end when /~\^|<:e>/ if @endnote_array - word.gsub!(/~\^|<:e>/,"#{@endnote_array[@endnote_counter-1]}") + word.gsub!(/~\^|<:e>/, + "#{@endnote_array[@endnote_counter-1]}") @endnote_counter+=1 end end |