From 319e43c29e0d220b6067658db9c4ecf51984e8c4 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 6 Dec 2012 18:39:00 +0100 Subject: beta 2012.12.06 18:39 --- tex/generic/context/luatex/luatex-fonts-merged.lua | 63 +++++++++++++--------- 1 file changed, 39 insertions(+), 24 deletions(-) (limited to 'tex/generic') diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index e4c16421f..e29b47f55 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 : 12/06/12 15:01:05 +-- merge date : 12/06/12 18:39:21 do -- begin closure to overcome local limits and interference @@ -2252,20 +2252,6 @@ function file.replacesuffix(filename, suffix) return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix end ---~ function file.join(...) ---~ local pth = concat({...},"/") ---~ pth = gsub(pth,"\\","/") ---~ local a, b = match(pth,"^(.*://)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ a, b = match(pth,"^(//)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ return (gsub(pth,"//+","/")) ---~ end - local trick_1 = char(1) local trick_2 = "^" .. trick_1 .. "/+" @@ -2292,15 +2278,44 @@ function file.join(...) -- rather dirty return (gsub(pth,"//+","/")) end ---~ print(file.join("//","/y")) ---~ print(file.join("/","/y")) ---~ print(file.join("","/y")) ---~ print(file.join("/x/","/y")) ---~ print(file.join("x/","/y")) ---~ print(file.join("http://","/y")) ---~ print(file.join("http://a","/y")) ---~ print(file.join("http:///a","/y")) ---~ print(file.join("//nas-1","/y")) +-- local slash = P("/") +-- local colon = P(":") + +-- local replacer = lpeg.replacer(S("\\/")^1,"/") +-- local stripper = Cs(P(slash)^0/"" * replacer) +-- local isnetwork = slash * slash * (1-slash) + (1-slash-colon)^1 * colon +-- local isroot = slash^1 * -1 +-- local hasroot = slash^1 + +-- function file.newjoin(...) -- rather dirty +-- local lst = { ... } +-- local one = lst[1] +-- if lpegmatch(isnetwork,one) then +-- local two = lpegmatch(replacer,concat(lst,"/",2)) +-- return one .. two +-- elseif lpegmatch(isroot,one) then +-- local two = lpegmatch(replacer,concat(lst,"/",2)) +-- if lpegmatch(hasroot,two) then +-- return two +-- else +-- return "/" .. two +-- end +-- elseif one == "" then +-- return lpegmatch(stripper,concat(lst,"/",2)) +-- else +-- return lpegmatch(replacer,concat(lst,"/")) +-- end +-- end + +-- print(file.join("//","/y")) +-- print(file.join("/","/y")) +-- print(file.join("","/y")) +-- print(file.join("/x/","/y")) +-- print(file.join("x/","/y")) +-- print(file.join("http://","/y")) +-- print(file.join("http://a","/y")) +-- print(file.join("http:///a","/y")) +-- print(file.join("//nas-1","/y")) -- We should be able to use: -- -- cgit v1.2.3