diff options
Diffstat (limited to 'lib/sisu/v0/texpdf_format.rb')
-rw-r--r-- | lib/sisu/v0/texpdf_format.rb | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 7849727b..3887600d 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -271,7 +271,8 @@ WOK @@dp=nil def initialize(md,string,string1=nil) @md,@string,@string1=md,string,string1 - if defined? @md.image and @md.image =~/center/ + if defined? @md.image \ + and @md.image =~/center/ @center_begin,@center_end='\begin{center}','\end{center}' else @center_begin,@center_end='','' end @@ -733,9 +734,11 @@ WOK image,m=/<:image\s+(\S+)\s+.+?width=``(\d+)''.+?>/m.match(@string).captures width=m[1] || '100' width=width.to_i*0.4 - image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") + image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \ + and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") dir.path.image_source_local_tex - elsif @md.fns =~/\.-ss[tm]$/ and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") + elsif @md.fns =~/\.-ss[tm]$/ \ + and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") dir.path.image_source_remote_tex elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}") dir.path.image_source_tex @@ -770,14 +773,17 @@ WOK hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace caption="{\\\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" if c #caption="{\\\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c[1]}\\end{scriptsize}&}" if c - image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") + image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \ + and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") dir.path.image_source_local_tex - elsif @md.fns =~/\.-ss[tm]$/ and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") + elsif @md.fns =~/\.-ss[tm]$/ \ + and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") dir.path.image_source_remote_tex elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}") dir.path.image_source_tex else - unless image.nil? or image.length < 2 + unless image.nil? \ + or image.length < 2 tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}") tell.error2 unless @md.cmd =~/q/ end @@ -805,7 +811,8 @@ WOK end z,url=r.match(word).captures if word =~r url=url.strip - if word =~/\{\s*\S+\.?(?:png|jpg|gif)/ and word=~/\s+\d+x\d+\s+/ + if word =~/\{\s*\S+\.?(?:png|jpg|gif)/ \ + and word=~/\s+\d+x\d+\s+/ image,x,y=z.scan(/\S+/) image.gsub!(/\\/,'') width=200 @@ -818,7 +825,8 @@ WOK when /a5/; @tx.a5 else @tx.a4 end - width=if orientation =~/portrait/ #value is not currently passed + width=if \ + orientation =~/portrait/ #value is not currently passed width=if width.to_i > dm.portrait.img_px; dm.portrait.img_px else width end @@ -835,14 +843,16 @@ WOK tell.print_grey #unless @opt.cmd =~/q/ end ins=if image #most images fc etc. #% clean up ! - out=if @md.fns =~/\.(?:ssm\.)?sst$/ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") + out=if @md.fns =~/\.(?:ssm\.)?sst$/ \ + and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") @center_begin + "\\\n\\href{#{url}}" + #not satisfactory: \\ added to ^line to mimic reference file output "{\\includegraphics*[width=#{width}pt]" + "{#{dir.path.image_source_local_tex}/#{image}}}" + "#{caption}" + @center_end if word =~ /(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/ - elsif @md.fns =~/\.-ss[tm]$/ and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") + elsif @md.fns =~/\.-ss[tm]$/ \ + and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") @center_begin + "\\\n\\href{#{url}}" + #not satisfactory: \\ added to ^line to mimic reference file output "{\\includegraphics*[width=#{width}pt]" + @@ -1197,7 +1207,8 @@ WOK def a4generic end def para_num - paranumber_display=if @md.markup.inspect =~/no_ocn/ or @md.mod.inspect =~/--no-ocn/; '' + paranumber_display=if @md.markup.inspect =~/no_ocn/ \ + or @md.mod.inspect =~/--no-ocn/; '' else "\\begin{tiny}~\\end{tiny}{\\marginpar{\\begin{tiny}#@string1\\end{tiny}}}" #ocn object citation numbering end if @string !~/^([1-6a-z-]#{@@tilde}\S*|<:.+?>|#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6})/ |