Class: SiSU_AO_CharacterCheck::Check
- Inherits:
-
Object
- Object
- SiSU_AO_CharacterCheck::Check
- Defined in:
- lib/sisu/ao_character_check.rb
Instance Method Summary collapse
- #character_check_and_oldstyle_endnote_array ⇒ Object
-
#initialize(data) ⇒ Check
constructor
A new instance of Check.
Constructor Details
#initialize(data) ⇒ Check
Returns a new instance of Check.
57 58 59 60 61 |
# File 'lib/sisu/ao_character_check.rb', line 57 def initialize(data) @data=data @comment='%' @endnote_array=[] end |
Instance Method Details
#character_check_and_oldstyle_endnote_array ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# 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 |