diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-03-26 13:38:18 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-03-26 13:38:18 +0100 |
commit | 788487819ccf38a8478cc2afd88e0c0b088d0ec1 (patch) | |
tree | 215addbe3b9e293c2958227e7fc8923880b2e71f /scripts | |
parent | adfe72d5a0c9d7bdc1bd7bc8faabb4d05e21d70a (diff) | |
download | context-788487819ccf38a8478cc2afd88e0c0b088d0ec1.tar.gz |
2016-03-26 13:07:00
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-fonts.lua | 24 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 39 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 39 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 39 | ||||
-rw-r--r-- | scripts/context/stubs/win64/mtxrun.lua | 39 |
5 files changed, 118 insertions, 62 deletions
diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index f25e198bc..79c8cf65e 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -10,6 +10,10 @@ local getargument = environment.getargument local setargument = environment.setargument local givenfiles = environment.files +local suffix, addsuffix, removesuffix, replacesuffix = file.suffix, file.addsuffix, file.removesuffix, file.replacesuffix +local nameonly, basename, joinpath, collapsepath = file.nameonly, file.basename, file.join, file.collapsepath +local lower = string.lower + local otfversion = 2.819 local otlversion = 3.013 @@ -168,7 +172,7 @@ function fonts.names.simple(alsotypeone) local simpleversion = 1.001 local simplelist = { "ttf", "otf", "ttc", "dfont", alsotypeone and "afm" or nil } local name = "luatex-fonts-names.lua" - local path = file.collapsepath(caches.getwritablepath("..","..","generic","fonts","data")) + local path = collapsepath(caches.getwritablepath("..","..","generic","fonts","data")) fonts.names.filters.list = simplelist fonts.names.version = simpleversion -- this number is the same as in font-dum.lua report("generating font database for 'luatex-fonts' version %s",fonts.names.version) @@ -186,7 +190,7 @@ function fonts.names.simple(alsotypeone) local format = simplelist[i] for tag, index in next, data.mappings[format] do local s = specifications[index] - simplemappings[tag] = { s.rawname, s.filename, s.subfont } + simplemappings[tag] = { s.rawname or nameonly(s.filename), s.filename, s.subfont } end end if environment.arguments.nocache then @@ -195,7 +199,7 @@ function fonts.names.simple(alsotypeone) dir.mkdirs(path) if lfs.isdir(path) then report("saving names on cache path %a",path) - name = file.join(path,name) + name = joinpath(path,name) else report("invalid cache path %a",path) end @@ -424,14 +428,14 @@ function scripts.fonts.justload() end function scripts.fonts.unpack() - local name = file.removesuffix(file.basename(givenfiles[1] or "")) + local name = removesuffix(basename(givenfiles[1] or "")) if name and name ~= "" then local cacheid = getargument("cache") or "otl" local cache = containers.define("fonts", cacheid, otlversion, true) -- cache is temp local cleanname = containers.cleanname(name) local data = containers.read(cache,cleanname) if data then - local savename = file.addsuffix(cleanname .. "-unpacked","tma") + local savename = addsuffix(cleanname .. "-unpacked","tma") report("fontsave, saving data in %s",savename) if data.creator == "context mkiv" then fonts.handlers.otf.readers.unpack(data) @@ -452,9 +456,9 @@ function scripts.fonts.save() if fontblob then if fontblob.validation_state and table.contains(fontblob.validation_state,"bad_ps_fontname") then report("ignoring bad fontname for %a",name) - savename = file.nameonly(name) .. "-bad-ps-name" + savename = nameonly(name) .. "-bad-ps-name" end - savename = file.addsuffix(string.lower(savename),"lua") + savename = addsuffix(lower(savename),"lua") report("fontsave, saving data in %a",savename) table.tofile(savename,fontloader.to_table(fontblob),"return") fontloader.close(fontblob) @@ -463,7 +467,7 @@ function scripts.fonts.save() if name and name ~= "" then local filename = resolvers.findfile(name) -- maybe also search for opentype if filename and filename ~= "" then - local suffix = string.lower(file.suffix(filename)) + local suffix = lower(suffix(filename)) if suffix == 'ttf' or suffix == 'otf' or suffix == 'ttc' or suffix == "dfont" then local fontinfo = fontloader.info(filename) if fontinfo then @@ -496,13 +500,13 @@ function scripts.fonts.convert() -- new save if name and name ~= "" then local filename = resolvers.findfile(name) -- maybe also search for opentype if filename and filename ~= "" then - local suffix = string.lower(file.suffix(filename)) + local suffix = lower(suffix(filename)) if suffix == 'ttf' or suffix == 'otf' or suffix == 'ttc' then local data = fonts.handlers.otf.readers.loadfont(filename,sub) if data then fonts.handlers.otf.readers.compact(data) fonts.handlers.otf.readers.rehash(data,getargument("names") and "names" or "unicodes") - local savename = file.replacesuffix(string.lower(data.metadata.fullname or filename),"lua") + local savename = replacesuffix(lower(data.metadata.fullname or filename),"lua") table.save(savename,data) report("font: %a saved as %a",filename,savename) else diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index d72be372e..176598941 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -9989,7 +9989,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 56627, stripped down to: 35669 +-- original size: 56973, stripped down to: 35872 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -10006,6 +10006,7 @@ local xml=xml local concat,remove,insert=table.concat,table.remove,table.insert local type,next,setmetatable,getmetatable,tonumber,rawset=type,next,setmetatable,getmetatable,tonumber,rawset local lower,find,match,gsub=string.lower,string.find,string.match,string.gsub +local sort=table.sort local utfchar=utf.char local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns local P,S,R,C,V,C,Cs=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.V,lpeg.C,lpeg.Cs @@ -10950,22 +10951,34 @@ local function verbose_element(e,handlers,escape) local ats=eat and next(eat) and {} if ats then local n=0 - for k,v in next,eat do + for k in next,eat do n=n+1 - ats[n]=f_attribute(k,escaped(v)) + ats[n]=k + end + if n==1 then + local k=ats[1] + ats=f_attribute(k,escaped(eat[k])) + else + sort(ats) + for i=1,n do + local k=ats[i] + ats[i]=f_attribute(k,escaped(eat[k])) + end + ats=concat(ats," ") end end if ern and trace_entities and ern~=ens then ens=ern end + local n=edt and #edt if ens~="" then - if edt and #edt>0 then + if n and n>0 then if ats then - handle("<",ens,":",etg," ",concat(ats," "),">") + handle("<",ens,":",etg," ",ats,">") else handle("<",ens,":",etg,">") end - for i=1,#edt do + for i=1,n do local e=edt[i] if type(e)=="string" then handle(escaped(e)) @@ -10976,19 +10989,19 @@ local function verbose_element(e,handlers,escape) handle("</",ens,":",etg,">") else if ats then - handle("<",ens,":",etg," ",concat(ats," "),"/>") + handle("<",ens,":",etg," ",ats,"/>") else handle("<",ens,":",etg,"/>") end end else - if edt and #edt>0 then + if n and n>0 then if ats then - handle("<",etg," ",concat(ats," "),">") + handle("<",etg," ",ats,">") else handle("<",etg,">") end - for i=1,#edt do + for i=1,n do local e=edt[i] if type(e)=="string" then handle(escaped(e)) @@ -10999,7 +11012,7 @@ local function verbose_element(e,handlers,escape) handle("</",etg,">") else if ats then - handle("<",etg," ",concat(ats," "),"/>") + handle("<",etg," ",ats,"/>") else handle("<",etg,"/>") end @@ -18722,8 +18735,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-fil.lua util-sac.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 : 796212 --- stripped bytes : 288762 +-- original bytes : 796558 +-- stripped bytes : 288905 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index d72be372e..176598941 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -9989,7 +9989,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 56627, stripped down to: 35669 +-- original size: 56973, stripped down to: 35872 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -10006,6 +10006,7 @@ local xml=xml local concat,remove,insert=table.concat,table.remove,table.insert local type,next,setmetatable,getmetatable,tonumber,rawset=type,next,setmetatable,getmetatable,tonumber,rawset local lower,find,match,gsub=string.lower,string.find,string.match,string.gsub +local sort=table.sort local utfchar=utf.char local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns local P,S,R,C,V,C,Cs=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.V,lpeg.C,lpeg.Cs @@ -10950,22 +10951,34 @@ local function verbose_element(e,handlers,escape) local ats=eat and next(eat) and {} if ats then local n=0 - for k,v in next,eat do + for k in next,eat do n=n+1 - ats[n]=f_attribute(k,escaped(v)) + ats[n]=k + end + if n==1 then + local k=ats[1] + ats=f_attribute(k,escaped(eat[k])) + else + sort(ats) + for i=1,n do + local k=ats[i] + ats[i]=f_attribute(k,escaped(eat[k])) + end + ats=concat(ats," ") end end if ern and trace_entities and ern~=ens then ens=ern end + local n=edt and #edt if ens~="" then - if edt and #edt>0 then + if n and n>0 then if ats then - handle("<",ens,":",etg," ",concat(ats," "),">") + handle("<",ens,":",etg," ",ats,">") else handle("<",ens,":",etg,">") end - for i=1,#edt do + for i=1,n do local e=edt[i] if type(e)=="string" then handle(escaped(e)) @@ -10976,19 +10989,19 @@ local function verbose_element(e,handlers,escape) handle("</",ens,":",etg,">") else if ats then - handle("<",ens,":",etg," ",concat(ats," "),"/>") + handle("<",ens,":",etg," ",ats,"/>") else handle("<",ens,":",etg,"/>") end end else - if edt and #edt>0 then + if n and n>0 then if ats then - handle("<",etg," ",concat(ats," "),">") + handle("<",etg," ",ats,">") else handle("<",etg,">") end - for i=1,#edt do + for i=1,n do local e=edt[i] if type(e)=="string" then handle(escaped(e)) @@ -10999,7 +11012,7 @@ local function verbose_element(e,handlers,escape) handle("</",etg,">") else if ats then - handle("<",etg," ",concat(ats," "),"/>") + handle("<",etg," ",ats,"/>") else handle("<",etg,"/>") end @@ -18722,8 +18735,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-fil.lua util-sac.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 : 796212 --- stripped bytes : 288762 +-- original bytes : 796558 +-- stripped bytes : 288905 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index d72be372e..176598941 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -9989,7 +9989,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 56627, stripped down to: 35669 +-- original size: 56973, stripped down to: 35872 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -10006,6 +10006,7 @@ local xml=xml local concat,remove,insert=table.concat,table.remove,table.insert local type,next,setmetatable,getmetatable,tonumber,rawset=type,next,setmetatable,getmetatable,tonumber,rawset local lower,find,match,gsub=string.lower,string.find,string.match,string.gsub +local sort=table.sort local utfchar=utf.char local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns local P,S,R,C,V,C,Cs=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.V,lpeg.C,lpeg.Cs @@ -10950,22 +10951,34 @@ local function verbose_element(e,handlers,escape) local ats=eat and next(eat) and {} if ats then local n=0 - for k,v in next,eat do + for k in next,eat do n=n+1 - ats[n]=f_attribute(k,escaped(v)) + ats[n]=k + end + if n==1 then + local k=ats[1] + ats=f_attribute(k,escaped(eat[k])) + else + sort(ats) + for i=1,n do + local k=ats[i] + ats[i]=f_attribute(k,escaped(eat[k])) + end + ats=concat(ats," ") end end if ern and trace_entities and ern~=ens then ens=ern end + local n=edt and #edt if ens~="" then - if edt and #edt>0 then + if n and n>0 then if ats then - handle("<",ens,":",etg," ",concat(ats," "),">") + handle("<",ens,":",etg," ",ats,">") else handle("<",ens,":",etg,">") end - for i=1,#edt do + for i=1,n do local e=edt[i] if type(e)=="string" then handle(escaped(e)) @@ -10976,19 +10989,19 @@ local function verbose_element(e,handlers,escape) handle("</",ens,":",etg,">") else if ats then - handle("<",ens,":",etg," ",concat(ats," "),"/>") + handle("<",ens,":",etg," ",ats,"/>") else handle("<",ens,":",etg,"/>") end end else - if edt and #edt>0 then + if n and n>0 then if ats then - handle("<",etg," ",concat(ats," "),">") + handle("<",etg," ",ats,">") else handle("<",etg,">") end - for i=1,#edt do + for i=1,n do local e=edt[i] if type(e)=="string" then handle(escaped(e)) @@ -10999,7 +11012,7 @@ local function verbose_element(e,handlers,escape) handle("</",etg,">") else if ats then - handle("<",etg," ",concat(ats," "),"/>") + handle("<",etg," ",ats,"/>") else handle("<",etg,"/>") end @@ -18722,8 +18735,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-fil.lua util-sac.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 : 796212 --- stripped bytes : 288762 +-- original bytes : 796558 +-- stripped bytes : 288905 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index d72be372e..176598941 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -9989,7 +9989,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 56627, stripped down to: 35669 +-- original size: 56973, stripped down to: 35872 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -10006,6 +10006,7 @@ local xml=xml local concat,remove,insert=table.concat,table.remove,table.insert local type,next,setmetatable,getmetatable,tonumber,rawset=type,next,setmetatable,getmetatable,tonumber,rawset local lower,find,match,gsub=string.lower,string.find,string.match,string.gsub +local sort=table.sort local utfchar=utf.char local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns local P,S,R,C,V,C,Cs=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.V,lpeg.C,lpeg.Cs @@ -10950,22 +10951,34 @@ local function verbose_element(e,handlers,escape) local ats=eat and next(eat) and {} if ats then local n=0 - for k,v in next,eat do + for k in next,eat do n=n+1 - ats[n]=f_attribute(k,escaped(v)) + ats[n]=k + end + if n==1 then + local k=ats[1] + ats=f_attribute(k,escaped(eat[k])) + else + sort(ats) + for i=1,n do + local k=ats[i] + ats[i]=f_attribute(k,escaped(eat[k])) + end + ats=concat(ats," ") end end if ern and trace_entities and ern~=ens then ens=ern end + local n=edt and #edt if ens~="" then - if edt and #edt>0 then + if n and n>0 then if ats then - handle("<",ens,":",etg," ",concat(ats," "),">") + handle("<",ens,":",etg," ",ats,">") else handle("<",ens,":",etg,">") end - for i=1,#edt do + for i=1,n do local e=edt[i] if type(e)=="string" then handle(escaped(e)) @@ -10976,19 +10989,19 @@ local function verbose_element(e,handlers,escape) handle("</",ens,":",etg,">") else if ats then - handle("<",ens,":",etg," ",concat(ats," "),"/>") + handle("<",ens,":",etg," ",ats,"/>") else handle("<",ens,":",etg,"/>") end end else - if edt and #edt>0 then + if n and n>0 then if ats then - handle("<",etg," ",concat(ats," "),">") + handle("<",etg," ",ats,">") else handle("<",etg,">") end - for i=1,#edt do + for i=1,n do local e=edt[i] if type(e)=="string" then handle(escaped(e)) @@ -10999,7 +11012,7 @@ local function verbose_element(e,handlers,escape) handle("</",etg,">") else if ats then - handle("<",etg," ",concat(ats," "),"/>") + handle("<",etg," ",ats,"/>") else handle("<",etg,"/>") end @@ -18722,8 +18735,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-fil.lua util-sac.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 : 796212 --- stripped bytes : 288762 +-- original bytes : 796558 +-- stripped bytes : 288905 -- end library merge |