diff options
author | Hans Hagen <pragma@wxs.nl> | 2013-01-08 19:28:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2013-01-08 19:28:00 +0100 |
commit | 6839f83e77cb6f3d2ada608c917e7004fc925c24 (patch) | |
tree | 814f160babe3ad70ac7c1fcadee79317673b61f9 /scripts/context/lua | |
parent | 5dca02e1882961ee70649f1ab96aead5c7f5910f (diff) | |
download | context-6839f83e77cb6f3d2ada608c917e7004fc925c24.tar.gz |
beta 2013.01.08 19:28
Diffstat (limited to 'scripts/context/lua')
-rw-r--r-- | scripts/context/lua/mtx-convert.lua | 2 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 11 |
2 files changed, 10 insertions, 3 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 |