aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v4/texpdf.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-02-07 19:12:08 -0500
committerRalph Amissah <ralph@amissah.com>2013-02-07 19:12:08 -0500
commit074d6d70a7b115ad5517af93d7d651b315b79dfb (patch)
treeb4c80cd2f197c48cf80e3d67d0ee2181bebf1660 /lib/sisu/v4/texpdf.rb
parentdebian/changelog (4.0.5-1) (diff)
parentv4: version & changelog, dates touched (diff)
Merge tag 'sisu_4.0.6' into debian/sid
Diffstat (limited to 'lib/sisu/v4/texpdf.rb')
-rw-r--r--lib/sisu/v4/texpdf.rb324
1 files changed, 198 insertions, 126 deletions
diff --git a/lib/sisu/v4/texpdf.rb b/lib/sisu/v4/texpdf.rb
index aa1f9444..34d4f69c 100644
--- a/lib/sisu/v4/texpdf.rb
+++ b/lib/sisu/v4/texpdf.rb
@@ -109,8 +109,12 @@ module SiSU_TeX
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]/
path=@env.url.output_tell
- 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.cmd,@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").flow
+ 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
+ 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
+ end
end
@md=@particulars.md
$flag=@md.opt.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format
@@ -157,27 +161,35 @@ module SiSU_TeX
def latex_do(texfilename,papersize)
@texfilename=texfilename
@@n_lpdf=@@n_lpdf+1
- SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} portrait ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/
tex_fn_base=@texfilename.gsub(/\.tex$/,'')
- cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.tex",'',@md.opt.cmd)
tell=SiSU_Screen::Ansi.new(@md.opt.cmd)
- tell.grey_open if @md.opt.cmd =~/[MVv]/
- if "#{tex_fn_base}" =~/\w+/ \
- and "#{papersize}" =~/\w+/
- 2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex portrait
- end
- tell.p_off if @md.opt.cmd =~/[MVv]/
- SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} landscape ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/
- cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.landscape.tex",'',@md.opt.cmd)
- tell.grey_open if @md.opt.cmd =~/[MVv]/
- 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[:pdf_p][:set]==:on
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} portrait ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/
+ 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+/ \
+ and "#{papersize}" =~/\w+/
+ 2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex portrait
+ end
+ 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]/
+ cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.landscape.tex",'',@md.opt.cmd)
+ tell.grey_open if @md.opt.cmd =~/[MVv]/
+ 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]/
+ end
pwd=Dir.pwd
- portrait_pdf="#{pwd}/#{tex_fn_base}.pdf"
- landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf"
+ if @md.opt.act[:pdf_p][:set]==:on
+ portrait_pdf="#{pwd}/#{tex_fn_base}.pdf"
+ end
+ if @md.opt.act[:pdf_l][:set]==:on
+ landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf"
+ end
case papersize
when /a4/; pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4
when /a5/; pdf_p=@f.pdf_p_a5; pdf_l=@f.pdf_l_a5
@@ -187,15 +199,19 @@ 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)
- if FileTest.file?(portrait_pdf)
- FileUtils::cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}")
- FileUtils::rm(portrait_pdf)
- else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.cmd.inspect =~/M/
+ 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 p "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.cmd.inspect =~/M/
+ end
end
- if FileTest.file?(landscape_pdf)
- FileUtils::cp(landscape_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_l}")
- FileUtils::rm(landscape_pdf)
- else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.cmd.inspect =~/M/
+ if @md.opt.act[:pdf_l][:set]==:on
+ if FileTest.file?(landscape_pdf)
+ FileUtils::cp(landscape_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_l}")
+ FileUtils::rm(landscape_pdf)
+ else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.cmd.inspect =~/M/
+ 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]/
end
@@ -214,13 +230,18 @@ module SiSU_TeX
Dir.chdir(@env.processing_path.tex)
texfile=@md.fns.gsub(/$/,".#{ps}.tex").
gsub(/~/,'-')
- if File.exist?(texfile) \
- and File.size(texfile) > 0
- @tex_f_no+=1
- #p "#{__FILE__}:#{__LINE__} texpdf generation disabled" if @md.opt.cmd.inspect =~/M/ #%% disable temporarily, re-enable
+ if @md.opt.act[:pdf_p][:set]==:on \
+ or @md.opt.act[:pdf_l][:set]==:on
latex_do(texfile,ps)
- else
- puts "\tzero file size #{@env.processing_path.tex}/#{texfile}"
+ if @md.opt.act[:pdf_p][:set]==:on
+ if File.exist?(texfile) \
+ and File.size(texfile) > 0
+ #@tex_f_no+=1
+ else
+ puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia)
+ puts "\tzero file size #{@env.processing_path.tex}/#{texfile}"
+ end
+ end
end
end
end
@@ -234,31 +255,33 @@ module SiSU_TeX
when /legal/; pdf_p=@f.pdf_p_legal; pdf_l=@f.pdf_l_legal
else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4
end
- if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_p}")
- mklnk=if @md.file.output_dir_structure.by_language_code? \
- or @md.file.output_dir_structure.by_filetype?
- "#{@md.fnb}.portrait.pdf"
- else 'portrait.pdf'
+ if @md.opt.act[:pdf_p][:set]==:on
+ if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_p}")
+ mklnk=((@md.file.output_dir_structure.by_language_code?) \
+ || (@md.file.output_dir_structure.by_filetype?)) \
+ ? "#{@md.fnb}.portrait.pdf"
+ : 'portrait.pdf'
+ if FileTest.directory?(@md.file.output_path.pdf.dir)
+ pwd=Dir.pwd
+ Dir.chdir(@md.file.output_path.pdf.dir)
+ FileUtils::rm_f(mklnk)
+ FileUtils::ln_s(pdf_p, mklnk)
+ Dir.chdir(pwd)
+ end
end
- if FileTest.directory?(@md.file.output_path.pdf.dir)
- pwd=Dir.pwd
+ end
+ if @md.opt.act[:pdf_l][:set]==:on
+ if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_l}")
+ mklnk=((@md.file.output_dir_structure.by_language_code?) \
+ || (@md.file.output_dir_structure.by_filetype?)) \
+ ? "#{@md.fnb}.landscape.pdf"
+ : 'landscape.pdf'
+ pwd_set=Dir.pwd
Dir.chdir(@md.file.output_path.pdf.dir)
FileUtils::rm_f(mklnk)
- FileUtils::ln_s(pdf_p, mklnk)
- Dir.chdir(pwd)
- end
- end
- if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_l}")
- mklnk=if @md.file.output_dir_structure.by_language_code? \
- or @md.file.output_dir_structure.by_filetype?
- "#{@md.fnb}.landscape.pdf"
- else 'landscape.pdf'
+ FileUtils::ln_s(pdf_l, mklnk)
+ Dir.chdir(pwd_set)
end
- pwd_set=Dir.pwd
- Dir.chdir(@md.file.output_path.pdf.dir)
- FileUtils::rm_f(mklnk)
- FileUtils::ln_s(pdf_l, mklnk)
- Dir.chdir(pwd_set)
end
else
SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn
@@ -303,7 +326,18 @@ module SiSU_TeX
data=@data
@@tex_footnote_array=[]
@@rights=nil
- SiSU_Screen::Ansi.new(@md.opt.cmd,"pdfTex portrait & landscape").txt_grey if @md.opt.cmd=~/[MVvz]/
+ txt_gen=if @md.opt.act[:pdf_l][:set]==:on \
+ and @md.opt.act[:pdf_p][:set]==:on
+ 'pdfTex portrait & landscape'
+ elsif @md.opt.act[:pdf_l][:set]==:on
+ 'pdfTex landscape'
+ elsif @md.opt.act[:pdf_p][:set]==:on
+ 'pdfTex portrait'
+ else
+ puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia)
+ 'error: neither landscape nor portrait'
+ end
+ SiSU_Screen::Ansi.new(@md.opt.cmd,txt_gen).txt_grey if @md.opt.cmd=~/[MVvz]/
if defined? @md.rights.all \
and not @md.rights.all.empty?
rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed
@@ -607,7 +641,7 @@ module SiSU_TeX
dob
end
def tex_box_listings
- <<WOK
+ <<-WOK
\\definecolor{listinggray}{gray}{0.9}
\\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
\\lstset{
@@ -632,10 +666,10 @@ module SiSU_TeX
commentstyle=\\color[rgb]{0.133,0.545,0.133},
stringstyle=\\color[rgb]{0.627,0.126,0.941},
}
-WOK
+ WOK
end
def tex_box_boites
- <<WOK
+ <<-WOK
\\def\\codeblockboitebox{%
\\def\\bkvz@before@breakbox{\\ifhmode\\par\\fi\\vskip\\breakboxskip\\relax}%
\\def\\bkvz@set@linewidth{\\advance\\linewidth -2\\fboxrule
@@ -653,7 +687,7 @@ WOK
\\def\\bkvz@bottom{\\hrule\\@height\\fboxrule}%
\\breakbox}
\\def\\endcodeblockboitebox{\\endbreakbox}
-WOK
+ WOK
end
def tex_codeblock
codeblock_box=if @codeblock_box=='listings'
@@ -671,14 +705,18 @@ WOK
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' }
- orient_portrait=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj)
- txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'landscape' }
- orient_landscape=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj)
- @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation(@codeblock_box)
- @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation(@codeblock_box)
- end
- @tex_file <<<<WOK
+ if @md.opt.act[:pdf_p][:set]==:on
+ txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'portrait' }
+ orient_portrait=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj)
+ @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation(@codeblock_box)
+ end
+ if @md.opt.act[:pdf_l][:set]==:on
+ txt_obj={ txt: "#{home}: - #{title}", paper_size: ps, orientation: 'landscape' }
+ orient_landscape=SiSU_TeX_Pdf::FormatHead.new(@md,txt_obj)
+ @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation(@codeblock_box)
+ end
+ end
+ @tex_file <<<<-WOK
#{@tex_ml.header}#{@tex_ml.footer}
\\tolerance=300
\\clubpenalty=300
@@ -708,15 +746,19 @@ WOK
% (tilde hash amp affected by http)
% \\sloppy
\\begin{document}
-WOK
+ WOK
sisu_rc_footnote=if @md.sc_info then @tex_ml.doc_sc_info_footnote_full
else @tex_ml.doc_sc_info_footnote_brief
end
@copymark='' #check and remove as now is superflous
x={}
txt_obj={ title: @md.title.full }
- x[:l]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_landscape
- x[:p]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_portrait
+ if @md.opt.act[:pdf_l][:set]==:on
+ x[:l]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_landscape
+ end
+ if @md.opt.act[:pdf_p][:set]==:on
+ x[:p]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_portrait
+ end
@tex_file << x
x=nil
if defined? @md.creator.author \
@@ -724,10 +766,10 @@ WOK
sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.creator.author)
author=sp_char.special_characters
@tex_file << if @md.author_home
- <<WOK
+ <<-WOK
\\author{\\href{#{@md.author_home}}{#{@copymark} \\textnormal{#{author}}}}
-WOK
+ WOK
else "\n\\author{#{@copymark} \\textnormal{#{author}}}"
end
end
@@ -736,22 +778,22 @@ WOK
and @md.make.cover_image[:cover] =~/\S+/
x={}
dir=SiSU_Env::InfoEnv.new(@md.fns)
- x[:l] =<<WOK
+ x[:l] =<<-WOK
\\titlepic{\\includegraphics[width=0.3\\textwidth]{#{dir.path.image_source_include}/#{@md.make.cover_image[:cover]}}}
-WOK
- x[:p] =<<WOK
+ WOK
+ x[:p] =<<-WOK
\\titlepic{\\includegraphics[width=0.6\\textwidth]{#{dir.path.image_source_include}/#{@md.make.cover_image[:cover]}}}
-WOK
+ WOK
@tex_file << x
x=nil
end
@tex_file << unless @md.fnb =~/^mail\s*$/ then @tex_ml.site
else '\date'
end
- @tex_file <<<<WOK
+ @tex_file <<<<-WOK
\\pagenumbering{roman}\\maketitle
\\pagestyle{fancy}
-WOK
+ WOK
if defined? @md.rights.all \
and @md.rights.all
@tex_file << "\\newpage\n"
@@ -760,24 +802,27 @@ WOK
end
x={}
if (@make.build.toc?)
- toc=<<WOK
+ toc=<<-WOK
\\renewcommand{\\contentsname}{#{@translate.contents}}
\\tableofcontents
-WOK
+ WOK
toc_pb={ l: @tex_ml.newpage('landscape'), p: @tex_ml.newpage('portrait') }
else
toc=''
toc_pb={ l: '', p: '' }
end
- x[:l] =<<WOK
+ if @md.opt.act[:pdf_l][:set]==:on
+ x[:l] =<<-WOK
#{@tex_ml.newpage('landscape')}
\\pagestyle{fancy}
#{toc}#{toc_pb[:l]}
\\pagenumbering{arabic}
#{@tex_ml.paraskip_normal}
#{@tex_ml.newpage('landscape')}
-WOK
- x[:p] =<<WOK
+ WOK
+ end
+ if @md.opt.act[:pdf_p][:set]==:on
+ x[:p] =<<-WOK
#{@tex_ml.newpage('portrait')}
\\pagestyle{fancy}
#{toc}#{toc_pb[:p]}
@@ -785,7 +830,8 @@ WOK
\\pagenumbering{arabic}
#{@tex_ml.paraskip_normal}
#{@tex_ml.newpage('portrait')}
-WOK
+ WOK
+ end
@tex_file << x
x=nil
data.each do |dob| #% case follows with levels 1-6 indents & graphics
@@ -897,59 +943,77 @@ WOK
def output_morph_hash(o)
ps,h,fn=o[:ps],o[:h],o[:filename]
if h[ps] \
- and (h[ps][:p] and h[ps][:l])
- if h[ps][:p]
- h[ps][:p]=h[ps][:p].gsub(/[ ]+$/m,'').
- gsub(/\n\n\n+/m,"\n\n")
- end
- if h[ps][:l]
- h[ps][:l]=h[ps][:l].gsub(/[ ]+$/m,'').
- gsub(/\n\n\n+/m,"\n\n")
- end
- #h[ps][:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:p]
- #h[ps][:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:l]
- if h[ps][:p] !~/\A\s*\Z/
- fn[:portrait].puts h[ps][:p],"\n"
- end
- if h[ps][:l] !~/\A\s*\Z/
- fn[:landscape].puts h[ps][:l],"\n"
- end
- elsif (h[:p] and h[:l])
- if h[:p]
- h[:p]=h[:p].gsub(/[ ]+$/m,'').
- gsub(/\n\n\n+/m,"\n\n")
+ and (h[ps][:p] or h[ps][:l])
+ if @md.opt.act[:pdf_p][:set]==:on
+ if h[ps][:p]
+ h[ps][:p]=h[ps][:p].gsub(/[ ]+$/m,'').
+ gsub(/\n\n\n+/m,"\n\n")
+ end
+ if h[ps][:p] !~/\A\s*\Z/
+ fn[:portrait].puts h[ps][:p],"\n"
+ end
end
- if h[:l]
- h[:l]=h[:l].gsub(/[ ]+$/m,'').
- gsub(/\n\n\n+/m,"\n\n")
+ if @md.opt.act[:pdf_l][:set]==:on
+ if h[ps][:l]
+ h[ps][:l]=h[ps][:l].gsub(/[ ]+$/m,'').
+ gsub(/\n\n\n+/m,"\n\n")
+ end
+ if h[ps][:l] !~/\A\s*\Z/
+ fn[:landscape].puts h[ps][:l],"\n"
+ end
end
- #h[:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:p]
- #h[:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:l]
- if h[:p] !~/\A\s*\Z/
- fn[:portrait].puts h[:p],"\n"
+ elsif (h[:p] or h[:l])
+ if @md.opt.act[:pdf_p][:set]==:on
+ if h[:p]
+ h[:p]=h[:p].gsub(/[ ]+$/m,'').
+ gsub(/\n\n\n+/m,"\n\n")
+ end
+ if h[:p] !~/\A\s*\Z/
+ fn[:portrait].puts h[:p],"\n"
+ end
end
- if h[:l] !~/\A\s*\Z/
- fn[:landscape].puts h[:l],"\n"
+ if @md.opt.act[:pdf_l][:set]==:on
+ if h[:l]
+ h[:l]=h[:l].gsub(/[ ]+$/m,'').
+ gsub(/\n\n\n+/m,"\n\n")
+ end
+ if h[:l] !~/\A\s*\Z/
+ fn[:landscape].puts h[:l],"\n"
+ end
end
else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/
end
end
def output(array)
@array=array=array.flatten.compact
- fns_l=@md.fns.gsub(/~/,'-') #this is a sorry fix, but necessary as it appears latex programs like not ~
+ fns=@md.fns.gsub(/~/,'-') #this is a sorry fix, but necessary as it appears latex programs like not ~
@md.papersize_array.each do |ps|
+ texfile_landscape=(@md.opt.act[:pdf_l][:set]==:on) \
+ ? (File.new("#{@env.processing_path.tex}/#{fns}.#{ps}.landscape.tex",'w+'))
+ : nil
+ texfile_portrait=(@md.opt.act[:pdf_p][:set]==:on) \
+ ? (File.new("#{@env.processing_path.tex}/#{fns}.#{ps}.tex",'w+'))
+ : nil
file={
- 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+')
+ landscape: texfile_landscape,
+ portrait: texfile_portrait
}
- file[:portrait] << @@tex_head[ps][:p]
- file[:landscape] << @@tex_head[ps][:l]
+ if @md.opt.act[:pdf_p][:set]==:on
+ file[:portrait] << @@tex_head[ps][:p]
+ end
+ if @md.opt.act[:pdf_l][:set]==:on
+ file[:landscape] << @@tex_head[ps][:l]
+ end
array.each do |morph|
if morph.is_a?(String)
#morph.gsub!(/^\s+/,'')
if morph !~/\A\s*\Z/
- file[:portrait].puts morph,"\n"
- file[:landscape].puts morph,"\n"
+ if @md.opt.act[:pdf_p][:set]==:on
+ file[:portrait].puts morph,"\n"
+ end
+ if @md.opt.act[:pdf_l][:set]==:on
+ file[:landscape].puts morph,"\n"
+ end
end
elsif morph.class.inspect =~ /SiSU_DAL_DocumentStructure/ \
and morph.tmp \
@@ -961,8 +1025,12 @@ WOK
end
if (morph.tmp !~/\A\s*\Z/) \
|| morph.is==:code
- file[:portrait].puts morph.tmp,"\n"
- file[:landscape].puts morph.tmp,"\n"
+ if @md.opt.act[:pdf_p][:set]==:on
+ file[:portrait].puts morph.tmp,"\n"
+ end
+ if @md.opt.act[:pdf_l][:set]==:on
+ file[:landscape].puts morph.tmp,"\n"
+ end
end
elsif morph.is_a?(Hash) #inserted headers and the like, only
h={ ps: ps, h: morph, filename: file }
@@ -973,8 +1041,12 @@ WOK
end
end
array=@array
- file[:portrait].close
- file[:landscape].close
+ if @md.opt.act[:pdf_p][:set]==:on
+ file[:portrait].close
+ end
+ if @md.opt.act[:pdf_l][:set]==:on
+ file[:landscape].close
+ end
end
@@tex_head={
'a4'=> { p: nil, l: nil },