From c7f4ff94b232adac607f0a8ad4ca00ee619a4bec Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 8 Oct 2010 11:35:43 -0400 Subject: texpdf, scaling of images (below the set max size), fix (+changelog) (requested fix) --- lib/sisu/v2/texpdf_format.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index 8eff07b9..36366c9b 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.rb @@ -339,7 +339,7 @@ module SiSU_TeX_Pdf image=z[/(\S+?\.(?:png|jpg|gif)\b)/m] image.gsub!(/\\/,'') width=if z =~ /\d+x\d*/ - w=(z[/(\d+)x\d*/,1]).to_i + w=(z[/\s(\d+)x\d*/,1]).to_i w*0.8 else '100' #revisit, is bug for small images/icons end @@ -498,7 +498,7 @@ module SiSU_TeX_Pdf and images_hash[ps]=~/\s+\d+x\d+(\s+|\s*#{Mx[:lnk_c]})/m image,x,y=z.scan(/\S+/) image.gsub!(/\\/,'') - w=((z =~/(\d+)x\d*/) ? z[/(\d+)x\d*/,1] : 200) + w=((z =~/\s(\d+)x\d*/) ? z[/\s(\d+)x\d*/,1] : 200) width={} width['a4'] = ((w.to_i > @dm['a4']) ? @dm['a4'] : w) width['letter'] = ((w.to_i > @dm['letter']) ? @dm['letter'] : w) -- cgit v1.2.3 From 20d511b8b4113c76619875920f50a04758bfba00 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 8 Oct 2010 11:38:07 -0400 Subject: odf:odt, incorporation and scaling of images, fix (+changelog) (requested fix) --- lib/sisu/v2/odf.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/odf.rb b/lib/sisu/v2/odf.rb index bb071683..41229249 100644 --- a/lib/sisu/v2/odf.rb +++ b/lib/sisu/v2/odf.rb @@ -197,7 +197,7 @@ module SiSU_ODF m,u=img[1],img[2] i=/^(\S+?\.(?:png|jpg|gif))/.match(m).captures.join if m =~/^(\S+?\.(?:png|jpg|gif))/ c=/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/.match(m).captures.join if m =~/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/ - w,h=/(\d+)x(\d+)/.match(m).captures if m =~/\d+x\d+/ + w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/ w=(w.to_i/37.79485).to_s h=(h.to_i/37.79485).to_s h=/([0-9]+\.\d{0,3})/.match(h).captures.join @@ -225,7 +225,8 @@ module SiSU_ODF cont.gsub!(/([)(\]\[])/,"\\\\\\1") cont.gsub!(/([+?])/,"\\\\\\1") # incorrect handling of + url.gsub!(/([+?])/,"\\\\\\1") - dob.obj.sub!(/#{Mx[:lnk_o]}[ ]*#{cont}[ ]*#{Mx[:lnk_c]}#{Mx[:url_o]}#{url}#{Mx[:url_c]}/m,image_odf(i)) #watch + dob.obj.sub!(/#{Mx[:lnk_o]}[ ]*#{cont}[ ]*#{Mx[:lnk_c]}image/m,image_odf(i)) + dob.obj.sub!(/#{Mx[:lnk_o]}[ ]*#{cont}[ ]*#{Mx[:lnk_c]}#{Mx[:url_o]}#{url}#{Mx[:url_c]}/m,image_odf(i)) dob.obj.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix end m=nil -- cgit v1.2.3 From bbcd934bd6b3ca45816a26d8a27dd917caa29f2d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 8 Oct 2010 11:39:51 -0400 Subject: html (html_tune) scaling of images, fix (+changelog) (requested fix) --- lib/sisu/v2/html_tune.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/html_tune.rb b/lib/sisu/v2/html_tune.rb index d5f3f35e..f4ad532f 100644 --- a/lib/sisu/v2/html_tune.rb +++ b/lib/sisu/v2/html_tune.rb @@ -267,8 +267,8 @@ module SiSU_HTML_Tune m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(image)/.match(word).captures end case m - when /\.png|\.jpg|\.gif|c=|\d+x\d+/ - w,h=/(\d+)x(\d+)/.match(m).captures if m =~/\d+x\d+/ + when /\.png|\.jpg|\.gif|c=|\s\d+x\d+/ + w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/ w=%{width="#{w}"} if w h=%{height="#{h}"} if h c=m[/"(.+?)"/m,1] -- cgit v1.2.3 From 50137a3afe66bc2f3604e3495a4290fd04348489 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 8 Oct 2010 11:41:03 -0400 Subject: epub (epub_tune) scaling of images, fix (+changelog) (requested fix) --- lib/sisu/v2/epub_tune.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/epub_tune.rb b/lib/sisu/v2/epub_tune.rb index 83e718aa..e0c1e029 100644 --- a/lib/sisu/v2/epub_tune.rb +++ b/lib/sisu/v2/epub_tune.rb @@ -269,8 +269,8 @@ module SiSU_EPUB_Tune m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(image)/.match(word).captures end case m - when /\.png|\.jpg|\.gif|c=|\d+x\d+/ - w,h=/(\d+)x(\d+)/.match(m).captures if m =~/\d+x\d+/ + when /\.png|\.jpg|\.gif|c=|\s\d+x\d+/ + w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/ w=%{width="#{w}"} if w h=%{height="#{h}"} if h c=m[/"(.+?)"/m,1] -- cgit v1.2.3