From 08c69d074001507d64cd5960c8679ec91a5a8353 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 23 Aug 2008 12:01:59 -0400 Subject: pass Hash to Format classes; some match tuning in dal --- lib/sisu/v0/texpdf.rb | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'lib/sisu/v0/texpdf.rb') diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index e4bd9c00..c5ee2092 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -382,8 +382,10 @@ module SiSU_TeX @md.papersize_array.each do |ps| @@tableheader={ ps => { :p => 0, :l => 0 }} para,para_p=@para.dup,@para.dup #visit - format_l=SiSU_TeX_Pdf::Format_text_object.new(md,para,ps) - format_p=SiSU_TeX_Pdf::Format_text_object.new(md,para_p,ps) + txt_obj={:txt =>para,:paper_size =>ps} + format_l=SiSU_TeX_Pdf::Format_text_object.new(md,txt_obj) + txt_obj={:txt =>para_p,:paper_size =>ps} + format_p=SiSU_TeX_Pdf::Format_text_object.new(md,txt_obj) @block[ps]={ :l => format_l.longtable_landscape, :p => format_p.longtable_portrait @@ -411,7 +413,8 @@ module SiSU_TeX end def markup_common(para) tex_f=nil - mono=SiSU_TeX_Pdf::Format_text_object.new(@md,para) + txt_obj={:txt =>para} + mono=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj) if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/ \ or @@flag_alt if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/ @@ -436,7 +439,8 @@ module SiSU_TeX elsif x =~/code/; @@flag_alt,@@flag_code=true,true elsif @@flag_alt if para =~ /#{Mx[:lnk_c]}(?:https?|file|ftp)/m - para=SiSU_TeX_Pdf::Format_text_object.new(@md,para,'a4').http + txt_obj={:txt =>para,:paper_size =>'a4'} + para=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).http end @group_collect << para #<< "\n\n" end @@ -501,11 +505,13 @@ module SiSU_TeX end if para =~ /#{Mx[:lnk_c]}(?:https?|file|ftp)/ para=if para !~/\.(?:png|jpg|gif)/ - SiSU_TeX_Pdf::Format_text_object.new(@md,para,'a4').http + txt_obj={:txt =>para,:paper_size =>'a4'} + SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).http else @block={} @md.papersize_array.each do |ps| - image=SiSU_TeX_Pdf::Format_text_object.new(@md,para,ps).http + txt_obj={:txt =>para,:paper_size =>ps} + image=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).http @block[ps]={ :l => image, :p => image @@ -524,8 +530,10 @@ module SiSU_TeX title=@md.title.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex subtitle=@md.subtitle.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') if @md.subtitle #no line splitting in heading neither html nor latex @md.papersize_array.each do |ps| - orient_portrait=SiSU_TeX_Pdf::Format_head.new(@md,ps,'portrait',"#{home}: - #{title} #{subtitle}") - orient_landscape=SiSU_TeX_Pdf::Format_head.new(@md,ps,'landscape',"#{home}: - #{title} #{subtitle}") + txt_obj={:txt =>"#{home}: - #{title} #{subtitle}",:paper_size =>ps,:orientation =>'portrait'} + orient_portrait=SiSU_TeX_Pdf::Format_head.new(@md,txt_obj) + txt_obj={:txt =>"#{home}: - #{title} #{subtitle}",:paper_size =>ps,:orientation =>'landscape'} + orient_landscape=SiSU_TeX_Pdf::Format_head.new(@md,txt_obj) @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation end @@ -544,8 +552,9 @@ WOK #end @copymark='' #check and remove as now is superflous x={} - x[:l]=SiSU_TeX_Pdf::Format_text_object.new(@md,@md.title,@md.subtitle).title_landscape - x[:p]=SiSU_TeX_Pdf::Format_text_object.new(@md,@md.title,@md.subtitle).title_portrait + txt_obj={:title =>@md.title,:subtitle =>@md.subtitle} + x[:l]=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).title_landscape + x[:p]=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).title_portrait @tex_file << x x=nil if @md.dc_creator @@ -680,7 +689,8 @@ WOK paranum=if ocn; para[m,2] else '' end - do_duo=SiSU_TeX_Pdf::Format_text_object.new(@md,parablock,paranum) + txt_obj={:txt =>parablock,:ocn =>paranum} + do_duo=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj) para=do_duo.para_num if parablock elsif para =~/^#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #2005 this is added for tables, rationalise m=/#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m -- cgit v1.2.3