From 7e3cee576368c095fe491014bd279eb280c598ba Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 3 Feb 2012 20:41:32 -0500 Subject: v3dv, dal +, use symbols to identify document objects type (is) and group (of) * (dal & code affected as a result) --- lib/sisu/v3dv/texpdf_format.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'lib/sisu/v3dv/texpdf_format.rb') diff --git a/lib/sisu/v3dv/texpdf_format.rb b/lib/sisu/v3dv/texpdf_format.rb index b82bf687..fdcdc3d1 100644 --- a/lib/sisu/v3dv/texpdf_format.rb +++ b/lib/sisu/v3dv/texpdf_format.rb @@ -123,7 +123,7 @@ module SiSU_TeX_Pdf 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 @@ -168,7 +168,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 @@ -1176,12 +1176,12 @@ WOK end end class SpecialCharacters - def initialize(md,str,is='') + def initialize(md,str,is=:default) @md,@txt,@is=md,str,is @brace_url=SiSU_Viz::Skin.new.url_decoration @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 @@ -1194,7 +1194,7 @@ WOK para_array << w end str=para_array.join(' ') - str=str.strip unless is=='code' + str=str.strip unless is==:code str else '' end @@ -1226,7 +1226,7 @@ WOK gsub(/&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=[] @@ -1249,7 +1249,7 @@ WOK para_array << w end str=para_array.join(' ') - str=str.strip unless is=='code' + str=str.strip unless is==:code str else '' end @@ -1258,7 +1258,7 @@ WOK gsub(/#{Mx[:br_eof]}/,''). gsub(/#{Mx[:br_endnotes]}/,'') #problem sequence -> - str=str.gsub(/&(?:nbsp);|#{Mx[:nbsp]}/,'\hardspace') unless is=='code' # < SiSU special character 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 @@ -1282,7 +1282,7 @@ WOK gsub(/&atild;<\/font><\/sup>/,' '). gsub(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript end - def xetex_special_characters_2(str,is='') + def xetex_special_characters_2(str,is=:default) str=str.gsub(/#{Mx[:gl_o]}#156#{Mx[:gl_c]}/,'\oe '). gsub(/\$/,'\$'). gsub(/\#/,'\#'). @@ -1293,7 +1293,7 @@ WOK end str=str.gsub(/\{/,'\{'). gsub(/\}/,'\}') - str=if is=='code' + str=if is==:code str.gsub(/&/,'{\\\&}'). gsub(/\\~(\\\{)/,'{$\tilde$}\1'). gsub(/(\\\})\\~/,'\1{$\tilde$}'). @@ -1316,7 +1316,7 @@ WOK '\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' + 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 positive lookahead, sequence issue with { linked }http://url cannot use \b at start end @@ -1334,7 +1334,7 @@ WOK 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' + 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 " -- cgit v1.2.3