From 965214d981e6129b782c67adcaf3a81aedcb0bac Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 20 Oct 2013 01:20:14 +0300 Subject: stable 2013.05.28 00:36 --- scripts/context/ruby/base/pdf.rb | 10 +------ scripts/context/ruby/base/switch.rb | 10 +++---- scripts/context/ruby/base/tex.rb | 53 ++++++++++++++++++------------------- 3 files changed, 32 insertions(+), 41 deletions(-) (limited to 'scripts/context/ruby') diff --git a/scripts/context/ruby/base/pdf.rb b/scripts/context/ruby/base/pdf.rb index 6be0d3f98..5aec06fc5 100644 --- a/scripts/context/ruby/base/pdf.rb +++ b/scripts/context/ruby/base/pdf.rb @@ -5,24 +5,16 @@ module PDFview @closecalls = Hash.new @allcalls = Hash.new - # acrobat no longer is a valid default as (1) it keeps crashing with pdfopen due to a dual acrobat/reader install (a side effect - # of the api changing every version, and (2) because there are all these anyoing popups with respect to signed, review, online - # this and that stuff ... hardly useable as fast previewer, and (3) sumatra is faster and nicer and doesn't block (okay, we have to - # get rid of this horrible yellow bg-coloring buts that is doable - - @method = 'sumatra' # 'default' # 'xpdf' + @method = 'default' # 'xpdf' @opencalls['default'] = "pdfopen --file" # "pdfopen --back --file" @opencalls['xpdf'] = "xpdfopen" - @opencalls['sumatra'] = 'start "test" sumatrapdf.exe -reuse-instance -bg-color 0xCCCCCC' @closecalls['default'] = "pdfclose --file" @closecalls['xpdf'] = nil - @closecalls['sumatra'] = nil @allcalls['default'] = "pdfclose --all" @allcalls['xpdf'] = nil - @allcalls['sumatra'] = nil def PDFview.setmethod(method) @method = method diff --git a/scripts/context/ruby/base/switch.rb b/scripts/context/ruby/base/switch.rb index 73f532082..e38752018 100644 --- a/scripts/context/ruby/base/switch.rb +++ b/scripts/context/ruby/base/switch.rb @@ -487,20 +487,20 @@ class CommandLine private - def dirtyvalue(value) # \xFF suddenly doesn't work any longer + def dirtyvalue(value) if value then value.gsub(/([\"\'])(.*?)\1/) do - $2.gsub(/\s+/o, "\0xFF") + $2.gsub(/\s+/o, "\xFF") end else '' end end - def cleanvalue(value) # \xFF suddenly doesn't work any longer + def cleanvalue(value) if value then # value.sub(/^([\"\'])(.*?)\1$/) { $2.gsub(/\xFF/o, ' ') } - value.gsub(/\0xFF/o, ' ') + value.gsub(/\xFF/o, ' ') else '' end @@ -569,7 +569,7 @@ class CommandLine def locateseries(series, value) - series.each_char do |key| # was .each but there is no alias to each_char any longer + series.each do |key| locatesingle(key,cleanvalue(value)) end diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb index 9a520f313..77d61b4db 100644 --- a/scripts/context/ruby/base/tex.rb +++ b/scripts/context/ruby/base/tex.rb @@ -364,7 +364,8 @@ class TEX def mpsformats() @@mpsformats.keys.sort end def defaulttexformats() ['en','nl','mptopdf'] end - def defaultmpsformats() ['metafun'] end # no longer formats + # def defaultmpsformats() ['metafun'] end # no longer formats + def defaultmpsformats() [] end def texmakeextras(format) @@texmakestr[format] || '' end def mpsmakeextras(format) @@mpsmakestr[format] || '' end @@ -629,36 +630,34 @@ class TEX texformatpath = '' end # generate mps formats - # if mpsformats && mpsengine then - # report("using mp engine #{mpsengine}") - # mpsformatpath = if getvariable('local') then '.' else Kpse.formatpath(mpsengine,false) end - # report("using mps format path #{mpsformatpath}") - # Dir.chdir(mpsformatpath) rescue false - # if FileTest.writable?(mpsformatpath) then - # mpsformats.each do |mpsformat| - # report("generating mps format #{mpsformat}") - # progname = validprogname([getvariable('progname'),mpsformat,mpsengine]) - # if not runcommand([quoted(mpsengine),prognameflag(progname),iniflag,runoptions(mpsengine),mpsformat,mpsmakeextras(mpsformat)]) then - # setvariable('error','no format made') - # end - # end - # else - # report("unable to make format due to lack of permissions") - # mpsformatpath = '' - # setvariable('error','file permission problem') - # end - # else - # mpsformatpath = '' - # end + if mpsformats && mpsengine then + report("using mp engine #{mpsengine}") + mpsformatpath = if getvariable('local') then '.' else Kpse.formatpath(mpsengine,false) end + report("using mps format path #{mpsformatpath}") + Dir.chdir(mpsformatpath) rescue false + if FileTest.writable?(mpsformatpath) then + mpsformats.each do |mpsformat| + report("generating mps format #{mpsformat}") + progname = validprogname([getvariable('progname'),mpsformat,mpsengine]) + if not runcommand([quoted(mpsengine),prognameflag(progname),iniflag,runoptions(mpsengine),mpsformat,mpsmakeextras(mpsformat)]) then + setvariable('error','no format made') + end + end + else + report("unable to make format due to lack of permissions") + mpsformatpath = '' + setvariable('error','file permission problem') + end + else + mpsformatpath = '' + end # check for problems report("") report("tex engine path: #{texformatpath}") unless texformatpath.empty? - # report("mps engine path: #{mpsformatpath}") unless mpsformatpath.empty? + report("mps engine path: #{mpsformatpath}") unless mpsformatpath.empty? report("") - # [['fmt','tex'],['mem','mps']].each do |f| - # [[texformatpath,'global'],[mpsformatpath,'global'],[savedpath,'current']].each do |p| - [['fmt','tex']].each do |f| - [[texformatpath,'global'],[savedpath,'current']].each do |p| + [['fmt','tex'],['mem','mps']].each do |f| + [[texformatpath,'global'],[mpsformatpath,'global'],[savedpath,'current']].each do |p| begin Dir.chdir(p[0]) rescue -- cgit v1.2.3