aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/texpdf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/texpdf.rb')
-rw-r--r--lib/sisu/v3/texpdf.rb289
1 files changed, 146 insertions, 143 deletions
diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb
index 47005d16..f0fb6b99 100644
--- a/lib/sisu/v3/texpdf.rb
+++ b/lib/sisu/v3/texpdf.rb
@@ -72,7 +72,7 @@ module SiSU_TeX
@@tex_debug_counter=@@table_pagebreak_counter=@@tex_footnote_call_counter=@@tex_table_flag=@@tex_counter=@@tex_column=@@tex_columns=@@tex_columns=@@counting=0
@@tex_pattern_margin_number=/\\\\begin\\\{tiny\\\}\\\\hspace\\\{0mm\\\}\\\\end\\\{tiny\\\}\\\{\\\\marginpar.+?\s+/
@@n=@@tableheader=@@rights=nil
- @@date ||=SiSU_Env::Info_date.new
+ @@date ||=SiSU_Env::InfoDate.new
class Source
require 'pstore'
require_relative 'sysenv' # sysenv.rb
@@ -83,18 +83,18 @@ module SiSU_TeX
include SiSU_TeX
def initialize(opt)
@opt=opt
- @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
@md=@particulars.md
- @env=SiSU_Env::Info_env.new(@md.fns) #@env=@particulars.env
+ @env=SiSU_Env::InfoEnv.new(@md.fns) #@env=@particulars.env
end
def directories
begin
case @opt.fns
when /\.(?:-|ssm\.)?sst$/
- SiSU_Env::SiSU_file.new(@md).mkdir
+ SiSU_Env::FileOp.new(@md).mkdir
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
+ rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error
ensure
end
end
@@ -114,14 +114,14 @@ module SiSU_TeX
$flag=@md.opt.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format
directories
#% needed needs to be reprogrammed !!!
- SiSU_Env::Info_skin.new(@md).select
+ SiSU_Env::InfoSkin.new(@md).select
dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- SiSU_TeX::Source::LaTeX_create.new(@particulars).songsheet
+ SiSU_TeX::Source::LaTeXcreate.new(@particulars).songsheet
dal_array=''
pwd=Dir.pwd
- SiSU_TeX::Source::LaTeX_to_pdf.new(@md,@particulars.env).latexrun_selective
+ SiSU_TeX::Source::LaTeXtoPdf.new(@md,@particulars.env).latexrun_selective
Dir.chdir(pwd)
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error
ensure
unless @opt.cmd =~/[MV]/ #check maintenance flag
texfiles=Dir["#{@env.processing_path.tex}/#{@opt.fns}*"]
@@ -137,25 +137,25 @@ module SiSU_TeX
@@tex_debug_counter=@@table_pagebreak_counter=@@tex_footnote_call_counter=@@tex_table_flag=@@tex_counter=@@tex_column=@@tex_columns=@@tex_columns=@@counting=0
@@tex_col_w=[]
@@n=@@tableheader=@@rights=nil
- @@date=SiSU_Env::Info_date.new
+ @@date=SiSU_Env::InfoDate.new
@@flag={}
$flag=1 #remove at some stage
SiSU_Env::Clear.new(@opt.cmd,@opt.fns).param_instantiate
end
end
private
- class LaTeX_to_pdf
+ class LaTeXtoPdf
@@n_lpdf||=0 #change
def initialize(md,env)
@md,@env=md,env
- @f=SiSU_Env::SiSU_file.new(@md).base_filename
+ @f=SiSU_Env::FileOp.new(@md).base_filename
end
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::System_call.new("#{tex_fn_base}.tex",'',@md.opt.cmd)
+ 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+/ \
@@ -164,7 +164,7 @@ module SiSU_TeX
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::System_call.new("#{tex_fn_base}.landscape.tex",'',@md.opt.cmd)
+ 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+/
@@ -208,8 +208,8 @@ module SiSU_TeX
when /\.(?:-|ssm\.)?sst$/
if FileTest.directory?(@env.processing_path.tex)==true
Dir.chdir(@env.processing_path.tex)
- texfile=@md.fns.gsub(/$/,".#{ps}.tex")
- texfile=texfile.gsub(/~/,'-')
+ texfile=@md.fns.gsub(/$/,".#{ps}.tex").
+ gsub(/~/,'-')
if File.exist?(texfile) \
and File.size(texfile) > 0
@tex_f_no+=1
@@ -261,11 +261,11 @@ module SiSU_TeX
end
lst=Dir["*.{aux,log,out}"]
lst.each {|file| File.unlink(file)} if lst
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error
+ rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error
end
end
end
- class LaTeX_create
+ class LaTeXcreate
@@tex_head={
'a4'=> { p: nil, l: nil },
'a5'=> { p: nil, l: nil },
@@ -278,23 +278,18 @@ module SiSU_TeX
def initialize(particulars)
@particulars=particulars
@md=@particulars.md
- @env=SiSU_Env::Info_env.new(@md.fns) #@env=@particulars.env
+ @env=SiSU_Env::InfoEnv.new(@md.fns) #@env=@particulars.env
@data=@particulars.dal_array # dal file drawn here
@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
+ @tex_ml=SiSU_TeX_Pdf::UseTeX.new(@md)
+ @vz=SiSU_Env::GetInit.instance.skin
+ @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern
@brace_url=SiSU_Viz::Skin.new.url_decoration
- vz=SiSU_Env::Get_init.instance.skin
- l=SiSU_Env::Standardise_language.new(@md.opt.lng).language
+ l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
@language=l[:n]
@translate=SiSU_Translate::Source.new(@md,@language)
- @skin_no_ocn=if defined? vz.ocn_display_off \
- and vz.ocn_display_off==true
- true
- else false
- end
@codeblock_box='listings' #alternative 'boites'
+ @make ||=SiSU_Env::ProcessingSettings.new(@md)
end
def songsheet
begin
@@ -305,7 +300,7 @@ module SiSU_TeX
if defined? @md.rights.all \
and not @md.rights.all.empty?
rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,rght.copyright.all)
+ sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,rght.copyright.all)
copymark=@md.author_copymark \
? '{\begin{small}\copyright\end{small}} '
: ''
@@ -315,7 +310,7 @@ module SiSU_TeX
end
if defined? @md.notes.prefix_b \
and not @md.notes.prefix_b.empty?
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,@md.notes.prefix_b)
+ sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.notes.prefix_b)
prefix_b=sp_char.special_characters_safe
@@prefix_b="\n #{Tex[:backslash]*2}[3]\\ \\linebreak \\ #{prefix_b}\n" unless @@prefix_b
end
@@ -324,16 +319,10 @@ module SiSU_TeX
if @md.flag_tables #WORK ON 2009
data=tables(data) #uncomment to start experimenting with tables
end
- ocn=if @md.markup.inspect =~/no_ocn/ \
- or @md.opt.mod.inspect =~/--no-ocn/ \
- or @skin_no_ocn
- false
- else true
- end
data=number_paras(data)
data=markup(data)
output(data)
- rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error
+ rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error
ensure
end
end
@@ -345,26 +334,26 @@ module SiSU_TeX
# from param, Sort out ... revert to more elegant solution
# even more of a kludge as had to insert newlines where code is used not satisfactory, think about
dob.tmp=dob.obj #.dup
- if dob.is=='para' \
- or dob.is=='heading'
- dob.tmp.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
- dob.tmp=SiSU_TeX_Pdf::Special_characters.new(@md,dob.tmp).special_characters
+ if dob.is==:para \
+ || dob.is==:heading
+ dob.tmp=dob.tmp.gsub(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
+ dob.tmp=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp).special_characters
if dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
- dob.tmp=SiSU_TeX_Pdf::Format_text_object.new(@md,dob.tmp).url_str_internal(dob.tmp)
+ dob.tmp=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob.tmp).url_str_internal(dob.tmp)
end
- elsif dob.is =='code'
+ elsif dob.is ==:code
dob.tmp=if @codeblock_box=='listings'
dob.tmp
else
- SiSU_TeX_Pdf::Special_characters.new(@md,dob.tmp).special_characters_code
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp).special_characters_code
end
- elsif dob.is =='break'
+ elsif dob.is ==:break
if dob.obj==Mx[:br_page]; dob.tmp='\newpage'
elsif dob.obj==Mx[:br_page_new]; dob.tmp='\clearpage'
elsif dob.obj==Mx[:br_obj]; dob.tmp='\parasep'
end
- elsif dob.is=='comment' \
- or dob.is=='meta'
+ elsif dob.is==:comment \
+ || dob.is==:meta
dob.tmp='' #dob.tmp=nil
end
end
@@ -374,9 +363,9 @@ module SiSU_TeX
data.each do |dob|
# EMBEDDED FOOTNOTES / ENDNOTES should be straightforward but not quite a synch.
if dob.tmp =~/#{Mx[:en_a_o]}[\d*+]+\s|#{Mx[:en_b_o]}([*+]\d+)\s/
- dob.tmp.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m,"\\footnote[\\1]{%\n \\2} ")
- dob.tmp.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ")
- dob.tmp.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ")
+ dob.tmp=dob.tmp.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m,"\\footnote[\\1]{%\n \\2} ").
+ gsub(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ").
+ gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ")
end
end
data
@@ -387,9 +376,9 @@ module SiSU_TeX
@md.papersize_array.each do |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)
+ format_l=SiSU_TeX_Pdf::FormatTextObject.new(md,dob)
dob.tmp={ tmp: dob.tmp, paper_size: ps }
- format_p=SiSU_TeX_Pdf::Format_text_object.new(md,dob)
+ format_p=SiSU_TeX_Pdf::FormatTextObject.new(md,dob)
@block[ps]={
l: format_l.longtable_landscape,
p: format_p.longtable_portrait
@@ -403,7 +392,7 @@ module SiSU_TeX
data.each do |dob|
@tex_file << if dob.class==String \
or dob.class==Hash; dob
- elsif dob.is=='table'
+ elsif dob.is==:table
tables_hash(@md,dob) #Hash result
else dob
end
@@ -414,17 +403,17 @@ module SiSU_TeX
dob
end
def box_boites(dob,ocn)
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,dob.tmp,dob.is)
+ sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp,dob.is)
dob.tmp=sp_char.special_characters_safe
- dob.tmp.gsub!(/(#{Mx[:nbsp]})/m,'{\color{mywhite}\1}')
- #dob.tmp.gsub!(/#{Mx[:nbsp]}/m,'{~}') # dob.tmp.gsub!(/#{Mx[:nbsp]}\s*/m,'{~}')
- dob.tmp.gsub!(/#{Mx[:vline]}/m,'\vline')
- dob.tmp.gsub!(/ \\( |#{Mx[:br_nl]})/,' {\textbackslash}\1')
- dob.tmp.gsub!(/#{Mx[:br_nl]}\s*\Z/m,'')
- dob.tmp.gsub!(/#{Mx[:br_nl]}{2}/,'\newline \\\\\\ ')
- dob.tmp.gsub!(/#{Mx[:br_nl]}/,' \\\\\\ ')
- dob.tmp.gsub!(/\n\n\n/m," \\newline\n\n")
- ocn=SiSU_TeX_Pdf::Format_text_object.new(@md).ocn_display(dob)
+ dob.tmp=dob.tmp.gsub(/(#{Mx[:nbsp]})/m,'{\color{mywhite}\1}').
+ #dob.tmp.gsub(/#{Mx[:nbsp]}/m,'{~}') # dob.tmp.gsub(/#{Mx[:nbsp]}\s*/m,'{~}')
+ gsub(/#{Mx[:vline]}/m,'\vline').
+ gsub(/ \\( |#{Mx[:br_nl]})/,' {\textbackslash}\1').
+ gsub(/#{Mx[:br_nl]}\s*\Z/m,'').
+ gsub(/#{Mx[:br_nl]}{2}/,'\newline \\\\\\ ').
+ gsub(/#{Mx[:br_nl]}/,' \\\\\\ ').
+ gsub(/\n\n\n/m," \\newline\n\n")
+ ocn=SiSU_TeX_Pdf::FormatTextObject.new(@md).ocn_display(dob)
dob.tmp = ocn \
+ @tex_ml.paraskip_small \
+ '\begin{Codeblock}' \
@@ -437,14 +426,14 @@ module SiSU_TeX
dob
end
def box_listings(dob,ocn)
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,dob.tmp,dob.is)
+ sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp,dob.is)
dob.tmp=sp_char.characters_code_listings
- dob.tmp.gsub!(/^\s+/m,'') #bug, fix earlier, should be made unecessary
- dob.tmp.gsub!(/#{Mx[:nbsp]}/m,' ')
- dob.tmp.gsub!(/#{Mx[:vline]}/m,'|')
- dob.tmp.gsub!(/#{Mx[:br_nl]}(?:\s?\n)?/m,"\n")
- dob.tmp.gsub!(/\n\n\n/m," \n\n")
- ocn=SiSU_TeX_Pdf::Format_text_object.new(@md).ocn_display(dob)
+ dob.tmp=dob.tmp.gsub(/^\s+/m,''). #bug, fix earlier, should be made unecessary
+ gsub(/#{Mx[:nbsp]}/m,' ').
+ gsub(/#{Mx[:vline]}/m,'|').
+ gsub(/#{Mx[:br_nl]}(?:\s?\n)?/m,"\n").
+ gsub(/\n\n\n/m," \n\n")
+ ocn=SiSU_TeX_Pdf::FormatTextObject.new(@md).ocn_display(dob)
dob.tmp = ocn \
+ @tex_ml.paraskip_small \
+ '\begin{Codeblock}' \
@@ -463,16 +452,18 @@ module SiSU_TeX
def markup_common(dob)
tex_f=nil
txt_obj={ dal: dob }
- if dob.of=='block'
- @lineone=case dob.is
- when /block|group|alt|verse/
- dob.tmp.gsub!(/#{Mx[:nbsp]}/m,'{~}')
- dob.tmp.gsub!(/#{Mx[:gl_bullet]}/m,'$\txtbullet$\hspace{\enspace}') #Bullet environment not used for grouped text, ∴ no hanging indent here
- dob.tmp.gsub!(/#{Mx[:br_nl]}+/m,"\n\n") #match not ideal, but currently not inserting extra newlines anyway
- ocn=SiSU_TeX_Pdf::Format_text_object.new(@md).ocn_display(dob)
- dob.tmp=if dob.is=='group' \
- or dob.is=='block' \
- or dob.is=='alt'
+ if dob.of==:block
+ @lineone=if dob.is==:block \
+ || dob.is==:group \
+ || dob.is==:alt \
+ || dob.is==:verse
+ dob.tmp=dob.tmp.gsub(/#{Mx[:nbsp]}/m,'{~}').
+ gsub(/#{Mx[:gl_bullet]}/m,'$\txtbullet$\hspace{\enspace}'). #Bullet environment not used for grouped text, ∴ no hanging indent here
+ gsub(/#{Mx[:br_nl]}+/m,"\n\n") #match not ideal, but currently not inserting extra newlines anyway
+ ocn=SiSU_TeX_Pdf::FormatTextObject.new(@md).ocn_display(dob)
+ dob.tmp=if dob.is==:group \
+ || dob.is==:block \
+ || dob.is==:alt
ocn \
+ @tex_ml.paraskip_small \
+ "\n" \
@@ -482,7 +473,7 @@ module SiSU_TeX
+ '\\end{footnotesize}' \
+ "\n" \
+ @tex_ml.paraskip_normal
- elsif dob.is=~/verse/
+ elsif dob.is==:verse
ocn \
+ @tex_ml.paraskip_tiny \
+ "\n" \
@@ -495,7 +486,7 @@ module SiSU_TeX
+ "\n\\linebreak\n"
end
dob
- when /code/
+ elsif dob.is ==:code
dob=if @codeblock_box == 'listings'
box_listings(dob,ocn)
elsif @codeblock_box == 'boites'
@@ -509,9 +500,9 @@ module SiSU_TeX
dob=enclose(dob) unless dob.tmp =~/^$/
dob
else
- tst=SiSU_TeX_Pdf::Format_text_object.new(@md,dob)
+ tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob)
case dob.is
- when 'heading'
+ when :heading
case dob.ln
when 1..3
tst.heading_major
@@ -523,17 +514,17 @@ module SiSU_TeX
tst.level6
else dob
end
- when 'heading_insert'
+ when :heading_insert
br="\n\\\\\n"
if dob.name=='book_index'
h=tst.heading_major
heading="\\clearpage\n" + h.tmp
idx_arr=[]
- idx=SiSU_Particulars::Combined_singleton.instance.get_idx_tex(@md.opt).tex_idx
+ idx=SiSU_Particulars::CombinedSingleton.instance.get_idx_tex(@md.opt).tex_idx
idx.each do |x|
x=if x.class==String
- x=SiSU_TeX_Pdf::Special_characters.new(@md,x).special_characters
- x=SiSU_TeX_Pdf::Format_text_object.new(@md,x).url_str_internal(x,true)
+ x=SiSU_TeX_Pdf::SpecialCharacters.new(@md,x).special_characters
+ x=SiSU_TeX_Pdf::FormatTextObject.new(@md,x).url_str_internal(x,true)
else x=nil
end
idx_arr << x.sub(/,$/,'') if x.class==String
@@ -551,11 +542,11 @@ module SiSU_TeX
elsif dob.ln==4 \
and dob.obj=~/Metadata\b/
h=tst.level4
- metadata=Metadata::TeX_metadata.new(@md).metadata_tex
+ metadata=SiSU_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: '' }
end
- when 'para'
+ when :para
if dob.bullet_
dob.tmp=tst.bullet
elsif dob.indent \
@@ -568,35 +559,35 @@ module SiSU_TeX
and (dob.indent != dob.hang or dob.indent =~/[1-9]/)
dob.tmp=tst.hang
else
- dob.tmp.strip!
+ dob.tmp=dob.tmp.strip
dob=enclose(dob) unless dob.tmp =~/^$/
end
else
- dob.tmp.strip! unless dob.is=='code'
+ dob.tmp=dob.tmp.strip unless dob.is==:code
dob=enclose(dob) unless dob.tmp =~/^$/
end
if dob.class==String
- dob.tmp.gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,' \newline ') #% tread with care
- dob.tmp.gsub!(/(\.#{Tex[:tilde]}\S*\s*|<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ') #% tread with care
+ dob.tmp=dob.tmp.gsub(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,' \newline '). #% tread with care
+ gsub(/(\.#{Tex[:tilde]}\S*\s*|<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ') #% tread with care
end
dob
end
if dob.tmp =~/(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image\b)/m \
- && dob.is !='code'
- dob=SiSU_TeX_Pdf::Bare_urls.new(@md,dob).bare_urls
- tst=SiSU_TeX_Pdf::Format_text_object.new(@md,dob)
+ && dob.is !=:code
+ dob=SiSU_TeX_Pdf::BareUrls.new(@md,dob).bare_urls
+ tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob)
dob=tst.urls_txt_and_images
dob
elsif dob.tmp =~/https?:\/\/\S+\b/m \
- && dob.is =='code' \
+ && dob.is ==:code \
&& @codeblock_box !='listings'
- dob=SiSU_TeX_Pdf::Bare_urls.new(@md,dob).bare_urls_in_code
+ dob=SiSU_TeX_Pdf::BareUrls.new(@md,dob).bare_urls_in_code
dob
end
if dob.class !=Hash \
&& dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image\b/ \
- && dob.is !='code'
- tst=SiSU_TeX_Pdf::Format_text_object.new(@md,dob)
+ && dob.is !=:code
+ tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob)
end
dob
end
@@ -666,9 +657,9 @@ WOK
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::Format_head.new(@md,txt_obj)
+ 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::Format_head.new(@md,txt_obj)
+ 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
@@ -709,13 +700,13 @@ WOK
@copymark='' #check and remove as now is superflous
x={}
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
+ x[:l]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_landscape
+ x[:p]=SiSU_TeX_Pdf::FormatTextObject.new(@md,txt_obj).title_portrait
@tex_file << x
x=nil
if defined? @md.creator.author \
and @md.creator.author
- sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,@md.creator.author)
+ sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.creator.author)
author=sp_char.special_characters
@tex_file << if @md.author_home
<<WOK
@@ -739,12 +730,20 @@ WOK
@tex_file << @@prefix_b if defined? @md.creator.prefix_b and @md.creator.prefix_b
end
x={}
- x[:l] =<<WOK
-#{@tex_ml.newpage('landscape')}
-\\pagestyle{fancy}
+ if (@make.build.toc?)
+ toc=<<WOK
\\renewcommand{\\contentsname}{#{@translate.contents}}
\\tableofcontents
+WOK
+ toc_pb={ l: @tex_ml.newpage('landscape'), p: @tex_ml.newpage('portrait') }
+ else
+ toc=''
+ toc_pb={ l: '', p: '' }
+ end
+ x[:l] =<<WOK
#{@tex_ml.newpage('landscape')}
+\\pagestyle{fancy}
+#{toc}#{toc_pb[:l]}
\\pagenumbering{arabic}
#{@tex_ml.paraskip_normal}
#{@tex_ml.newpage('landscape')}
@@ -752,8 +751,7 @@ WOK
x[:p] =<<WOK
#{@tex_ml.newpage('portrait')}
\\pagestyle{fancy}
-\\renewcommand{\\contentsname}{#{@translate.contents}}
-\\tableofcontents
+#{toc}#{toc_pb[:p]}
#{@tex_ml.newpage('portrait')}
\\pagenumbering{arabic}
#{@tex_ml.paraskip_normal}
@@ -763,10 +761,10 @@ WOK
x=nil
data.each do |dob| #% case follows with levels 1-6 indents & graphics
if dob.class==Hash
- elsif dob.of=='para' \
- or dob.of=='block' #GATEWAY FIX FIX stuff
+ elsif dob.of==:para \
+ || dob.of==:block #GATEWAY FIX FIX stuff
dob=markup_common(dob)
- elsif dob.is=='table'
+ elsif dob.is==:table
if ( dob.tmp['a4'] \
or dob.tmp['a5'] \
or dob.tmp['b5'] \
@@ -809,14 +807,10 @@ WOK
@tex_file << "\n\\end{document}"
end
def number_paras_numbering(dob) # need tables and other types of object
- if dob.of =~/para/ #\
+ if dob.of ==:para
paranum=dob.ocn ? dob.ocn : ''
paranum = '' if paranum.to_i==0
- paranumber_display=if @md.markup.inspect =~/no_ocn/ \
- or @md.opt.mod.inspect =~/--no-ocn/ \
- or not dob.ocn_
- ''
- else
+ paranumber_display=if @make.build.ocn?
tags=''
#[keep] code that follows inserts "name tags" as hypertargets, currently using ocn (converting nametags to ocn) for internal linking, related code: |texpdf_format.rb|@|uses nametags directly|
#if dob.tags.length > 0 # insert tags "hypertargets"
@@ -825,6 +819,7 @@ WOK
# end
#end
"\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{dob.ocn}}#{tags}\\end{tiny}}}" #ocn object citation numbering
+ else ''
end
dob.tmp = paranumber_display + dob.tmp
end
@@ -860,7 +855,9 @@ WOK
else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/
end
else
- dob=if dob.of !~/comment|meta|layout/
+ dob=if dob.of !=:comment \
+ || dob.of !=:meta \
+ || dob.of !=:layout
number_paras_numbering(dob)
else dob
end
@@ -872,12 +869,16 @@ WOK
ps,h,fn=o[:ps],o[:h],o[:filename]
if h[ps] \
and (h[ps][:p] and h[ps][:l])
- h[ps][:p].gsub!(/[ ]+$/m,'') if h[ps][:p]
- h[ps][:l].gsub!(/[ ]+$/m,'') if h[ps][:l]
- #h[ps][:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:p]
- #h[ps][:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:l]
- h[ps][:p].gsub!(/\n\n\n+/m,"\n\n") if h[ps][:p]
- h[ps][:l].gsub!(/\n\n\n+/m,"\n\n") if 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
@@ -885,12 +886,16 @@ WOK
fn[:landscape].puts h[ps][:l],"\n"
end
elsif (h[:p] and h[:l])
- h[:p].gsub!(/[ ]+$/m,'') if h[:p]
- h[:l].gsub!(/[ ]+$/m,'') if h[:l]
- #h[:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:p]
- #h[:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:l]
- h[:p].gsub!(/\n\n\n+/m,"\n\n") if h[:p]
- h[:l].gsub!(/\n\n\n+/m,"\n\n") if h[:l]
+ if h[:p]
+ h[:p]=h[:p].gsub(/[ ]+$/m,'').
+ gsub(/\n\n\n+/m,"\n\n")
+ end
+ if h[:l]
+ h[:l]=h[:l].gsub(/[ ]+$/m,'').
+ gsub(/\n\n\n+/m,"\n\n")
+ 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"
end
@@ -901,9 +906,7 @@ WOK
end
end
def output(array)
- array.flatten!
- array.compact!
- @array=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 ~
@md.papersize_array.each do |ps|
file={
@@ -919,16 +922,16 @@ WOK
file[:portrait].puts morph,"\n"
file[:landscape].puts morph,"\n"
end
- elsif morph.class.inspect =~ /SiSU_document_structure/ \
+ elsif morph.class.inspect =~ /SiSU_DAL_DocumentStructure/ \
and morph.tmp \
and morph.tmp.class==String
- if morph.is !='code' \
- && morph.of !='block'
- morph.tmp.gsub!(/^\s+/,'')
+ if morph.is !=:code \
+ && morph.of !=:block
+ morph.tmp=morph.tmp.gsub(/^\s+/,'')
else morph.tmp
end
- if morph.tmp !~/\A\s*\Z/ \
- or morph.is=='code'
+ if (morph.tmp !~/\A\s*\Z/) \
+ || morph.is==:code
file[:portrait].puts morph.tmp,"\n"
file[:landscape].puts morph.tmp,"\n"
end