From 19f0402bf96ee3aa359cd7361d2683b5ce05fdeb Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 3 Sep 2014 17:37:00 +0200 Subject: beta 2014.09.03 17:37 --- .../context/lexers/scite-context-lexer-lua.lua | 5 ++ scripts/context/lua/mtxrun.lua | 77 ++++++++++++--------- scripts/context/stubs/mswin/mtxrun.lua | 77 ++++++++++++--------- scripts/context/stubs/unix/mtxrun | 77 ++++++++++++--------- scripts/context/stubs/win64/mtxrun.lua | 77 ++++++++++++--------- tex/context/base/back-pdf.lua | 8 ++- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4433 -> 4432 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/data-res.lua | 3 + tex/context/base/grph-inc.lua | 47 +++++++++++-- tex/context/base/grph-inc.mkiv | 2 + tex/context/base/l-url.lua | 65 +++++++++-------- tex/context/base/page-imp.mkiv | 6 +- tex/context/base/page-lin.mkvi | 3 +- tex/context/base/status-files.pdf | Bin 24983 -> 24991 bytes tex/context/base/status-lua.pdf | Bin 327145 -> 327147 bytes tex/context/base/strc-ref.mkvi | 25 ++++++- tex/context/base/strc-rsc.lua | 32 +++++++-- tex/context/base/util-str.lua | 3 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 4 +- 21 files changed, 328 insertions(+), 187 deletions(-) diff --git a/context/data/scite/context/lexers/scite-context-lexer-lua.lua b/context/data/scite/context/lexers/scite-context-lexer-lua.lua index c44d586ba..3d5d18fc8 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-lua.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-lua.lua @@ -25,6 +25,7 @@ local lualexer = lexer.new("lua","scite-context-lexer-lua") local whitespace = lualexer.whitespace local stringlexer = lexer.load("scite-context-lexer-lua-longstring") +local labellexer = lexer.load("scite-context-lexer-lua-labelstring") local directives = { } -- communication channel @@ -185,11 +186,15 @@ local structure = token("special", S('{}[]()')) local optionalspace = spacing^0 local hasargument = #S("{([") +-- ideal should be an embedded lexer .. + local gotokeyword = token("keyword", P("goto")) * spacing * token("grouping",validword) local gotolabel = token("keyword", P("::")) + * (spacing + shortcomment)^0 * token("grouping",validword) + * (spacing + shortcomment)^0 * token("keyword", P("::")) local p_keywords = exact_match(keywords) diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 624152316..21820f5e5 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -3644,7 +3644,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-url"] = package.loaded["l-url"] or true --- original size: 12292, stripped down to: 5585 +-- original size: 12465, stripped down to: 5710 if not modules then modules={} end modules ['l-url']={ version=1.001, @@ -3730,19 +3730,25 @@ local splitquery=Cf (Ct("")*P { "sequence", pair=Cg(key*equal*value), },rawset) local function hashed(str) - if str=="" then + if not str or str=="" then return { scheme="invalid", original=str, } end - local s=split(str) - local rawscheme=s[1] - local rawquery=s[4] - local somescheme=rawscheme~="" - local somequery=rawquery~="" + local detailed=split(str) + local rawscheme="" + local rawquery="" + local somescheme=false + local somequery=false + if detailed then + rawscheme=detailed[1] + rawquery=detailed[4] + somescheme=rawscheme~="" + somequery=rawquery~="" + end if not somescheme and not somequery then - s={ + return { scheme="file", authority="", path=str, @@ -3752,28 +3758,28 @@ local function hashed(str) noscheme=true, filename=str, } - else - local authority,path,filename=s[2],s[3] - if authority=="" then - filename=path - elseif path=="" then - filename="" - else - filename=authority.."/"..path - end - s={ - scheme=rawscheme, - authority=authority, - path=path, - query=lpegmatch(unescaper,rawquery), - queries=lpegmatch(splitquery,rawquery), - fragment=s[5], - original=str, - noscheme=false, - filename=filename, - } end - return s + local authority=detailed[2] + local path=detailed[3] + local filename=nil + if authority=="" then + filename=path + elseif path=="" then + filename="" + else + filename=authority.."/"..path + end + return { + scheme=rawscheme, + authority=authority, + path=path, + query=lpegmatch(unescaper,rawquery), + queries=lpegmatch(splitquery,rawquery), + fragment=detailed[5], + original=str, + noscheme=false, + filename=filename, + } end url.split=split url.hasscheme=hasscheme @@ -5058,7 +5064,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 34240, stripped down to: 18733 +-- original size: 34326, stripped down to: 18774 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -5605,7 +5611,6 @@ local builder=Cs { "start", +V("j")+V("J") +V("m")+V("M") +V("z") -+V("*") )+V("*") )*(P(-1)+Carg(1)) )^0, @@ -5649,6 +5654,7 @@ local builder=Cs { "start", ["a"]=(prefix_any*P("a"))/format_a, ["A"]=(prefix_any*P("A"))/format_A, ["*"]=Cs(((1-P("%"))^1+P("%%")/"%%")^1)/format_rest, + ["?"]=Cs(((1-P("%"))^1 )^1)/format_rest, ["!"]=Carg(2)*prefix_any*P("!")*C((1-P("!"))^1)*P("!")/format_extension, } local direct=Cs ( @@ -14115,7 +14121,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 64069, stripped down to: 44444 +-- original size: 64139, stripped down to: 44503 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -15221,6 +15227,9 @@ local function find_otherwise(filename,filetype,wantedfiles,allresults) end end collect_instance_files=function(filename,askedformat,allresults) + if not filename or filename=="" then + return {} + end askedformat=askedformat or "" filename=collapsepath(filename,".") filename=gsub(filename,"^%./",getcurrentdir().."/") @@ -17416,8 +17425,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 719718 --- stripped bytes : 257186 +-- original bytes : 720047 +-- stripped bytes : 257290 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 624152316..21820f5e5 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -3644,7 +3644,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-url"] = package.loaded["l-url"] or true --- original size: 12292, stripped down to: 5585 +-- original size: 12465, stripped down to: 5710 if not modules then modules={} end modules ['l-url']={ version=1.001, @@ -3730,19 +3730,25 @@ local splitquery=Cf (Ct("")*P { "sequence", pair=Cg(key*equal*value), },rawset) local function hashed(str) - if str=="" then + if not str or str=="" then return { scheme="invalid", original=str, } end - local s=split(str) - local rawscheme=s[1] - local rawquery=s[4] - local somescheme=rawscheme~="" - local somequery=rawquery~="" + local detailed=split(str) + local rawscheme="" + local rawquery="" + local somescheme=false + local somequery=false + if detailed then + rawscheme=detailed[1] + rawquery=detailed[4] + somescheme=rawscheme~="" + somequery=rawquery~="" + end if not somescheme and not somequery then - s={ + return { scheme="file", authority="", path=str, @@ -3752,28 +3758,28 @@ local function hashed(str) noscheme=true, filename=str, } - else - local authority,path,filename=s[2],s[3] - if authority=="" then - filename=path - elseif path=="" then - filename="" - else - filename=authority.."/"..path - end - s={ - scheme=rawscheme, - authority=authority, - path=path, - query=lpegmatch(unescaper,rawquery), - queries=lpegmatch(splitquery,rawquery), - fragment=s[5], - original=str, - noscheme=false, - filename=filename, - } end - return s + local authority=detailed[2] + local path=detailed[3] + local filename=nil + if authority=="" then + filename=path + elseif path=="" then + filename="" + else + filename=authority.."/"..path + end + return { + scheme=rawscheme, + authority=authority, + path=path, + query=lpegmatch(unescaper,rawquery), + queries=lpegmatch(splitquery,rawquery), + fragment=detailed[5], + original=str, + noscheme=false, + filename=filename, + } end url.split=split url.hasscheme=hasscheme @@ -5058,7 +5064,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 34240, stripped down to: 18733 +-- original size: 34326, stripped down to: 18774 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -5605,7 +5611,6 @@ local builder=Cs { "start", +V("j")+V("J") +V("m")+V("M") +V("z") -+V("*") )+V("*") )*(P(-1)+Carg(1)) )^0, @@ -5649,6 +5654,7 @@ local builder=Cs { "start", ["a"]=(prefix_any*P("a"))/format_a, ["A"]=(prefix_any*P("A"))/format_A, ["*"]=Cs(((1-P("%"))^1+P("%%")/"%%")^1)/format_rest, + ["?"]=Cs(((1-P("%"))^1 )^1)/format_rest, ["!"]=Carg(2)*prefix_any*P("!")*C((1-P("!"))^1)*P("!")/format_extension, } local direct=Cs ( @@ -14115,7 +14121,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 64069, stripped down to: 44444 +-- original size: 64139, stripped down to: 44503 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -15221,6 +15227,9 @@ local function find_otherwise(filename,filetype,wantedfiles,allresults) end end collect_instance_files=function(filename,askedformat,allresults) + if not filename or filename=="" then + return {} + end askedformat=askedformat or "" filename=collapsepath(filename,".") filename=gsub(filename,"^%./",getcurrentdir().."/") @@ -17416,8 +17425,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 719718 --- stripped bytes : 257186 +-- original bytes : 720047 +-- stripped bytes : 257290 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 624152316..21820f5e5 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -3644,7 +3644,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-url"] = package.loaded["l-url"] or true --- original size: 12292, stripped down to: 5585 +-- original size: 12465, stripped down to: 5710 if not modules then modules={} end modules ['l-url']={ version=1.001, @@ -3730,19 +3730,25 @@ local splitquery=Cf (Ct("")*P { "sequence", pair=Cg(key*equal*value), },rawset) local function hashed(str) - if str=="" then + if not str or str=="" then return { scheme="invalid", original=str, } end - local s=split(str) - local rawscheme=s[1] - local rawquery=s[4] - local somescheme=rawscheme~="" - local somequery=rawquery~="" + local detailed=split(str) + local rawscheme="" + local rawquery="" + local somescheme=false + local somequery=false + if detailed then + rawscheme=detailed[1] + rawquery=detailed[4] + somescheme=rawscheme~="" + somequery=rawquery~="" + end if not somescheme and not somequery then - s={ + return { scheme="file", authority="", path=str, @@ -3752,28 +3758,28 @@ local function hashed(str) noscheme=true, filename=str, } - else - local authority,path,filename=s[2],s[3] - if authority=="" then - filename=path - elseif path=="" then - filename="" - else - filename=authority.."/"..path - end - s={ - scheme=rawscheme, - authority=authority, - path=path, - query=lpegmatch(unescaper,rawquery), - queries=lpegmatch(splitquery,rawquery), - fragment=s[5], - original=str, - noscheme=false, - filename=filename, - } end - return s + local authority=detailed[2] + local path=detailed[3] + local filename=nil + if authority=="" then + filename=path + elseif path=="" then + filename="" + else + filename=authority.."/"..path + end + return { + scheme=rawscheme, + authority=authority, + path=path, + query=lpegmatch(unescaper,rawquery), + queries=lpegmatch(splitquery,rawquery), + fragment=detailed[5], + original=str, + noscheme=false, + filename=filename, + } end url.split=split url.hasscheme=hasscheme @@ -5058,7 +5064,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 34240, stripped down to: 18733 +-- original size: 34326, stripped down to: 18774 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -5605,7 +5611,6 @@ local builder=Cs { "start", +V("j")+V("J") +V("m")+V("M") +V("z") -+V("*") )+V("*") )*(P(-1)+Carg(1)) )^0, @@ -5649,6 +5654,7 @@ local builder=Cs { "start", ["a"]=(prefix_any*P("a"))/format_a, ["A"]=(prefix_any*P("A"))/format_A, ["*"]=Cs(((1-P("%"))^1+P("%%")/"%%")^1)/format_rest, + ["?"]=Cs(((1-P("%"))^1 )^1)/format_rest, ["!"]=Carg(2)*prefix_any*P("!")*C((1-P("!"))^1)*P("!")/format_extension, } local direct=Cs ( @@ -14115,7 +14121,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 64069, stripped down to: 44444 +-- original size: 64139, stripped down to: 44503 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -15221,6 +15227,9 @@ local function find_otherwise(filename,filetype,wantedfiles,allresults) end end collect_instance_files=function(filename,askedformat,allresults) + if not filename or filename=="" then + return {} + end askedformat=askedformat or "" filename=collapsepath(filename,".") filename=gsub(filename,"^%./",getcurrentdir().."/") @@ -17416,8 +17425,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 719718 --- stripped bytes : 257186 +-- original bytes : 720047 +-- stripped bytes : 257290 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 624152316..21820f5e5 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -3644,7 +3644,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-url"] = package.loaded["l-url"] or true --- original size: 12292, stripped down to: 5585 +-- original size: 12465, stripped down to: 5710 if not modules then modules={} end modules ['l-url']={ version=1.001, @@ -3730,19 +3730,25 @@ local splitquery=Cf (Ct("")*P { "sequence", pair=Cg(key*equal*value), },rawset) local function hashed(str) - if str=="" then + if not str or str=="" then return { scheme="invalid", original=str, } end - local s=split(str) - local rawscheme=s[1] - local rawquery=s[4] - local somescheme=rawscheme~="" - local somequery=rawquery~="" + local detailed=split(str) + local rawscheme="" + local rawquery="" + local somescheme=false + local somequery=false + if detailed then + rawscheme=detailed[1] + rawquery=detailed[4] + somescheme=rawscheme~="" + somequery=rawquery~="" + end if not somescheme and not somequery then - s={ + return { scheme="file", authority="", path=str, @@ -3752,28 +3758,28 @@ local function hashed(str) noscheme=true, filename=str, } - else - local authority,path,filename=s[2],s[3] - if authority=="" then - filename=path - elseif path=="" then - filename="" - else - filename=authority.."/"..path - end - s={ - scheme=rawscheme, - authority=authority, - path=path, - query=lpegmatch(unescaper,rawquery), - queries=lpegmatch(splitquery,rawquery), - fragment=s[5], - original=str, - noscheme=false, - filename=filename, - } end - return s + local authority=detailed[2] + local path=detailed[3] + local filename=nil + if authority=="" then + filename=path + elseif path=="" then + filename="" + else + filename=authority.."/"..path + end + return { + scheme=rawscheme, + authority=authority, + path=path, + query=lpegmatch(unescaper,rawquery), + queries=lpegmatch(splitquery,rawquery), + fragment=detailed[5], + original=str, + noscheme=false, + filename=filename, + } end url.split=split url.hasscheme=hasscheme @@ -5058,7 +5064,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 34240, stripped down to: 18733 +-- original size: 34326, stripped down to: 18774 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -5605,7 +5611,6 @@ local builder=Cs { "start", +V("j")+V("J") +V("m")+V("M") +V("z") -+V("*") )+V("*") )*(P(-1)+Carg(1)) )^0, @@ -5649,6 +5654,7 @@ local builder=Cs { "start", ["a"]=(prefix_any*P("a"))/format_a, ["A"]=(prefix_any*P("A"))/format_A, ["*"]=Cs(((1-P("%"))^1+P("%%")/"%%")^1)/format_rest, + ["?"]=Cs(((1-P("%"))^1 )^1)/format_rest, ["!"]=Carg(2)*prefix_any*P("!")*C((1-P("!"))^1)*P("!")/format_extension, } local direct=Cs ( @@ -14115,7 +14121,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 64069, stripped down to: 44444 +-- original size: 64139, stripped down to: 44503 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -15221,6 +15227,9 @@ local function find_otherwise(filename,filetype,wantedfiles,allresults) end end collect_instance_files=function(filename,askedformat,allresults) + if not filename or filename=="" then + return {} + end askedformat=askedformat or "" filename=collapsepath(filename,".") filename=gsub(filename,"^%./",getcurrentdir().."/") @@ -17416,8 +17425,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 719718 --- stripped bytes : 257186 +-- original bytes : 720047 +-- stripped bytes : 257290 -- end library merge diff --git a/tex/context/base/back-pdf.lua b/tex/context/base/back-pdf.lua index ce42c9124..f7f995f39 100644 --- a/tex/context/base/back-pdf.lua +++ b/tex/context/base/back-pdf.lua @@ -52,7 +52,7 @@ function commands.pdfstartrotation(a) local s, c = sind(a), cosd(a) context(pdfsave()) context(pdfsetmatrix(c,s,-s,c)) - insert(stack,restore and { c, -s, s, c } or false) + insert(stack,restore and { c, -s, s, c } or true) end end @@ -68,7 +68,7 @@ function commands.pdfstartscaling(sx,sy) end context(pdfsave()) context(pdfsetmatrix(sx,0,0,sy)) - insert(stack,restore and { 1/sx, 0, 0, 1/sy } or false) + insert(stack,restore and { 1/sx, 0, 0, 1/sy } or true) end end @@ -78,13 +78,15 @@ function commands.pdfstartmatrix(sx,rx,ry,sy) -- tx, ty else context(pdfsave()) context(pdfsetmatrix(sx,rx,ry,sy)) - insert(stack,store and { -sx, -rx, -ry, -sy } or false) + insert(stack,store and { -sx, -rx, -ry, -sy } or true) end end local function pdfstopsomething() local top = remove(stack) if top == false then + -- not wrapped + elseif top == true then context(pdfrestore()) elseif top then context(pdfsetmatrix(unpack(top))) diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index dd04289e9..189bbf25f 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2014.08.29 20:57} +\newcontextversion{2014.09.03 17:37} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 54792ec8f..0d9a5e990 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 8ff3a4b55..e7915b7d8 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.08.29 20:57} +\edef\contextversion{2014.09.03 17:37} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua index b3ec90898..3dd16c23b 100644 --- a/tex/context/base/data-res.lua +++ b/tex/context/base/data-res.lua @@ -1368,6 +1368,9 @@ end -- always analyze .. todo: use url split collect_instance_files = function(filename,askedformat,allresults) -- uses nested + if not filename or filename == "" then + return { } + end askedformat = askedformat or "" filename = collapsepath(filename,".") diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index d42d8b225..7fa80aa6e 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -47,7 +47,7 @@ local formatters = string.formatters local longtostring = string.longtostring local expandfilename = dir.expandname -local P, R, S, Cc, lpegmatch = lpeg.P, lpeg.R, lpeg.S, lpeg.Cc, lpeg.match +local P, R, S, Cc, C, Cs, Ct, lpegmatch = lpeg.P, lpeg.R, lpeg.S, lpeg.Cc, lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.match local settings_to_array = utilities.parsers.settings_to_array local settings_to_hash = utilities.parsers.settings_to_hash @@ -754,7 +754,7 @@ local internalschemes = { local function locate(request) -- name, format, cache -- not resolvers.cleanpath(request.name) as it fails on a!b.pdf and b~c.pdf -- todo: more restricted cleanpath - local askedname = request.name + local askedname = request.name or "" local askedhash = f_hash_part(askedname,request.conversion or "default",request.resolution or "default") local foundname = figures_found[askedhash] if foundname then @@ -1429,14 +1429,53 @@ local epstopdf = { programs.epstopdf = epstopdf programs.gs = epstopdf +local cleanups = { } +local cleaners = { } + +local whitespace = lpeg.patterns.whitespace +local quadruple = Ct((whitespace^0 * lpeg.patterns.number/tonumber * whitespace^0)^4) +local betterbox = P("%%BoundingBox:") * quadruple + * P("%%HiResBoundingBox:") * quadruple + * P("%AI3_Cropmarks:") * quadruple + * P("%%CropBox:") * quadruple + / function(b,h,m,c) + return formatters["%%%%BoundingBox: %i %i %i %i\n%%%%HighResBoundingBox: %F %F %F %F\n%%%%CropBox: %F %F %F %F\n"]( + m[1],m[2],m[3],m[4], + m[1],m[2],m[3],m[4], + m[1],m[2],m[3],m[4] + ) + end +local nocrap = P("%") / "" * ( + (P("AI9_PrivateDataBegin") * P(1)^0) / "%%%%EOF" + + (P("%EOF") * whitespace^0 * P("%AI9_PrintingDataEnd") * P(1)^0) / "%%%%EOF" + + (P("AI7_Thumbnail") * (1-P("%%EndData"))^0 * P("%%EndData")) / "" + ) +local whatever = nocrap + P(1) +local pattern = Cs((betterbox * whatever^1 + whatever)^1) + +directives.register("graphics.conversion.eps.cleanup.ai",function(v) cleanups.ai = v end) + +cleaners.ai = function(name) + local tmpname = name .. ".tmp" + io.savedata(tmpname,lpegmatch(pattern,io.loaddata(name))) + return tmpname +end + function epsconverter.pdf(oldname,newname,resolution) -- the resolution interface might change local epstopdf = programs.epstopdf -- can be changed - local presets = epstopdf.resolutions[resolution or ""] or epstopdf.resolutions.high + local presets = epstopdf.resolutions[resolution or "high"] or epstopdf.resolutions.high + local tmpname = oldname + if cleanups.ai then + tmpname = cleaners.ai(oldname) + end runprogram(epstopdf.command, epstopdf.argument, { newname = newname, - oldname = oldname, + oldname = tmpname, presets = presets, } ) + if tmpname ~= oldname then + os.remove(tmpname) + end end epsconverter.default = epsconverter.pdf diff --git a/tex/context/base/grph-inc.mkiv b/tex/context/base/grph-inc.mkiv index fd6004427..9774320d6 100644 --- a/tex/context/base/grph-inc.mkiv +++ b/tex/context/base/grph-inc.mkiv @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% \enabledirectives[graphics.conversion.eps.cleanup.ai] + % todo: messages \writestatus{loading}{ConTeXt Graphic Macros / Figure Inclusion} diff --git a/tex/context/base/l-url.lua b/tex/context/base/l-url.lua index 7bb731254..8e96b4525 100644 --- a/tex/context/base/l-url.lua +++ b/tex/context/base/l-url.lua @@ -145,19 +145,25 @@ local splitquery = Cf ( Ct("") * P { "sequence", -- hasher local function hashed(str) -- not yet ok (/test?test) - if str == "" then + if not str or str == "" then return { scheme = "invalid", original = str, } end - local s = split(str) - local rawscheme = s[1] - local rawquery = s[4] - local somescheme = rawscheme ~= "" - local somequery = rawquery ~= "" + local detailed = split(str) + local rawscheme = "" + local rawquery = "" + local somescheme = false + local somequery = false + if detailed then + rawscheme = detailed[1] + rawquery = detailed[4] + somescheme = rawscheme ~= "" + somequery = rawquery ~= "" + end if not somescheme and not somequery then - s = { + return { scheme = "file", authority = "", path = str, @@ -167,30 +173,33 @@ local function hashed(str) -- not yet ok (/test?test) noscheme = true, filename = str, } - else -- not always a filename but handy anyway - local authority, path, filename = s[2], s[3] - if authority == "" then - filename = path - elseif path == "" then - filename = "" - else - filename = authority .. "/" .. path - end - s = { - scheme = rawscheme, - authority = authority, - path = path, - query = lpegmatch(unescaper,rawquery), -- unescaped, but possible conflict with & and = - queries = lpegmatch(splitquery,rawquery), -- split first and then unescaped - fragment = s[5], - original = str, - noscheme = false, - filename = filename, - } end - return s + -- not always a filename but handy anyway + local authority = detailed[2] + local path = detailed[3] + local filename = nil + if authority == "" then + filename = path + elseif path == "" then + filename = "" + else + filename = authority .. "/" .. path + end + return { + scheme = rawscheme, + authority = authority, + path = path, + query = lpegmatch(unescaper,rawquery), -- unescaped, but possible conflict with & and = + queries = lpegmatch(splitquery,rawquery), -- split first and then unescaped + fragment = detailed[5], + original = str, + noscheme = false, + filename = filename, + } end +-- inspect(hashed()) +-- inspect(hashed("")) -- inspect(hashed("template:///test")) -- inspect(hashed("template:///test++.whatever")) -- inspect(hashed("template:///test%2B%2B.whatever")) diff --git a/tex/context/base/page-imp.mkiv b/tex/context/base/page-imp.mkiv index 230ede570..e3668a6cd 100644 --- a/tex/context/base/page-imp.mkiv +++ b/tex/context/base/page-imp.mkiv @@ -355,7 +355,7 @@ {\dosetuparrangement{2}{2}{4}{3}{3}% \pusharrangedpageSIXTEENTWO\poparrangedpagesAtoD\relax} -\installpagearrangement 2*2*4 % onother one of Willy Egger +\installpagearrangement 2*2*4 % another one of Willy Egger {\dosetuparrangement{2}{1}{8}{3}{2}% \pusharrangedpageSIXTEENFOUR\poparrangedpagesAtoH\relax} @@ -748,7 +748,7 @@ \poparrangedpages \fi} -%D Might be used if a printer is printing from a rol or creating mini-books from A4: +%D Might be used if a printer is printing from a roll or creating mini-books from A4: %D This section has 16 pages. The folding scheme is first a Z-fold and at the end %D a final fold in the spine. %D Coding: [2*8*Z] @@ -1045,7 +1045,7 @@ %D There should be arrangements for sections made of heavy and thick paper. i.e. the heavier the paper %D the fewer pages per section: -%D Section with 8 pages put on to sheets of paper. Each sheet carries recto 2 and verso 2 pages. +%D Section with 8 pages put on two sheets of paper. Each sheet carries recto 2 and verso 2 pages. %D Coding: [2*2*2] \installpagearrangement 2*2*2 diff --git a/tex/context/base/page-lin.mkvi b/tex/context/base/page-lin.mkvi index e3b628487..c55a1228b 100644 --- a/tex/context/base/page-lin.mkvi +++ b/tex/context/base/page-lin.mkvi @@ -103,8 +103,9 @@ {\dontleavehmode\begingroup \global\advance\c_page_lines_reference\plusone \attribute\linereferenceattribute\c_page_lines_reference - #3% + #3% todo: #3{#1} as there is no need to pass #1 as part of #3 % for the moment we use a simple system i.e. no prefixes etc .. todo: store as number + \c_strc_references_bind_state\zerocount % we don't want the prewordbreak and manage it here \normalexpanded{\strc_references_set_named_reference{line}{#2}{conversion=\linenumberingparameter\c!conversion}{\the\c_page_lines_reference}}% kind labels userdata text \endgroup} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 97e928c35..2cdcb5a33 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index d12a331e7..c6b2b1a71 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-ref.mkvi b/tex/context/base/strc-ref.mkvi index 3702531cf..65634b2e6 100644 --- a/tex/context/base/strc-ref.mkvi +++ b/tex/context/base/strc-ref.mkvi @@ -150,6 +150,25 @@ \def\dofinishsomereference#kind{\executeifdefined{dofinish#{kind}reference}\gobbletwoarguments} +% This is somewhat tricky: we want to keep the reference with the following word but +% that word should also hyphenate. We need to find a better way. + +% 0 = nothing +% 1 = bind to following word + +\setnewconstant\c_strc_references_bind_state\plusone + +\def\strc_references_inject_before + {} + +\def\strc_references_inject_after + {\ifcase\c_strc_references_bind_state + % nothing + \or + \prewordbreak % to be tested: \removeunwantedspaces\permithyphenation + \fi} + + \unexpanded\def\strc_references_set_named_reference {\ifreferencing \expandafter\strc_references_set_named_reference_indeed @@ -231,10 +250,11 @@ \xdef\currentdestinationattribute{\number\lastdestinationattribute}% % will become an option: \ifnum\lastdestinationattribute>\zerocount + \strc_references_inject_before % new \dontleavehmode\hbox attr \destinationattribute\lastdestinationattribute\bgroup \strc_references_flush_destination_nodes \egroup - \prewordbreak % new + \strc_references_inject_after % new \fi} \def\strc_references_set_page_only_destination_attribute#labels% could in fact be fully expandable @@ -302,10 +322,11 @@ \xdef\currentdestinationattribute{\number\lastdestinationattribute}% % will become an option: \ifnum\lastdestinationattribute>\zerocount + \strc_references_inject_before % new \dontleavehmode\hbox attr \destinationattribute\lastdestinationattribute\bgroup \strc_references_flush_destination_nodes \egroup - \prewordbreak % new + \strc_references_inject_after % new \fi} \unexpanded\def\strc_references_direct_full diff --git a/tex/context/base/strc-rsc.lua b/tex/context/base/strc-rsc.lua index e2105a4ef..cc670400f 100644 --- a/tex/context/base/strc-rsc.lua +++ b/tex/context/base/strc-rsc.lua @@ -12,7 +12,8 @@ if not modules then modules = { } end modules ['strc-rsc'] = { -- The scanner accepts nested outer, but we don't care too much, maybe -- some day we will have both but currently the innermost wins. -local lpegmatch, lpegP, lpegS, lpegCs, lpegCt, lpegCf, lpegCc, lpegC, lpegCg = lpeg.match, lpeg.P, lpeg.S, lpeg.Cs, lpeg.Ct, lpeg.Cf, lpeg.Cc, lpeg.C, lpeg.Cg +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local lpegP, lpegS, lpegCs, lpegCt, lpegCf, lpegCc, lpegC, lpegCg = lpeg.P, lpeg.S, lpeg.Cs, lpeg.Ct, lpeg.Cf, lpeg.Cc, lpeg.C, lpeg.Cg local find = string.find local spaces = lpegP(" ")^0 @@ -34,18 +35,28 @@ local backslash = lpegP("\\") local endofall = spaces * lpegP(-1) -local o_token = 1 - rparent - rbrace - lparent - lbrace -- can be made more efficient -local a_token = 1 - rbrace +----- o_token = 1 - rparent - rbrace - lparent - lbrace -- can be made more efficient +----- a_token = 1 - rbrace local s_token = 1 - lparent - lbrace local i_token = 1 - lparent - lbrace - endofall local f_token = 1 - lparent - lbrace - dcolon local c_token = 1 - lparent - lbrace - tcolon +-- experimental + +local o_token = lpegpatterns.nestedparents + + (1 - rparent - lbrace) +local a_token = lpegpatterns.nestedbraces + + (1 - rbrace) +local q_token = lpegpatterns.unsingle + + lpegpatterns.undouble + local hastexcode = lpegCg(lpegCc("has_tex") * lpegCc(true)) -- cannot be made to work local component = lpegCg(lpegCc("component") * lpegCs(c_token^1)) local outer = lpegCg(lpegCc("outer") * lpegCs(f_token^1)) -local operation = lpegCg(lpegCc("operation") * lpegCs(o_token^1)) -local arguments = lpegCg(lpegCc("arguments") * lpegCs(a_token^0)) +----- operation = lpegCg(lpegCc("operation") * lpegCs(o_token^1)) +local operation = lpegCg(lpegCc("operation") * lpegCs(q_token + o_token^1)) +local arguments = lpegCg(lpegCc("arguments") * lpegCs(q_token + a_token^0)) local special = lpegCg(lpegCc("special") * lpegCs(s_token^1)) local inner = lpegCg(lpegCc("inner") * lpegCs(i_token^1)) @@ -152,3 +163,14 @@ references.splitcomponent = splitcomponent -- inspect(splitreference([[outer::special()]])) -- inspect(splitreference([[outer::inner{argument}]])) -- inspect(splitreference([[special(outer::operation)]])) + +-- inspect(splitreference([[special(operation)]])) +-- inspect(splitreference([[special(operation(whatever))]])) +-- inspect(splitreference([[special(operation{argument,argument{whatever}})]])) +-- inspect(splitreference([[special(operation{argument{whatever}})]])) + +-- inspect(splitreference([[special("operation(")]])) +-- inspect(splitreference([[special("operation(whatever")]])) +-- inspect(splitreference([[special(operation{"argument,argument{whatever"})]])) +-- inspect(splitreference([[special(operation{"argument{whatever"})]])) + diff --git a/tex/context/base/util-str.lua b/tex/context/base/util-str.lua index 2739a20c4..fd6fc4d91 100644 --- a/tex/context/base/util-str.lua +++ b/tex/context/base/util-str.lua @@ -842,7 +842,7 @@ local builder = Cs { "start", + V("m") + V("M") -- new + V("z") -- new -- - + V("*") -- ignores probably messed up % + -- + V("?") -- ignores probably messed up % ) + V("*") ) @@ -897,6 +897,7 @@ local builder = Cs { "start", ["A"] = (prefix_any * P("A")) / format_A, -- %A => "..." (forces tostring) -- ["*"] = Cs(((1-P("%"))^1 + P("%%")/"%%")^1) / format_rest, -- rest (including %%) + ["?"] = Cs(((1-P("%"))^1 )^1) / format_rest, -- rest (including %%) -- ["!"] = Carg(2) * prefix_any * P("!") * C((1-P("!"))^1) * P("!") / format_extension, } diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 77aab3049..d947aa686 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 08/29/14 20:57:48 +-- merge date : 09/03/14 17:37:43 do -- begin closure to overcome local limits and interference @@ -3173,7 +3173,6 @@ local builder=Cs { "start", +V("j")+V("J") +V("m")+V("M") +V("z") -+V("*") )+V("*") )*(P(-1)+Carg(1)) )^0, @@ -3217,6 +3216,7 @@ local builder=Cs { "start", ["a"]=(prefix_any*P("a"))/format_a, ["A"]=(prefix_any*P("A"))/format_A, ["*"]=Cs(((1-P("%"))^1+P("%%")/"%%")^1)/format_rest, + ["?"]=Cs(((1-P("%"))^1 )^1)/format_rest, ["!"]=Carg(2)*prefix_any*P("!")*C((1-P("!"))^1)*P("!")/format_extension, } local direct=Cs ( -- cgit v1.2.3