aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/wikispeak.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/wikispeak.rb')
-rw-r--r--lib/sisu/v0/wikispeak.rb48
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/sisu/v0/wikispeak.rb b/lib/sisu/v0/wikispeak.rb
index 8ac3b351..967387d9 100644
--- a/lib/sisu/v0/wikispeak.rb
+++ b/lib/sisu/v0/wikispeak.rb
@@ -110,25 +110,25 @@ module SiSU_Wikispeak
end
def lev_segname_para_ocn
@text=nil
- if @para =~/^(\d~|<:.+?>).+?<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
- if /^(([1-6])~(\S+))\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para)
+ if @para =~/^(\d~|<:.+?>).+?#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
+ if /^(([1-6])~(\S+))\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para)
@format,@lev,segname,@text,@ocn=$1,$2,$3,$4,$5
- elsif /^(([1-6])~)\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para)
+ elsif /^(([1-6])~)\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para)
@format,@lev,@text,@ocn=$1,$2,$3,$4
- elsif /<:(.+?)>\s*(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para)
+ elsif /<:(.+?)>\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para)
@format,@text,@ocn=$1,$2,$3
- elsif /^(([1-6])~(\S+))\s+(\S.+?)<~(\d+);(?:\w|[0-6]:)\d+;[um]\d+><#@dp:#@dp>$/m.match(@para)
+ elsif /^(([1-6])~(\S+))\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;[um]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para)
@@alt_id_count+=1
@format,@lev,segname,@text,@ocn=$1,$2,$3,$4,"x#{@@alt_id_count}"
- elsif /^(([1-6])~)\s+(\S.+?)<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/m.match(@para)
+ elsif /^(([1-6])~)\s+(\S.+?)#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para)
@@alt_id_count+=1
@format,@lev,@text,@ocn=$1,$2,$3,"x#{@@alt_id_count}"
end
else
- if /(.+?)<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m.match(@para)
+ if /(.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m.match(@para)
@text,@ocn=$1,$2
end
- if @para !~/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$|^$/ #added 2002w06
+ if @para !~/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$|^$/ #added 2002w06
@text=/(.+?)/m.match(@para)[1]
end
if /^((\d)~(?:~\S+)?)\s+(.+)/m.match(@para)
@@ -136,10 +136,10 @@ module SiSU_Wikispeak
end
end
format=@format.dup
- @lev_para_ocn=if @para =~/.+<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
+ @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{#Mx[:id_c]}$/
Format::Format_text_object.new(format,@text,@ocn)
else
- Format::Format_text_object.new(format,@text,"<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>")
+ Format::Format_text_object.new(format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}")
end
self
end
@@ -154,7 +154,7 @@ module SiSU_Wikispeak
@data,@md=data,md
@vz=SiSU_Env::Get_init.instance.skin
@dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
- @regx=/^(?:(?:<:p[bn]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ #m # 2004w18 pb pn removal added
+ @regx=/^(?:(?:#{Mx[:br_line]}\s*|#{Mx[:br_nl]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]}\s*)?(.+?)\s*#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #m # 2004w18 pb pn removal added
@tab="\t"
@@dostype='unix footnotes'
@br="\n"
@@ -168,7 +168,7 @@ module SiSU_Wikispeak
end
# Used for extraction of endnotes from paragraphs
def extract_endnotes(para='')
- notes=para.scan(/~[{\[]([\d*+]+\s+.+?)\s*<#@dp>[}\]]~/)
+ notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
@n=[]
end
def wiki_metadata(meta)
@@ -220,9 +220,9 @@ WOK
n3=lv + 2
lv=nil if lv == 0
extract_endnotes(para)
- para.gsub!(/~[{\[](?:[\d*+]+)\s+(.+?)<#@dp>[}\]]~/,'<ref>\1</ref>') # endnote marker marked up
- para.gsub!(/^\d~\S*\s+/,'') # endnote marker marked up
- para.gsub!(/<\S+?><#@dp:#@dp>/,'') # endnote marker marked up
+ para.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(?:[\d*+]+)\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'<ref>\1</ref>') # endnote marker marked up
+ para.gsub!(/^#{Rx[:lv]}\S*\s+/,'') # endnote marker marked up
+ para.gsub!(/<\S+?>#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') # endnote marker marked up
if lv
@@wiki[:body] << case lv
when 1; '='*2 << para.strip << @br*2
@@ -243,7 +243,7 @@ WOK
table_message='[table omitted, see other document formats]'
fix=[]
data.each do |para|
- para.gsub!(/<!Th?¡.+/um,"#@br#{table_message}")
+ para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#@br#{table_message}")
para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check
para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down
para.gsub!(/&#169;/,'©') # bullet markup, marked down
@@ -255,9 +255,9 @@ WOK
para.gsub!(/<u>(.+?)<\/u>/,'_\1_')
para.gsub!(/\{(.+?)\}(https?:\/\/\S+)/,'[\2 \1]')
para.gsub!(/(https?:\/\/\S+)/,'[\1]')
- para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/,'')
+ para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/,'')
para.gsub!(/<:p[bn]>/,'') # remove page breaks
- para.gsub!(/^\s*<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,'') # remove empty lines - check
+ para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') # remove empty lines - check
para.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')
para.gsub!(/<:name#\S+?>/,'') # remove name links
para.gsub!(/&nbsp;/,' ') # decide on
@@ -270,14 +270,14 @@ WOK
if d_meta; wiki_metadata(d_meta)
end
end
- if para !~/(^0~|<ENDNOTES>|<EOF>)/
+ if para !~/(^0~|#{Mx[:br_endnotes]}|#{Mx[:br_eof]})/
if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change
paranum=para[@regx,3]
@p_num=Format::Paragraph_number.new(paranum)
end
@sto=Split_text_object.new(para).lev_segname_para_ocn
### problem in scroll, it appears tables are getting paragraph numbers
- m=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
+ m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
if para =~m \
and para=~/\S+/
para=case @sto.format
@@ -325,17 +325,17 @@ WOK
elsif para =~/#{table_message}/
@@wiki[:body] << para << @br
elsif para =~/(Note|Endnotes?)/ \
- and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
+ and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
elsif para =~/(MetaData)/ \
- and para =~/<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info ####suspect visit
+ and para =~/#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info ####suspect visit
#formatMono=MonoSiSU.new('<br /><a name="metadata">MetaData</a>')
#para=formatMono.bold_para
elsif para.include? 'Owner Details' \
- and para !~/<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
+ and para !~/#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
#formatMono=MonoSiSU.new('<br /><a name="owner.details">Owner Details</a>')
#@@wiki[:owner_details]=formatMono.bold_para
#para=''
- elsif para =~/(¡|<!Th?)/u #tables !
+ elsif para =~/(#{Mx[:tc_p]}|#{Mx[:gr_o]}Th?)/u #tables !
elsif para =~/(.*)<!#!>(.*)/
one,two=$1,$2
format_text=Format_text_object.new(one,two)