diff options
author | Ralph Amissah <ralph@amissah.com> | 2008-02-05 05:02:54 +0000 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2008-02-05 05:02:54 +0000 |
commit | 4c36cadd7fef8b4bbdb0f423bdc4b7c7365d5699 (patch) | |
tree | 5e8d5017242f98cf516999e189d0616a479c7b0d /lib/sisu/v0/dal.rb | |
parent | for update replace LIKE with '=' ; required by pg8.3 bigint (diff) |
ruby 1.9 open; future pgsql testing on 8.3; encoding utf-8 checks; version bump 0.65.0
* ruby 1.9 use opened, testing required
* db sql pgsql future testing on version 8.3
* encoding utf-8 some compatibility checks
Diffstat (limited to 'lib/sisu/v0/dal.rb')
-rw-r--r-- | lib/sisu/v0/dal.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 6bd11568..e31dba69 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -138,7 +138,11 @@ module SiSU_DAL end def read_fnm dal=[] - dal=if FileTest.file?(@fnm); File.open(@fnm){ |f| dal=Marshal.load(f)} + dal=if FileTest.file?(@fnm) + if RUBY_VERSION < '1.9' + File.open(@fnm){ |f| dal=Marshal.load(f)} + else File.open(@fnm,'r:utf-8'){ |f| dal=Marshal.load(f)} + end else SiSU_DAL::Source.new(@opt).create_dal end end @@ -236,12 +240,12 @@ module SiSU_DAL para.gsub!(/<br>/,'<br />') #needed by xml, xhtml etc. #para.gsub!(/<p>/,'<p />') #consider para.gsub!(/`/,"'") - para.gsub!(/\342\200\231/,"'") #if para =~/’/ #Avoid #‘ ’ #“ ” para.gsub!(/\t/,' ') - para.gsub!(/�/,' ') #watch, replace with char code - para.gsub!(/[“”]/,'""') - para.gsub!(/[–—]/,'-') #— – chk - para.gsub!(/·/,'*') + para.gsub!(/\342\200\231/u,"'") #if para =~/’/ #Avoid #‘ ’ #“ ” + para.gsub!(/�/u,' ') #watch, replace with char code + para.gsub!(/[“”]/u,'""') + para.gsub!(/[–—]/u,'-') #— – chk + para.gsub!(/·/u,'*') para.gsub!(/\\copy(?:right)?\b/,'©') para.gsub!(/\\trademark\b|\\tm\b/,'®') #non_utf8(para) @@ -519,7 +523,7 @@ module SiSU_DAL @tuned_file=[] data.each do |para| para.gsub!(/(^|[^<][^v][^>])\n/,'\1 ') #messy, but idea is that tables should retain breaks - para.gsub!(/^/,"\n") unless para =~/¡/ + para.gsub!(/^/,"\n") unless para =~/¡/u para.gsub!(/^\s+|\s$/,"\n") @tuned_file << para end |