diff options
author | Ralph Amissah <ralph@amissah.com> | 2008-02-05 23:50:34 +0000 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2008-02-05 23:50:34 +0000 |
commit | ad21750ba3c44303d0c2ad91269771605612a8e6 (patch) | |
tree | fb1c5ce2737a1cf04069e409563e20540dcea9ff /lib/sisu/v0/dal.rb | |
parent | Updated sisu-0.64.2 (diff) | |
parent | version rolled back, not ready to open ruby 1.9 some libraries not yet available (diff) |
Merge branch 'upstream' into debian/sid
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 |