diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-convert.lua | 2 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 11 | ||||
-rw-r--r-- | scripts/context/ruby/base/switch.rb | 2 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 11 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 11 |
5 files changed, 29 insertions, 8 deletions
diff --git a/scripts/context/lua/mtx-convert.lua b/scripts/context/lua/mtx-convert.lua index 04ff38aad..14ade611e 100644 --- a/scripts/context/lua/mtx-convert.lua +++ b/scripts/context/lua/mtx-convert.lua @@ -34,7 +34,7 @@ local convert = scripts.convert convert.converters = convert.converters or { } local converters = convert.converters -local gsprogram = (os.type == "windows" and "gswin32c") or "gs" +local gsprogram = os.type == "windows" and "gswin32c" or "gs" local gstemplate_eps = "%s -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dEPSCrop -dNOPAUSE -dSAFER -dNOCACHE -dBATCH -dAutoRotatePages=/None -dProcessColorModel=/DeviceCMYK -sOutputFile=%s %s -c quit" local gstemplate_ps = "%s -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dNOPAUSE -dSAFER -dNOCACHE -dBATCH -dAutoRotatePages=/None -dProcessColorModel=/DeviceCMYK -sOutputFile=%s %s -c quit" diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 706b8973a..f704d63e4 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -353,6 +353,8 @@ patterns.propername = R("AZ","az","__") * R("09","AZ","az", "__")^0 * P(-1) patterns.somecontent = (anything - newline - space)^1 -- (utf8char - newline - space)^1 patterns.beginline = #(1-newline) +patterns.longtostring = Cs(whitespace^0/"" * nonwhitespace^0 * ((whitespace^0/" " * (patterns.quoted + nonwhitespace)^1)^0)) + local function anywhere(pattern) --slightly adapted from website return P { P(pattern) + 1 * V(1) } end @@ -1034,8 +1036,9 @@ function string.limit(str,n,sentinel) -- not utf proof end end -local stripper = patterns.stripper -local collapser = patterns.collapser +local stripper = patterns.stripper +local collapser = patterns.collapser +local longtostring = patterns.longtostring function string.strip(str) return lpegmatch(stripper,str) or "" @@ -1045,6 +1048,10 @@ function string.collapsespaces(str) return lpegmatch(collapser,str) or "" end +function string.longtostring(str) + return lpegmatch(longtostring,str) or "" +end + -- function string.is_empty(str) -- return not find(str,"%S") -- end diff --git a/scripts/context/ruby/base/switch.rb b/scripts/context/ruby/base/switch.rb index 19eced424..79613dcd0 100644 --- a/scripts/context/ruby/base/switch.rb +++ b/scripts/context/ruby/base/switch.rb @@ -18,7 +18,7 @@ require "rbconfig" -$mswindows = Config::CONFIG['host_os'] =~ /mswin/ +$mswindows = RbConfig::CONFIG['host_os'] =~ /mswin/ $separator = File::PATH_SEPARATOR class String diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 706b8973a..f704d63e4 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -353,6 +353,8 @@ patterns.propername = R("AZ","az","__") * R("09","AZ","az", "__")^0 * P(-1) patterns.somecontent = (anything - newline - space)^1 -- (utf8char - newline - space)^1 patterns.beginline = #(1-newline) +patterns.longtostring = Cs(whitespace^0/"" * nonwhitespace^0 * ((whitespace^0/" " * (patterns.quoted + nonwhitespace)^1)^0)) + local function anywhere(pattern) --slightly adapted from website return P { P(pattern) + 1 * V(1) } end @@ -1034,8 +1036,9 @@ function string.limit(str,n,sentinel) -- not utf proof end end -local stripper = patterns.stripper -local collapser = patterns.collapser +local stripper = patterns.stripper +local collapser = patterns.collapser +local longtostring = patterns.longtostring function string.strip(str) return lpegmatch(stripper,str) or "" @@ -1045,6 +1048,10 @@ function string.collapsespaces(str) return lpegmatch(collapser,str) or "" end +function string.longtostring(str) + return lpegmatch(longtostring,str) or "" +end + -- function string.is_empty(str) -- return not find(str,"%S") -- end diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 706b8973a..f704d63e4 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -353,6 +353,8 @@ patterns.propername = R("AZ","az","__") * R("09","AZ","az", "__")^0 * P(-1) patterns.somecontent = (anything - newline - space)^1 -- (utf8char - newline - space)^1 patterns.beginline = #(1-newline) +patterns.longtostring = Cs(whitespace^0/"" * nonwhitespace^0 * ((whitespace^0/" " * (patterns.quoted + nonwhitespace)^1)^0)) + local function anywhere(pattern) --slightly adapted from website return P { P(pattern) + 1 * V(1) } end @@ -1034,8 +1036,9 @@ function string.limit(str,n,sentinel) -- not utf proof end end -local stripper = patterns.stripper -local collapser = patterns.collapser +local stripper = patterns.stripper +local collapser = patterns.collapser +local longtostring = patterns.longtostring function string.strip(str) return lpegmatch(stripper,str) or "" @@ -1045,6 +1048,10 @@ function string.collapsespaces(str) return lpegmatch(collapser,str) or "" end +function string.longtostring(str) + return lpegmatch(longtostring,str) or "" +end + -- function string.is_empty(str) -- return not find(str,"%S") -- end |