aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/texpdf_format.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/texpdf_format.rb')
-rw-r--r--lib/sisu/v3/texpdf_format.rb514
1 files changed, 258 insertions, 256 deletions
diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb
index 25cb0c63..ae277ec6 100644
--- a/lib/sisu/v3/texpdf_format.rb
+++ b/lib/sisu/v3/texpdf_format.rb
@@ -59,30 +59,30 @@
module SiSU_TeX_Pdf
@@table_pg_break_counter=1
include SiSU_Viz
- class Bare_urls
+ class BareUrls
def initialize(md,dob=nil)
@md,@dob=md,dob
@brace_url=SiSU_Viz::Skin.new.url_decoration
end
def bare_urls
- @dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
- "#{@brace_url.tex_open}\\1</a>#{@brace_url.tex_close}")
- @dob.tmp.gsub!(/(^|[^\\])_/m,'\1\_') #watch may not work
- @dob.tmp.gsub!(/(^|[^#{Mx[:lnk_c]}])#{Mx[:url_o]}_?(?:\\?_)?(\S+?)#{Mx[:url_c]}/m,
- "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}")
+ @dob.obj=@dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
+ "#{@brace_url.tex_open}\\1</a>#{@brace_url.tex_close}")
+ @dob.tmp=@dob.tmp.gsub(/(^|[^\\])_/m,'\1\_'). #watch may not work
+ gsub(/(^|[^#{Mx[:lnk_c]}])#{Mx[:url_o]}_?(?:\\?_)?(\S+?)#{Mx[:url_c]}/m,
+ "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}")
@dob
end
def bare_urls_in_code
- @dob.tmp.gsub!(/(^|[^\\])_/m,'\1\_') #watch may not work
- @dob.tmp.gsub!(/(https?:\/\/\S+?)([{]|[.,;)\]]?(?: |$))/m,
- '\begin{scriptsize}\url{\1}\end{scriptsize}\2')
+ @dob.tmp=@dob.tmp.gsub(/(^|[^\\])_/m,'\1\_'). #watch may not work
+ gsub(/(https?:\/\/\S+?)([{]|[.,;)\]]?(?: |$))/m,
+ '\begin{scriptsize}\url{\1}\end{scriptsize}\2')
@dob
end
end
- class Format_text_object
+ class FormatTextObject
require_relative 'defaults' # defaults.rb
attr_accessor :string,:string1,:orientation,:url,:dir,:tex
- @@sys=SiSU_Env::System_call.new
+ @@sys=SiSU_Env::SystemCall.new
@@tex_pattern_margin_number=/\\begin\{tiny\}\\hspace\{0mm\}\\end\{tiny\}\{\\marginpar.+?\}\}\}/
@@tableheader={
'a4' => { p: 0, l: 0 },
@@ -91,7 +91,7 @@ module SiSU_TeX_Pdf
'letter' => { p: 0, l: 0 },
'legal' => { p: 0, l: 0 }
}
- @@sys=SiSU_Env::System_call.new
+ @@sys=SiSU_Env::SystemCall.new
def initialize(md,dob=nil)
@md,@dob=md,dob
if defined? @md.image \
@@ -100,31 +100,34 @@ module SiSU_TeX_Pdf
else @center_begin,@center_end='',''
end
@start_table=''
- @tx=SiSU_Env::Get_init.instance.tex
+ @tx=SiSU_Env::GetInit.instance.tex
@brace_rel=SiSU_Viz::Skin.new.rel_decoration
- @env ||=SiSU_Env::Info_env.new(@md.fns)
- @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine
+ @env ||=SiSU_Env::InfoEnv.new(@md.fns)
+ @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine
+ @make ||=SiSU_Env::ProcessingSettings.new(@md)
end
def ocn_display(dob)
- "\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{dob.ocn}}\\end{tiny}}}" #ocn object citation numbering
+ show_ocn=(@make.build.ocn?) \
+ ? dob.ocn
+ : ''
+ "\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{show_ocn}}\\end{tiny}}}" #ocn object citation numbering
end
def table_special_characters(r)
- r.gsub!(/#{Mx[:tc_p]}|$/u,'&')
- r.gsub!(/%/,'\%')
- r.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}')
- r.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}')
- r.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}') # ulem
- r.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''") # quote #CHECK
- r.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}') # ulem
- r.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}') # ulem
- r.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$")
- r.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$")
- r
+ r=r.gsub(/#{Mx[:tc_p]}|$/u,'&').
+ gsub(/%/,'\%').
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}'). # ulem
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''"). # quote #CHECK
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}'). # ulem
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}'). # ulem
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$").
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$")
end
def longtable_landscape
end_table='\end{longtable}'
row_break='\\\\\\'
- txt=if @dob.is=='table'
+ txt=if @dob.is==:table
tw=case @dob.tmp[:paper_size]
when /a4/i; @tx.a4.landscape.w #European default, SiSU default
when /letter/i; @tx.letter.landscape.w #U.S. default
@@ -147,19 +150,21 @@ module SiSU_TeX_Pdf
"\\begin{tiny}\n\\begin{longtable}#{colW}\n"
rows=@dob.obj.split(/#{Mx[:br_nl]}/)
if @dob.head_ #result imperfect, check on
- rows[0].gsub!(/(^|.+?)(?:#{Mx[:tc_p]}|$)/u,'\bfseries \1&')
- rows[0].gsub!(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")
+ rows[0]=rows[0].gsub(/(^|.+?)(?:#{Mx[:tc_p]}|$)/u,'\bfseries \1&').
+ gsub(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")
end
+ rows_new=[]
rows.each do |r|
r=table_special_characters(r)
- r.gsub!(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/
+ r=r.gsub(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/
if r=~/\<!f(.+?)!\>/ # not tested table footer if any
tablefoot=$1
- r.gsub!(/\<!f(.+?)!\>/,'')
+ r=r.gsub(/\<!f(.+?)!\>/,'')
r="#{r} \\multicolumn{#{@dob.cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n"
end
+ rows_new << r
end
- table=rows.join #@dob[:dal].obj=rows.join
+ table=rows_new.join #@dob[:dal].obj=rows.join
ocn_display(@dob) + start_table + table + " #{end_table}\n\\end{tiny}"
else ''
end
@@ -167,7 +172,7 @@ module SiSU_TeX_Pdf
def longtable_portrait
end_table='\end{longtable}'
row_break='\\\\\\'
- txt=if @dob.is=='table'
+ txt=if @dob.is==:table
tw=case @dob.tmp[:paper_size]
when /a4/i; @tx.a4.portrait.w #European default, SiSU default
when /letter/i; @tx.letter.portrait.w #U.S. default
@@ -190,19 +195,21 @@ module SiSU_TeX_Pdf
"\\begin{tiny}\n\\begin{longtable}#{colW}\n"
rows=@dob.obj.split(/#{Mx[:br_nl]}/)
if @dob.head_
- rows[0].gsub!(/(^|.+?)(?:#{Mx[:tc_p]}|$)/u,'\bfseries \1&')
- rows[0].gsub!(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")
+ rows[0]=rows[0].gsub(/(^|.+?)(?:#{Mx[:tc_p]}|$)/u,'\bfseries \1&').
+ gsub(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")
end
+ rows_new=[]
rows.each do |r|
r=table_special_characters(r)
- r.gsub!(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/
+ r=r.gsub(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/
if r=~/\<!f(.+?)!\>/ # not tested table footer if any
tablefoot=$1
- r.gsub!(/\<!f(.+?)!\>/,'')
+ r=r.gsub(/\<!f(.+?)!\>/,'')
r="#{r} \\multicolumn{#{@dob.cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n"
end
+ rows_new << r
end
- table=rows.join #@dob[:dal].obj=rows.join
+ table=rows_new.join #@dob[:dal].obj=rows.join
ocn_display(@dob) + start_table + table + " #{end_table}\n\\end{tiny}"
else ''
end
@@ -210,17 +217,17 @@ module SiSU_TeX_Pdf
def heading_major
dob=@dob
title=@md.title.full
- dob.tmp.strip! if dob.tmp
- dob.tmp.gsub!(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')
+ dob.tmp=dob.tmp.strip if dob.tmp
+ dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')
cont_ln=dob.tmp.dup
- cont_ln.gsub!(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2')
- cont_ln.gsub!(@@tex_pattern_margin_number,'')
+ cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2').
+ gsub(@@tex_pattern_margin_number,'')
clearp=(dob.lv =~/B/ && dob.obj =='Metadata') ? "\\clearpage\n" : ''
if dob.tmp =~/\\[Ff]ootnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings!
- cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ')
- cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
+ cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ').
+ gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
end
- dob.tmp.gsub!(/^(.*)\n?$/m,
+ dob.tmp=dob.tmp.gsub(/^(.*)\n?$/m,
"#{clearp}\\part*{\\1}
\\addcontentsline{toc}{section}{#{cont_ln}}
\\markboth{#{title}}\n")
@@ -228,23 +235,23 @@ module SiSU_TeX_Pdf
end
def level4
dob=@dob
- dob.tmp.strip! if dob.tmp
- dob.tmp.gsub!(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')
+ dob.tmp=dob.tmp.strip if dob.tmp
+ dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')
cont_ln=dob.tmp.dup
- cont_ln.gsub!(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2')
- cont_ln.gsub!(@@tex_pattern_margin_number,'')
- cont_ln.gsub!(/#{Tex[:backslash]*2}/,"#{Tex[:backslash]*4}") # added w42
- cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
+ cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2').
+ gsub(@@tex_pattern_margin_number,'').
+ gsub(/#{Tex[:backslash]*2}/,"#{Tex[:backslash]*4}"). # added w42
+ gsub(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
+ gsub(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
title=@md.title.full
if dob.name =~/endnotes/
- dob.tmp.gsub!(/.+/m,'')
+ dob.tmp=dob.tmp.gsub(/.+/m,'')
end
if dob.tmp =~/\\footnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings!
- cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ')
- cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
+ cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ').
+ gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
end
- dob.tmp.gsub!(/^(.*)?\n?$/m,"\\subsubsection*{\\1}
+ dob.tmp=dob.tmp.gsub(/^(.*)?\n?$/m,"\\subsubsection*{\\1}
\\addcontentsline{toc}{subsection}{#{cont_ln}}
\\markright{#{title}}")
dob
@@ -252,19 +259,19 @@ module SiSU_TeX_Pdf
def level5
dob=@dob
# there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\@txt*, same for next section 2002w46
- dob.tmp.strip! if dob.tmp
- dob.tmp.gsub!(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')
+ dob.tmp=dob.tmp.strip if dob.tmp
+ dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')
cont_ln=dob.tmp.dup
- cont_ln.gsub!(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2')
- cont_ln.gsub!(@@tex_pattern_margin_number,'')
- cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- cont_ln.gsub!(/\\\&/,' and ') #revisit: tmp bugfix 200507, substitutes & with 'and' in toc, needed e.g. for AT&T, see ffa
+ cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2').
+ gsub(@@tex_pattern_margin_number,'').
+ gsub(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
+ gsub(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
+ gsub(/\\\&/,' and ') #revisit: tmp bugfix 200507, substitutes & with 'and' in toc, needed e.g. for AT&T, see ffa
if dob.tmp =~/\\footnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings!
- cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ')
- cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
+ cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ').
+ gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
end
- dob.tmp.gsub!(/^(.*)?\n?$/m,
+ dob.tmp=dob.tmp.gsub(/^(.*)?\n?$/m,
"\\subsubsection*{\\1}
\\addcontentsline{toc}{subsubsection}{#{cont_ln} \\\\
}")
@@ -273,22 +280,22 @@ module SiSU_TeX_Pdf
def level6
dob=@dob
# there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\sub@txt*, same for previous section 2002w46
- dob.tmp.strip! if dob.tmp
- dob.tmp.gsub!(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')
+ dob.tmp=dob.tmp.strip if dob.tmp
+ dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')
cont_ln=dob.tmp.dup
- cont_ln.gsub!(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2')
- cont_ln.gsub!(@@tex_pattern_margin_number,'')
- cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
- cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
+ cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2').
+ gsub(@@tex_pattern_margin_number,'').
+ gsub(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
+ gsub(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22
if dob.tmp =~/\\footnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings!
- cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ')
- cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
+ cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ').
+ gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')
end
- dob.tmp.gsub!(/^(.*)?\n?$/m,
+ dob.tmp=dob.tmp.gsub(/^(.*)?\n?$/m,
"\\subsubsection*{\\1}
\\addcontentsline{toc}{subsubsection}{~~~~#{cont_ln} \\\\
}")
- #dob.tmp.gsub!(/^(.*)?\n?$/m,
+ #dob.tmp.gsub(/^(.*)?\n?$/m,
# '\subsubsection*{\1}')
dob
end
@@ -462,7 +469,7 @@ module SiSU_TeX_Pdf
blt
end
def symbol_graphic
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
image='c_' + /<:=\s*(\S+?)\s*>/m.match(@txt).captures.join + '.png' #watch
if FileTest.file?("#{dir.path.image_source_include}/#{image}")
@txt.gsub!(/<:=\s*(\S+?)\s*>/,
@@ -473,7 +480,7 @@ module SiSU_TeX_Pdf
end
end
def image
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
image,m=/#{Mx[:lnk_o]}\s*(\S+)\s+.+?width=``(\d+)''.+?#{Mx[:lnk_c]}/m.match(@txt).captures
width=m[1] || '100'
width=width.to_i*0.4
@@ -496,7 +503,7 @@ module SiSU_TeX_Pdf
end
end
def png(ps='') #fc missing image check
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
# messy clean up
z=@txt[/#{Mx[:lnk_o]}(\S.+?)#{Mx[:lnk_c]}(?:image|png)/,1].strip if @txt =~ /#{Mx[:lnk_o]}\S.+?#{Mx[:lnk_c]}(?:image|png)/ # match operator for z \\ fragile !
if z #debug 2004w14
@@ -534,7 +541,7 @@ module SiSU_TeX_Pdf
end
end
def url_str_internal(str,idx=nil)
- map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map #p map_nametags
+ map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags
rgx_url_generic=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/m
rgx_url_relative=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}:\S+?#{Mx[:rel_c]}/m
rgx_url_internal=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}#?\S+?#{Mx[:rel_c]}/m
@@ -569,8 +576,7 @@ module SiSU_TeX_Pdf
#? (str.sub!(rgx_url_internal,"\\hyperlink{#{url}}{#{link}}")) \
#: (str.sub!(rgx_url_internal,"#{@brace_rel.tex_open}\\hyperlink{#{url}}{#{link}}#{@brace_rel.tex_close}"))
end
- str.gsub!(/#{Xx[:protect]}/,'')
- str
+ str=str.gsub(/#{Xx[:protect]}/,'')
end
def url_str(str)
rgx_url_generic=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m
@@ -582,7 +588,7 @@ module SiSU_TeX_Pdf
link=z.strip
link.gsub!(/&/,"#{Xx[:protect]}&")
str.sub!(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}")
- str.gsub!(/#{Xx[:protect]}/,'')
+ str=str.gsub(/#{Xx[:protect]}/,'')
str
else str
end
@@ -607,6 +613,8 @@ module SiSU_TeX_Pdf
link.gsub!(/&/,"#{Xx[:protect]}&")
dob.tmp.sub!(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}#{punctuate}")
dob.tmp.gsub!(/#{Xx[:protect]}/,'')
+ #dob.tmp=dob.tmp.sub(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}#{punctuate}").
+ # gsub(/#{Xx[:protect]}/,'')
dob
else dob
end
@@ -616,7 +624,7 @@ module SiSU_TeX_Pdf
end
def urls_txt_and_images
dob=@dob
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
@dm={
'a4'=> @tx.a4.landscape.img_px,
'letter'=> @tx.letter.landscape.img_px,
@@ -737,7 +745,7 @@ module SiSU_TeX_Pdf
dob
end
def title
- title=SiSU_TeX_Pdf::Special_characters.new(@md,@md.title.full).special_characters_safe
+ title=SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.title.full).special_characters_safe
"\n\\title{#{title}}"
end
def title_landscape
@@ -747,11 +755,11 @@ module SiSU_TeX_Pdf
title
end
end
- class Format_head
+ class FormatHead
require_relative 'prog_text_translation' # prog_text_translation.rb
def initialize(md,t_o)
@md,@t_o=md,t_o
- @env=SiSU_Env::Info_env.new(@md.fns)
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
if t_o.class==Hash
@txt =t_o[:txt] || nil
@subtitle=t_o[:subtitle] || nil
@@ -762,24 +770,24 @@ module SiSU_TeX_Pdf
p t_o.class
p caller
end
- @tx=SiSU_Env::Get_init.instance.tex
+ @tx=SiSU_Env::GetInit.instance.tex
@brace_url=SiSU_Viz::Skin.new.url_decoration
- @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine
+ @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine
@ps=@txt if @txt=~/(?:a4|letter|legal|book|a5|b5)/i
@lang ||=SiSU_i18n::Languages.new #.list[@md.opt.lng][:xlp]
@author=if defined? @md.creator.author \
and @md.creator.author=~/\S+/
- SiSU_TeX_Pdf::Special_characters.new(@md,@md.creator.author).special_characters_safe
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.creator.author).special_characters_safe
else ''
end
@subject=if defined? @md.classify.subject \
and @md.classify.subject=~/\S+/
- SiSU_TeX_Pdf::Special_characters.new(@md,@md.classify.subject).special_characters_safe
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.classify.subject).special_characters_safe
else ''
end
@keywords=if defined? @md.classify.keywords \
and @md.classify.keywords=~/\S+/
- SiSU_TeX_Pdf::Special_characters.new(@md,@md.classify.keywords).special_characters_safe
+ SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.classify.keywords).special_characters_safe
else ''
end
end
@@ -797,7 +805,7 @@ module SiSU_TeX_Pdf
end
if lang_char_arr.length > 0
lang_char_arr.slice(1..9).each { |ch| otherlang << @lang.list[ch][:xlp] }
- otherlang.uniq!
+ otherlang=otherlang.uniq
end
otherlang=otherlang.join(',')
{ mainlang: mainlang, otherlang: otherlang }
@@ -1171,59 +1179,58 @@ WOK
def a4generic
end
end
- class Special_characters
- def initialize(md,str,is='')
+ class SpecialCharacters
+ def initialize(md,str,is=:default)
@md,@txt,@is=md,str,is
@brace_url=SiSU_Viz::Skin.new.url_decoration
- @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine
+ @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine
end
- def xetex_code_listings(str,is='') # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list
+ def xetex_code_listings(str,is=:default) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list
word=str.scan(/\S+|\n/) #unless line =~/^(?:@\S|%+\s)/
para_array=[]
str=if word
word.each do |w| # _ - / # | : ! ^ ~
- w.gsub!(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<'); w.gsub!(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>')
- w.gsub!(/[\\]?~/,'~')
- w.gsub!(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,"\n") #watch
- w.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'~') #126 usual
- w.gsub!(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|') #unless is=='code' #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX
+ w=w.gsub(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<').gsub(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>').
+ gsub(/[\\]?~/,'~').
+ gsub(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,"\n"). #watch
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'~'). #126 usual
+ gsub(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|') #unless is=='code' #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX
para_array << w
end
str=para_array.join(' ')
- str=str.strip unless is=='code'
+ str=str.strip unless is==:code
str
else ''
end
- str.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' ')
- str.gsub!(/.+?<-#>/,'')
- str.gsub!(/#{Mx[:br_eof]}/,'')
- str.gsub!(/#{Mx[:br_endnotes]}/,'')
+ str=str.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' ').
+ gsub(/.+?<-#>/,'').
+ gsub(/#{Mx[:br_eof]}/,'').
+ gsub(/#{Mx[:br_endnotes]}/,'').
#problem sequence ->
- str.gsub!(/&(?:lt|#060);/,'<') # < SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'>') # > SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{') # { SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}') # } SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'~') # ~ SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#') # # SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') # ! SiSU not really special sisu character but done, also LaTeX
- #str.gsub!(/(^|\s)\*\s/,'\1\asterisk ') # * should you wish to escape astrisk e.g. describing \*{bold}*
- str.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') # * should you wish to escape astrisk e.g. describing \*{bold}*
- str.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') # - SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+') # + SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,',') # + SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'&') #unless @txt=~/<:code>/ # / SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/') # / SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\') # \ SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_') # _ SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|') # | SiSU not really special sisu character but done, also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':') # : SiSU not really special sisu character but done, also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'^') # ^ SiSU not really special sisu character but done, also LaTeX
+ gsub(/&(?:lt|#060);/,'<'). # < SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'>'). # > SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'). # { SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}'). # } SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'~'). # ~ SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#'). # # SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!'). # ! SiSU not really special sisu character but done, also LaTeX
+ #gsub(/(^|\s)\*\s/,'\1\asterisk '). # * should you wish to escape astrisk e.g. describing \*{bold}*
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*'). # * should you wish to escape astrisk e.g. describing \*{bold}*
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-'). # - SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+'). # + SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,','). # + SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'&'). #unless @txt=~/<:code>/ # / SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/'). # / SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\'). # \ SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_'). # _ SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|'). # | SiSU not really special sisu character but done, also LaTeX
+ gsub(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':'). # : SiSU not really special sisu character but done, also LaTeX
+ gsub(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'^'). # ^ SiSU not really special sisu character but done, also LaTeX
##watch placement, problem sequence ^
- str.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ')
- str.gsub!(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript
- str
+ gsub(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ').
+ gsub(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript
end
- def xetex_special_characters_1(str,is='') # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list
+ def xetex_special_characters_1(str,is=:default) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list
#str=Iconv.conv('ISO-8859-1', 'UTF-8', @txt) # `require': iconv will be deprecated in the future, use String#encode instead.
word=str.scan(/\S+|\n/) #unless line =~/^(?:@\S|%+\s)/
para_array=[]
@@ -1232,155 +1239,150 @@ WOK
if w !~/https?:/ \
and w=~/\/\S+?\// \
and w.length > 6
- w.gsub!(/([_.\/])/,'\1\-')
+ w=w.gsub(/([_.\/])/,'\1\-')
end
- w.gsub!(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<'); w.gsub!(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>')
- w.gsub!(/[\\]?~/,'<=tilde>')
- w.gsub!(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,' \newline ') #watch
- w.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') #126 usual
- w.gsub!(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'\pipe') #unless is=='code' #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX
+ w=w.gsub(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<').gsub(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>').
+ gsub(/[\\]?~/,'<=tilde>').
+ gsub(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,' \newline '). #watch
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>'). #126 usual
+ gsub(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'\pipe') #unless is=='code' #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX
if w !~/#{Mx[:rel_o]}/ \
and w !~/#{Mx[:gl_o]}#/
- w.gsub!(/\#/,'<=hash>')
+ w=w.gsub(/\#/,'<=hash>')
end
para_array << w
end
str=para_array.join(' ')
- str=str.strip unless is=='code'
+ str=str.strip unless is==:code
str
else ''
end
- str.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' ')
- str.gsub!(/.+?<-#>/,'')
- str.gsub!(/#{Mx[:br_eof]}/,'')
- str.gsub!(/#{Mx[:br_endnotes]}/,'')
+ str=str.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' ').
+ gsub(/.+?<-#>/,'').
+ gsub(/#{Mx[:br_eof]}/,'').
+ gsub(/#{Mx[:br_endnotes]}/,'')
#problem sequence ->
- str.gsub!(/&(?:nbsp);|#{Mx[:nbsp]}/,'\hardspace') unless is=='code' # < SiSU special character also LaTeX
- str.gsub!(/&(?:lt|#060);/,'\lt') # < SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'\gt') # > SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'\curlyopen') # { SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'\curlyclose') # } SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') # ~ SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'\#') # # SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') # ! SiSU not really special sisu character but done, also LaTeX
- str.gsub!(/(^|\s)\*\s/,'\1\asterisk ') # * should you wish to escape astrisk e.g. describing \*{bold}*
- str.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'\*') # * should you wish to escape astrisk e.g. describing \*{bold}*
- str.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') # - SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+') # + SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,',') # + SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'<=amp>') #unless @txt=~/<:code>/ # / SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'\slash') # / SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\textbackslash') # \ SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'<=underscore>') # _ SiSU special character also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|') # | SiSU not really special sisu character but done, also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':') # : SiSU not really special sisu character but done, also LaTeX
- str.gsub!(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'\caret') # ^ SiSU not really special sisu character but done, also LaTeX
+ str=str.gsub(/&(?:nbsp);|#{Mx[:nbsp]}/,'\hardspace') unless is==:code # < SiSU special character also LaTeX
+ str=str.gsub(/&(?:lt|#060);/,'\lt'). # < SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'\gt'). # > SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'\curlyopen'). # { SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'\curlyclose'). # } SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>'). # ~ SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'\#'). # # SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!'). # ! SiSU not really special sisu character but done, also LaTeX
+ gsub(/(^|\s)\*\s/,'\1\asterisk '). # * should you wish to escape astrisk e.g. describing \*{bold}*
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'\*'). # * should you wish to escape astrisk e.g. describing \*{bold}*
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-'). # - SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+'). # + SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,','). # + SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'<=amp>'). #unless @txt=~/<:code>/ # / SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'\slash'). # / SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\textbackslash'). # \ SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'<=underscore>'). # _ SiSU special character also LaTeX
+ gsub(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|'). # | SiSU not really special sisu character but done, also LaTeX
+ gsub(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':'). # : SiSU not really special sisu character but done, also LaTeX
+ gsub(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'\caret'). # ^ SiSU not really special sisu character but done, also LaTeX
##watch placement, problem sequence ^
- str.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ')
- str.gsub!(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript
- str
- end
- def xetex_special_characters_2(str,is='')
- str.gsub!(/#{Mx[:gl_o]}#156#{Mx[:gl_c]}/,'\oe ')
- str.gsub!(/\$/,'\$')
- str.gsub!(/\#/,'\#')
- str.gsub!(/\%/,'\%')
- str.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes
+ gsub(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ').
+ gsub(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript
+ end
+ def xetex_special_characters_2(str,is=:default)
+ str=str.gsub(/#{Mx[:gl_o]}#156#{Mx[:gl_c]}/,'\oe ').
+ gsub(/\$/,'\$').
+ gsub(/\#/,'\#').
+ gsub(/\%/,'\%').
+ gsub(/\~/,'\~') #revist, should not be necessary to mark remaining tildes
if str !~/^\s*#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image\s/
- str.gsub!(/_/,'\_')
+ str=str.gsub(/_/,'\_')
end
- str.gsub!(/\{/,'\{')
- str.gsub!(/\}/,'\}')
- if is=='code'
- str.gsub!(/&/,'{\\\&}')
- str.gsub!(/\\~(\\\{)/,'{$\tilde$}\1')
- str.gsub!(/(\\\})\\~/,'\1{$\tilde$}')
- str.gsub!(/\\~(\[)/,'{$\tilde$}\1')
- str.gsub!(/(\])\\~/,'\1{$\tilde$}')
- str.gsub!(/<=tilde>/,'{$\tilde$}')
- str.gsub!(/<=hash>/,'{\#}')
+ str=str.gsub(/\{/,'\{').
+ gsub(/\}/,'\}')
+ str=if is==:code
+ str.gsub(/&/,'{\\\&}').
+ gsub(/\\~(\\\{)/,'{$\tilde$}\1').
+ gsub(/(\\\})\\~/,'\1{$\tilde$}').
+ gsub(/\\~(\[)/,'{$\tilde$}\1').
+ gsub(/(\])\\~/,'\1{$\tilde$}').
+ gsub(/<=tilde>/,'{$\tilde$}').
+ gsub(/<=hash>/,'{\#}')
else
- str.gsub!(/&nbsp;|#{Mx[:nbsp]}/,'~') # ~ character for hardspace
- str.gsub!(/&/,'<=amp>')
+ str.gsub(/&nbsp;|#{Mx[:nbsp]}/,'~'). # ~ character for hardspace
+ gsub(/&/,'<=amp>')
end
- str.gsub!(/&\S+?;/,' ')
- str.gsub!(/§/u,'\S') #latex: space between next character not preserved? #str.gsub!(/§ /,'\S ')
- str.gsub!(/£/u,'\pounds')
- str.gsub!(/<a href=".+?">/,' ')
- str.gsub!(/<\/a>/,' ')
- str.gsub!(/((?:^|\s)#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
- '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url
- str.gsub!(/#{Mx[:url_o]}\\_(\S+?)#{Mx[:url_c]}/,
- '\begin{scriptsize}\url{\1}\end{scriptsize}') #special case \{ e.g. \}http://url
- str.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
- '\begin{scriptsize}\\url{\1}\end{scriptsize}') #specially escaped url no decoration
- unless is=='code'
- str.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/,
+ str=str.gsub(/&\S+?;/,' ').
+ gsub(/§/u,'\S'). #latex: space between next character not preserved? #str.gsub(/§ /,'\S ')
+ gsub(/£/u,'\pounds').
+ gsub(/<a href=".+?">/,' ').
+ gsub(/<\/a>/,' ').
+ gsub(/((?:^|\s)#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
+ '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3'). #special case \{ e.g. \}http://url
+ gsub(/#{Mx[:url_o]}\\_(\S+?)#{Mx[:url_c]}/,
+ '\begin{scriptsize}\url{\1}\end{scriptsize}'). #special case \{ e.g. \}http://url
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
+ '\begin{scriptsize}\\url{\1}\end{scriptsize}') #specially escaped url no decoration
+ unless is==:code
+ str=str.gsub(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/,
"\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start
- else #code-block: angle brackets special characters, note _ already escaped
- str.gsub!(/\\_</m,'{\UseTextSymbol{OML}{<}}')
- str.gsub!(/\\_>/m,'{\UseTextSymbol{OML}{>}}')
end
- str.gsub!(/<:ee>/,'')
- str.gsub!(/<!>/,' ')
+ str=str.gsub(/<:ee>/,'').
+ gsub(/<!>/,' ').
#proposed change, insert, but may be redundant
- str.gsub!(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ") # Work Area
- str.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}')
- str.gsub!(/<h\d+>(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}')
- str.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}')
- str.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}') # ulem
- str.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''") # quote #CHECK
- str.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}') # ulem
- str.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}') # ulem
- str.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$")
- str.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$")
- str.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\begin{monosp}\1\end{monosp}')
- unless is=='code'
- str.gsub!(/"(.+?)"/,'“\1”') # quote marks / quotations open & close " need condition exclude for code
- str.gsub!(/\s+"/,' “') # open "
- str.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*"/,'\1“') #fix Mx[:lv_o] # open "
- str.gsub!(/"(\s|\.|,|:|;)/,'”\1') # close "
- str.gsub!(/"(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*$/,'”\1') #fix Mx[:lv_o] # close "
- str.gsub!(/"(\.|,)/,'”') # close "
- str.gsub!(/\s+'/,' `') # open '
- str.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*'/,'\1`') #fix Mx[:lv_o] # open '
+ gsub(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} "). # Work Area
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}').
+ gsub(/<h\d+>(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}'). # ulem
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''"). # quote #CHECK
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}'). # ulem
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}'). # ulem
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$").
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$").
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\begin{monosp}\1\end{monosp}')
+ unless is==:code
+ str=str.gsub(/"(.+?)"/,'“\1”'). # quote marks / quotations open & close " need condition exclude for code
+ gsub(/\s+"/,' “'). # open "
+ gsub(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*"/,'\1“'). #fix Mx[:lv_o] # open "
+ gsub(/"(\s|\.|,|:|;)/,'”\1'). # close "
+ gsub(/"(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*$/,'”\1'). #fix Mx[:lv_o] # close "
+ gsub(/"(\.|,)/,'”'). # close "
+ gsub(/\s+'/,' `'). # open '
+ gsub(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*'/,'\1`') #fix Mx[:lv_o] # open '
end
- str.gsub!(/(<font.*?>|<\/font>)/,'')
- str.gsub!(/\s*#{Mx[:fa_superscript_o]}(\S+?)#{Mx[:fa_superscript_c]}/,'^\1')
+ str=str.gsub(/(<font.*?>|<\/font>)/,'').
+ gsub(/\s*#{Mx[:fa_superscript_o]}(\S+?)#{Mx[:fa_superscript_c]}/,'^\1')
str
end
def xetex_special_characters_3(str)
- str.gsub!(/<br(\s*[^\/][^>])/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
- str.gsub!(/([^<][^b][^r]\s+)\/>/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
+ str=str.gsub(/<br(\s*[^\/][^>])/,'\1'). # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
+ gsub(/([^<][^b][^r]\s+)\/>/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder
while str =~/(https?:\/\/\S+?)(?:<=tilde>\S+)+/ #tilde in urls \href treated differently from text #FIX
- str.gsub!(/(https?:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2')
+ str=str.gsub(/(https?:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2')
end
- str.gsub!(/<=tilde>/,'{$\tilde$}')
- str.gsub!(/(https?:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2') #hash in urls \href treated differently from text #FIX
- str.gsub!(/<=hash>/,'{\#}')
+ str=str.gsub(/<=tilde>/,'{$\tilde$}').
+ gsub(/(https?:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2'). #hash in urls \href treated differently from text #FIX
+ gsub(/<=hash>/,'{\#}')
while str =~/(https?:\/\/\S+?)(?:<=amp>\S+)+/ #amp in urls \href treated differently from text #FIX
- str.gsub!(/(https?:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2')
+ str=str.gsub(/(https?:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2')
end
- str.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005
- str.gsub!(/<=copymark>\s*(.+)/,
- '^\copyright \textnormal{\1} \2') # watch likely to be problematic
+ str=str.gsub(/<=amp>/,'{\\\&}'). #changed ... 2005
+ gsub(/<=copymark>\s*(.+)/,
+ '^\copyright \textnormal{\1} \2') # watch likely to be problematic
str
end
def special_characters_safe_close(str)
- str.gsub!(/<=tilde>/,'{$\tilde$}')
- str.gsub!(/<=hash>/,'{\#}')
- str.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005
- str.gsub!(/<=copymark>\s*(.+)/,
- '^\copyright \textnormal{\1} \2') # watch likely to be problematic
- str
+ str=str.gsub(/<=tilde>/,'{$\tilde$}').
+ gsub(/<=hash>/,'{\#}').
+ gsub(/<=amp>/,'{\\\&}'). #changed ... 2005
+ gsub(/<=copymark>\s*(.+)/,
+ '^\copyright \textnormal{\1} \2') # watch likely to be problematic
end
def special_characters_code_fix(str)
- str.gsub!(/<=tilde>/,'{$\tilde$}')
+ str=str.gsub(/<=tilde>/,'{$\tilde$}')
str
end
def special_characters_unsafe_1(str) #depreciated, make obsolete
# some substitutions are sequence sensitive, rearrange with care.
- str.gsub!(/\\textbackslash (copyright|clearpage|newpage)/,"\\\\\\1") #kludge bad solution, find out where tail is sent through specChar !
+ str=str.gsub(/\\textbackslash (copyright|clearpage|newpage)/,"\\\\\\1") #kludge bad solution, find out where tail is sent through specChar !
str
end
def special_characters #special characters - some substitutions are sequence sensitive, rearrange with care.
@@ -1393,8 +1395,8 @@ WOK
end
def special_word_break_points
str=@txt
- str.gsub!(/([_,.;:\/|=])/,'\1\-')
- str.gsub!(/(--)(\S{4,})/,'\1\-\2')
+ str=str.gsub(/([_,.;:\/|=])/,'\1\-').
+ gsub(/(--)(\S{4,})/,'\1\-\2')
@txt=str
end
def special_number_break_points
@@ -1416,16 +1418,16 @@ WOK
end
def special_characters_code
str=@txt
- str.gsub!(/ \\\\([ #{Mx[:br_nl]}]+|$)/,' \textbackslash\textbackslash\hardspace\1')
+ str=str.gsub(/ \\\\([ #{Mx[:br_nl]}]+|$)/,' \textbackslash\textbackslash\hardspace\1')
str
end
end
- class Use_TeX
+ class UseTeX
attr_accessor :url,:txt,:date
def initialize(md)
@md=md
- @vz=SiSU_Env::Get_init.instance.skin
- @date=SiSU_Env::Info_date.new # #{@date.year}
+ @vz=SiSU_Env::GetInit.instance.skin
+ @date=SiSU_Env::InfoDate.new # #{@date.year}
@copymark='{\\begin{footnotesize}\\raisebox{1ex}{\\copyright}\\end{footnotesize}}'
@brace_url=SiSU_Viz::Skin.new.url_decoration
end
@@ -1499,7 +1501,7 @@ WOK
end
end
def sisu_rights
- v=SiSU_Env::Info_version.instance.get_version
+ v=SiSU_Env::InfoVersion.instance.get_version
base_prog_txt=if @md.base_program
case @md.base_program
when /kdissert/i; "\n\\\\ This document prepared using \\href{http://freehackers.org/~tnagy/kdissert/}{Kdissert \\ http://freehackers.org/~tnagy/kdissert/ } \\\\ Kdissert is Document Mapping software by Thomas Nagy"
@@ -1527,7 +1529,7 @@ WOK
" \\footnote{%\nGenerated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\ \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} \\newline \\href{http://www.sisudoc.org}{www.sisudoc.org} \\\n}"
end
def doc_sc_info
- v=SiSU_Env::Info_version.instance.get_version
+ v=SiSU_Env::InfoVersion.instance.get_version
<<WOK
\\\\
{\\begin{footnotesize}
@@ -1539,7 +1541,7 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu }\\- ve
WOK
end
def doc_no_sc_info
- v=SiSU_Env::Info_version.instance.get_version
+ v=SiSU_Env::InfoVersion.instance.get_version
<<WOK
\\\\
{\\begin{small}
@@ -1560,9 +1562,9 @@ WOK
WOK
end
def doc_tail
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
base_html="#{dir.url.root}/#{@md.fnb}"
- v=SiSU_Env::Info_version.instance.get_version
+ v=SiSU_Env::InfoVersion.instance.get_version
sisu_ico=if FileTest.file?("#{dir.path.image_source_include}/sisu.png")
"\\includegraphics*[width=60pt]{#{dir.path.image_source_include}/sisu.png}"
else
@@ -1600,7 +1602,7 @@ WOK
WOK
end
def mail_tail #not retested, the old mail_tail is commented out and appended to this program
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
<<WOK
\\subsection*{Mail sender details}
\\addcontentsline{toc}{subsection}{Mail sender details}