diff options
author | Ralph Amissah <ralph@amissah.com> | 2008-03-22 17:05:50 +0000 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2008-03-22 17:05:50 +0000 |
commit | bbd1100d9674b4d4b57e62999414beaf339ff4a5 (patch) | |
tree | 14e57887d095272b2d77a474ae78af6c91952430 /lib/sisu/v0/sysenv.rb | |
parent | track a couple of questions (diff) |
tex to pdf, xetex (utf8) added as alternative to pdftex
Diffstat (limited to 'lib/sisu/v0/sysenv.rb')
-rw-r--r-- | lib/sisu/v0/sysenv.rb | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index 9cf14507..816c72b7 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -1,4 +1,4 @@ -# coding: utf-8 +# coding: utf-6 =begin * Name: SiSU @@ -647,30 +647,36 @@ module SiSU_Env else puts "\tWARN: #{program} is not installed #{program_ref}" end end - def latex2pdf #convert from latex to pdf - prog=[] - prog=['pdflatex','pdfetex','pdftex'] - program_ref="\n\t\tSee http://www.tug.org/applications/pdftex/\n\t\tOn Debian this is is included in tetex-extra" + def tex2pdf_engine + prog=['xetex','xelatex','pdflatex','pdfetex','pdftex'] @pdfetex_flag=false @cmd ||='' - tell=if @cmd =~/[MVv]/; '' - else '> /dev/null' - end - mode='batchmode' - #mode='nonstopmode' + @texpdf=nil prog.each do |program| if program_found?(program) - case program - when /pdflatex/; system("#{program} -interaction=#{mode} #@input #{tell}\n") - when /pdfetex/; system("#{program} -interaction=#{mode} -fmt=pdflatex #@input #{tell}\n") # debian specific paramters ? - #system("#{program} -interaction=batchmode -progname=pdflatex #@input\n") - when /pdftex/; system("#{program} -interaction=#{mode} -fmt=pdflatex #@input #{tell}\n") - end + @texpdf=program if program =~/xetex|xelatex|pdftex|pdflatex/ @pdfetex_flag=true break end - unless @pdfetex_flag; puts "\tWARN: none of the following programs are installed: #{program[0]}, #{program[1]}, #{program[2]} is installed. #{program_ref}" + end + @texpdf + end + def latex2pdf #convert from latex to pdf + tell=if @cmd =~/[MVv]/; '' + else '> /dev/null' + end + mode='batchmode' + #mode='nonstopmode' + program_ref="\n\t\tSee http://www.tug.org/applications/pdftex/\n\t\tOn Debian this is is included in tetex-extra" + texpdf=tex2pdf_engine + if @pdfetex_flag; + texpdf_cmd=case texpdf + when /xetex/; "#{texpdf} -interaction=#{mode} -fmt=xelatex #@input #{tell}\n" + when /pdftex/; "#{texpdf} -interaction=#{mode} -fmt=pdflatex #@input #{tell}\n" + when /xelatex|pdflatex/; "#{texpdf} -interaction=#{mode} #@input #{tell}\n" end + system(texpdf_cmd) + else puts "\tWARN: none of the following programs are installed: #{program[0]}, #{program[1]}, #{program[2]} is installed. #{program_ref}" end end def makeinfo #texinfo @@ -2558,11 +2564,11 @@ WOK end def images unless FileTest.directory?("#{@env.path.output}/_sisu") - mkdir_p("#{@env.path.output}/_sisu") + mkdir_p("#{@env.path.output}/_sisu") end unless File.exist?("#{@env.path.output}/_sisu/image_sys") \ or File.symlink?("#{@env.path.output}/_sisu/image_sys") - File.symlink("../../_sisu/image_sys", "#{@env.path.output}/_sisu/image_sys") + File.symlink("../../_sisu/image_sys", "#{@env.path.output}/_sisu/image_sys") end end def man_forms @@ -2657,7 +2663,7 @@ WOK def dbi if psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/ "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}" - else "DBI:Pg:database=#{psql.db};port=#{psql.port}" + else "DBI:Pg:database=#{psql.db};port=#{psql.port}" end end self @@ -3138,7 +3144,7 @@ fns_array=unless fns =~/\.ssm.sst$/ IO.readlines(fns,'') else IO.readlines(fns,'r:utf-8') end -else +else if RUBY_VERSION < '1.9' IO.readlines("#{path.composite_file}/#{fns}",'') else IO.readlines("#{path.composite_file}/#{fns}",'r:utf-8') |