diff options
author | Ralph Amissah <ralph@amissah.com> | 2012-10-01 15:43:19 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2012-10-01 15:43:19 -0400 |
commit | 6b2c44794b8aeeca96a9b3114b87b3c1df69fd9d (patch) | |
tree | 20ffa7c21eda17b340e473733088fa80986cc0d6 /lib/sisu/v3/texpdf.rb | |
parent | v3: cosmetic code, if true ; x, remove semicolons replace with "then" (diff) |
v3: cosmetic code, .is_a?(X) replaces .class==X (& some defined? & nil? tests)
Diffstat (limited to 'lib/sisu/v3/texpdf.rb')
-rw-r--r-- | lib/sisu/v3/texpdf.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index fc007a4f..0665c9b4 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -401,8 +401,8 @@ module SiSU_TeX def tables(data) @tex_file=[] data.each do |dob| - @tex_file << if dob.class==String \ - or dob.class==Hash + @tex_file << if dob.is_a?(String) \ + or dob.is_a?(Hash) dob elsif dob.is==:table tables_hash(@md,dob) #Hash result @@ -538,12 +538,12 @@ module SiSU_TeX idx_arr=[] idx=SiSU_Particulars::CombinedSingleton.instance.get_idx_raw(@md.opt).raw_idx idx.each do |x| - x=if x.class==String + x=if x.is_a?(String) x=SiSU_TeX_Pdf::SpecialCharacters.new(@md,x).special_characters x=SiSU_TeX_Pdf::FormatTextObject.new(@md,x).url_str_internal(x,true) else x=nil end - idx_arr << x.sub(/,$/,'') if x.class==String + idx_arr << x.sub(/,$/,'') if x.is_a?(String) end idx_str=idx_arr.join(br) l=heading + br + idx_str @@ -582,7 +582,7 @@ module SiSU_TeX dob.tmp=dob.tmp.strip unless dob.is==:code dob=enclose(dob) unless dob.tmp =~/^$/ end - if dob.class==String + if dob.is_a?(String) dob.tmp=dob.tmp.gsub(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,' \newline '). #% tread with care gsub(/(\.#{Tex[:tilde]}\S*\s*|<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ') #% tread with care end @@ -776,7 +776,7 @@ WOK @tex_file << x x=nil data.each do |dob| #% case follows with levels 1-6 indents & graphics - if dob.class==Hash + if dob.is_a?(Hash) elsif dob.of==:para \ || dob.of==:block #GATEWAY FIX FIX stuff dob=markup_common(dob) @@ -797,7 +797,7 @@ WOK end end end - elsif dob.tmp.class==Hash \ + elsif dob.tmp.is_a?(Hash) \ and (dob.tmp[:p] and dob.tmp[:l]) dob = { p: markup_common(dob.tmp[:p]), @@ -844,7 +844,7 @@ WOK def number_paras(data) tex_file=[] data.each do |dob| - dob=if dob.class==Hash + dob=if dob.is_a?(Hash) if ( dob['a4'] \ or dob['a5'] \ or dob['b5'] \ @@ -932,7 +932,7 @@ WOK file[:portrait] << @@tex_head[ps][:p] file[:landscape] << @@tex_head[ps][:l] array.each do |morph| - if morph.class==String + if morph.is_a?(String) #morph.gsub!(/^\s+/,'') if morph !~/\A\s*\Z/ file[:portrait].puts morph,"\n" @@ -940,7 +940,7 @@ WOK end elsif morph.class.inspect =~ /SiSU_DAL_DocumentStructure/ \ and morph.tmp \ - and morph.tmp.class==String + and morph.tmp.is_a?(String) if morph.is !=:code \ && morph.of !=:block morph.tmp=morph.tmp.gsub(/^\s+/,'') @@ -951,10 +951,10 @@ WOK file[:portrait].puts morph.tmp,"\n" file[:landscape].puts morph.tmp,"\n" end - elsif morph.class==Hash #inserted headers and the like, only + elsif morph.is_a?(Hash) #inserted headers and the like, only h={ ps: ps, h: morph, filename: file } output_morph_hash(h) - elsif morph.tmp.class==Hash #tables & images? + elsif morph.tmp.is_a?(Hash) #tables & images? h={ ps: ps, h: morph.tmp, filename: file } output_morph_hash(h) end |