aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/texpdf.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-10-23 23:40:45 -0400
committerRalph Amissah <ralph@amissah.com>2013-10-23 23:40:45 -0400
commitedd89902036bde18c91031470e19c871a182cf6d (patch)
tree1269e7b1660aa64896fc21768002e837233c2c24 /lib/sisu/v5/texpdf.rb
parentv4 v5: version & changelog (diff)
v5: options & downstream, more use of opt.act instead of opt.cmd
* opt.act.*.set==:on instead of opt.cmd =~/\S/
Diffstat (limited to 'lib/sisu/v5/texpdf.rb')
-rw-r--r--lib/sisu/v5/texpdf.rb67
1 files changed, 47 insertions, 20 deletions
diff --git a/lib/sisu/v5/texpdf.rb b/lib/sisu/v5/texpdf.rb
index 0d259cf1..2dc3e860 100644
--- a/lib/sisu/v5/texpdf.rb
+++ b/lib/sisu/v5/texpdf.rb
@@ -110,14 +110,16 @@ module SiSU_TeX
def song
begin
@md=@particulars.md
- SiSU_Screen::Ansi.new(@opt.cmd,'LaTeX/PDF',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.cmd =~/q/
- if @opt.cmd =~/[MVv]/
+ SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'LaTeX/PDF',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.act[:quiet][:set]==:on
+ if (@opt.act[:verbose][:set]==:on \
+ || @opt.act[:verbose_plus][:set]==:on \
+ || @opt.act[:maintenance][:set]==:on)
@env.url.output_tell
if @md.opt.act[:pdf_l][:set]==:on
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").flow
+ SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").flow
end
if @md.opt.act[:pdf_p][:set]==:on
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").flow
+ SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").flow
end
end
@md=@particulars.md
@@ -135,7 +137,8 @@ module SiSU_TeX
__LINE__.to_s + ':' + __FILE__
end
ensure
- unless @opt.cmd =~/[MV]/ #check maintenance flag
+ unless (@opt.act[:verbose_plus][:set]==:on \
+ || @opt.act[:maintenance][:set]==:on)
texfiles=Dir["#{@env.processing_path.tex}/#{@opt.fns}*"]
texfiles.each do |f|
if FileTest.file?(f)
@@ -168,7 +171,11 @@ module SiSU_TeX
tex_fn_base=@texfilename.gsub(/\.tex$/,'')
tell=SiSU_Screen::Ansi.new(@md.opt.cmd)
if @md.opt.act[:pdf_p][:set]==:on
- SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} portrait ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/
+ if (@md.opt.act[:verbose][:set]==:on \
+ || @md.opt.act[:verbose_plus][:set]==:on \
+ || @md.opt.act[:maintenance][:set]==:on)
+ SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"#{papersize} portrait ->").dark_grey_title_hi
+ end
cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.tex",'',@md.opt.cmd)
tell.grey_open if @md.opt.cmd =~/[MVv]/
if "#{tex_fn_base}" =~/\w+/ \
@@ -178,14 +185,26 @@ module SiSU_TeX
tell.p_off if @md.opt.cmd =~/[MVv]/
end
if @md.opt.act[:pdf_l][:set]==:on
- SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} landscape ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/
+ if (@md.opt.act[:verbose][:set]==:on \
+ || @md.opt.act[:verbose_plus][:set]==:on \
+ || @md.opt.act[:maintenance][:set]==:on)
+ SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"#{papersize} landscape ->").dark_grey_title_hi
+ end
cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.landscape.tex",'',@md.opt.cmd)
- tell.grey_open if @md.opt.cmd =~/[MVv]/
+ if (@md.opt.act[:verbose][:set]==:on \
+ || @md.opt.act[:verbose_plus][:set]==:on \
+ || @md.opt.act[:maintenance][:set]==:on)
+ tell.grey_open
+ end
if "#{tex_fn_base}" =~/\w+/ \
and "#{papersize}" =~/\w+/
2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex landscape
end
- tell.p_off if @md.opt.cmd =~/[MVv]/
+ if (@md.opt.act[:verbose][:set]==:on \
+ || @md.opt.act[:verbose_plus][:set]==:on \
+ || @md.opt.act[:maintenance][:set]==:on)
+ tell.p_off
+ end
end
pwd=Dir.pwd
if @md.opt.act[:pdf_p][:set]==:on
@@ -203,14 +222,14 @@ module SiSU_TeX
else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4
end
FileUtils::mkdir_p(@md.file.output_path.pdf.dir) unless FileTest.directory?(@md.file.output_path.pdf.dir)
- cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX
+ cX=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]).cX
if @md.opt.act[:pdf_p][:set]==:on
if FileTest.file?(portrait_pdf)
FileUtils::cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}")
FileUtils::rm(portrait_pdf)
else
STDERR.puts "#{cX.fuchsia}pdf file not generated#{cX.off} <#{cX.blue}#{portrait_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)"
- STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.cmd.inspect =~/M/
+ STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.act[:maintenance][:set]==:on
end
end
if @md.opt.act[:pdf_l][:set]==:on
@@ -219,10 +238,14 @@ module SiSU_TeX
FileUtils::rm(landscape_pdf)
else
STDERR.puts "#{cX.fuchsia}pdf file not generated#{cX.off} <#{cX.blue}#{landscape_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)"
- STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.cmd.inspect =~/M/
+ STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.act[:maintenance][:set]==:on
end
end
- SiSU_Screen::Ansi.new(@md.opt.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number if @md.opt.cmd =~/[MVv]/
+ if (@md.opt.act[:verbose][:set]==:on \
+ || @md.opt.act[:verbose_plus][:set]==:on \
+ || @md.opt.act[:maintenance][:set]==:on)
+ SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number
+ end
end
def latexrun_selective
begin
@@ -291,7 +314,7 @@ module SiSU_TeX
end
end
else
- SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn
+ SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn
end
lst=Dir["*.{aux,log,out}"]
lst.each {|file| File.unlink(file)} if lst
@@ -343,7 +366,11 @@ module SiSU_TeX
else
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark('error: neither landscape nor portrait')
end
- SiSU_Screen::Ansi.new(@md.opt.cmd,txt_gen).txt_grey if @md.opt.cmd=~/[MVvz]/
+ if (@md.opt.act[:verbose][:set]==:on \
+ || @md.opt.act[:verbose_plus][:set]==:on \
+ || @md.opt.act[:maintenance][:set]==:on)
+ SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],txt_gen).txt_grey
+ end
if defined? @md.rights.all \
and not @md.rights.all.empty?
rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed
@@ -853,7 +880,7 @@ module SiSU_TeX
p: markup_common(dob.tmp[ps][:p]),
l: markup_common(dob.tmp[ps][:l])
}
- else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/
+ else p "#{__FILE__}:#{__LINE__}" if @md.opt.act[:maintenance][:set]==:on
end
end
end
@@ -863,7 +890,7 @@ module SiSU_TeX
p: markup_common(dob.tmp[:p]),
l: markup_common(dob.tmp[:l])
}
- else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/
+ else p "#{__FILE__}:#{__LINE__}" if @md.opt.act[:maintenance][:set]==:on
end
end
@tex_file << dob
@@ -918,7 +945,7 @@ module SiSU_TeX
l: number_paras_numbering(dob.tmp[ps][:l])
}
dob.tmp=para_hash
- else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/
+ else p "#{__FILE__}:#{__LINE__}" if @md.opt.act[:maintenance][:set]==:on
end
end
end
@@ -927,7 +954,7 @@ module SiSU_TeX
p: number_paras_numbering(dob.tmp[:p]),
l: number_paras_numbering(dob.tmp[:l])
}
- else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/
+ else p "#{__FILE__}:#{__LINE__}" if @md.opt.act[:maintenance][:set]==:on
end
else
dob=if dob.of !=:comment \
@@ -981,7 +1008,7 @@ module SiSU_TeX
fn[:landscape].puts h[:l],"\n"
end
end
- else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/
+ else p "#{__FILE__}:#{__LINE__}" if @md.opt.act[:maintenance][:set]==:on
end
end
def output(array)