diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-03-02 22:54:28 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-03-02 22:54:28 -0500 |
commit | 0569fd776ab4ce33689ca3337acd62f2415b6348 (patch) | |
tree | 4644037b28d876d8637a610f5df1a29535a4ef9a /lib/sisu/v3/texpdf.rb | |
parent | debian/changelog (3.0.1-1) (diff) | |
parent | CHANGELOG_v{1,2,3}, syslink, avoid duplication (diff) |
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib/sisu/v3/texpdf.rb')
-rw-r--r-- | lib/sisu/v3/texpdf.rb | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index e0646603..9497d51f 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -1,4 +1,4 @@ -# coding: utf-8 +# encoding: utf-8 =begin * Name: SiSU @@ -58,13 +58,13 @@ =end module SiSU_TeX require 'pstore' - require "#{SiSU_lib}/defaults" # defaults.rb + require_relative 'defaults' # defaults.rb include SiSU_Viz - require "#{SiSU_lib}/particulars" # particulars.rb + require_relative 'particulars' # particulars.rb include SiSU_Particulars - require "#{SiSU_lib}/texpdf_format" # texpdf_format.rb + require_relative 'texpdf_format' # texpdf_format.rb include SiSU_TeX_Pdf - require "#{SiSU_lib}/shared_metadata" # shared_metadata.rb + require_relative 'shared_metadata' # shared_metadata.rb @tex_file=@@tex_footnote_array=@@tex_col_w=[] @@tabular="{tabular}" @@column_instruct=@@squigle_close=@@tex_line_mode=@@tex_word_mode=@@line_mode='' @@ -74,10 +74,10 @@ module SiSU_TeX @@date ||=SiSU_Env::Info_date.new class Source require 'pstore' - require "#{SiSU_lib}/sysenv" # sysenv.rb + require_relative 'sysenv' # sysenv.rb include SiSU_Env include SiSU_Viz - require "#{SiSU_lib}/dal" # dal.rb + require_relative 'dal' # dal.rb include SiSU_DAL include SiSU_TeX def initialize(opt) @@ -91,7 +91,7 @@ module SiSU_TeX case @opt.fns when /\.(?:-|ssm\.)?sst$/ SiSU_Env::SiSU_file.new(@md).mkdir - Dir.mkdir(@env.path.processing_tex) unless FileTest.directory?(@env.path.processing_tex) + Dir.mkdir(@env.processing_path.tex) unless FileTest.directory?(@env.processing_path.tex) end rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure @@ -123,7 +123,7 @@ module SiSU_TeX rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure unless @opt.cmd =~/[MV]/ #check maintenance flag - texfiles=Dir["#{@env.path.processing_tex}/#{@opt.fns}*"] + texfiles=Dir["#{@env.processing_path.tex}/#{@opt.fns}*"] texfiles.each do |f| if FileTest.file?(f) File.unlink(f) @@ -206,8 +206,8 @@ module SiSU_TeX if @md.fns =~/\.(?:-|ssm\.)?sst$/ case @md.fns when /\.(?:-|ssm\.)?sst$/ - if FileTest.directory?(@env.path.processing_tex)==true - Dir.chdir(@env.path.processing_tex) + if FileTest.directory?(@env.processing_path.tex)==true + Dir.chdir(@env.processing_path.tex) texfile=@md.fns.gsub(/$/,".#{ps}.tex") texfile=texfile.gsub(/~/,'-') if File.exist?(texfile) \ @@ -216,7 +216,7 @@ module SiSU_TeX #p "#{__FILE__}:#{__LINE__} texpdf generation disabled" if @md.cmd.inspect =~/M/ #%% disable temporarily, re-enable latex_do(texfile,ps) else - puts "\tzero file size #{@env.path.processing_tex}/#{texfile}" + puts "\tzero file size #{@env.processing_path.tex}/#{texfile}" end end end @@ -265,12 +265,12 @@ module SiSU_TeX end class LaTeX_create @@tex_head={ - 'a4'=> {:p => nil, :l => nil}, - 'a5'=> {:p => nil, :l => nil}, - 'b5'=> {:p => nil, :l => nil}, - 'letter'=>{:p => nil, :l => nil}, - 'legal'=> {:p => nil, :l => nil}, - 'book'=> {:p => nil, :l => nil} + 'a4'=> { p: nil, l: nil }, + 'a5'=> { p: nil, l: nil }, + 'b5'=> { p: nil, l: nil }, + 'letter'=>{ p: nil, l: nil }, + 'legal'=> { p: nil, l: nil }, + 'book'=> { p: nil, l: nil } } @@prefix_b=nil def initialize(particulars) @@ -278,7 +278,7 @@ module SiSU_TeX @md=@particulars.md @env=SiSU_Env::Info_env.new(@md.fns) #@env=@particulars.env @data=@particulars.dal_array # dal file drawn here - @st={ :tex=>{} } + @st={ tex: {} } @tex_ml=SiSU_TeX_Pdf::Use_TeX.new(@md) @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern @@ -373,14 +373,14 @@ module SiSU_TeX @block={} @dob=dob @md.papersize_array.each do |ps| - @@tableheader={ ps => { :p => 0, :l => 0 }} - dob.tmp={:tmp =>dob.tmp,:paper_size =>ps} + @@tableheader={ ps => { p: 0, l: 0 } } + dob.tmp={ tmp: dob.tmp, paper_size: ps } format_l=SiSU_TeX_Pdf::Format_text_object.new(md,dob) - dob.tmp={:tmp =>dob.tmp,:paper_size =>ps} + dob.tmp={ tmp: dob.tmp, paper_size: ps } format_p=SiSU_TeX_Pdf::Format_text_object.new(md,dob) @block[ps]={ - :l => format_l.longtable_landscape, - :p => format_p.longtable_portrait + l: format_l.longtable_landscape, + p: format_p.longtable_portrait } end @dob.tmp=@block @@ -403,7 +403,7 @@ module SiSU_TeX end def markup_common(dob) tex_f=nil - txt_obj={:dal =>dob} + txt_obj={ dal: dob } if dob.of=='block' @lineone=case dob.is when /block|group|alt|verse/ @@ -499,7 +499,7 @@ module SiSU_TeX '\begin{multicols}{2}' + br + idx_str + br + '\end{multicols}' - dob.tmp={:l =>l,:p =>p} + dob.tmp={ l: l, p: p } elsif dob.ln==2 \ and dob.obj=~/Metadata\b/ tst.heading_major @@ -508,7 +508,7 @@ module SiSU_TeX h=tst.level4 metadata=Metadata::TeX_metadata.new(@md).metadata_tex dob.tmp=h.tmp + ' ' + '\begin{scriptsize}' + metadata.join(br) + '\end{scriptsize}' - else dob.tmp='' # dob.tmp={:l =>'',:p =>''} + else dob.tmp='' # dob.tmp={ l: '', p: '' } end when 'para' if dob.bullet_ @@ -557,9 +557,9 @@ module SiSU_TeX home=@vz.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex title=@md.title.full.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex @md.papersize_array.each do |ps| - txt_obj={:txt =>"#{home}: - #{title}",:paper_size =>ps,:orientation =>'portrait'} + txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'portrait' } orient_portrait=SiSU_TeX_Pdf::Format_head.new(@md,txt_obj) - txt_obj={:txt =>"#{home}: - #{title}",:paper_size =>ps,:orientation =>'landscape'} + txt_obj={ txt: "#{home}: - #{title}", 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 @@ -587,7 +587,7 @@ WOK end @copymark='' #check and remove as now is superflous x={} - txt_obj={:title =>@md.title.full} + txt_obj={ title: @md.title.full } 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 @@ -653,8 +653,8 @@ WOK if dob.tmp[ps] if (dob.tmp[ps][:p] and dob.tmp[ps][:l]) dob.tmp[ps]={ - :p => markup_common(dob.tmp[ps][:p]), - :l => markup_common(dob.tmp[ps][:l]) + p: markup_common(dob.tmp[ps][:p]), + l: markup_common(dob.tmp[ps][:l]) } else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/ end @@ -663,8 +663,8 @@ WOK elsif dob.tmp.class==Hash \ and (dob.tmp[:p] and dob.tmp[:l]) dob = { - :p => markup_common(dob.tmp[:p]), - :l => markup_common(dob.tmp[:l]) + p: markup_common(dob.tmp[:p]), + l: markup_common(dob.tmp[:l]) } else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/ end @@ -721,8 +721,8 @@ WOK if defined? dob.tmp and dob.tmp[ps] if (dob.tmp[ps][:p] and dob.tmp[ps][:l]) para_hash[ps]={ - :p => number_paras_numbering(dob.tmp[ps][:p]), - :l => number_paras_numbering(dob.tmp[ps][:l]) + p: number_paras_numbering(dob.tmp[ps][:p]), + l: number_paras_numbering(dob.tmp[ps][:l]) } dob.tmp=para_hash else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/ @@ -731,8 +731,8 @@ WOK end elsif (dob.tmp[:p] and dob.tmp[:l]) dob.tmp = { - :p => number_paras_numbering(dob.tmp[:p]), - :l => number_paras_numbering(dob.tmp[:l]) + p: number_paras_numbering(dob.tmp[:p]), + l: number_paras_numbering(dob.tmp[:l]) } else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/ end @@ -780,8 +780,8 @@ WOK fns_l=@md.fns.gsub(/~/,'-') #this is a sorry fix, but necessary as it appears latex programs like not ~ @md.papersize_array.each do |ps| file={ - :landscape =>File.new("#{@env.path.processing_tex}/#{fns_l}.#{ps}.landscape.tex",'w+'), - :portrait =>File.new("#{@env.path.processing_tex}/#{fns_l}.#{ps}.tex",'w+') + landscape: File.new("#{@env.processing_path.tex}/#{fns_l}.#{ps}.landscape.tex",'w+'), + portrait: File.new("#{@env.processing_path.tex}/#{fns_l}.#{ps}.tex",'w+') } file[:portrait] << @@tex_head[ps][:p] file[:landscape] << @@tex_head[ps][:l] @@ -805,10 +805,10 @@ WOK file[:landscape].puts morph.tmp,"\n" end elsif morph.class==Hash #inserted headers and the like, only - h={:ps =>ps,:h =>morph,:filename =>file} + h={ ps: ps, h: morph, filename: file } output_morph_hash(h) elsif morph.tmp.class==Hash #tables & images? - h={:ps =>ps,:h =>morph.tmp,:filename =>file} + h={ ps: ps, h: morph.tmp, filename: file } output_morph_hash(h) end end @@ -817,12 +817,12 @@ WOK file[:landscape].close end @@tex_head={ - 'a4'=> {:p => nil, :l => nil}, - 'a5'=> {:p => nil, :l => nil}, - 'b5'=> {:p => nil, :l => nil}, - 'letter'=>{:p => nil, :l => nil}, - 'legal'=> {:p => nil, :l => nil}, - 'book'=> {:p => nil, :l => nil} + 'a4'=> { p: nil, l: nil }, + 'a5'=> { p: nil, l: nil }, + 'b5'=> { p: nil, l: nil }, + 'letter'=>{ p: nil, l: nil }, + 'legal'=> { p: nil, l: nil }, + 'book'=> { p: nil, l: nil } } array=[] end |