aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/db_import.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/db_import.rb')
-rw-r--r--lib/sisu/v0/db_import.rb145
1 files changed, 75 insertions, 70 deletions
diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb
index cb68ffd6..1e788f8e 100644
--- a/lib/sisu/v0/db_import.rb
+++ b/lib/sisu/v0/db_import.rb
@@ -138,20 +138,20 @@ module SiSU_DB_import
end
def special_character_escape(string)
string.gsub!(/'/,"''") #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'")
- string.gsub!(/<:br>/,"<br />\n")
- string.gsub!(/<:(?:code|alt|group|verse)(?:-end)?>/,'')
- string.gsub!(/<:name#\S+?>/,'')
+ string.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"<br />\n")
+ string.gsub!(/#{Mx[:gr_o]}(?:code|alt|group|verse)(?:-end)?#{Mx[:gr_c]}/,'')
+ string.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
string.gsub!(/\{\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)\}\S+/,'[image: \1] \2')
string.gsub!(/\{\s*(.+?)\s*\}(?:https?|file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2')
end
def strip_markup(string) #define rules, make same as in dal clean
- string.gsub!(/<sup>(\d+)<\/sup>/,'[\1]')
- string.gsub!(/<:i[12]>/,'')
+ string.gsub!(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]')
+ string.gsub!(/#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/,'')
string.gsub!(/(?:&nbsp\\;)+/,' ')
- 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!(/#{Mx[:gr_o]}T[h]?#{Mx[:tc_p]}.+?#{Mx[:gr_c]}/u,"[TABLE]\n") #tables #CHECK should take whole table
+ string.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}\d+(.+)#{Mx[:tc_c]}/u,'\1') #tables
+ string.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' ') #tables
+ string.gsub!(/#{Mx[:tc_p]}/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+/,' ')
@@ -375,23 +375,30 @@ module SiSU_DB_import
@col[:en_z]=nil
dal_array.each do |data|
#data.gsub!(/<[biu]>(.+?)<\/[biu]>/,'\1') # remove bold, italics, underscore
- data.gsub!(/<b>(.+?)<\/b>/,'\1') # remove bold, italics, underscore
- data.gsub!(/<i>(.+?)<\/i>/,'\1') # remove bold, italics, underscore
- data.gsub!(/<u>(.+?)<\/u>/,'\1') # remove bold, italics, underscore
- #data.gsub!(/<:name#\S+?>/,'')
+ data.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1')
+ #data.gsub!(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphaisis_c]}/,'\1')
+ data.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1')
+ data.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1')
+ data.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1')
+ data.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1')
+ data.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1')
+ data.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1')
+ data.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1')
+ data.gsub!(/#{Mx[:gl_o]}(●)#{Mx[:gl_c]}\s*/,'\1 ')
+ data.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
@col[:seg]=@@seg
- if data =~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}>/m # regular text
+ if data =~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m # regular text
notedata=data.dup
- if data[/^([123])~\s+(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/]
+ if data[/^#{Mx[:lv_o]}([123]):\S*?#{Mx[:lv_c]}\s*(.+?)#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})#{Mx[:id_c]}/m]
@col[:lev],txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=$1,$2,$3,$4,$5,$6,$7
@col[:lid]+=1
- if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/
+ if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
endnotes(txt).range
- if txt =~/~\{.+?\}~/; @en << endnotes(txt).standard
+ if txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
end
- if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk
+ if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
end
- if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus
+ if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_o]}/; @en_pls << endnotes(txt).plus
end
txt=endnotes(txt).clean_text
end
@@ -413,7 +420,7 @@ module SiSU_DB_import
when /3/; @col[:lv3]+=1
end
@col[:lev]=@col[:plaintext]=@col[:body]=''
- elsif data[/^4~(.+?)\s+(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/]
+ elsif data[/^#{Mx[:lv_o]}4:(\S*?)#{Mx[:lv_c]}\s*(.+?)#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})#{Mx[:id_c]}/]
@@seg,txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=$1,$2,$3,$4,$5,$6,$7
@col[:seg]=@@seg
@col[:lv4]+=1
@@ -426,13 +433,13 @@ module SiSU_DB_import
end
@env=SiSU_Env::Info_env.new(@md.fns)
@base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html"
- if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/
+ if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
endnotes(txt).range
- if txt =~ /~\{.+?\}~/; @en << endnotes(txt).standard
+ if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
end
- if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk
+ if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
end
- if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus
+ if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus
end
txt=endnotes(txt).clean_text(@base_url)
end
@@ -449,9 +456,9 @@ module SiSU_DB_import
t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file)
t.tuple
@col[:lev]=@col[:plaintext]=@col[:body]=''
- elsif data[/^5~(?:~\S+)?(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/] # header lev5 seg level
+ elsif data[/^#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*(.+?)#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})#{Mx[:id_c]}/] # header lev5 seg level
txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=$1,$2,$3,$4,$5,$6
- re=/^5~(.+?)\s+/
+ re=/^#{Mx[:lv_o]}5:(\S*?)#{Mx[:lv_c]}/
@@seg_full=re.match(data)[1] if data=~re #create?
@@seg ||='' #nil # watch
@col[:seg]=@@seg
@@ -465,13 +472,13 @@ module SiSU_DB_import
end
@env=SiSU_Env::Info_env.new(@md.fns)
@base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html"
- if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/
+ if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
endnotes(txt).range
- if txt =~ /~\{.+?\}~/; @en << endnotes(txt).standard
+ if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
end
- if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk
+ if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
end
- if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus
+ if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus
end
txt=endnotes(txt).clean_text(@base_url)
end
@@ -488,9 +495,9 @@ module SiSU_DB_import
t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file)
t.tuple
@col[:lev]=@col[:plaintext]=@col[:body]=''
- elsif data[/^6~(?:~\S+)?(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/] # header lev6 seg level
+ elsif data[/^#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*(.+?)#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})#{Mx[:id_c]}/] # header lev6 seg level
txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=$1,$2,$3,$4,$5,$6
- re=/^6~(.+?)\s+/
+ re=/^#{Mx[:lv_o]}6:(\S*?)#{Mx[:lv_c]}/
@@seg_full=re.match(data)[1] if data=~re #create?
@@seg ||='' #nil # watch
@col[:seg]=@@seg
@@ -504,13 +511,13 @@ module SiSU_DB_import
end
@env=SiSU_Env::Info_env.new(@md.fns)
@base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html"
- if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/
+ if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
endnotes(txt).range
- if txt =~ /~\{.+?\}~/; @en << endnotes(txt).standard
+ if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
end
- if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk
+ if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
end
- if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus
+ if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus
end
txt=endnotes(txt).clean_text(@base_url)
end
@@ -530,21 +537,21 @@ module SiSU_DB_import
else #% regular text
@col[:lid]+=1
txt=''
- txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=(/(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/m).match(data).captures
+ txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=(/(.+?)#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})#{Mx[:id_c]}/m).match(data).captures
@hname=if @col[:seg] \
and not @col[:seg].to_s.empty?
- @@hname=@col[:seg].to_s
+ @@hname=@col[:seg].to_s
else @@hname
end
@env=SiSU_Env::Info_env.new(@md.fns)
@base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html"
- if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/
+ if txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
endnotes(txt).range
- if txt =~ /~\{.+?\}~/; @en << endnotes(txt).standard
+ if txt =~ /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @en << endnotes(txt).standard
end
- if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk
+ if txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @en_ast << endnotes(txt).asterisk
end
- if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus
+ if txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @en_pls << endnotes(txt).plus
end
txt=endnotes(txt).clean_text(@base_url)
end
@@ -562,12 +569,10 @@ module SiSU_DB_import
end
if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last
end
- @col[:body]=if txt=~/<!T[h]?¡.+?!~\d+;\w\d+;\w\d+>/ #watch
+ @col[:body]=if txt=~/#{Mx[:gr_o]}T[h]?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/ #watch
SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).html_table
- elsif txt=~/<:i1>/
- SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).indent1
- elsif txt=~/<:i2>/
- SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).indent2
+ elsif txt=~/^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/
+ SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).indent($1)
else
SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).norm
end
@@ -580,11 +585,11 @@ module SiSU_DB_import
@col[:en_a]=@col[:en_z]=nil
@col[:lev]=@col[:plaintext]=@col[:body]=''
end
- if notedata =~ /~\{.+?\}~/ #% import into database endnotes tables
- endnote_array=notedata.scan(/~\{.+?\}~/)
+ if notedata =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/ #% import into database endnotes tables
+ endnote_array=notedata.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/)
endnote_array.each do |inf|
- if inf[/~\{\d+.+?<[0-9a-f]{#{@@dl}}>\}~/] # dal new endnotes 2003w31/1
- if inf[/~\{(\d+)(.+?)<([0-9a-f]{#{@@dl}})>\}~/] # dal new endnotes 2003w31/1
+ if inf[/#{Mx[:en_a_o]}\d+.+?#{Mx[:id_o]}[0-9a-f]{#{@@dl}}#{Mx[:id_c]}#{Mx[:en_a_c]}/] # dal new endnotes 2003w31/1
+ if inf[/#{Mx[:en_a_o]}(\d+)(.+?)#{Mx[:id_o]}([0-9a-f]{#{@@dl}})#{Mx[:id_c]}#{Mx[:en_a_c]}/] # dal new endnotes 2003w31/1
nr,txt,digest_clean=$1,$2,$3
end
@id_n+=1
@@ -620,11 +625,11 @@ module SiSU_DB_import
end
word_mode=notedata.scan(/\S+/)
end
- if notedata =~ /~\[\*.+?\]~/ #% import into database endnotes tables
- endnote_array=notedata.scan(/~\[\*.+?\]~/)
+ if notedata =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/ #% import into database endnotes tables
+ endnote_array=notedata.scan(/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/)
endnote_array.each do |inf|
- if inf[/~\[\*\d+.+?<[0-9a-f]{#{@@dl}}>\]~/] # dal new endnotes 2003w31/1
- if inf[/~\[[*](\d+)(.+?)<([0-9a-f]{#{@@dl}})>\]~/] # dal new endnotes 2003w31/1
+ if inf[/#{Mx[:en_b_o]}\*\d+.+?#{Mx[:id_o]}[0-9a-f]{#{@@dl}}#{Mx[:id_c]}#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1
+ if inf[/#{Mx[:en_b_o]}[*](\d+)(.+?)#{Mx[:id_o]}([0-9a-f]{#{@@dl}})#{Mx[:id_c]}#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1
nr,txt,digest_clean=$1,$2,$3
end
@id_n+=1
@@ -661,11 +666,11 @@ module SiSU_DB_import
end
word_mode=notedata.scan(/\S+/)
end
- if notedata =~ /~\[\+.+?\]~/ #% import into database endnotes tables
- endnote_array=notedata.scan(/~\[\+.+?\]~/)
+ if notedata =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/ #% import into database endnotes tables
+ endnote_array=notedata.scan(/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/)
endnote_array.each do |inf|
- if inf[/~\[\+\d+.+?<[0-9a-f]{#{@@dl}}>\]~/] # dal new endnotes 2003w31/1
- if inf[/~\[[+](\d+)(.+?)<([0-9a-f]{#{@@dl}})>\]~/] # dal new endnotes 2003w31/1
+ if inf[/#{Mx[:en_b_o]}\+\d+.+?#{Mx[:id_o]}[0-9a-f]{#{@@dl}}#{Mx[:id_c]}#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1
+ if inf[/#{Mx[:en_b_o]}[+](\d+)(.+?)#{Mx[:id_o]}([0-9a-f]{#{@@dl}})#{Mx[:id_c]}#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1
nr,txt,digest_clean=$1,$2,$3
end
@id_n+=1
@@ -710,38 +715,38 @@ module SiSU_DB_import
def endnotes(txt)
@txt=txt
def standard
- x=if @txt =~ /~\{.+?\}~/; @txt.scan(/~\{(\d+).+?\}~/)
+ x=if @txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/; @txt.scan(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/)
else nil
end
end
def asterisk
- x=if @txt =~/~\[\*.+?\]~/; @txt.scan(/~\[[*](\d+).+?\]~/)
+ x=if @txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/; @txt.scan(/#{Mx[:en_b_o]}[*](\d+).+?#{Mx[:en_b_c]}/)
else nil
end
end
def plus
- x=if @txt =~/~\[\+.+?\]~/; @txt.scan(/~\[[+](\d+).+?\]~/)
+ x=if @txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/; @txt.scan(/#{Mx[:en_b_o]}[+](\d+).+?#{Mx[:en_b_c]}/)
else nil
end
end
def clean_text(base_url=nil)
if base_url
- @txt.gsub!(/~\{(\d+).+?\}~/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
- @txt.gsub!(/~\[([*]\d+).+?\]~/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
- @txt.gsub!(/~\[([+]\d+).+?\]~/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
+ @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
+ @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
+ @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
else
- @txt.gsub!(/~\{(\d+).+?\}~/,'<sup>\1</sup>')
- @txt.gsub!(/~\[([*]\d+).+?\]~/,'<sup>\1</sup>')
- @txt.gsub!(/~\[([+]\d+).+?\]~/,'<sup>\1</sup>')
+ @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,'<sup>\1</sup>')
+ @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>')
+ @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>')
end
@txt
end
def range
@col[:en_a]=@col[:en_z]=nil
- if @txt =~ /~\{.+?\}~|~\[([*]\d+).+?\]~|~\[([+]\d+).+?\]~/
+ if @txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}|#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/
word_array=@txt.scan(/\S+/)
word_array.each do |w|
- if w[/~[{\[][*+]?(\d+)\s+.+?[}\]]~/] # not tested since change 2003w31
+ if w[/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/] # not tested since change 2003w31
@col[:en_a]=$1 unless @col[:en_a]
@col[:en_z]=@col[:en_a].dup unless @col[:en_a]
@col[:en_z]=$1 if @col[:en_a]