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 | |
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
-rw-r--r-- | CHANGELOG | 16 | ||||
-rwxr-xr-x | bin/sisu | 10 | ||||
-rw-r--r-- | lib/sisu/v0/dal.rb | 18 | ||||
-rw-r--r-- | lib/sisu/v0/dal_doc_str.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v0/dal_doc_str_tables.rb | 24 | ||||
-rw-r--r-- | lib/sisu/v0/db_import.rb | 8 | ||||
-rw-r--r-- | lib/sisu/v0/html_format.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v0/html_segments.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v0/html_table.rb | 22 | ||||
-rw-r--r-- | lib/sisu/v0/html_tune.rb | 172 | ||||
-rw-r--r-- | lib/sisu/v0/manpage.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v0/odf.rb | 12 | ||||
-rw-r--r-- | lib/sisu/v0/odf_format.rb | 26 | ||||
-rw-r--r-- | lib/sisu/v0/plaintext.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v0/shared_html_lite.rb | 12 | ||||
-rw-r--r-- | lib/sisu/v0/shared_xml.rb | 336 | ||||
-rw-r--r-- | lib/sisu/v0/sysenv.rb | 25 | ||||
-rw-r--r-- | lib/sisu/v0/texinfo.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v0/texinfo_format.rb | 26 | ||||
-rw-r--r-- | lib/sisu/v0/texpdf.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v0/texpdf_format.rb | 46 | ||||
-rw-r--r-- | lib/sisu/v0/wikispeak.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v0/xml_tables.rb | 38 |
23 files changed, 430 insertions, 391 deletions
@@ -9,11 +9,17 @@ Reverse Chronological: %% STABLE MANIFEST -%% sisu_0.64.3.orig.tar.gz (2008-02-02:04/6) -http://www.jus.uio.no/sisu/pkg/src/sisu_0.64.3.orig.tar.gz - sisu_0.64.3.orig.tar.gz - sisu_0.64.3-1.dsc - sisu_0.64.3-1.diff.gz +%% sisu_0.65.0.orig.tar.gz (2008-02-05:05/2) +http://www.jus.uio.no/sisu/pkg/src/sisu_0.65.0.orig.tar.gz + sisu_0.65.0.orig.tar.gz + sisu_0.65.0-1.dsc + sisu_0.65.0-1.diff.gz + + * ruby 1.9 opened + + * db sql pgsql future testing on version 8.3 + + * encoding utf-8 some compatibility checks * db sql, for updates use match criteria '=' instead of LIKE (required for pgsql 8.3 with bigint) @@ -1,9 +1,13 @@ #!/usr/bin/env ruby #SiSU: copyright (C) 1997..2008 Ralph Amissah; License GPL, see appended program information -raise "Please, use Ruby1.8 (1.8.4 or later), current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' or RUBY_VERSION > '1.9' -#raise "Please, use Ruby1.8.4 or later, current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' +raise "Please, use Ruby1.8.4 or later, current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' $VERBOSE=nil -$KCODE='u' +if RUBY_VERSION < '1.9' + $KCODE='u' + TS1='¡' +else + TS1='¡'.force_encoding('utf-8') +end branch='v0' SiSU_lib="sisu/#{branch}" require "#{SiSU_lib}/hub" 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 diff --git a/lib/sisu/v0/dal_doc_str.rb b/lib/sisu/v0/dal_doc_str.rb index a59800c4..68529c38 100644 --- a/lib/sisu/v0/dal_doc_str.rb +++ b/lib/sisu/v0/dal_doc_str.rb @@ -228,7 +228,7 @@ module SiSU_document_structure end para.gsub!(/\n\n/,"\n") if para =~/<:(?:code|verse|alt|group)>/ #newlines taken out para.gsub!(/(<:(?:code-end)>)/,"\n\\1") if para =~/<:(?:code-end)>/ #newlines added check - if para =~/<!Th?¡/; para.gsub!(/(<!Th?¡.+?!)>/,"\\1~#{o[:ocn]};#{o[:lv]};#{o[:type]}>") + if para =~/<!Th?¡/u; para.gsub!(/(<!Th?¡.+?!)>/u,"\\1~#{o[:ocn]};#{o[:lv]};#{o[:type]}>") end @o_array << Struct.new(o).structure if o end diff --git a/lib/sisu/v0/dal_doc_str_tables.rb b/lib/sisu/v0/dal_doc_str_tables.rb index 7289543e..fd5d6fe4 100644 --- a/lib/sisu/v0/dal_doc_str_tables.rb +++ b/lib/sisu/v0/dal_doc_str_tables.rb @@ -96,9 +96,9 @@ module SiSU_document_structure_tables w=widths.split(/;/) tuned_file=[] tuned_file << if para =~/\{(?:t|table)~h(?:\sc\d+;)?[\d; ]*\}/ - "<!Th¡ c#{@row[2].length}; #{widths}!>" + "<!Th#{TS1} c#{@row[2].length}; #{widths}!>" elsif para =~/\{(?:t|table)(?:\sc\d+;)?[\d; ]*\}/ - "<!T¡ c#{@row[2].length}; #{widths}!>" + "<!T#{TS1} c#{@row[2].length}; #{widths}!>" end @row.each do |l| l << '' if l.length == (@row[1].length - 1) @@ -109,9 +109,9 @@ module SiSU_document_structure_tables l.each do |c| n +=1 #'<td>' + c + '</td>' table << if c =~/\A(?:\n)?\s*\Z/ - "¡¡#{w[n]}¡" + ' ' + "#{TS1}#{TS1}#{w[n]}#{TS1}" + ' ' else - "¡¡#{w[n]}¡" + c.strip + "#{TS1}#{TS1}#{w[n]}#{TS1}" + c.strip end end table << '!>' #'</tr>' @@ -140,8 +140,8 @@ module SiSU_document_structure_tables instructions=$1 @@column=instructions.split(/;\s*/) @@columns=@@column[0] - para.gsub!(/^table\{~h\s+(c\d+?;.+?)$/,'<!Th¡ \1!>') - para.gsub!(/^table\{\s+(c\d+?;.+?)$/,'<!T¡ \1!>') + para.gsub!(/^table\{~h\s+(c\d+?;.+?)$/,"<!Th#{TS1} \\1!>") + para.gsub!(/^table\{\s+(c\d+?;.+?)$/,"<!T#{TS1} \\1!>") @@flag['table_to']=true end if @@flag['table_to'] \ @@ -160,10 +160,10 @@ module SiSU_document_structure_tables and para =~/\S/ @@counter=1 sub_array=para.dup - @@line_mode=sub_array.scan(/.+/) + @@line_mode=sub_array.scan(/.+/u) Tables.new(@md,@@line_mode).tr_td para=@@line_mode.join - para.gsub!(/(.*\S+.*)\Z/m,'<!\1!>') unless para =~/<!Th?¡/ + para.gsub!(/(.*\S+.*)\Z/m,'<!\1!>') unless para =~/<!Th?#{TS1}/u end para.gsub!(/\n/,' ') para.strip! @@ -182,7 +182,10 @@ module SiSU_document_structure_tables data.each do |line| if @@counter <= @@columns.to_i \ and line !~/(\}T\s*$|<:table[-_](close|end)>|<!TZ!>)/ - line.gsub!(/(.+)/,"¡¡#{@@column[@@counter]}¡\\1") unless line =~/<!Th?¡/ + #if line.encoding.inspect =~/Encoding:ASCII-8BIT/ + # line=line.force_encoding('utf-8') + #end + line.gsub!(/(.+)/,"#{TS1}#{TS1}#{@@column[@@counter]}#{TS1}\\1") unless line =~/<!Th?#{TS1}/u @@counter+=1 end end @@ -191,3 +194,6 @@ module SiSU_document_structure_tables end end __END__ +#p line.encoding +@data.each {|x| p x.encoding } +p para if para.encoding.inspect =~/Encoding:ASCII-8BIT/ diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb index 38cbb45d..0c53e5e5 100644 --- a/lib/sisu/v0/db_import.rb +++ b/lib/sisu/v0/db_import.rb @@ -133,10 +133,10 @@ module SiSU_DB_import string.gsub!(/<sup>(\d+)<\/sup>/,'[\1]') string.gsub!(/<:i[12]>/,'') string.gsub!(/(?: \\;)+/,' ') - string.gsub!(/<!T[h]?¡.+?!>/,"[TABLE]\n") #tables - string.gsub!(/<!¡¡\d+(.+?)!>/,'\1') #tables - string.gsub!(/¡¡\d+¡/,' ') #tables - string.gsub!(/¡/,' ') #tables tidy later + string.gsub!(/<!T[h]?¡.+?!>/u,"[TABLE]\n") #tables + string.gsub!(/<!¡¡\d+(.+?)!>/u,'\1') #tables + string.gsub!(/¡¡\d+¡/u,' ') #tables + string.gsub!(/¡/u,' ') #tables tidy later string.gsub!(/<.+?>/,'') string.gsub!(/\{.+?\.(?:png|jpg|gif).+?\}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search string.gsub!(/\s\s+/,' ') diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index d973ff5d..4ca2ff96 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -980,7 +980,7 @@ WOK @format,parablock=txt[0],txt[1] @parablock=parablock ##performance hit does not justify action: - #@parablock=if parablock=~/\S+/ and parablock !~/<!Th?¡ /m + #@parablock=if parablock=~/\S+/ and parablock !~/<!Th?¡ /um # wrap=SiSU_text_utils::Wrap.new(parablock,70,4) # wrap.line_wrap #else parablock diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index 7972619a..687000f1 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -174,7 +174,7 @@ module SiSU_HTML_seg end m=para[/.+?<a name="(\d+)">.*/]; @@get_hash_to=$1 if m # changed 2002w42, again w44 ! & again 2003w16 m=para[/^4~(\S+)/]; @@get_hash_fn=$1 if m - para=if para =~/<!Th?¡\s+c|<:(?:code|alt|verse|group)>/m; para.split(/\n/) + para=if para =~/<!Th?¡\s+c|<:(?:code|alt|verse|group)>/um; para.split(/\n/) else para end if para.class == String @@ -323,7 +323,7 @@ module SiSU_HTML_seg end else para end - elsif para =~/¡|<!T[hZ]?/ + elsif para =~/¡|<!T[hZ]?/u table=SiSU_HTML_shared::Table.new(para) para=table.table end diff --git a/lib/sisu/v0/html_table.rb b/lib/sisu/v0/html_table.rb index 12d02407..1ac39daf 100644 --- a/lib/sisu/v0/html_table.rb +++ b/lib/sisu/v0/html_table.rb @@ -101,8 +101,8 @@ module SiSU_HTML_table m=@parablock[/<!f(.+?)!>/,1] @@tablefoot << m if m @parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if @parablock =~/<!Th¡/ - if @parablock =~/<!Th?¡.+?!~(\d+);\w\d+;\w\d+>/; @parablock=table_head($1) + @@tablehead=1 if @parablock =~/<!Th¡/u + if @parablock =~/<!Th?¡.+?!~(\d+);\w\d+;\w\d+>/u; @parablock=table_head($1) end if @parablock =~/<!TZ!>/ tablefoot=[] @@ -112,12 +112,12 @@ module SiSU_HTML_table end end if @@tablehead == 1 - if @parablock =~/¡¡/ - if @parablock =~/<!¡¡(\d+?)¡/ - @parablock.gsub!(/<!¡¡(\d+?)¡/,table_row($1,true)) + if @parablock =~/¡¡/u + if @parablock =~/<!¡¡(\d+?)¡/u + @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1,true)) end - if @parablock =~/¡¡(\d+?)¡/ - @parablock.gsub!(/¡¡(\d+?)¡/,table_cell($1,true)) + if @parablock =~/¡¡(\d+?)¡/u + @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1,true)) end if @parablock =~/!>/ @parablock.gsub!(/!>/,table_row_close(true)) @@ -126,11 +126,11 @@ module SiSU_HTML_table end @parablock else - if @parablock =~/<!¡¡(\d+?)¡/ - @parablock.gsub!(/<!¡¡(\d+?)¡/,table_row($1)) + if @parablock =~/<!¡¡(\d+?)¡/u + @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1)) end - if @parablock =~/¡¡(\d+?)¡/ - @parablock.gsub!(/¡¡(\d+?)¡/,table_cell($1)) + if @parablock =~/¡¡(\d+?)¡/u + @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1)) end if @parablock =~/!>/ @parablock.gsub!(/!>/,table_row_close) diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index 9e8203bd..43b0fe70 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -88,7 +88,7 @@ module SiSU_Tune data=[] @data.each{|x| x.strip; data << x if not x.empty?} #1.9 array? data.each do |para| - @filename_tune.puts para, "\n" #if para !~/¡/ + @filename_tune.puts para, "\n" #if para !~/¡/u end end def marshal @@ -102,91 +102,91 @@ module SiSU_Tune @html=html end def clean - @html.gsub!(/¢/,'¢') # ¢ - @html.gsub!(/£/,'£') # £ - @html.gsub!(/¥/,'¥') # ¥ - @html.gsub!(/§/,'§') # § - @html.gsub!(/©/,'©') # © - @html.gsub!(/ª/,'ª') # ª - @html.gsub!(/«/,'«') # « - @html.gsub!(/®/,'®') # ® - @html.gsub!(/°/,'°') # ° - @html.gsub!(/±/,'±') # ± - @html.gsub!(/²/,'²') # ² - @html.gsub!(/³/,'³') # ³ - @html.gsub!(/µ/,'µ') # µ - @html.gsub!(/¶/,'¶') # ¶ - @html.gsub!(/¹/,'¹') # ¹ - @html.gsub!(/º/,'º') # º - @html.gsub!(/»/,'»') # » - @html.gsub!(/¼/,'¼') # ¼ - @html.gsub!(/½/,'½') # ½ - @html.gsub!(/¾/,'¾') # ¾ - @html.gsub!(/×/,'×') # × - @html.gsub!(/÷/,'÷') # ÷ - @html.gsub!(/¿/,'¿') # ¿ - @html.gsub!(/À/,'À') # À - @html.gsub!(/Á/,'Á') # Á - @html.gsub!(/Â/,'Â') #  - @html.gsub!(/Ã/,'Ã') # à - @html.gsub!(/Ä/,'Ä') # Ä - @html.gsub!(/Å/,'Å') # Å - @html.gsub!(/Æ/,'Æ') # Æ - @html.gsub!(/Ç/,'Ç') # Ç - @html.gsub!(/È/,'È') # È - @html.gsub!(/É/,'É') # É - @html.gsub!(/Ê/,'Ê') # Ê - @html.gsub!(/Ë/,'Ë') # Ë - @html.gsub!(/Ì/,'Ì') # Ì - @html.gsub!(/Í/,'Í') # Í - @html.gsub!(/Î/,'Î') # Î - @html.gsub!(/Ï/,'Ï') # Ï - @html.gsub!(/Ð/,'Ð') # Ð - @html.gsub!(/Ñ/,'Ñ') # Ñ - @html.gsub!(/Ò/,'Ò') # Ò - @html.gsub!(/Ó/,'Ó') # Ó - @html.gsub!(/Ô/,'Ô') # Ô - @html.gsub!(/Õ/,'Õ') # Õ - @html.gsub!(/Ö/,'Ö') # Ö - @html.gsub!(/Ø/,'Ø') # Ø - @html.gsub!(/Ù/,'Ù') # Ù - @html.gsub!(/Ú/,'Ú') # Ú - @html.gsub!(/Û/,'Û') # Û - @html.gsub!(/Ü/,'Ü') # Ü - @html.gsub!(/Ý/,'Ý') # Ý - @html.gsub!(/Þ/,'Þ') # Þ - @html.gsub!(/ß/,'ß') # ß - @html.gsub!(/à/,'à') # à - @html.gsub!(/á/,'á') # á - @html.gsub!(/â/,'â') # â - @html.gsub!(/ã/,'ã') # ã - @html.gsub!(/ä/,'ä') # ä - @html.gsub!(/å/,'å') # å - @html.gsub!(/æ/,'æ') # æ - @html.gsub!(/ç/,'ç') # ç - @html.gsub!(/è/,'è') # è - @html.gsub!(/é/,'é') # é - @html.gsub!(/ê/,'ê') # ê - @html.gsub!(/ë/,'ë') # ë - @html.gsub!(/ì/,'ì') # ì - @html.gsub!(/í/,'í') # í - @html.gsub!(/î/,'î') # î - @html.gsub!(/ï/,'ï') # ï - @html.gsub!(/ð/,'ð') # ð - @html.gsub!(/ñ/,'ñ') # ñ - @html.gsub!(/ò/,'ò') # ò - @html.gsub!(/ó/,'ó') # ó - @html.gsub!(/ô/,'ô') # ô - @html.gsub!(/õ/,'õ') # õ - @html.gsub!(/ö/,'ö') # ö - @html.gsub!(/ø/,'ø') # ø - @html.gsub!(/ù/,'ù') # ú - @html.gsub!(/ú/,'ú') # û - @html.gsub!(/û/,'û') # ü - @html.gsub!(/ü/,'ü') # ý - @html.gsub!(/þ/,'þ') # þ - @html.gsub!(/ÿ/,'ÿ') # ÿ - @html.gsub!(/ý/,'ý') + @html.gsub!(/¢/u,'¢') # ¢ + @html.gsub!(/£/u,'£') # £ + @html.gsub!(/¥/u,'¥') # ¥ + @html.gsub!(/§/u,'§') # § + @html.gsub!(/©/u,'©') # © + @html.gsub!(/ª/u,'ª') # ª + @html.gsub!(/«/u,'«') # « + @html.gsub!(/®/u,'®') # ® + @html.gsub!(/°/u,'°') # ° + @html.gsub!(/±/u,'±') # ± + @html.gsub!(/²/u,'²') # ² + @html.gsub!(/³/u,'³') # ³ + @html.gsub!(/µ/u,'µ') # µ + @html.gsub!(/¶/u,'¶') # ¶ + @html.gsub!(/¹/u,'¹') # ¹ + @html.gsub!(/º/u,'º') # º + @html.gsub!(/»/u,'»') # » + @html.gsub!(/¼/u,'¼') # ¼ + @html.gsub!(/½/u,'½') # ½ + @html.gsub!(/¾/u,'¾') # ¾ + @html.gsub!(/×/u,'×') # × + @html.gsub!(/÷/u,'÷') # ÷ + @html.gsub!(/¿/u,'¿') # ¿ + @html.gsub!(/À/u,'À') # À + @html.gsub!(/Á/u,'Á') # Á + @html.gsub!(/Â/u,'Â') #  + @html.gsub!(/Ã/u,'Ã') # à + @html.gsub!(/Ä/u,'Ä') # Ä + @html.gsub!(/Å/u,'Å') # Å + @html.gsub!(/Æ/u,'Æ') # Æ + @html.gsub!(/Ç/u,'Ç') # Ç + @html.gsub!(/È/u,'È') # È + @html.gsub!(/É/u,'É') # É + @html.gsub!(/Ê/u,'Ê') # Ê + @html.gsub!(/Ë/u,'Ë') # Ë + @html.gsub!(/Ì/u,'Ì') # Ì + @html.gsub!(/Í/u,'Í') # Í + @html.gsub!(/Î/u,'Î') # Î + @html.gsub!(/Ï/u,'Ï') # Ï + @html.gsub!(/Ð/u,'Ð') # Ð + @html.gsub!(/Ñ/u,'Ñ') # Ñ + @html.gsub!(/Ò/u,'Ò') # Ò + @html.gsub!(/Ó/u,'Ó') # Ó + @html.gsub!(/Ô/u,'Ô') # Ô + @html.gsub!(/Õ/u,'Õ') # Õ + @html.gsub!(/Ö/u,'Ö') # Ö + @html.gsub!(/Ø/u,'Ø') # Ø + @html.gsub!(/Ù/u,'Ù') # Ù + @html.gsub!(/Ú/u,'Ú') # Ú + @html.gsub!(/Û/u,'Û') # Û + @html.gsub!(/Ü/u,'Ü') # Ü + @html.gsub!(/Ý/u,'Ý') # Ý + @html.gsub!(/Þ/u,'Þ') # Þ + @html.gsub!(/ß/u,'ß') # ß + @html.gsub!(/à/u,'à') # à + @html.gsub!(/á/u,'á') # á + @html.gsub!(/â/u,'â') # â + @html.gsub!(/ã/u,'ã') # ã + @html.gsub!(/ä/u,'ä') # ä + @html.gsub!(/å/u,'å') # å + @html.gsub!(/æ/u,'æ') # æ + @html.gsub!(/ç/u,'ç') # ç + @html.gsub!(/è/u,'è') # è + @html.gsub!(/é/u,'é') # é + @html.gsub!(/ê/u,'ê') # ê + @html.gsub!(/ë/u,'ë') # ë + @html.gsub!(/ì/u,'ì') # ì + @html.gsub!(/í/u,'í') # í + @html.gsub!(/î/u,'î') # î + @html.gsub!(/ï/u,'ï') # ï + @html.gsub!(/ð/u,'ð') # ð + @html.gsub!(/ñ/u,'ñ') # ñ + @html.gsub!(/ò/u,'ò') # ò + @html.gsub!(/ó/u,'ó') # ó + @html.gsub!(/ô/u,'ô') # ô + @html.gsub!(/õ/u,'õ') # õ + @html.gsub!(/ö/u,'ö') # ö + @html.gsub!(/ø/u,'ø') # ø + @html.gsub!(/ù/u,'ù') # ú + @html.gsub!(/ú/u,'ú') # û + @html.gsub!(/û/u,'û') # ü + @html.gsub!(/ü/u,'ü') # ý + @html.gsub!(/þ/u,'þ') # þ + @html.gsub!(/ÿ/u,'ÿ') # ÿ + @html.gsub!(/ý/u,'ý') @html end end diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb index c00d74b8..0657b0b6 100644 --- a/lib/sisu/v0/manpage.rb +++ b/lib/sisu/v0/manpage.rb @@ -311,7 +311,7 @@ WOK table_message='[table omitted, see other document formats]' fix=[] data.each do |para| - para.gsub!(/<!Th?¡.+/m,"#@br#{table_message}") + para.gsub!(/<!Th?¡.+/um,"#@br#{table_message}") para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down para.gsub!(/<sup>(.+?)<\/sup>/,'^\1^') @@ -449,7 +449,7 @@ WOK #formatMono=MonoSiSU.new('<br /><a name="owner.details">Owner Details</a>') #@@manpage[:owner_details]=formatMono.bold_para #para='' - elsif para =~/(¡|<!Th?)/ #tables ! + elsif para =~/(¡|<!Th?)/u #tables ! elsif para =~/(.*)<!#!>(.*)/ one,two=$1,$2 format_text=Format_text_object.new(one,two) diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index 874f87e1..f168ddc4 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -440,7 +440,7 @@ module SiSU_ODF elsif para =~ /<:code(?:-end)?>/ @@odf[:body] << code(para) @@odf[:body] << @br*2 - elsif para =~ /<!Th?/ #elsif para =~ /<!Th?¡/ + elsif para =~ /<!Th?/ #elsif para =~ /<!Th?¡/u @@odf[:body] << table(para) @@odf[:body] << @br*2 else @@ -457,7 +457,7 @@ module SiSU_ODF wordlist end def markup(data) # Used for major markup instructions - safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`¡]/ + safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`¡]/u dir=SiSU_Env::Info_env.new(@md.fns) @data_mod,@endnotes,@level,@cont,@copen,@odf_contents_close=Array.new(6){[]} @rcdc=false @@ -508,10 +508,10 @@ module SiSU_ODF para.gsub!(/<sup>(.+?)<\/sup>/,'<text:span text:style-name="T4">\1</text:span>') para.gsub!(/<sub>(.+?)<\/sub>/,'<text:span text:style-name="T5">\1</text:span>') para.gsub!(/`/,"'") - para.gsub!(//,'-') - para.gsub!(/·/,'*') - para.gsub!(/[“”]/,'""') - para.gsub!(/[–—]/,'-') #— – chk + para.gsub!(//u,'-') + para.gsub!(/·/u,'*') + para.gsub!(/[“”]/u,'""') + para.gsub!(/[–—]/u,'-') #— – chk para.gsub!(/ < /i,'<') para.gsub!(/\\copy(?:right)?\b/,'©') para.gsub!(/\\trademark\b|\\tm\b/,'®') diff --git a/lib/sisu/v0/odf_format.rb b/lib/sisu/v0/odf_format.rb index 05d1aefa..f704ea45 100644 --- a/lib/sisu/v0/odf_format.rb +++ b/lib/sisu/v0/odf_format.rb @@ -181,10 +181,10 @@ module OD_format m=@parablock[/<!f(.+?)!>/,1] @@tablefoot << m if m @parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if @parablock =~/<!Th¡/ - @@table_counter+=1 if @parablock =~/<!Th?¡/ - if @parablock =~/<!Th¡\s+c(\d+).+?!~\d+;\w\d+;\w\d+>/; @parablock=table_head(@@table_counter,$1,true) - elsif @parablock =~/<!T¡\s+c(\d+).+?!~\d+;\w\d+;\w\d+>/; @parablock=table_head(@@table_counter,$1) + @@tablehead=1 if @parablock =~/<!Th¡/u + @@table_counter+=1 if @parablock =~/<!Th?¡/u + if @parablock =~/<!Th¡\s+c(\d+).+?!~\d+;\w\d+;\w\d+>/u; @parablock=table_head(@@table_counter,$1,true) + elsif @parablock =~/<!T¡\s+c(\d+).+?!~\d+;\w\d+;\w\d+>/u; @parablock=table_head(@@table_counter,$1) end if @parablock =~/<!TZ!>/ tablefoot=[] @@ -194,12 +194,12 @@ module OD_format end end if @@tablehead == 1 - if @parablock =~/¡¡/ - if @parablock =~/<!¡¡(\d+?)¡/ - @parablock.gsub!(/<!¡¡(\d+?)¡/,table_row($1,true)) + if @parablock =~/¡¡/u + if @parablock =~/<!¡¡(\d+?)¡/u + @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1,true)) end - if @parablock =~/¡¡(\d+?)¡/ - @parablock.gsub!(/¡¡(\d+?)¡/,table_cell($1,true)) + if @parablock =~/¡¡(\d+?)¡/u + @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1,true)) end if @parablock =~/!>/ @parablock.gsub!(/!>/,table_row_close(true)) @@ -208,11 +208,11 @@ module OD_format end @parablock else - if @parablock =~/<!¡¡(\d+?)¡/ - @parablock.gsub!(/<!¡¡(\d+?)¡/,table_row($1)) + if @parablock =~/<!¡¡(\d+?)¡/u + @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1)) end - if @parablock =~/¡¡(\d+?)¡/ - @parablock.gsub!(/¡¡(\d+?)¡/,table_cell($1)) + if @parablock =~/¡¡(\d+?)¡/u + @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1)) end if @parablock =~/!>/ @parablock.gsub!(/!>/,table_row_close) diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index 62499e57..5beac25e 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -321,7 +321,7 @@ WOK table_message='[table omitted, see other document formats]' fix=[] data.each do |para| - para.gsub!(/<!Th?¡.+/m,"#@br#{table_message}") + para.gsub!(/<!Th?¡.+/um,"#@br#{table_message}") para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down para.gsub!(/<sup>(.+?)<\/sup>/,'^\1^') @@ -436,7 +436,7 @@ WOK #formatMono=MonoSiSU.new('<br /><a name="owner.details">Owner Details</a>') #@plaintext[:owner_details]=formatMono.bold_para #para='' - elsif para =~/(¡|<!Th?)/ #tables ! + elsif para =~/(¡|<!Th?)/u #tables ! elsif para =~/(.*)<!#!>(.*)/ one,two=$1,$2 format_text=Format_text_object.new(one,two) diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index da41dbb0..9f646790 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -194,7 +194,7 @@ GSUB m=parablock[/<!f(.+?)!>/,1] @@tablefoot<<m if m parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if parablock =~/<!Th¡/ + @@tablehead=1 if parablock =~/<!Th¡/u parablock.gsub!(/<!Th?¡.+?!~(\d+)>/, #%{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"><tr><td valign="top" align="justify"><p class="norm" id="\\1"> </p> </td><td>\n} + %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">}) @@ -207,12 +207,12 @@ GSUB #%{#{tablefoot}}) end if @@tablehead == 1 - if parablock =~/¡¡/ - parablock.gsub!(/<!¡¡(\d+?)¡/, + if parablock =~/¡¡/u + parablock.gsub!(/<!¡¡(\d+?)¡/u, %{\n<tr>} + %{\n<td width="\\1%" valign="top">} + %{#{para_table}<b>}) - parablock.gsub!(/¡¡(\d+?)¡/, + parablock.gsub!(/¡¡(\d+?)¡/u, %{</b></td><td width="\\1%" valign="top">} + %{#{para_table}<b>}) parablock.gsub!(/!>/, '</b></td></tr>') @@ -220,11 +220,11 @@ GSUB end parablock else - parablock.gsub!(/<!¡¡(\d+?)¡/, + parablock.gsub!(/<!¡¡(\d+?)¡/u, %{\n<tr>} + %{\n<td width="\\1%" valign="top">} + %{#{para_table}}) - parablock.gsub!(/¡¡(\d+?)¡/, + parablock.gsub!(/¡¡(\d+?)¡/u, %{</td><td width="\\1%" valign="top">} + %{#{para_table}}) parablock.gsub!(/!>/, '</td></tr>') diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 45dec06d..fd27c664 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -166,178 +166,178 @@ module SiSU_XML_munge #¢£¥§©ª«®°±²³µ¶¹º»¼½¾×÷ ##para.gsub!(//, '&#;') ##para.gsub!(//, '&;') - para.gsub!(/¢/, '¢') # '¢' # ¢ - para.gsub!(/£/, '£') # '£' # £ - para.gsub!(/¥/, '¥') # '¥' # ¥ - para.gsub!(/§/, '§') # '§' # § - para.gsub!(/©/, '©') # '©' # © - para.gsub!(/ª/, 'ª') # 'ª' # ª - para.gsub!(/«/, '«') # '«' # « - para.gsub!(/®/, '®') # '®' # ® - para.gsub!(/°/, '°') # '°' # ° - para.gsub!(/±/, '±') # '±' # ± - para.gsub!(/²/, '²') # '²' # ² - para.gsub!(/³/, '³') # '³' # ³ - para.gsub!(/µ/, 'µ') # 'µ' # µ - para.gsub!(/¶/, '¶') # '¶' # ¶ - para.gsub!(/¹/, '¹') # '¹' # ¹ - para.gsub!(/º/, 'º') # 'º' # º - para.gsub!(/»/, '»') # '»' # » - para.gsub!(/¼/, '¼') # '¼' # ¼ - para.gsub!(/½/, '½') # '½' # ½ - para.gsub!(/¾/, '¾') # '¾' # ¾ - para.gsub!(/×/, '×') # '×' # × - para.gsub!(/÷/, '÷') # '÷' # ÷ - para.gsub!(/¿/, '¿') # '¿' # ¿ - para.gsub!(/À/, 'À') # 'À' # À - para.gsub!(/Á/, 'Á') # 'Á' # Á - para.gsub!(/Â/, 'Â') # 'Â' #  - para.gsub!(/Ã/, 'Ã') # 'Ã' # à - para.gsub!(/Ä/, 'Ä') # 'Ä' # Ä - para.gsub!(/Å/, 'Å') # 'Å' # Å - para.gsub!(/Æ/, 'Æ') # 'Æ' # Æ - para.gsub!(/Ç/, 'Ç') # 'Ç' # Ç - para.gsub!(/È/, 'È') # 'È' # È - para.gsub!(/É/, 'É') # 'É' # É - para.gsub!(/Ê/, 'Ê') # 'Ê' # Ê - para.gsub!(/Ë/, 'Ë') # 'Ë' # Ë - para.gsub!(/Ì/, 'Ì') # 'Ì' # Ì - para.gsub!(/Í/, 'Í') # 'Í' # Í - para.gsub!(/Î/, 'Î') # 'Î' # Î - para.gsub!(/Ï/, 'Ï') # 'Ï' # Ï - para.gsub!(/Ð/, 'Ð') # 'Ð' # Ð - para.gsub!(/Ñ/, 'Ñ') # 'Ñ' # Ñ - para.gsub!(/Ò/, 'Ò') # 'Ò' # Ò - para.gsub!(/Ó/, 'Ó') # 'Ó' # Ó - para.gsub!(/Ô/, 'Ô') # 'Ô' # Ô - para.gsub!(/Õ/, 'Õ') # 'Õ' # Õ - para.gsub!(/Ö/, 'Ö') # 'Ö' # Ö - para.gsub!(/Ø/, 'Ø') # 'Ø' # Ø - para.gsub!(/Ù/, 'Ù') # 'Ù' # Ù - para.gsub!(/Ú/, 'Ú') # 'Ú' # Ú - para.gsub!(/Û/, 'Û') # 'Û' # Û - para.gsub!(/Ü/, 'Ü') # 'Ü' # Ü - para.gsub!(/Ý/, 'Ý') # 'Ý' # Ý - para.gsub!(/Þ/, 'Þ') # 'Þ' # Þ - para.gsub!(/ß/, 'ß') # 'ß' # ß - para.gsub!(/à/, 'à') # 'à' # à - para.gsub!(/á/, 'á') # 'á' # á - para.gsub!(/â/, 'â') # 'â' # â - para.gsub!(/ã/, 'ã') # 'ã' # ã - para.gsub!(/ä/, 'ä') # 'ä' # ä - para.gsub!(/å/, 'å') # 'å' # å - para.gsub!(/æ/, 'æ') # 'æ' # æ - para.gsub!(/ç/, 'ç') # 'ç' # ç - para.gsub!(/è/, 'è') # 'è' # è - para.gsub!(/é/, 'é') # '´' # é - para.gsub!(/ê/, 'ê') # 'ˆ' # ê - para.gsub!(/ë/, 'ë') # 'ë' # ë - para.gsub!(/ì/, 'ì') # 'ì' # ì - para.gsub!(/í/, 'í') # '´' # í - para.gsub!(/î/, 'î') # 'î' # î - para.gsub!(/ï/, 'ï') # 'ï' # ï - para.gsub!(/ð/, 'ð') # 'ð' # ð - para.gsub!(/ñ/, 'ñ') # 'ñ' # ñ - para.gsub!(/ò/, 'ò') # 'ò' # ò - para.gsub!(/ó/, 'ó') # 'ó' # ó - para.gsub!(/ô/, 'ô') # 'ô' # ô - para.gsub!(/õ/, 'õ') # 'õ' # õ - para.gsub!(/ö/, 'ö') # 'ö' # ö - para.gsub!(/ø/, 'ø') # 'ø' # ø - para.gsub!(/ù/, 'ú') # 'ù' # ú - para.gsub!(/ú/, 'û') # 'ú' # û - para.gsub!(/û/, 'ü') # 'û' # ü - para.gsub!(/ü/, 'ý') # 'ü' # ý - para.gsub!(/þ/, 'þ') # 'þ' # þ - para.gsub!(/ÿ/, 'ÿ') # 'ÿ' # ÿ + para.gsub!(/¢/u, '¢') # '¢' # ¢ + para.gsub!(/£/u, '£') # '£' # £ + para.gsub!(/¥/u, '¥') # '¥' # ¥ + para.gsub!(/§/u, '§') # '§' # § + para.gsub!(/©/u, '©') # '©' # © + para.gsub!(/ª/u, 'ª') # 'ª' # ª + para.gsub!(/«/u, '«') # '«' # « + para.gsub!(/®/u, '®') # '®' # ® + para.gsub!(/°/u, '°') # '°' # ° + para.gsub!(/±/u, '±') # '±' # ± + para.gsub!(/²/u, '²') # '²' # ² + para.gsub!(/³/u, '³') # '³' # ³ + para.gsub!(/µ/u, 'µ') # 'µ' # µ + para.gsub!(/¶/u, '¶') # '¶' # ¶ + para.gsub!(/¹/u, '¹') # '¹' # ¹ + para.gsub!(/º/u, 'º') # 'º' # º + para.gsub!(/»/u, '»') # '»' # » + para.gsub!(/¼/u, '¼') # '¼' # ¼ + para.gsub!(/½/u, '½') # '½' # ½ + para.gsub!(/¾/u, '¾') # '¾' # ¾ + para.gsub!(/×/u, '×') # '×' # × + para.gsub!(/÷/u, '÷') # '÷' # ÷ + para.gsub!(/¿/u, '¿') # '¿' # ¿ + para.gsub!(/À/u, 'À') # 'À' # À + para.gsub!(/Á/u, 'Á') # 'Á' # Á + para.gsub!(/Â/u, 'Â') # 'Â' #  + para.gsub!(/Ã/u, 'Ã') # 'Ã' # à + para.gsub!(/Ä/u, 'Ä') # 'Ä' # Ä + para.gsub!(/Å/u, 'Å') # 'Å' # Å + para.gsub!(/Æ/u, 'Æ') # 'Æ' # Æ + para.gsub!(/Ç/u, 'Ç') # 'Ç' # Ç + para.gsub!(/È/u, 'È') # 'È' # È + para.gsub!(/É/u, 'É') # 'É' # É + para.gsub!(/Ê/u, 'Ê') # 'Ê' # Ê + para.gsub!(/Ë/u, 'Ë') # 'Ë' # Ë + para.gsub!(/Ì/u, 'Ì') # 'Ì' # Ì + para.gsub!(/Í/u, 'Í') # 'Í' # Í + para.gsub!(/Î/u, 'Î') # 'Î' # Î + para.gsub!(/Ï/u, 'Ï') # 'Ï' # Ï + para.gsub!(/Ð/u, 'Ð') # 'Ð' # Ð + para.gsub!(/Ñ/u, 'Ñ') # 'Ñ' # Ñ + para.gsub!(/Ò/u, 'Ò') # 'Ò' # Ò + para.gsub!(/Ó/u, 'Ó') # 'Ó' # Ó + para.gsub!(/Ô/u, 'Ô') # 'Ô' # Ô + para.gsub!(/Õ/u, 'Õ') # 'Õ' # Õ + para.gsub!(/Ö/u, 'Ö') # 'Ö' # Ö + para.gsub!(/Ø/u, 'Ø') # 'Ø' # Ø + para.gsub!(/Ù/u, 'Ù') # 'Ù' # Ù + para.gsub!(/Ú/u, 'Ú') # 'Ú' # Ú + para.gsub!(/Û/u, 'Û') # 'Û' # Û + para.gsub!(/Ü/u, 'Ü') # 'Ü' # Ü + para.gsub!(/Ý/u, 'Ý') # 'Ý' # Ý + para.gsub!(/Þ/u, 'Þ') # 'Þ' # Þ + para.gsub!(/ß/u, 'ß') # 'ß' # ß + para.gsub!(/à/u, 'à') # 'à' # à + para.gsub!(/á/u, 'á') # 'á' # á + para.gsub!(/â/u, 'â') # 'â' # â + para.gsub!(/ã/u, 'ã') # 'ã' # ã + para.gsub!(/ä/u, 'ä') # 'ä' # ä + para.gsub!(/å/u, 'å') # 'å' # å + para.gsub!(/æ/u, 'æ') # 'æ' # æ + para.gsub!(/ç/u, 'ç') # 'ç' # ç + para.gsub!(/è/u, 'è') # 'è' # è + para.gsub!(/é/u, 'é') # '´' # é + para.gsub!(/ê/u, 'ê') # 'ˆ' # ê + para.gsub!(/ë/u, 'ë') # 'ë' # ë + para.gsub!(/ì/u, 'ì') # 'ì' # ì + para.gsub!(/í/u, 'í') # '´' # í + para.gsub!(/î/u, 'î') # 'î' # î + para.gsub!(/ï/u, 'ï') # 'ï' # ï + para.gsub!(/ð/u, 'ð') # 'ð' # ð + para.gsub!(/ñ/u, 'ñ') # 'ñ' # ñ + para.gsub!(/ò/u, 'ò') # 'ò' # ò + para.gsub!(/ó/u, 'ó') # 'ó' # ó + para.gsub!(/ô/u, 'ô') # 'ô' # ô + para.gsub!(/õ/u, 'õ') # 'õ' # õ + para.gsub!(/ö/u, 'ö') # 'ö' # ö + para.gsub!(/ø/u, 'ø') # 'ø' # ø + para.gsub!(/ù/u, 'ú') # 'ù' # ú + para.gsub!(/ú/u, 'û') # 'ú' # û + para.gsub!(/û/u, 'ü') # 'û' # ü + para.gsub!(/ü/u, 'ý') # 'ü' # ý + para.gsub!(/þ/u, 'þ') # 'þ' # þ + para.gsub!(/ÿ/u, 'ÿ') # 'ÿ' # ÿ end end def html(para='') if @sys.locale =~/utf-?8/i # instead ucs for utf8 #require 'iconv' ? Iñtërnâtiônàlizætiøn - para.gsub!(/¢/, '¢') # ¢ - para.gsub!(/£/, '£') # £ - para.gsub!(/¥/, '¥') # ¥ - para.gsub!(/§/, '§') # § - para.gsub!(/©/, '©') # © - para.gsub!(/ª/, 'ª') # ª - para.gsub!(/«/, '«') # « - para.gsub!(/®/, '®') # ® - para.gsub!(/°/, '°') # ° - para.gsub!(/±/, '±') # ± - para.gsub!(/²/, '²') # ² - para.gsub!(/³/, '³') # ³ - para.gsub!(/µ/, 'µ') # µ - para.gsub!(/¶/, '¶') # ¶ - para.gsub!(/¹/, '¹') # ¹ - para.gsub!(/º/, 'º') # º - para.gsub!(/»/, '»') # » - para.gsub!(/¼/, '¼') # ¼ - para.gsub!(/½/, '½') # ½ - para.gsub!(/¾/, '¾') # ¾ - para.gsub!(/×/, '×') # × - para.gsub!(/÷/, '÷') # ÷ - para.gsub!(/¿/, '¿') # ¿ - para.gsub!(/À/, 'À') # À - para.gsub!(/Á/, 'Á') # Á - para.gsub!(/Â/, 'Â') #  - para.gsub!(/Ã/, 'Ã') # à - para.gsub!(/Ä/, 'Ä') # Ä - para.gsub!(/Å/, 'Å') # Å - para.gsub!(/Æ/, 'Æ') # Æ - para.gsub!(/Ç/, 'Ç') # Ç - para.gsub!(/È/, 'È') # È - para.gsub!(/É/, 'É') # É - para.gsub!(/Ê/, 'Ê') # Ê - para.gsub!(/Ë/, 'Ë') # Ë - para.gsub!(/Ì/, 'Ì') # Ì - para.gsub!(/Í/, 'Í') # Í - para.gsub!(/Î/, 'Î') # Î - para.gsub!(/Ï/, 'Ï') # Ï - para.gsub!(/Ð/, 'Ð') # Ð - para.gsub!(/Ñ/, 'Ñ') # Ñ - para.gsub!(/Ò/, 'Ò') # Ò - para.gsub!(/Ó/, 'Ó') # Ó - para.gsub!(/Ô/, 'Ô') # Ô - para.gsub!(/Õ/, 'Õ') # Õ - para.gsub!(/Ö/, 'Ö') # Ö - para.gsub!(/Ø/, 'Ø') # Ø - para.gsub!(/Ù/, 'Ù') # Ù - para.gsub!(/Ú/, 'Ú') # Ú - para.gsub!(/Û/, 'Û') # Û - para.gsub!(/Ü/, 'Ü') # Ü - para.gsub!(/Ý/, 'Ý') # Ý - para.gsub!(/Þ/, 'Þ') # Þ - para.gsub!(/ß/, 'ß') # ß - para.gsub!(/à/, 'à') # à - para.gsub!(/á/, 'á') # á - para.gsub!(/â/, 'â') # â - para.gsub!(/ã/, 'ã') # ã - para.gsub!(/ä/, 'ä') # ä - para.gsub!(/å/, 'å') # å - para.gsub!(/æ/, 'æ') # æ - para.gsub!(/ç/, 'ç') # ç - para.gsub!(/è/, 'è') # è - para.gsub!(/é/, '´') # é - para.gsub!(/ê/, 'ˆ') # ê - para.gsub!(/ë/, 'ë') # ë - para.gsub!(/ì/, 'ì') # ì - para.gsub!(/í/, '´') # í - para.gsub!(/î/, 'î') # î - para.gsub!(/ï/, 'ï') # ï - para.gsub!(/ð/, 'ð') # ð - para.gsub!(/ñ/, 'ñ') # ñ - para.gsub!(/ò/, 'ò') # ò - para.gsub!(/ó/, 'ó') # ó - para.gsub!(/ô/, 'ô') # ô - para.gsub!(/õ/, 'õ') # õ - para.gsub!(/ö/, 'ö') # ö - para.gsub!(/ø/, 'ø') # ø - para.gsub!(/ù/, 'ù') # ú - para.gsub!(/ú/, 'ú') # û - para.gsub!(/û/, 'û') # ü - para.gsub!(/ü/, 'ü') # ý - para.gsub!(/þ/, 'þ') # þ - para.gsub!(/ÿ/, 'ÿ') # ÿ + para.gsub!(/¢/u, '¢') # ¢ + para.gsub!(/£/u, '£') # £ + para.gsub!(/¥/u, '¥') # ¥ + para.gsub!(/§/u, '§') # § + para.gsub!(/©/u, '©') # © + para.gsub!(/ª/u, 'ª') # ª + para.gsub!(/«/u, '«') # « + para.gsub!(/®/u, '®') # ® + para.gsub!(/°/u, '°') # ° + para.gsub!(/±/u, '±') # ± + para.gsub!(/²/u, '²') # ² + para.gsub!(/³/u, '³') # ³ + para.gsub!(/µ/u, 'µ') # µ + para.gsub!(/¶/u, '¶') # ¶ + para.gsub!(/¹/u, '¹') # ¹ + para.gsub!(/º/u, 'º') # º + para.gsub!(/»/u, '»') # » + para.gsub!(/¼/u, '¼') # ¼ + para.gsub!(/½/u, '½') # ½ + para.gsub!(/¾/u, '¾') # ¾ + para.gsub!(/×/u, '×') # × + para.gsub!(/÷/u, '÷') # ÷ + para.gsub!(/¿/u, '¿') # ¿ + para.gsub!(/À/u, 'À') # À + para.gsub!(/Á/u, 'Á') # Á + para.gsub!(/Â/u, 'Â') #  + para.gsub!(/Ã/u, 'Ã') # à + para.gsub!(/Ä/u, 'Ä') # Ä + para.gsub!(/Å/u, 'Å') # Å + para.gsub!(/Æ/u, 'Æ') # Æ + para.gsub!(/Ç/u, 'Ç') # Ç + para.gsub!(/È/u, 'È') # È + para.gsub!(/É/u, 'É') # É + para.gsub!(/Ê/u, 'Ê') # Ê + para.gsub!(/Ë/u, 'Ë') # Ë + para.gsub!(/Ì/u, 'Ì') # Ì + para.gsub!(/Í/u, 'Í') # Í + para.gsub!(/Î/u, 'Î') # Î + para.gsub!(/Ï/u, 'Ï') # Ï + para.gsub!(/Ð/u, 'Ð') # Ð + para.gsub!(/Ñ/u, 'Ñ') # Ñ + para.gsub!(/Ò/u, 'Ò') # Ò + para.gsub!(/Ó/u, 'Ó') # Ó + para.gsub!(/Ô/u, 'Ô') # Ô + para.gsub!(/Õ/u, 'Õ') # Õ + para.gsub!(/Ö/u, 'Ö') # Ö + para.gsub!(/Ø/u, 'Ø') # Ø + para.gsub!(/Ù/u, 'Ù') # Ù + para.gsub!(/Ú/u, 'Ú') # Ú + para.gsub!(/Û/u, 'Û') # Û + para.gsub!(/Ü/u, 'Ü') # Ü + para.gsub!(/Ý/u, 'Ý') # Ý + para.gsub!(/Þ/u, 'Þ') # Þ + para.gsub!(/ß/u, 'ß') # ß + para.gsub!(/à/u, 'à') # à + para.gsub!(/á/u, 'á') # á + para.gsub!(/â/u, 'â') # â + para.gsub!(/ã/u, 'ã') # ã + para.gsub!(/ä/u, 'ä') # ä + para.gsub!(/å/u, 'å') # å + para.gsub!(/æ/u, 'æ') # æ + para.gsub!(/ç/u, 'ç') # ç + para.gsub!(/è/u, 'è') # è + para.gsub!(/é/u, '´') # é + para.gsub!(/ê/u, 'ˆ') # ê + para.gsub!(/ë/u, 'ë') # ë + para.gsub!(/ì/u, 'ì') # ì + para.gsub!(/í/u, '´') # í + para.gsub!(/î/u, 'î') # î + para.gsub!(/ï/u, 'ï') # ï + para.gsub!(/ð/u, 'ð') # ð + para.gsub!(/ñ/u, 'ñ') # ñ + para.gsub!(/ò/u, 'ò') # ò + para.gsub!(/ó/u, 'ó') # ó + para.gsub!(/ô/u, 'ô') # ô + para.gsub!(/õ/u, 'õ') # õ + para.gsub!(/ö/u, 'ö') # ö + para.gsub!(/ø/u, 'ø') # ø + para.gsub!(/ù/u, 'ù') # ú + para.gsub!(/ú/u, 'ú') # û + para.gsub!(/û/u, 'û') # ü + para.gsub!(/ü/u, 'ü') # ý + para.gsub!(/þ/u, 'þ') # þ + para.gsub!(/ÿ/u, 'ÿ') # ÿ end end self diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index 28dc088b..fb3daefe 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -1201,9 +1201,16 @@ WOK "#{source_file_path}/#{file}" end def read_source_file(fns) - fns_array=unless fns =~/\.ssm.sst$/ - IO.readlines(fns,'') - else IO.readlines("#{path.composite_file}/#{fns}",'') + fns_array=if RUBY_VERSION < '1.9' + x=unless fns =~/\.ssm.sst$/ + IO.readlines(fns,'') + else IO.readlines("#{path.composite_file}/#{fns}",'') + end + else #ruby version >= '1.9' + x=unless fns =~/\.ssm.sst$/ + IO.readlines(fns,'r:utf-8') + else IO.readlines("#{path.composite_file}/#{fns}",'r:utf-8') + end end end def path #dir @@ -3124,3 +3131,15 @@ module SiSU_Errors end __END__ https? intro check 2007-09-22 + +fns_array=unless fns =~/\.ssm.sst$/ + if RUBY_VERSION < '1.9' + IO.readlines(fns,'') + else IO.readlines(fns,'r:utf-8') + end +else + if RUBY_VERSION < '1.9' + IO.readlines("#{path.composite_file}/#{fns}",'') + else IO.readlines("#{path.composite_file}/#{fns}",'r:utf-8') + end +end diff --git a/lib/sisu/v0/texinfo.rb b/lib/sisu/v0/texinfo.rb index f96a3339..b6133ed7 100644 --- a/lib/sisu/v0/texinfo.rb +++ b/lib/sisu/v0/texinfo.rb @@ -159,7 +159,7 @@ module SiSU_TexInfo data.each do |para| # DEBUG 2003w16 this is a kludge, because i could not get parameters # from param, Sort out ... revert to more elegant solution - if para =~ /<!Th?¡\s+c/ + if para =~ /<!Th?¡\s+c/u @@flag['tables']='y' # KLUDGE get from param end para.gsub!(/<:p[bn]>/,'') @@ -242,7 +242,7 @@ module SiSU_TexInfo @tex_file=[] @@tableheader=0 data.each do |para| - if para =~ /¡|<!T/i + if para =~ /¡|<!T/ui do_mono=TexInfoFormat::Texinfo.new(para,@md) para=do_mono.longtable # using longtable latex package end diff --git a/lib/sisu/v0/texinfo_format.rb b/lib/sisu/v0/texinfo_format.rb index fbf8dd9a..6564460a 100644 --- a/lib/sisu/v0/texinfo_format.rb +++ b/lib/sisu/v0/texinfo_format.rb @@ -374,7 +374,7 @@ WOK def longtable @end_table="\\end{longtable}" @row_break='\\\\\\' - if @para[/<!Th?¡\s+c(\d+);(.+?)!>/i] + if @para[/<!Th?¡\s+c(\d+);(.+?)!>/ui] no_of_cols,cols_width=$1,$2 @@tableheader=1 if @para =~ /<!Th/i @w=cols_width.split(/;\s+/) @@ -389,17 +389,17 @@ WOK @colW=@colW.join @@start_table="\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{longtable}[hb]#@colW\n" - @para.gsub!(/<!Th?¡\s+c\d+?;.+!>/,"#{@@start_table}") + @para.gsub!(/<!Th?¡\s+c\d+?;.+!>/u,"#{@@start_table}") end if @para =~/<!TZ!>/ @para.gsub!(/<!TZ!>/," #@end_table") end - @para.gsub!(/<!¡/,'') + @para.gsub!(/<!¡/u,'') if @@tableheader==1 - if @para =~/¡\d+?¡(.+?)(?:¡|!)/ + if @para =~/¡\d+?¡(.+?)(?:¡|!)/u tablefoot=para[/\<!f(.+?)!\>/,1] @para.gsub!(/\<!f(.+?)!\>/,'') - @para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/, + @para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u, "{\\begin{tiny} {\\bfseries \\1}\\end{tiny}}&") @para.gsub!(/&>\s*$/, " #@row_break \\hline\\endhead #@row_break") @@ -408,8 +408,8 @@ WOK @@number_of_cols=0 end else - if @para =~/¡\d+?¡(.+?)(?:¡|!)/ - @para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,"\\begin{tiny}\\1\\end{tiny}&") + if @para =~/¡\d+?¡(.+?)(?:¡|!)/u + @para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,"\\begin{tiny}\\1\\end{tiny}&") @para.gsub!(/&>\s*$/," #@row_break") end end @@ -422,7 +422,7 @@ WOK @end_table="\\end{tabular}" @row_break='\\\\\\\\' @break_page="#@row_break\n#@row_break \n" - if @para[/<!Th?¡\s+c(\d+);(.+?)!>/i] + if @para[/<!Th?¡\s+c(\d+);(.+?)!>/ui] no_of_cols,cols_width=$1,$2 @w=cols_width.split(/;\s+/) @colW=[] @@ -431,13 +431,13 @@ WOK @colW << "p{#{col_w}cm}" if col_w end @@start_table="\\begin{tabular}{#@colW}\n" - @para.gsub!(/<!Th?¡\s+c\d+?;.+!>/,"#{@@start_table}") + @para.gsub!(/<!Th?¡\s+c\d+?;.+!>/u,"#{@@start_table}") end if @para =~/<!TZ!>/ @para.gsub!(/<!TZ!>/,"#@end_table") @@table_pg_break_counter=1 end - if @para =~/<!¡/ + if @para =~/<!¡/u if @@table_pg_break_counter==28 # taken from 34 ideal for portrait to 28 which suits landscape @para = "\n\n#@end_table \n" + @@ -445,14 +445,14 @@ WOK "#{@@start_table}\n" @@table_pg_break_counter=1 else - @para.gsub!(/<!¡/,'') + @para.gsub!(/<!¡/u,'') @@table_pg_break_counter+=1 tablefoot=@para[/\<!f(.+?)!\>/] @para.gsub!(/\<!f(.+?)!\>/,'') end end - if @para =~/¡\d+?¡(.+?)(?:¡|!)/ - @para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,"\\begin{tiny}\\1\\end{tiny}&") + if @para =~/¡\d+?¡(.+?)(?:¡|!)/u + @para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,"\\begin{tiny}\\1\\end{tiny}&") @para.gsub!(/&>\s*$/,"#@row_break") end @para diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index d19384cf..f11e456d 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -302,12 +302,12 @@ module SiSU_TeX else para end if para.class == String - @md.flag_tables=true if para =~/<!Th?¡\s+c/ + @md.flag_tables=true if para =~/<!Th?¡\s+c/u do_mono=SiSU_TeX_Pdf::Format_text_object.new(@md,para) @tex_file << do_mono.special_characters elsif para.class == Array para.each do |grp| - @md.flag_tables=true if grp =~/<!Th?¡\s+c/ + @md.flag_tables=true if grp =~/<!Th?¡\s+c/u do_mono=SiSU_TeX_Pdf::Format_text_object.new(@md,grp) @tex_file << do_mono.special_characters end @@ -343,7 +343,7 @@ module SiSU_TeX @@tableheader={ :p => 0, :l => 0 } @tex_file=[] data.each do |para| - @tex_file << if para =~/¡|<!T/ + @tex_file << if para =~/¡|<!T/u tables_hash(@md,para) #Hash result else para end diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 47b66729..ba84f323 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -287,7 +287,7 @@ WOK def longtable_landscape @end_table='\end{longtable}' @row_break='\\\\\\' - if @string[/<!Th?¡\s+c(\d+);(.+?)!\\~(\d+;\w\d+;\w\d+)>/] + if @string[/<!Th?¡\s+c(\d+);(.+?)!\\~(\d+;\w\d+;\w\d+)>/u] no_of_cols,cols_width,ocn=$1,$2,$3 tw=case @md.papersize when /a4/i; @tx.a4.landscape.w #European default, SiSU default @@ -313,24 +313,24 @@ WOK @colW=@colW.join @start_table="<~#{ocn}>\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{tiny}\n\\begin{longtable}#@colW\n" - @string.gsub!(/<!Th?¡\s+c\d+?;.+!\\~\d+;\w\d+;\w\d+>/,@start_table) + @string.gsub!(/<!Th?¡\s+c\d+?;.+!\\~\d+;\w\d+;\w\d+>/u,@start_table) end if @string =~/<!TZ!>/ @string.gsub!(/<!TZ!>/," #@end_table\n\\end{tiny}") end - @string.gsub!(/<!¡/,'') + @string.gsub!(/<!¡/u,'') if @@tableheader[:l] == 1 - if @string =~/¡\d+?¡(.+?)(?:¡|!)/ + if @string =~/¡\d+?¡(.+?)(?:¡|!)/u tablefoot=@string[/\<!f(.+?)!\>/,1] @string.gsub!(/\<!f(.+?)!\>/,'') - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,'\bfseries \1&') + @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,'\bfseries \1&') @string.gsub!(/&>\s*$/," #@row_break \\hline\\endhead #@row_break") @string="#@string \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot @@tableheader[:l],@@number_of_cols=0,0 end else - if @string =~/¡\d+?¡(.+?)(?:¡|!)/ - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,'\1&') + if @string =~/¡\d+?¡(.+?)(?:¡|!)/u + @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,'\1&') @string.gsub!(/&>\s*$/," #@row_break") end end @@ -341,7 +341,7 @@ WOK def longtable_portrait @end_table='\end{longtable}' @row_break='\\\\\\' - if @string[/<!Th?¡\s+c(\d+);(.+?)!\\~(\d+;\w\d+;\w\d+)>/] + if @string[/<!Th?¡\s+c(\d+);(.+?)!\\~(\d+;\w\d+;\w\d+)>/u] no_of_cols,cols_width,ocn=$1,$2,$3 tw=case @md.papersize when /a4/i; @tx.a4.portrait.w #European default, SiSU default @@ -368,24 +368,24 @@ WOK @colW=@colW.join @start_table="<~#{ocn}>\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{tiny}\n\\begin{longtable}#@colW\n" - @string.gsub!(/<!Th?¡\s+c\d+?;.+!\\~\d+;\w\d+;\w\d+>/,"#@start_table") + @string.gsub!(/<!Th?¡\s+c\d+?;.+!\\~\d+;\w\d+;\w\d+>/u,"#@start_table") end if @string =~/<!TZ!>/ @string.gsub!(/<!TZ!>/," #@end_table\n\\end{tiny}") end - @string.gsub!(/<!¡/,'') + @string.gsub!(/<!¡/u,'') if @@tableheader[:p] == 1 - if @string =~/¡\d+?¡(.+?)(?:¡|!)/ + if @string =~/¡\d+?¡(.+?)(?:¡|!)/u tablefoot=@string[/\<!f(.+?)!\>/,1] @string.gsub!(/\<!f(.+?)!\>/,'') - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,'\bfseries \1&') + @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,'\bfseries \1&') @string.gsub!(/&>\s*$/," #@row_break \\hline\\endhead #@row_break") @string="#@string \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot @@tableheader[:p],@@number_of_cols=0,0 end else - if @string =~/¡\d+?¡(.+?)(?:¡|!)/ - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,'\1&') + if @string =~/¡\d+?¡(.+?)(?:¡|!)/u + @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,'\1&') @string.gsub!(/&>\s*$/," #@row_break") end end @@ -399,7 +399,7 @@ WOK @end_table="\\end{tabular}" @row_break='\\\\\\\\' @break_page="#@row_break\n#@row_break \n" - if @string[/<!Th?¡\s+c(\d+);(.+?)!>/] + if @string[/<!Th?¡\s+c(\d+);(.+?)!>/u] no_of_cols,cols_width=$1,$2 @w=cols_width.split(/;\s*/) @colW=[] @@ -408,25 +408,25 @@ WOK @colW << "p{#{col_w}cm}" if col_w end @start_table="\\begin{tabular}{#@colW}\n" - @string.gsub!(/<!Th?¡\s+c\d+?;.+!>/,"#@start_table}") + @string.gsub!(/<!Th?¡\s+c\d+?;.+!>/u,"#@start_table}") end if @string =~/<!TZ!>/ @string.gsub!(/<!TZ!>/,"#@end_table") @@table_pg_break_counter=1 end - if @string =~/<!¡/ + if @string =~/<!¡/u if @@table_pg_break_counter == 28 # taken from 34 ideal for portrait to 28 which suits landscape @string="\n\n#@end_table \n#@break_page#@start_table\n" @@table_pg_break_counter=1 else - @string.gsub!(/<!¡/,'') + @string.gsub!(/<!¡/u,'') @@table_pg_break_counter+=1 tablefoot=@string[/\<!f(.+?)!\>/,1] @string.gsub!(/\<!f(.+?)!\>/,'') end end - if @string =~/¡\d+?¡(.+?)(?:¡|!)/ - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,"\\1&") + if @string =~/¡\d+?¡(.+?)(?:¡|!)/u + @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,"\\1&") @string.gsub!(/&>\s*$/,"#@row_break") end @string @@ -438,7 +438,7 @@ WOK para_array=[] if word word.each do |w| # _ - / # | : ! ^ ~ - unless para =~/^(?:0~|%+ |<!Th?¡ )/m + unless para =~/^(?:0~|%+ |<!Th?¡ )/um w.gsub!(/[\\]?~/,'<=tilde>') unless w=~/^[1-6]~|~\{|\}~|~\[|\]~|^\^~\s|~\^|\*~\S+|~#|\{t~|<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ w.gsub!(/&#(?:126|152);/,'<=tilde>') #126 usual #w.gsub!(/&#(?:126|152);/,'<=tilde>') unless w=~/https?:\/\/\S+/ #126 usual @@ -501,8 +501,8 @@ WOK if @@flag_code; @string.gsub!(/&/,'{\\\&}') else @string.gsub!(/(\s+&\s+)/,' and ') end - @string.gsub!(/§/,'\S') #latex: space between next character not preserved? #@string.gsub!(/§ /,'\S ') - @string.gsub!(/£/,'\pounds') + @string.gsub!(/§/u,'\S') #latex: space between next character not preserved? #@string.gsub!(/§ /,'\S ') + @string.gsub!(/£/u,'\pounds') @string.gsub!(/&\S+?;/,' ') @string.gsub!(/<a href=".+?">/,' ') @string.gsub!(/<\/a>/,' ') diff --git a/lib/sisu/v0/wikispeak.rb b/lib/sisu/v0/wikispeak.rb index 0812e81a..ec74afce 100644 --- a/lib/sisu/v0/wikispeak.rb +++ b/lib/sisu/v0/wikispeak.rb @@ -242,7 +242,7 @@ WOK table_message='[table omitted, see other document formats]' fix=[] data.each do |para| - para.gsub!(/<!Th?¡.+/m,"#@br#{table_message}") + para.gsub!(/<!Th?¡.+/um,"#@br#{table_message}") para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down para.gsub!(/©/,'©') # bullet markup, marked down @@ -334,7 +334,7 @@ WOK #formatMono=MonoSiSU.new('<br /><a name="owner.details">Owner Details</a>') #@@wiki[:owner_details]=formatMono.bold_para #para='' - elsif para =~/(¡|<!Th?)/ #tables ! + elsif para =~/(¡|<!Th?)/u #tables ! elsif para =~/(.*)<!#!>(.*)/ one,two=$1,$2 format_text=Format_text_object.new(one,two) diff --git a/lib/sisu/v0/xml_tables.rb b/lib/sisu/v0/xml_tables.rb index bc045837..be8c1dd1 100644 --- a/lib/sisu/v0/xml_tables.rb +++ b/lib/sisu/v0/xml_tables.rb @@ -87,9 +87,9 @@ module SiSU_Tables m=@parablock[/<!f(.+?)!>/,1] @@tablefoot << m if m @parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if @parablock =~/<!Th¡/ - if @parablock =~/<!Th?¡/ - @parablock.gsub!(/<!Th?¡.+?!~(\d+);\w\d+;\w\d+>/, + @@tablehead=1 if @parablock =~/<!Th¡/u + if @parablock =~/<!Th?¡/u + @parablock.gsub!(/<!Th?¡.+?!~(\d+);\w\d+;\w\d+>/u, %{\n<ocn>#@ocn</ocn><table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">}) end if @parablock =~/<!TZ!>/ @@ -101,12 +101,12 @@ module SiSU_Tables @parablock.gsub!(/<!TZ!>\s*/,"</table>\n") end if @@tablehead == 1 - if @parablock =~/¡¡/ - @parablock.gsub!(/<!¡¡(\d+?)¡/, + if @parablock =~/¡¡/u + @parablock.gsub!(/<!¡¡(\d+?)¡/u, %{<tr> <td width="\\1%" valign="top"> #{@vz.paragraph_table_xml}<b>}) - @parablock.gsub!(/¡¡(\d+?)¡/, + @parablock.gsub!(/¡¡(\d+?)¡/u, %{</b></td><td width="\\1%" valign="top"> #{@vz.paragraph_table_xml}<b>}) @parablock.gsub!(/!>/,"</b>\n</td>\n</tr>") @@ -114,11 +114,11 @@ module SiSU_Tables end @parablock else - @parablock.gsub!(/<!¡¡(\d+?)¡/, + @parablock.gsub!(/<!¡¡(\d+?)¡/u, %{<tr> <td width="\\1%" valign="top"> #{@vz.paragraph_table_xml}}) - @parablock.gsub!(/¡¡(\d+?)¡/, + @parablock.gsub!(/¡¡(\d+?)¡/u, %{ </td> <td width="\\1%" valign="top"> @@ -170,8 +170,8 @@ module SiSU_Tables m=@parablock[/<!f(.+?)!>/,1] @@tablefoot << m if m @parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if @parablock =~/<!Th¡/ - if @parablock =~/<!Th?¡.+?!~(\d+);\w\d+;\w\d+>/; @parablock=table_head($1) + @@tablehead=1 if @parablock =~/<!Th¡/u + if @parablock =~/<!Th?¡.+?!~(\d+);\w\d+;\w\d+>/u; @parablock=table_head($1) end if @parablock =~/<!TZ!>/ tablefoot=[] @@ -181,12 +181,12 @@ module SiSU_Tables end end if @@tablehead == 1 - if @parablock =~/¡¡/ - if @parablock =~/<!¡¡(\d+?)¡/ - @parablock.gsub!(/<!¡¡(\d+?)¡/,table_row($1,true)) + if @parablock =~/¡¡/u + if @parablock =~/<!¡¡(\d+?)¡/u + @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1,true)) end - if @parablock =~/¡¡(\d+?)¡/ - @parablock.gsub!(/¡¡(\d+?)¡/,table_cell($1,true)) + if @parablock =~/¡¡(\d+?)¡/u + @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1,true)) end if @parablock =~/!>/ @parablock.gsub!(/!>/,table_row_close(true)) @@ -195,11 +195,11 @@ module SiSU_Tables end @parablock else - if @parablock =~/<!¡¡(\d+?)¡/ - @parablock.gsub!(/<!¡¡(\d+?)¡/,table_row($1)) + if @parablock =~/<!¡¡(\d+?)¡/u + @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1)) end - if @parablock =~/¡¡(\d+?)¡/ - @parablock.gsub!(/¡¡(\d+?)¡/,table_cell($1)) + if @parablock =~/¡¡(\d+?)¡/u + @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1)) end if @parablock =~/!>/ @parablock.gsub!(/!>/,table_row_close) |