class SiSU_AO_CharacterCheck::Check
Public Class Methods
new(data)
click to toggle source
# File lib/sisu/ao_character_check.rb, line 57 def initialize(data) @data=data @comment='%' @endnote_array=[] end
Public Instance Methods
character_check_and_oldstyle_endnote_array()
click to toggle source
# File lib/sisu/ao_character_check.rb, line 62 def character_check_and_oldstyle_endnote_array data=@data @endnote_array=[] endnote_no=1 @tuned_file=data.select do |dob| unless dob.is ==:table dob.obj=dob.obj.strip. gsub(/^[{~}]\s*$/,''). gsub(/~#\s*/,"#{Mx[:pa_non_object_no_heading]}"). gsub(/-#\s*/,"#{Mx[:pa_non_object_dummy_heading]}"). gsub(/(#{Mx[:en_a_o]})\s*\s+/,'\1 '). gsub(/(~\{\s*)\s+/,'\1 '). gsub(/ \/\//,"#{Mx[:br_line]}"). gsub(/<br>/,"#{Mx[:br_line]}"). #needed by xml, xhtml etc. gsub(/\t/,' '). gsub(/\342\200\231/u,"'"). #if dob =~/’/ #Avoid #‘ ’ #“ ” gsub(/\\copy(?:right)?\b/,'©'). gsub(/\\trademark\b|\\tm\b/,'®') dob.obj=dob.obj + "\n" unless dob.is ==:code case dob.obj when /\^~/ #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+ sub_dob=dob.obj.dup @endnote_array << sub_dob.gsub(/\n/,''). gsub(/\^~\s+(.+)\s*/, %{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}). strip endnote_no+=1 dob=nil if dob.obj =~/\^~ .+/ #watch, removes 'binary' endnote now in endnote array for later insertion end end end dob if dob.is_a?(Object) end.flatten.compact [@tuned_file,@endnote_array] end