diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v2/epub_tune.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v2/html_tune.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v2/odf.rb | 5 | ||||
-rw-r--r-- | lib/sisu/v2/texpdf_format.rb | 4 |
4 files changed, 9 insertions, 8 deletions
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] 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] 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 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) |