From f31e286f4a73c5c0f355512b0cb45c6c82088516 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 22 Jun 2013 01:13:46 -0400 Subject: v5: general code cleaning * propagate back to v4 after testing --- lib/sisu/v5/texpdf_format.rb | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'lib/sisu/v5/texpdf_format.rb') diff --git a/lib/sisu/v5/texpdf_format.rb b/lib/sisu/v5/texpdf_format.rb index df6c5a25..9e71e128 100644 --- a/lib/sisu/v5/texpdf_format.rb +++ b/lib/sisu/v5/texpdf_format.rb @@ -130,7 +130,7 @@ module SiSU_TeX_Pdf def longtable_landscape end_table='\end{longtable}' row_break='\\\\\\' - txt=if @dob.is==:table + 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 @@ -175,7 +175,7 @@ module SiSU_TeX_Pdf def longtable_portrait end_table='\end{longtable}' row_break='\\\\\\' - txt=if @dob.is==:table + 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 @@ -488,8 +488,6 @@ module SiSU_TeX_Pdf end def url_str_internal(str,idx=nil) 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 while str =~/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/m link,url=$1,$2 @@ -581,7 +579,7 @@ module SiSU_TeX_Pdf images_hash={ } generic_rgx=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image\b)/m rgx_url_generic=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m - url_bare_rgx=/#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m + #url_bare_rgx=/#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m url_image_rgx=/#{Mx[:lnk_o]}[a-zA-Z0-9_\\-]+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m image_rgx=/#{Mx[:lnk_o]}[a-zA-Z0-9_\\-]+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}image/m @md.papersize_array.each do |ps| @@ -614,7 +612,7 @@ module SiSU_TeX_Pdf end if images_hash[ps] =~/#{Mx[:lnk_o]}\s*\S+\.?(?:png|jpg|gif)/m \ and images_hash[ps]=~/\s+\d+x\d+(\s+|\s*#{Mx[:lnk_c]})/m - image,x,y=z.scan(/\S+/) + image=z.scan(/\S+/)[0] #image,x,y=z.scan(/\S+/) image.gsub!(/\\/,'') w=((z =~/\s(\d+)x\d*/) ? z[/\s(\d+)x\d*/,1] : 200) width={} @@ -645,8 +643,6 @@ module SiSU_TeX_Pdf pt=/(\/\S+?\/sisupod\/\S+?\/sisupod)\/doc/.match(@md.opt.f_pth[:pth])[1] img_src=pt + '/image' if FileTest.file?("#{img_src}/#{image}") - img_src - case images_hash[ps] when url_image_rgx images_hash[ps].sub!(url_image_rgx, @@ -699,7 +695,6 @@ module SiSU_TeX_Pdf end #while loop images_hash end - images_hash use_images_hash={} images_hash.each do |k,t| use_images_hash[k]={ l: t, p: t} @@ -1425,7 +1420,7 @@ module SiSU_TeX_Pdf "\\rhead[ ]{ }\n" end def footer - f="\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@md.footer_links[:left][:url]}}{#{@md.footer_links[:left][:say]}}}\n" + + "\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@md.footer_links[:left][:url]}}{#{@md.footer_links[:left][:say]}}}\n" + "\\cfoot{\\href{#{@md.footer_links[:center][:url]}}{#{@md.footer_links[:center][:say]}}}\n" + "\\rfoot[\\tiny \\href{}{}]{\\textrm{\\thepage}}\n" end @@ -1518,7 +1513,6 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\ end def doc_tail dir=SiSU_Env::InfoEnv.new(@md.fns) - base_html="#{dir.url.root}/#{@md.fnb}" 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}" -- cgit v1.2.3