From 5463542d926a6ca73d86251154cabc00a9333fa5 Mon Sep 17 00:00:00 2001
From: Marius
Date: Thu, 18 Aug 2011 17:40:23 +0300
Subject: beta 2011.08.18 16:00
---
fonts/map/pdftex/context/original-base.map | 3 +-
metapost/context/base/mp-page.mp | 28 +--
scripts/context/lua/mtx-convert.lua | 87 ++++++----
scripts/context/lua/mtx-fonts.lua | 1 +
scripts/context/lua/mtx-update.lua | 2 +-
scripts/context/lua/mtxrun.lua | 121 ++++++++-----
scripts/context/stubs/mswin/mtxrun.lua | 121 ++++++++-----
scripts/context/stubs/unix/mtxrun | 121 ++++++++-----
tex/context/base/back-exp.lua | 22 +--
tex/context/base/back-pdf.mkiv | 2 +-
tex/context/base/bibl-tra.mkiv | 17 +-
tex/context/base/buff-ver.mkiv | 6 +-
tex/context/base/cont-new.mkii | 2 +-
tex/context/base/cont-new.mkiv | 2 +-
tex/context/base/context-base.lmx | 7 +
tex/context/base/context-version.pdf | Bin 4090 -> 4092 bytes
tex/context/base/context-version.png | Bin 105681 -> 106138 bytes
tex/context/base/context.mkii | 2 +-
tex/context/base/context.mkiv | 2 +-
tex/context/base/data-exp.lua | 90 ++++++----
tex/context/base/data-pre.lua | 2 +-
tex/context/base/file-job.lua | 2 +-
tex/context/base/font-con.lua | 10 +-
tex/context/base/font-ctx.lua | 11 +-
tex/context/base/font-ext.lua | 18 +-
tex/context/base/font-otn.lua | 6 +-
tex/context/base/grph-inc.lua | 16 +-
tex/context/base/l-lpeg.lua | 13 +-
tex/context/base/lang-def.mkiv | 2 +-
tex/context/base/lpdf-mis.lua | 78 +++++----
tex/context/base/lpdf-xmp.lua | 12 +-
tex/context/base/lxml-lpt.lua | 13 +-
tex/context/base/lxml-tab.lua | 11 +-
tex/context/base/math-ali.mkiv | 58 -------
tex/context/base/mult-aux.mkiv | 51 +++---
tex/context/base/mult-sys.mkiv | 2 +-
tex/context/base/node-inj.lua | 16 ++
tex/context/base/node-res.lua | 10 +-
tex/context/base/pack-rul.mkiv | 71 ++++----
tex/context/base/page-imp.mkiv | 10 +-
tex/context/base/page-mrk.mkiv | 12 +-
tex/context/base/page-one.mkiv | 2 +-
tex/context/base/phys-dim.lua | 88 ++++++----
tex/context/base/phys-dim.mkiv | 147 ++++++++++------
tex/context/base/scrn-bar.mkvi | 8 +-
tex/context/base/scrn-but.mkvi | 4 +-
tex/context/base/scrn-fld.mkvi | 2 +-
tex/context/base/scrn-hlp.mkvi | 4 +-
tex/context/base/spac-ver.mkiv | 2 +-
tex/context/base/status-files.pdf | Bin 23848 -> 23869 bytes
tex/context/base/status-lua.pdf | Bin 162226 -> 162210 bytes
tex/context/base/strc-def.mkiv | 2 +-
tex/context/base/strc-doc.lua | 51 +++++-
tex/context/base/strc-flt.mkiv | 4 +-
tex/context/base/strc-lst.mkiv | 86 ++--------
tex/context/base/strc-not.mkiv | 5 +-
tex/context/base/strc-num.mkiv | 76 ++++-----
tex/context/base/strc-ren.mkiv | 1 +
tex/context/base/strc-sbe.mkiv | 2 +-
tex/context/base/strc-sec.mkiv | 189 ++++++++++++---------
tex/context/base/syst-aux.mkiv | 128 +++++---------
tex/context/base/type-otf.mkiv | 44 ++++-
tex/context/base/typo-krn.lua | 121 +++++++------
tex/context/base/typo-mar.lua | 17 +-
tex/context/base/typo-mar.mkiv | 7 +-
tex/context/base/util-str.lua | 58 ++++---
tex/generic/context/luatex/luatex-fonts-merged.lua | 47 +++--
67 files changed, 1238 insertions(+), 917 deletions(-)
diff --git a/fonts/map/pdftex/context/original-base.map b/fonts/map/pdftex/context/original-base.map
index 637a87aa5..4958426c5 100644
--- a/fonts/map/pdftex/context/original-base.map
+++ b/fonts/map/pdftex/context/original-base.map
@@ -6,8 +6,7 @@ rsfs10 rsfs10 pt then
dir.mkdirs(outputpath)
- convert(suffix,oldname,newname)
+ converters.convertgraphic(suffix,oldname,newname)
end
elseif lfs.isdir(inputpath .. "/".. name) then
- graphics.converters.convertpath(inputpath .. "/".. name,outputpath .. "/".. name)
+ converters.convertpath(inputpath .. "/".. name,outputpath .. "/".. name)
end
end
end
-function graphics.converters.convertfile(oldname)
+function converters.convertfile(oldname)
local suffix = file.extname(oldname)
- if graphics.converters[suffix] then
- local newname = file.replacesuffix(name,"pdf")
+ if converters[suffix] then
+ local newname = file.replacesuffix(oldname,"pdf")
if oldname == newname then
-- todo: downsample, crop etc
elseif environment.argument("force") then
- convert(suffix,oldname,newname)
+ converters.convertgraphic(suffix,oldname,newname)
else
local et = lfs.attributes(oldname,"modification")
local pt = lfs.attributes(newname,"modification")
if not pt or et > pt then
- convert(suffix,oldname,newname)
+ converters.convertgraphic(suffix,oldname,newname)
end
end
end
end
-scripts = scripts or { }
-scripts.convert = scripts.convert or { }
+if environment.ownscript then
+ -- stand alone
+else
+ report(application.banner)
+ return convert
+end
-scripts.convert.delay = 5 * 60 -- 5 minutes
+convert.delay = 5 * 60 -- 5 minutes
-function scripts.convert.convertall()
+function convert.convertall()
local watch = environment.arguments.watch or false
- local delay = environment.arguments.delay or scripts.convert.delay
+ local delay = environment.arguments.delay or convert.delay
local input = environment.arguments.inputpath or "."
local output = environment.arguments.outputpath or "."
while true do
- graphics.converters.convertpath(input, output)
+ converters.convertpath(input, output)
if watch then
os.sleep(delay)
else
@@ -128,17 +143,17 @@ function scripts.convert.convertall()
end
end
-function scripts.convert.convertgiven()
+function convert.convertgiven()
local files = environment.files
for i=1,#files do
- graphics.converters.convertfile(files[i])
+ converters.convertfile(files[i])
end
end
-if environment.argument("convertall") then
- scripts.convert.convertall()
+if environment.arguments.convertall then
+ convert.convertall()
elseif environment.files[1] then
- scripts.convert.convertgiven()
+ convert.convertgiven()
else
application.help()
end
diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua
index 90fa1b03e..c5b458c14 100644
--- a/scripts/context/lua/mtx-fonts.lua
+++ b/scripts/context/lua/mtx-fonts.lua
@@ -8,6 +8,7 @@ if not modules then modules = { } end modules ['mtx-fonts'] = {
local helpinfo = [[
--save save open type font in raw table
+--unpack save a tma file in a more readale format
--reload generate new font database
--reload --simple generate 'luatex-fonts-names.lua' (not for context!)
diff --git a/scripts/context/lua/mtx-update.lua b/scripts/context/lua/mtx-update.lua
index 2b8c06f0a..cb12b99ce 100644
--- a/scripts/context/lua/mtx-update.lua
+++ b/scripts/context/lua/mtx-update.lua
@@ -344,7 +344,7 @@ function scripts.update.synchronize()
destination = gsub(destination,"\\","/")
archive = gsub(archive,"",version)
if osplatform == "windows" or osplatform == "mswin" then
- destination = gsub(destination,"([a-zA-Z]):/", "/cygdrive/%1/")
+ destination = gsub(destination,"([a-zA-Z]):/", "/cygdrive/%1/") -- ^
end
individual[#individual+1] = { archive, destination }
end
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index fc4e81d1c..6ac5a5ce5 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -1112,6 +1112,9 @@ if not modules then modules = { } end modules ['l-lpeg'] = {
license = "see context related readme files"
}
+
+-- a new lpeg fails on a #(1-P(":")) test and really needs a + P(-1)
+
local lpeg = require("lpeg")
-- tracing (only used when we encounter a problem in integration of lpeg in luatex)
@@ -1148,7 +1151,7 @@ patterns.alwaysmatched = alwaysmatched
local digit, sign = R('09'), S('+-')
local cr, lf, crlf = P("\r"), P("\n"), P("\r\n")
-local newline = crlf + cr + lf
+local newline = crlf + S("\r\n") -- cr + lf
local escaped = P("\\") * anything
local squote = P("'")
local dquote = P('"')
@@ -1668,8 +1671,6 @@ function lpeg.append(list,pp,delayed)
end
-
-
end -- of closure
do -- create closure to overcome 200 locals limit
@@ -7425,18 +7426,15 @@ alternative.
function xml.checkbom(root) -- can be made faster
if root.ri then
- local dt, found = root.dt, false
+ local dt = root.dt
for k=1,#dt do
local v = dt[k]
if type(v) == "table" and v.special and v.tg == "@pi@" and find(v.dt[1],"xml.*version=") then
- found = true
- break
+ return
end
end
- if not found then
- insert(dt, 1, { special=true, ns="", tg="@pi@", dt = { "xml version='1.0' standalone='yes'"} } )
- insert(dt, 2, "\n" )
- end
+ insert(dt, 1, { special=true, ns="", tg="@pi@", dt = { "xml version='1.0' standalone='yes'"} } )
+ insert(dt, 2, "\n" )
end
end
@@ -8547,7 +8545,10 @@ local special_1 = P("*") * Cc(register_auto_descendant) * Cc(register_all_nodes
local special_2 = P("/") * Cc(register_auto_self)
local special_3 = P("") * Cc(register_auto_self)
-local pathparser = Ct { "patterns", -- can be made a bit faster by moving pattern outside
+local no_nextcolon = P(-1) + #(1-P(":")) -- newer lpeg needs the P(-1)
+local no_nextlparent = P(-1) + #(1-P("(")) -- newer lpeg needs the P(-1)
+
+local pathparser = Ct { "patterns", -- can be made a bit faster by moving some patterns outside
patterns = spaces * V("protocol") * spaces * (
( V("special") * spaces * P(-1) ) +
@@ -8576,10 +8577,8 @@ local pathparser = Ct { "patterns", -- can be made a bit faster by moving patter
shortcuts = V("shortcuts_a") * (spaces * "/" * spaces * V("shortcuts_a"))^0,
s_descendant_or_self = (P("***/") + P("/")) * Cc(register_descendant_or_self), --- *** is a bonus
- -- s_descendant_or_self = P("/") * Cc(register_descendant_or_self),
s_descendant = P("**") * Cc(register_descendant),
- s_child = P("*") * #(1-P(":")) * Cc(register_child ),
--- s_child = P("*") * #(P("/")+P(-1)) * Cc(register_child ),
+ s_child = P("*") * no_nextcolon * Cc(register_child ),
s_parent = P("..") * Cc(register_parent ),
s_self = P("." ) * Cc(register_self ),
s_root = P("^^") * Cc(register_root ),
@@ -8606,13 +8605,13 @@ local pathparser = Ct { "patterns", -- can be made a bit faster by moving patter
expressions = expression / register_expression,
letters = R("az")^1,
- name = (1-lpeg.S("/[]()|:*!"))^1,
+ name = (1-lpeg.S("/[]()|:*!"))^1, -- make inline
negate = P("!") * Cc(false),
nodefunction = V("negate") + P("not") * Cc(false) + Cc(true),
nodetest = V("negate") + Cc(true),
nodename = (V("negate") + Cc(true)) * spaces * ((V("wildnodename") * P(":") * V("wildnodename")) + (Cc(false) * V("wildnodename"))),
- wildnodename = (C(V("name")) + P("*") * Cc(false)) * #(1-P("(")),
+ wildnodename = (C(V("name")) + P("*") * Cc(false)) * no_nextlparent,
nodeset = spaces * Ct(V("nodename") * (spaces * P("|") * spaces * V("nodename"))^0) * spaces,
finalizer = (Cb("protocol") * P("/")^-1 * C(V("name")) * arguments * P(-1)) / register_finalizer,
@@ -10522,41 +10521,73 @@ end
-- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}}
-- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c}
-local cleanup = lpeg.replacer {
- { "!" , "" },
- { "\\" , "/" },
-}
-
-local homedir
+-- local cleanup = lpeg.replacer {
+-- { "!" , "" },
+-- { "\\" , "/" },
+-- }
+--
+-- local homedir
+--
+-- function resolvers.cleanpath(str) -- tricky, maybe only simple paths
+-- if not homedir then
+-- homedir = lpegmatch(cleanup,environment.homedir or "")
+-- if homedir == char(127) or homedir == "" or not lfs.isdir(homedir) then
+-- if trace_expansions then
+-- report_expansions("no home dir set, ignoring dependent paths")
+-- end
+-- function resolvers.cleanpath(str)
+-- if find(str,"~") then
+-- return "" -- special case
+-- else
+-- return str and lpegmatch(cleanup,str)
+-- end
+-- end
+-- else
+-- cleanup = lpeg.replacer {
+-- { "!" , "" },
+-- { "\\" , "/" },
+-- { "~" , homedir },
+-- }
+-- function resolvers.cleanpath(str)
+-- return str and lpegmatch(cleanup,str)
+-- end
+-- end
+-- end
+-- return resolvers.cleanpath(str)
+-- end
-function resolvers.cleanpath(str)
- if not homedir then
- homedir = lpegmatch(cleanup,environment.homedir or "")
- if homedir == char(127) or homedir == "" or not lfs.isdir(homedir) then
- if trace_expansions then
- report_expansions("no home dir set, ignoring dependent paths")
- end
- function resolvers.cleanpath(str)
- if find(str,"~") then
- return "" -- special case
- else
- return str and lpegmatch(cleanup,str)
- end
- end
- else
- cleanup = lpeg.replacer {
- { "!" , "" },
- { "\\" , "/" },
- { "~" , homedir },
- }
- function resolvers.cleanpath(str)
- return str and lpegmatch(cleanup,str)
+function resolvers.cleanpath(str) -- tricky, maybe only simple paths
+ local doslashes = (P("\\")/"/" + 1)^0
+ local donegation = (P("!") /"" )^0
+ local homedir = lpegmatch(Cs(donegation * doslashes),environment.homedir or "")
+ if homedir == "~" or homedir == "" or not lfs.isdir(homedir) then
+ if trace_expansions then
+ report_expansions("no home dir set, ignoring dependent paths")
+ end
+ function resolvers.cleanpath(str)
+ if not str or find(str,"~") then
+ return "" -- special case
+ else
+ return lpegmatch(cleanup,str)
end
end
+ else
+ local dohome = ((P("~")+P("$HOME"))/homedir)^0
+ local cleanup = Cs(donegation * dohome * doslashes)
+ function resolvers.cleanpath(str)
+ return str and lpegmatch(cleanup,str) or ""
+ end
end
return resolvers.cleanpath(str)
end
+-- print(resolvers.cleanpath(""))
+-- print(resolvers.cleanpath("!"))
+-- print(resolvers.cleanpath("~"))
+-- print(resolvers.cleanpath("~/test"))
+-- print(resolvers.cleanpath("!~/test"))
+-- print(resolvers.cleanpath("~/test~test"))
+
-- This one strips quotes and funny tokens.
local expandhome = P("~") / "$HOME" -- environment.homedir
@@ -13338,7 +13369,7 @@ end
prefixes.filename = function(str)
local fullname = findgivenfile(str) or ""
- return cleanpath(file.basename((fullname ~= "" and fullname) or str))
+ return cleanpath(file.basename((fullname ~= "" and fullname) or str)) -- no cleanpath needed here
end
prefixes.pathname = function(str)
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index fc4e81d1c..6ac5a5ce5 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -1112,6 +1112,9 @@ if not modules then modules = { } end modules ['l-lpeg'] = {
license = "see context related readme files"
}
+
+-- a new lpeg fails on a #(1-P(":")) test and really needs a + P(-1)
+
local lpeg = require("lpeg")
-- tracing (only used when we encounter a problem in integration of lpeg in luatex)
@@ -1148,7 +1151,7 @@ patterns.alwaysmatched = alwaysmatched
local digit, sign = R('09'), S('+-')
local cr, lf, crlf = P("\r"), P("\n"), P("\r\n")
-local newline = crlf + cr + lf
+local newline = crlf + S("\r\n") -- cr + lf
local escaped = P("\\") * anything
local squote = P("'")
local dquote = P('"')
@@ -1668,8 +1671,6 @@ function lpeg.append(list,pp,delayed)
end
-
-
end -- of closure
do -- create closure to overcome 200 locals limit
@@ -7425,18 +7426,15 @@ alternative.
function xml.checkbom(root) -- can be made faster
if root.ri then
- local dt, found = root.dt, false
+ local dt = root.dt
for k=1,#dt do
local v = dt[k]
if type(v) == "table" and v.special and v.tg == "@pi@" and find(v.dt[1],"xml.*version=") then
- found = true
- break
+ return
end
end
- if not found then
- insert(dt, 1, { special=true, ns="", tg="@pi@", dt = { "xml version='1.0' standalone='yes'"} } )
- insert(dt, 2, "\n" )
- end
+ insert(dt, 1, { special=true, ns="", tg="@pi@", dt = { "xml version='1.0' standalone='yes'"} } )
+ insert(dt, 2, "\n" )
end
end
@@ -8547,7 +8545,10 @@ local special_1 = P("*") * Cc(register_auto_descendant) * Cc(register_all_nodes
local special_2 = P("/") * Cc(register_auto_self)
local special_3 = P("") * Cc(register_auto_self)
-local pathparser = Ct { "patterns", -- can be made a bit faster by moving pattern outside
+local no_nextcolon = P(-1) + #(1-P(":")) -- newer lpeg needs the P(-1)
+local no_nextlparent = P(-1) + #(1-P("(")) -- newer lpeg needs the P(-1)
+
+local pathparser = Ct { "patterns", -- can be made a bit faster by moving some patterns outside
patterns = spaces * V("protocol") * spaces * (
( V("special") * spaces * P(-1) ) +
@@ -8576,10 +8577,8 @@ local pathparser = Ct { "patterns", -- can be made a bit faster by moving patter
shortcuts = V("shortcuts_a") * (spaces * "/" * spaces * V("shortcuts_a"))^0,
s_descendant_or_self = (P("***/") + P("/")) * Cc(register_descendant_or_self), --- *** is a bonus
- -- s_descendant_or_self = P("/") * Cc(register_descendant_or_self),
s_descendant = P("**") * Cc(register_descendant),
- s_child = P("*") * #(1-P(":")) * Cc(register_child ),
--- s_child = P("*") * #(P("/")+P(-1)) * Cc(register_child ),
+ s_child = P("*") * no_nextcolon * Cc(register_child ),
s_parent = P("..") * Cc(register_parent ),
s_self = P("." ) * Cc(register_self ),
s_root = P("^^") * Cc(register_root ),
@@ -8606,13 +8605,13 @@ local pathparser = Ct { "patterns", -- can be made a bit faster by moving patter
expressions = expression / register_expression,
letters = R("az")^1,
- name = (1-lpeg.S("/[]()|:*!"))^1,
+ name = (1-lpeg.S("/[]()|:*!"))^1, -- make inline
negate = P("!") * Cc(false),
nodefunction = V("negate") + P("not") * Cc(false) + Cc(true),
nodetest = V("negate") + Cc(true),
nodename = (V("negate") + Cc(true)) * spaces * ((V("wildnodename") * P(":") * V("wildnodename")) + (Cc(false) * V("wildnodename"))),
- wildnodename = (C(V("name")) + P("*") * Cc(false)) * #(1-P("(")),
+ wildnodename = (C(V("name")) + P("*") * Cc(false)) * no_nextlparent,
nodeset = spaces * Ct(V("nodename") * (spaces * P("|") * spaces * V("nodename"))^0) * spaces,
finalizer = (Cb("protocol") * P("/")^-1 * C(V("name")) * arguments * P(-1)) / register_finalizer,
@@ -10522,41 +10521,73 @@ end
-- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}}
-- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c}
-local cleanup = lpeg.replacer {
- { "!" , "" },
- { "\\" , "/" },
-}
-
-local homedir
+-- local cleanup = lpeg.replacer {
+-- { "!" , "" },
+-- { "\\" , "/" },
+-- }
+--
+-- local homedir
+--
+-- function resolvers.cleanpath(str) -- tricky, maybe only simple paths
+-- if not homedir then
+-- homedir = lpegmatch(cleanup,environment.homedir or "")
+-- if homedir == char(127) or homedir == "" or not lfs.isdir(homedir) then
+-- if trace_expansions then
+-- report_expansions("no home dir set, ignoring dependent paths")
+-- end
+-- function resolvers.cleanpath(str)
+-- if find(str,"~") then
+-- return "" -- special case
+-- else
+-- return str and lpegmatch(cleanup,str)
+-- end
+-- end
+-- else
+-- cleanup = lpeg.replacer {
+-- { "!" , "" },
+-- { "\\" , "/" },
+-- { "~" , homedir },
+-- }
+-- function resolvers.cleanpath(str)
+-- return str and lpegmatch(cleanup,str)
+-- end
+-- end
+-- end
+-- return resolvers.cleanpath(str)
+-- end
-function resolvers.cleanpath(str)
- if not homedir then
- homedir = lpegmatch(cleanup,environment.homedir or "")
- if homedir == char(127) or homedir == "" or not lfs.isdir(homedir) then
- if trace_expansions then
- report_expansions("no home dir set, ignoring dependent paths")
- end
- function resolvers.cleanpath(str)
- if find(str,"~") then
- return "" -- special case
- else
- return str and lpegmatch(cleanup,str)
- end
- end
- else
- cleanup = lpeg.replacer {
- { "!" , "" },
- { "\\" , "/" },
- { "~" , homedir },
- }
- function resolvers.cleanpath(str)
- return str and lpegmatch(cleanup,str)
+function resolvers.cleanpath(str) -- tricky, maybe only simple paths
+ local doslashes = (P("\\")/"/" + 1)^0
+ local donegation = (P("!") /"" )^0
+ local homedir = lpegmatch(Cs(donegation * doslashes),environment.homedir or "")
+ if homedir == "~" or homedir == "" or not lfs.isdir(homedir) then
+ if trace_expansions then
+ report_expansions("no home dir set, ignoring dependent paths")
+ end
+ function resolvers.cleanpath(str)
+ if not str or find(str,"~") then
+ return "" -- special case
+ else
+ return lpegmatch(cleanup,str)
end
end
+ else
+ local dohome = ((P("~")+P("$HOME"))/homedir)^0
+ local cleanup = Cs(donegation * dohome * doslashes)
+ function resolvers.cleanpath(str)
+ return str and lpegmatch(cleanup,str) or ""
+ end
end
return resolvers.cleanpath(str)
end
+-- print(resolvers.cleanpath(""))
+-- print(resolvers.cleanpath("!"))
+-- print(resolvers.cleanpath("~"))
+-- print(resolvers.cleanpath("~/test"))
+-- print(resolvers.cleanpath("!~/test"))
+-- print(resolvers.cleanpath("~/test~test"))
+
-- This one strips quotes and funny tokens.
local expandhome = P("~") / "$HOME" -- environment.homedir
@@ -13338,7 +13369,7 @@ end
prefixes.filename = function(str)
local fullname = findgivenfile(str) or ""
- return cleanpath(file.basename((fullname ~= "" and fullname) or str))
+ return cleanpath(file.basename((fullname ~= "" and fullname) or str)) -- no cleanpath needed here
end
prefixes.pathname = function(str)
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index fc4e81d1c..6ac5a5ce5 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -1112,6 +1112,9 @@ if not modules then modules = { } end modules ['l-lpeg'] = {
license = "see context related readme files"
}
+
+-- a new lpeg fails on a #(1-P(":")) test and really needs a + P(-1)
+
local lpeg = require("lpeg")
-- tracing (only used when we encounter a problem in integration of lpeg in luatex)
@@ -1148,7 +1151,7 @@ patterns.alwaysmatched = alwaysmatched
local digit, sign = R('09'), S('+-')
local cr, lf, crlf = P("\r"), P("\n"), P("\r\n")
-local newline = crlf + cr + lf
+local newline = crlf + S("\r\n") -- cr + lf
local escaped = P("\\") * anything
local squote = P("'")
local dquote = P('"')
@@ -1668,8 +1671,6 @@ function lpeg.append(list,pp,delayed)
end
-
-
end -- of closure
do -- create closure to overcome 200 locals limit
@@ -7425,18 +7426,15 @@ alternative.
function xml.checkbom(root) -- can be made faster
if root.ri then
- local dt, found = root.dt, false
+ local dt = root.dt
for k=1,#dt do
local v = dt[k]
if type(v) == "table" and v.special and v.tg == "@pi@" and find(v.dt[1],"xml.*version=") then
- found = true
- break
+ return
end
end
- if not found then
- insert(dt, 1, { special=true, ns="", tg="@pi@", dt = { "xml version='1.0' standalone='yes'"} } )
- insert(dt, 2, "\n" )
- end
+ insert(dt, 1, { special=true, ns="", tg="@pi@", dt = { "xml version='1.0' standalone='yes'"} } )
+ insert(dt, 2, "\n" )
end
end
@@ -8547,7 +8545,10 @@ local special_1 = P("*") * Cc(register_auto_descendant) * Cc(register_all_nodes
local special_2 = P("/") * Cc(register_auto_self)
local special_3 = P("") * Cc(register_auto_self)
-local pathparser = Ct { "patterns", -- can be made a bit faster by moving pattern outside
+local no_nextcolon = P(-1) + #(1-P(":")) -- newer lpeg needs the P(-1)
+local no_nextlparent = P(-1) + #(1-P("(")) -- newer lpeg needs the P(-1)
+
+local pathparser = Ct { "patterns", -- can be made a bit faster by moving some patterns outside
patterns = spaces * V("protocol") * spaces * (
( V("special") * spaces * P(-1) ) +
@@ -8576,10 +8577,8 @@ local pathparser = Ct { "patterns", -- can be made a bit faster by moving patter
shortcuts = V("shortcuts_a") * (spaces * "/" * spaces * V("shortcuts_a"))^0,
s_descendant_or_self = (P("***/") + P("/")) * Cc(register_descendant_or_self), --- *** is a bonus
- -- s_descendant_or_self = P("/") * Cc(register_descendant_or_self),
s_descendant = P("**") * Cc(register_descendant),
- s_child = P("*") * #(1-P(":")) * Cc(register_child ),
--- s_child = P("*") * #(P("/")+P(-1)) * Cc(register_child ),
+ s_child = P("*") * no_nextcolon * Cc(register_child ),
s_parent = P("..") * Cc(register_parent ),
s_self = P("." ) * Cc(register_self ),
s_root = P("^^") * Cc(register_root ),
@@ -8606,13 +8605,13 @@ local pathparser = Ct { "patterns", -- can be made a bit faster by moving patter
expressions = expression / register_expression,
letters = R("az")^1,
- name = (1-lpeg.S("/[]()|:*!"))^1,
+ name = (1-lpeg.S("/[]()|:*!"))^1, -- make inline
negate = P("!") * Cc(false),
nodefunction = V("negate") + P("not") * Cc(false) + Cc(true),
nodetest = V("negate") + Cc(true),
nodename = (V("negate") + Cc(true)) * spaces * ((V("wildnodename") * P(":") * V("wildnodename")) + (Cc(false) * V("wildnodename"))),
- wildnodename = (C(V("name")) + P("*") * Cc(false)) * #(1-P("(")),
+ wildnodename = (C(V("name")) + P("*") * Cc(false)) * no_nextlparent,
nodeset = spaces * Ct(V("nodename") * (spaces * P("|") * spaces * V("nodename"))^0) * spaces,
finalizer = (Cb("protocol") * P("/")^-1 * C(V("name")) * arguments * P(-1)) / register_finalizer,
@@ -10522,41 +10521,73 @@ end
-- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}}
-- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c}
-local cleanup = lpeg.replacer {
- { "!" , "" },
- { "\\" , "/" },
-}
-
-local homedir
+-- local cleanup = lpeg.replacer {
+-- { "!" , "" },
+-- { "\\" , "/" },
+-- }
+--
+-- local homedir
+--
+-- function resolvers.cleanpath(str) -- tricky, maybe only simple paths
+-- if not homedir then
+-- homedir = lpegmatch(cleanup,environment.homedir or "")
+-- if homedir == char(127) or homedir == "" or not lfs.isdir(homedir) then
+-- if trace_expansions then
+-- report_expansions("no home dir set, ignoring dependent paths")
+-- end
+-- function resolvers.cleanpath(str)
+-- if find(str,"~") then
+-- return "" -- special case
+-- else
+-- return str and lpegmatch(cleanup,str)
+-- end
+-- end
+-- else
+-- cleanup = lpeg.replacer {
+-- { "!" , "" },
+-- { "\\" , "/" },
+-- { "~" , homedir },
+-- }
+-- function resolvers.cleanpath(str)
+-- return str and lpegmatch(cleanup,str)
+-- end
+-- end
+-- end
+-- return resolvers.cleanpath(str)
+-- end
-function resolvers.cleanpath(str)
- if not homedir then
- homedir = lpegmatch(cleanup,environment.homedir or "")
- if homedir == char(127) or homedir == "" or not lfs.isdir(homedir) then
- if trace_expansions then
- report_expansions("no home dir set, ignoring dependent paths")
- end
- function resolvers.cleanpath(str)
- if find(str,"~") then
- return "" -- special case
- else
- return str and lpegmatch(cleanup,str)
- end
- end
- else
- cleanup = lpeg.replacer {
- { "!" , "" },
- { "\\" , "/" },
- { "~" , homedir },
- }
- function resolvers.cleanpath(str)
- return str and lpegmatch(cleanup,str)
+function resolvers.cleanpath(str) -- tricky, maybe only simple paths
+ local doslashes = (P("\\")/"/" + 1)^0
+ local donegation = (P("!") /"" )^0
+ local homedir = lpegmatch(Cs(donegation * doslashes),environment.homedir or "")
+ if homedir == "~" or homedir == "" or not lfs.isdir(homedir) then
+ if trace_expansions then
+ report_expansions("no home dir set, ignoring dependent paths")
+ end
+ function resolvers.cleanpath(str)
+ if not str or find(str,"~") then
+ return "" -- special case
+ else
+ return lpegmatch(cleanup,str)
end
end
+ else
+ local dohome = ((P("~")+P("$HOME"))/homedir)^0
+ local cleanup = Cs(donegation * dohome * doslashes)
+ function resolvers.cleanpath(str)
+ return str and lpegmatch(cleanup,str) or ""
+ end
end
return resolvers.cleanpath(str)
end
+-- print(resolvers.cleanpath(""))
+-- print(resolvers.cleanpath("!"))
+-- print(resolvers.cleanpath("~"))
+-- print(resolvers.cleanpath("~/test"))
+-- print(resolvers.cleanpath("!~/test"))
+-- print(resolvers.cleanpath("~/test~test"))
+
-- This one strips quotes and funny tokens.
local expandhome = P("~") / "$HOME" -- environment.homedir
@@ -13338,7 +13369,7 @@ end
prefixes.filename = function(str)
local fullname = findgivenfile(str) or ""
- return cleanpath(file.basename((fullname ~= "" and fullname) or str))
+ return cleanpath(file.basename((fullname ~= "" and fullname) or str)) -- no cleanpath needed here
end
prefixes.pathname = function(str)
diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua
index 49ea38041..0fb7ca350 100644
--- a/tex/context/base/back-exp.lua
+++ b/tex/context/base/back-exp.lua
@@ -164,7 +164,7 @@ local numbertoallign = {
[3] = "left", ["3"] = "left", [variables.flushleft ] = "left",
}
-local defaultnature = "mixed" -- "inline"
+local defaultnature = "mixed" -- "inline"
setmetatableindex(used, function(t,k)
if k then
@@ -254,16 +254,18 @@ local function hashlistdata()
end
end
-local spaces = { } -- watch how we also moved the -1 in depth-1 to the creator
+--~ local spaces = { } -- watch how we also moved the -1 in depth-1 to the creator
-setmetatableindex(spaces, function(t,k)
- if not k then
- k = 1
- end
- local s = rep(" ",k-1)
- t[k] = s
- return s
-end)
+--~ setmetatableindex(spaces, function(t,k)
+--~ if not k then
+--~ return ""
+--~ end
+--~ local s = rep(" ",k-1)
+--~ t[k] = s
+--~ return s
+--~ end)
+
+local spaces = utilities.strings.newrepeater(" ",-1)
function structurestags.setattributehash(fulltag,key,value) -- public hash
if type(fulltag) == "number" then
diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv
index 469ead0db..0bd256241 100644
--- a/tex/context/base/back-pdf.mkiv
+++ b/tex/context/base/back-pdf.mkiv
@@ -115,7 +115,7 @@
%D An example of usage is:
-\appendtoks
+\appendtoks % this will be moved to lua
\pdfbackendsetinfo{ConTeXt.Version}{\contextversion}%
\pdfbackendsetinfo{ConTeXt.Time} {\number\normalyear.\twodigits\normalmonth.\twodigits\normalday\space \twodigits\currenthour:\twodigits\currentminute}%
\pdfbackendsetinfo{ConTeXt.Jobname}{\jobname}%
diff --git a/tex/context/base/bibl-tra.mkiv b/tex/context/base/bibl-tra.mkiv
index 51309327e..e11e6fd6f 100644
--- a/tex/context/base/bibl-tra.mkiv
+++ b/tex/context/base/bibl-tra.mkiv
@@ -656,9 +656,7 @@
%D Now prohibits comments, so % can be used for urls
\unexpanded\def\startpublication
- {\begingroup
- \catcode\commentasciicode\othercatcode
- \dosingleempty\dostartpublication}
+ {\dosingleempty\dostartpublication}
\let\stoppublication\relax
@@ -676,12 +674,17 @@
% hm, we can store at the lua end ...
-\long\def\dostartpublication[#1]#2\stoppublication
- {\doifassignmentelse{#1}%
+\def\dostartpublication[#1]%
+ {\begingroup
+ \doifassignmentelse{#1}%
{\getparameters[\??pb][k=\s!unknown,t=article,n=,s=,a=,y=,o=,u=,#1]}%
{\getparameters[\??pb][k=#1,t=article,n=,s=,a=,y=,o=,u=]}%
\ctxlua{bibtex.hacks.register("\@@pbk")}%
- \setxvalue{pbd:\@@pbk}##1{\noexpand\ifcase##1\noexpand\or
+ \catcode\commentasciicode\othercatcode
+ \dodostartpublication}
+
+\def\dodostartpublication#1\stoppublication
+ {\setxvalue{pbd:\@@pbk}##1{\noexpand\ifcase##1\noexpand\or
\@@pbk\noexpand\or
\@@pba\noexpand\or
\@@pby\noexpand\or
@@ -690,7 +693,7 @@
\@@pbt\noexpand\or
\@@pbo\noexpand\or
\@@pbu\noexpand\or
- \normalunexpanded{#2}\noexpand\fi}%
+ \normalunexpanded{#1}\noexpand\fi}%
\endgroup
\ignorespaces}
diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv
index 168de9353..f0f25991e 100644
--- a/tex/context/base/buff-ver.mkiv
+++ b/tex/context/base/buff-ver.mkiv
@@ -108,7 +108,7 @@
%D Specific inline verbatim commands can be defined with the
%D following command.
-\installcommandhandler{\??ty}{type}{\??ty}
+\installcommandhandler \??ty {type} \??ty
\appendtoks
\normalexpanded{\dodefinetype{\currenttype}}%
@@ -138,7 +138,7 @@
%D
%D The definitions default to the standard typing values.
-\installcommandhandler{\??tp}{typing}{\??tp}
+\installcommandhandler \??tp {typing} \??tp
\appendtoks
\normalexpanded{\dodefinetyping{\currenttyping}}%
@@ -294,7 +294,7 @@
\doifnextoptionalelse\redotype\dodotype}
\def\redotype[#1]%
- {\getparameters[\??ty\currenttype][#1]%
+ {\setupcurrenttype[#1]%
\dodotype}
\def\dodotype
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index ab9b2c0c8..a6083522a 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.08.04 00:42}
+\newcontextversion{2011.08.18 16:00}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 3a3d255bf..9fd5d3b2d 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{2011.08.04 00:42}
+\newcontextversion{2011.08.18 16:00}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context-base.lmx b/tex/context/base/context-base.lmx
index fd27927bf..09817463b 100644
--- a/tex/context/base/context-base.lmx
+++ b/tex/context/base/context-base.lmx
@@ -24,6 +24,13 @@
+ 0) and v('refreshurl') then ?>
+
+