aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/dal.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2008-02-05 05:02:54 +0000
committerRalph Amissah <ralph@amissah.com>2008-02-05 05:02:54 +0000
commit4c36cadd7fef8b4bbdb0f423bdc4b7c7365d5699 (patch)
tree5e8d5017242f98cf516999e189d0616a479c7b0d /lib/sisu/v0/dal.rb
parentfor 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.rb18
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 #&lsquo; &rsquo; #&ldquo; &rdquo;
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 #&lsquo; &rsquo; #&ldquo; &rdquo;
+ para.gsub!(/�/u,' ') #watch, replace with char code
+ para.gsub!(/[“”]/u,'""')
+ para.gsub!(/[­–—]/u,'-') #— – chk
+ para.gsub!(/·/u,'*')
para.gsub!(/\\copy(?:right)?\b/,'&#169;')
para.gsub!(/\\trademark\b|\\tm\b/,'&#174;')
#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