aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/odf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/odf.rb')
-rw-r--r--lib/sisu/v0/odf.rb61
1 files changed, 40 insertions, 21 deletions
diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb
index 9fb6b51e..d21a8628 100644
--- a/lib/sisu/v0/odf.rb
+++ b/lib/sisu/v0/odf.rb
@@ -249,7 +249,7 @@ module SiSU_ODF
txt.gsub!(/([)(\]\[])/,"\\\\\\1")
txt.gsub!(/([+?*])/,"\\\\\\1") # problems with +
url.gsub!(/([+?])/,"\\\\\\1") # problems with +
- para.gsub!(/\{\s*#{txt}\}#{url}/m,text_link_odf(txt,url,trail)) #make sure trailing ']' are not caught in url
+ para.gsub!(/#{Mx[:lnk_o]}\s*#{txt}#{Mx[:lnk_c]}#{url}/m,text_link_odf(txt,url,trail)) #make sure trailing ']' are not caught in url
para.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix
end
m=nil
@@ -358,11 +358,29 @@ module SiSU_ODF
end
def table(para) #
if para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block
- table=SiSU_ODF_format::Table.new(@md,para)
+ txt_obj={:table =>para}
+ table=SiSU_ODF_format::Table.new(@md,txt_obj)
para=table.table_split
end
end
- def odf_structure(para='',lv='',ocn='',hname='') #% Used to extract the structure of a document
+ def odf_structure(md,t_o)
+ @md,@t_o=md,t_o
+ @md,@t_o=md,t_o
+ if t_o.class == Hash
+ para =t_o[:txt] || nil
+ lv =t_o[:lv] || nil
+ ocn =t_o[:ocn] || nil
+ hname =t_o[:h_name] || nil
+ #@h_name =t_o[:h_name] || nil
+ #elsif t_o.class == Array
+ # @txt =txt[0]
+ #elsif t_o.class == String
+ # @txt =txt
+ else
+ #@one,@two,@three=one,two,three
+ p t_o.class
+ p caller
+ end
lv=lv.to_i
n=lv - 1
n3=lv + 2
@@ -515,31 +533,35 @@ module SiSU_ODF
and para=~/\S+/
para=case @sto.format
when /^(1):(\S*)/
- odf_structure(para,$1,@sto.ocn,$2)
+ txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
+ odf_structure(@md,txt_obj)
para
when /^(2):(\S*)/
- odf_structure(para,$1,@sto.ocn,$2)
+ txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
+ odf_structure(@md,txt_obj)
para
when /^(3):(\S*)/
- odf_structure(para,$1,@sto.ocn,$2)
+ txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
+ odf_structure(@md,txt_obj)
para
when /^(4):(\S+)/ # work on see Split_text_object
- odf_structure(para,$1,@sto.ocn,$2)
+ txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
+ odf_structure(@md,txt_obj)
# work on see SiSU_text_parts::Split_text_object
para
when /^(5):(\S*)/
- odf_structure(para,$1,@sto.ocn,$2)
+ txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
+ odf_structure(@md,txt_obj)
para
when /^(6):(\S*)/
- odf_structure(para,$1,@sto.ocn,$2)
+ txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
+ odf_structure(@md,txt_obj)
para
- else odf_structure(para,nil,nil,nil) #watch may be problematic
+ else
+ txt_obj={:txt =>para}
+ odf_structure(@md,txt_obj) #watch may be problematic
para
end
- elsif para =~/(.*)<!#!>(.*)/
- one,two=$1,$2
- format_text=SiSU_ODF_format::Format_text_object.new(one,two)
- para=format_text.seg_no_paranum
end
if para =~/<a name="n\d+">/ \
and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/ # -endnote
@@ -548,17 +570,14 @@ module SiSU_ODF
if (para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/)
# i don't get the condition for no paranum
end
- if para =~/<:center>/
- one,two=/(.*)<:center>(.*)/.match(para)[1,2]
- format_text=SiSU_ODF_format::Format_text_object.new(one,two)
- para=format_text.center
- end
else
if para =~ /^(4)~(\S+)/
- odf_structure(para,$1,@sto.ocn,$2)
+ txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2}
+ odf_structure(@md,txt_obj)
para
elsif para =~/#{Mx[:id_o]}~(\d+);m\d+;[mdv]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/
- odf_structure(para,nil,nil,nil) #watch may be problematic
+ txt_obj={:txt =>para}
+ odf_structure(@md,txt_obj) #watch may be problematic
para
end
end