diff options
Diffstat (limited to 'scripts/context/ruby')
-rw-r--r-- | scripts/context/ruby/base/tool.rb | 36 | ||||
-rw-r--r-- | scripts/context/ruby/texexec.rb | 6 |
2 files changed, 11 insertions, 31 deletions
diff --git a/scripts/context/ruby/base/tool.rb b/scripts/context/ruby/base/tool.rb index 9f120ca11..77ad947fe 100644 --- a/scripts/context/ruby/base/tool.rb +++ b/scripts/context/ruby/base/tool.rb @@ -129,7 +129,7 @@ module Tool def Tool.simplefilename(old) - return old unless test(?f,old) + return old if not FileTest.file?(old) new = old.downcase new.gsub!(/[^A-Za-z0-9\_\-\.\\\/]/o) do # funny chars @@ -141,9 +141,10 @@ module Tool $1 + ':' end end - new.gsub!(/(.+?)\.(.+?)(\..+)$/o) do # duplicate . - $1 + '-' + $2 + $3 - end + # fragile for a.b.c.d.bla-bla.e.eps + # new.gsub!(/(.+?)\.(.+?)(\..+)$/o) do # duplicate . + # $1 + '-' + $2 + $3 + # end new.gsub!(/\-+/o) do # duplicate - '-' end @@ -244,7 +245,7 @@ module Tool new.sub!(/\.ai$/io) do '.eps' end - new.sub!(/\.ai(.*?)$/io) do + new.sub!(/\.ai([a-z0-9]*)$/io) do '-' + $1 + '.eps' end new @@ -253,7 +254,7 @@ module Tool def Tool.cleanfilename(old,logging=nil) - return old unless test(?f,old) + return old if not FileTest.file?(old) new = checksuffix(simplefilename(old)) unless new == old @@ -269,29 +270,6 @@ module Tool end - def Tool.preventduplicates(old,logging=nil) - - return false unless test(?f,old) - - if old =~ /\.(tif|jpg|png|tiff)$/io - suffix = $1 - new = old - newn, news = new.split('.') - if test(?e,'newn.eps') - new = newn + '-' + suffix + '.' + suffix - begin - File.rename(old,new) - logging.report("renaming duplicate #{old} to #{new}") unless logging - return true - rescue - logging.report("unable to rename duplicate #{old} to #{new}") unless logging - end - end - end - return false - - end - def Tool.servername host = Socket::gethostname begin diff --git a/scripts/context/ruby/texexec.rb b/scripts/context/ruby/texexec.rb index f1c8059c9..55636780d 100644 --- a/scripts/context/ruby/texexec.rb +++ b/scripts/context/ruby/texexec.rb @@ -154,10 +154,12 @@ class Commands if job = TEX.new(logger) then prepare(job) job.cleanuptemprunfiles + fast = @commandline.option('fast') files = @commandline.arguments.sort - if files.length > 0 then + if fast or (files.length > 0) then if f = File.open(job.tempfilename('tex'),'w') then - Kpse.runscript('rlxtools', ['--identify','--collect'], files.join(' ')) + files.delete("texexec.pdf") + Kpse.runscript('rlxtools', ['--identify','--collect'], files.join(' ')) unless fast figures = @commandline.checkedoption('method', 'a').downcase paperoffset = @commandline.checkedoption('paperoffset', '0pt') backspace = @commandline.checkedoption('backspace', '1.5cm') |