diff options
78 files changed, 926 insertions, 541 deletions
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index 36c71e463..8f2363229 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -66,7 +66,6 @@ expert options: --update update context from website (not to be confused with contextgarden) --profile profile job (use: mtxrun --script profile --analyze) --timing generate timing and statistics overview ---tracefiles show some extra info when locating files (at the tex end) --extra=name process extra (mtx-context-<name> in distribution) --extras show extras @@ -526,14 +525,15 @@ function scripts.context.multipass.makeoptionfile(jobname,ctxdata,kindofrun,curr -- setalways("%% feedback and basic job control") -- - -- Option file, we can pass more on the commandline some day soon. + -- Option file, we can pass more on the commandline some day soon. Actually we + -- should use directives and trackers. -- setfixed ("timing" , "\\usemodule[timing]") setfixed ("batchmode" , "\\batchmode") setfixed ("batch" , "\\batchmode") setfixed ("nonstopmode" , "\\nonstopmode") setfixed ("nonstop" , "\\nonstopmode") - setfixed ("tracefiles" , "\\tracefilestrue") + -- setfixed ("tracefiles" , "\\tracefilestrue") setfixed ("nostats" , "\\nomkivstatistics") setfixed ("paranoid" , "\\def\\maxreadlevel{1}") -- diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 488594892..af7298858 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -3920,7 +3920,7 @@ local tables = utilities.tables local format, gmatch, rep = string.format, string.gmatch, string.rep local concat, insert, remove = table.concat, table.insert, table.remove local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatable, tonumber, tostring -local type, next, rawset = type, next, rawset +local type, next, rawset, tonumber = type, next, rawset, tonumber function tables.definetable(target) -- defines undefined tables local composed, t, n = nil, { }, 0 @@ -3990,10 +3990,16 @@ end local function toxml(t,d,result,step) for k, v in table.sortedpairs(t) do if type(v) == "table" then - result[#result+1] = format("%s<%s>",d,k) - toxml(v,d..step,result) - result[#result+1] = format("%s</%s>",d,k) - elseif tonumber(k) then + if type(k) == "number" then + result[#result+1] = format("%s<entry n='%s'>",d,k) + toxml(v,d..step,result,step) + result[#result+1] = format("%s</entry>",d,k) + else + result[#result+1] = format("%s<%s>",d,k) + toxml(v,d..step,result,step) + result[#result+1] = format("%s</%s>",d,k) + end + elseif type(k) == "number" then result[#result+1] = format("%s<entry n='%s'>%s</entry>",d,k,v,k) else result[#result+1] = format("%s<%s>%s</%s>",d,k,tostring(v),k) @@ -10739,7 +10745,7 @@ end resolvers.updaterelations() -- push this in the metatable -> newindex local function simplified(t,k) - return rawget(t,lower(gsub(k," ",""))) + return k and rawget(t,lower(gsub(k," ",""))) or nil end setmetatableindex(formats, simplified) @@ -12197,9 +12203,22 @@ local function collect_files(names) return noffiles > 0 and filelist or nil end -function resolvers.registerintrees(name) - if not find(name,"^%.") then - instance.foundintrees[name] = (instance.foundintrees[name] or 0) + 1 -- maybe only one +local fit = { } + +function resolvers.registerintrees(filename,format,filetype,usedmethod,foundname) + local foundintrees = instance.foundintrees + if usedmethod == "direct" and filename == foundname and fit[foundname] then + -- just an extra lookup after a test on presence + else + local t = { + filename = filename, + format = format ~= "" and format or nil, + filetype = filetype ~= "" and filetype or nil, + usedmethod = usedmethod, + foundname = foundname, + } + fit[foundname] = t + foundintrees[#foundintrees+1] = t end end @@ -12223,12 +12242,54 @@ local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$")) local collect_instance_files +local function find_analyze(filename,askedformat,allresults) + local filetype, wantedfiles, ext = '', { }, fileextname(filename) + -- too tricky as filename can be bla.1.2.3: + -- + -- if not suffixmap[ext] then + -- wantedfiles[#wantedfiles+1] = filename + -- end + wantedfiles[#wantedfiles+1] = filename + if askedformat == "" then + if ext == "" or not suffixmap[ext] then + local defaultsuffixes = resolvers.defaultsuffixes + for i=1,#defaultsuffixes do + local forcedname = filename .. '.' .. defaultsuffixes[i] + wantedfiles[#wantedfiles+1] = forcedname + filetype = resolvers.formatofsuffix(forcedname) + if trace_locating then + report_resolving("forcing filetype '%s'",filetype) + end + end + else + filetype = resolvers.formatofsuffix(filename) + if trace_locating then + report_resolving("using suffix based filetype '%s'",filetype) + end + end + else + if ext == "" or not suffixmap[ext] then + local format_suffixes = suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] + end + end + end + filetype = askedformat + if trace_locating then + report_resolving("using given filetype '%s'",filetype) + end + end + return filetype, wantedfiles +end + local function find_direct(filename,allresults) if not dangerous[askedformat] and isreadable(filename) then if trace_detail then report_resolving("file '%s' found directly",filename) end - return { filename } + return "direct", { filename } end end @@ -12237,7 +12298,10 @@ local function find_wildcard(filename,allresults) if trace_locating then report_resolving("checking wildcard '%s'", filename) end - return resolvers.findwildcardfiles(filename) -- we can use the local + local method, result = resolvers.findwildcardfiles(filename) + if result then + return "wildcard", result + end end end @@ -12252,7 +12316,7 @@ local function find_qualified(filename,allresults) -- this one will be split too if trace_detail then report_resolving("qualified file '%s' found", filename) end - return { filename } + return "qualified", { filename } end if trace_detail then report_resolving("locating qualified file '%s'", filename) @@ -12268,12 +12332,12 @@ local function find_qualified(filename,allresults) -- this one will be split too if trace_locating then report_resolving("no suffix, forcing format filetype '%s'", s) end - return { forcedname } + return "qualified", { forcedname } end end end end - if suffix ~= "" then + if suffix and suffix ~= "" then -- try to find in tree (no suffix manipulation), here we search for the -- matching last part of the name local basename = filebasename(filename) @@ -12307,7 +12371,7 @@ local function find_qualified(filename,allresults) -- this one will be split too end end if #result > 0 then - return result + return "qualified", result end end end @@ -12322,53 +12386,11 @@ local function find_qualified(filename,allresults) -- this one will be split too -- end -- end -- if #result > 0 then - -- return result + -- return "qualified", result -- end end end -local function find_analyze(filename,askedformat,allresults) - local filetype, wantedfiles, ext = '', { }, fileextname(filename) - -- too tricky as filename can be bla.1.2.3: - -- - -- if not suffixmap[ext] then - -- wantedfiles[#wantedfiles+1] = filename - -- end - wantedfiles[#wantedfiles+1] = filename - if askedformat == "" then - if ext == "" or not suffixmap[ext] then - local defaultsuffixes = resolvers.defaultsuffixes - for i=1,#defaultsuffixes do - local forcedname = filename .. '.' .. defaultsuffixes[i] - wantedfiles[#wantedfiles+1] = forcedname - filetype = resolvers.formatofsuffix(forcedname) - if trace_locating then - report_resolving("forcing filetype '%s'",filetype) - end - end - else - filetype = resolvers.formatofsuffix(filename) - if trace_locating then - report_resolving("using suffix based filetype '%s'",filetype) - end - end - else - if ext == "" or not suffixmap[ext] then - local format_suffixes = suffixes[askedformat] - if format_suffixes then - for i=1,#format_suffixes do - wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] - end - end - end - filetype = askedformat - if trace_locating then - report_resolving("using given filetype '%s'",filetype) - end - end - return filetype, wantedfiles -end - local function check_subpath(fname) if isreadable(fname) then if trace_detail then @@ -12499,9 +12521,12 @@ local function find_intree(filename,filetype,wantedfiles,allresults) end -- todo recursive scanning if done and not allresults then - return #result > 0 and result + break end end + if #result > 0 then + return "intree", result + end end end @@ -12520,36 +12545,40 @@ local function find_onpath(filename,filetype,wantedfiles,allresults) end end end - return #result > 0 and result + if #result > 0 then + return "onpath", result + end end local function find_otherwise(filename,filetype,wantedfiles,allresults) -- other text files | any | whatever local filelist = collect_files(wantedfiles) local fl = filelist and filelist[1] if fl then - return { resolvers.resolve(fl[3]) } -- filename + return "otherwise", { resolvers.resolve(fl[3]) } -- filename end end +-- we could have a loop over the 6 functions but then we'd have to +-- always analyze + collect_instance_files = function(filename,askedformat,allresults) -- uses nested - local result, stamp, filetype, wantedfiles askedformat = askedformat or "" filename = collapsepath(filename) if allresults then -- no need for caching, only used for tracing local filetype, wantedfiles = find_analyze(filename,askedformat) local results = { - { method = "direct", list = find_direct (filename,stamp,true) }, - { method = "wildcard", list = find_wildcard (filename,true) }, - { method = "qualified", list = find_qualified(filename,true) }, - { method = "in tree", list = find_intree (filename,filetype,wantedfiles,true) }, - { method = "on path", list = find_onpath (filename,filetype,wantedfiles,true) }, - { method = "otherwise", list = find_otherwise(filename,filetype,wantedfiles,true) }, + { find_direct (filename,true) }, + { find_wildcard (filename,true) }, + { find_qualified(filename,true) }, + { find_intree (filename,filetype,wantedfiles,true) }, + { find_onpath (filename,filetype,wantedfiles,true) }, + { find_otherwise(filename,filetype,wantedfiles,true) }, } local result, status, done = { }, { }, { } for k, r in next, results do - local method, list = r.method, r.list - if list then + local method, list = r[1], r[2] + if method and list then for i=1,#list do local c = collapsepath(list[i]) if not done[c] then @@ -12565,6 +12594,7 @@ collect_instance_files = function(filename,askedformat,allresults) -- uses neste end return result, status else + local method, result, stamp, filetype, wantedfiles if instance.remember then stamp = format("%s--%s", filename, askedformat) result = stamp and instance.found[stamp] @@ -12575,21 +12605,27 @@ collect_instance_files = function(filename,askedformat,allresults) -- uses neste return result end end - result = find_direct (filename,stamp) or - find_wildcard (filename) or - find_qualified(filename) + method, result = find_direct(filename) if not result then - local filetype, wantedfiles = find_analyze(filename,askedformat) - result = find_intree (filename,filetype,wantedfiles) or - find_onpath (filename,filetype,wantedfiles) or - find_otherwise(filename,filetype,wantedfiles) - end - if result then - for k=1,#result do - local rk = collapsepath(result[k]) - result[k] = rk - resolvers.registerintrees(rk) -- for tracing used files + method, result = find_wildcard(filename) + if not result then + method, result = find_qualified(filename) + if not result then + filetype, wantedfiles = find_analyze(filename,askedformat) + method, result = find_intree(filename,filetype,wantedfiles) + if not result then + method, result = find_onpath(filename,filetype,wantedfiles) + if not result then + method, result = find_otherwise(filename,filetype,wantedfiles) + end + end + end end + end + if result and #result > 0 then + local foundname = collapsepath(result[1]) + resolvers.registerintrees(filename,askedformat,filetype,method,foundname) + result = { foundname } else result = { } -- maybe false end @@ -14971,11 +15007,11 @@ function runners.execute_script(fullname,internal,nosplit) environment.ownscript = result dofile(result) else + local binary = runners.applications[file.extname(result)] result = string.quoted(string.unquoted(result)) -- if string.match(result,' ') and not string.match(result,"^\".*\"$") then -- result = '"' .. result .. '"' -- end - local binary = runners.applications[file.extname(result)] if binary and binary ~= "" then result = binary .. " " .. result end diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 488594892..af7298858 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -3920,7 +3920,7 @@ local tables = utilities.tables local format, gmatch, rep = string.format, string.gmatch, string.rep local concat, insert, remove = table.concat, table.insert, table.remove local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatable, tonumber, tostring -local type, next, rawset = type, next, rawset +local type, next, rawset, tonumber = type, next, rawset, tonumber function tables.definetable(target) -- defines undefined tables local composed, t, n = nil, { }, 0 @@ -3990,10 +3990,16 @@ end local function toxml(t,d,result,step) for k, v in table.sortedpairs(t) do if type(v) == "table" then - result[#result+1] = format("%s<%s>",d,k) - toxml(v,d..step,result) - result[#result+1] = format("%s</%s>",d,k) - elseif tonumber(k) then + if type(k) == "number" then + result[#result+1] = format("%s<entry n='%s'>",d,k) + toxml(v,d..step,result,step) + result[#result+1] = format("%s</entry>",d,k) + else + result[#result+1] = format("%s<%s>",d,k) + toxml(v,d..step,result,step) + result[#result+1] = format("%s</%s>",d,k) + end + elseif type(k) == "number" then result[#result+1] = format("%s<entry n='%s'>%s</entry>",d,k,v,k) else result[#result+1] = format("%s<%s>%s</%s>",d,k,tostring(v),k) @@ -10739,7 +10745,7 @@ end resolvers.updaterelations() -- push this in the metatable -> newindex local function simplified(t,k) - return rawget(t,lower(gsub(k," ",""))) + return k and rawget(t,lower(gsub(k," ",""))) or nil end setmetatableindex(formats, simplified) @@ -12197,9 +12203,22 @@ local function collect_files(names) return noffiles > 0 and filelist or nil end -function resolvers.registerintrees(name) - if not find(name,"^%.") then - instance.foundintrees[name] = (instance.foundintrees[name] or 0) + 1 -- maybe only one +local fit = { } + +function resolvers.registerintrees(filename,format,filetype,usedmethod,foundname) + local foundintrees = instance.foundintrees + if usedmethod == "direct" and filename == foundname and fit[foundname] then + -- just an extra lookup after a test on presence + else + local t = { + filename = filename, + format = format ~= "" and format or nil, + filetype = filetype ~= "" and filetype or nil, + usedmethod = usedmethod, + foundname = foundname, + } + fit[foundname] = t + foundintrees[#foundintrees+1] = t end end @@ -12223,12 +12242,54 @@ local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$")) local collect_instance_files +local function find_analyze(filename,askedformat,allresults) + local filetype, wantedfiles, ext = '', { }, fileextname(filename) + -- too tricky as filename can be bla.1.2.3: + -- + -- if not suffixmap[ext] then + -- wantedfiles[#wantedfiles+1] = filename + -- end + wantedfiles[#wantedfiles+1] = filename + if askedformat == "" then + if ext == "" or not suffixmap[ext] then + local defaultsuffixes = resolvers.defaultsuffixes + for i=1,#defaultsuffixes do + local forcedname = filename .. '.' .. defaultsuffixes[i] + wantedfiles[#wantedfiles+1] = forcedname + filetype = resolvers.formatofsuffix(forcedname) + if trace_locating then + report_resolving("forcing filetype '%s'",filetype) + end + end + else + filetype = resolvers.formatofsuffix(filename) + if trace_locating then + report_resolving("using suffix based filetype '%s'",filetype) + end + end + else + if ext == "" or not suffixmap[ext] then + local format_suffixes = suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] + end + end + end + filetype = askedformat + if trace_locating then + report_resolving("using given filetype '%s'",filetype) + end + end + return filetype, wantedfiles +end + local function find_direct(filename,allresults) if not dangerous[askedformat] and isreadable(filename) then if trace_detail then report_resolving("file '%s' found directly",filename) end - return { filename } + return "direct", { filename } end end @@ -12237,7 +12298,10 @@ local function find_wildcard(filename,allresults) if trace_locating then report_resolving("checking wildcard '%s'", filename) end - return resolvers.findwildcardfiles(filename) -- we can use the local + local method, result = resolvers.findwildcardfiles(filename) + if result then + return "wildcard", result + end end end @@ -12252,7 +12316,7 @@ local function find_qualified(filename,allresults) -- this one will be split too if trace_detail then report_resolving("qualified file '%s' found", filename) end - return { filename } + return "qualified", { filename } end if trace_detail then report_resolving("locating qualified file '%s'", filename) @@ -12268,12 +12332,12 @@ local function find_qualified(filename,allresults) -- this one will be split too if trace_locating then report_resolving("no suffix, forcing format filetype '%s'", s) end - return { forcedname } + return "qualified", { forcedname } end end end end - if suffix ~= "" then + if suffix and suffix ~= "" then -- try to find in tree (no suffix manipulation), here we search for the -- matching last part of the name local basename = filebasename(filename) @@ -12307,7 +12371,7 @@ local function find_qualified(filename,allresults) -- this one will be split too end end if #result > 0 then - return result + return "qualified", result end end end @@ -12322,53 +12386,11 @@ local function find_qualified(filename,allresults) -- this one will be split too -- end -- end -- if #result > 0 then - -- return result + -- return "qualified", result -- end end end -local function find_analyze(filename,askedformat,allresults) - local filetype, wantedfiles, ext = '', { }, fileextname(filename) - -- too tricky as filename can be bla.1.2.3: - -- - -- if not suffixmap[ext] then - -- wantedfiles[#wantedfiles+1] = filename - -- end - wantedfiles[#wantedfiles+1] = filename - if askedformat == "" then - if ext == "" or not suffixmap[ext] then - local defaultsuffixes = resolvers.defaultsuffixes - for i=1,#defaultsuffixes do - local forcedname = filename .. '.' .. defaultsuffixes[i] - wantedfiles[#wantedfiles+1] = forcedname - filetype = resolvers.formatofsuffix(forcedname) - if trace_locating then - report_resolving("forcing filetype '%s'",filetype) - end - end - else - filetype = resolvers.formatofsuffix(filename) - if trace_locating then - report_resolving("using suffix based filetype '%s'",filetype) - end - end - else - if ext == "" or not suffixmap[ext] then - local format_suffixes = suffixes[askedformat] - if format_suffixes then - for i=1,#format_suffixes do - wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] - end - end - end - filetype = askedformat - if trace_locating then - report_resolving("using given filetype '%s'",filetype) - end - end - return filetype, wantedfiles -end - local function check_subpath(fname) if isreadable(fname) then if trace_detail then @@ -12499,9 +12521,12 @@ local function find_intree(filename,filetype,wantedfiles,allresults) end -- todo recursive scanning if done and not allresults then - return #result > 0 and result + break end end + if #result > 0 then + return "intree", result + end end end @@ -12520,36 +12545,40 @@ local function find_onpath(filename,filetype,wantedfiles,allresults) end end end - return #result > 0 and result + if #result > 0 then + return "onpath", result + end end local function find_otherwise(filename,filetype,wantedfiles,allresults) -- other text files | any | whatever local filelist = collect_files(wantedfiles) local fl = filelist and filelist[1] if fl then - return { resolvers.resolve(fl[3]) } -- filename + return "otherwise", { resolvers.resolve(fl[3]) } -- filename end end +-- we could have a loop over the 6 functions but then we'd have to +-- always analyze + collect_instance_files = function(filename,askedformat,allresults) -- uses nested - local result, stamp, filetype, wantedfiles askedformat = askedformat or "" filename = collapsepath(filename) if allresults then -- no need for caching, only used for tracing local filetype, wantedfiles = find_analyze(filename,askedformat) local results = { - { method = "direct", list = find_direct (filename,stamp,true) }, - { method = "wildcard", list = find_wildcard (filename,true) }, - { method = "qualified", list = find_qualified(filename,true) }, - { method = "in tree", list = find_intree (filename,filetype,wantedfiles,true) }, - { method = "on path", list = find_onpath (filename,filetype,wantedfiles,true) }, - { method = "otherwise", list = find_otherwise(filename,filetype,wantedfiles,true) }, + { find_direct (filename,true) }, + { find_wildcard (filename,true) }, + { find_qualified(filename,true) }, + { find_intree (filename,filetype,wantedfiles,true) }, + { find_onpath (filename,filetype,wantedfiles,true) }, + { find_otherwise(filename,filetype,wantedfiles,true) }, } local result, status, done = { }, { }, { } for k, r in next, results do - local method, list = r.method, r.list - if list then + local method, list = r[1], r[2] + if method and list then for i=1,#list do local c = collapsepath(list[i]) if not done[c] then @@ -12565,6 +12594,7 @@ collect_instance_files = function(filename,askedformat,allresults) -- uses neste end return result, status else + local method, result, stamp, filetype, wantedfiles if instance.remember then stamp = format("%s--%s", filename, askedformat) result = stamp and instance.found[stamp] @@ -12575,21 +12605,27 @@ collect_instance_files = function(filename,askedformat,allresults) -- uses neste return result end end - result = find_direct (filename,stamp) or - find_wildcard (filename) or - find_qualified(filename) + method, result = find_direct(filename) if not result then - local filetype, wantedfiles = find_analyze(filename,askedformat) - result = find_intree (filename,filetype,wantedfiles) or - find_onpath (filename,filetype,wantedfiles) or - find_otherwise(filename,filetype,wantedfiles) - end - if result then - for k=1,#result do - local rk = collapsepath(result[k]) - result[k] = rk - resolvers.registerintrees(rk) -- for tracing used files + method, result = find_wildcard(filename) + if not result then + method, result = find_qualified(filename) + if not result then + filetype, wantedfiles = find_analyze(filename,askedformat) + method, result = find_intree(filename,filetype,wantedfiles) + if not result then + method, result = find_onpath(filename,filetype,wantedfiles) + if not result then + method, result = find_otherwise(filename,filetype,wantedfiles) + end + end + end end + end + if result and #result > 0 then + local foundname = collapsepath(result[1]) + resolvers.registerintrees(filename,askedformat,filetype,method,foundname) + result = { foundname } else result = { } -- maybe false end @@ -14971,11 +15007,11 @@ function runners.execute_script(fullname,internal,nosplit) environment.ownscript = result dofile(result) else + local binary = runners.applications[file.extname(result)] result = string.quoted(string.unquoted(result)) -- if string.match(result,' ') and not string.match(result,"^\".*\"$") then -- result = '"' .. result .. '"' -- end - local binary = runners.applications[file.extname(result)] if binary and binary ~= "" then result = binary .. " " .. result end diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 488594892..af7298858 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -3920,7 +3920,7 @@ local tables = utilities.tables local format, gmatch, rep = string.format, string.gmatch, string.rep local concat, insert, remove = table.concat, table.insert, table.remove local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatable, tonumber, tostring -local type, next, rawset = type, next, rawset +local type, next, rawset, tonumber = type, next, rawset, tonumber function tables.definetable(target) -- defines undefined tables local composed, t, n = nil, { }, 0 @@ -3990,10 +3990,16 @@ end local function toxml(t,d,result,step) for k, v in table.sortedpairs(t) do if type(v) == "table" then - result[#result+1] = format("%s<%s>",d,k) - toxml(v,d..step,result) - result[#result+1] = format("%s</%s>",d,k) - elseif tonumber(k) then + if type(k) == "number" then + result[#result+1] = format("%s<entry n='%s'>",d,k) + toxml(v,d..step,result,step) + result[#result+1] = format("%s</entry>",d,k) + else + result[#result+1] = format("%s<%s>",d,k) + toxml(v,d..step,result,step) + result[#result+1] = format("%s</%s>",d,k) + end + elseif type(k) == "number" then result[#result+1] = format("%s<entry n='%s'>%s</entry>",d,k,v,k) else result[#result+1] = format("%s<%s>%s</%s>",d,k,tostring(v),k) @@ -10739,7 +10745,7 @@ end resolvers.updaterelations() -- push this in the metatable -> newindex local function simplified(t,k) - return rawget(t,lower(gsub(k," ",""))) + return k and rawget(t,lower(gsub(k," ",""))) or nil end setmetatableindex(formats, simplified) @@ -12197,9 +12203,22 @@ local function collect_files(names) return noffiles > 0 and filelist or nil end -function resolvers.registerintrees(name) - if not find(name,"^%.") then - instance.foundintrees[name] = (instance.foundintrees[name] or 0) + 1 -- maybe only one +local fit = { } + +function resolvers.registerintrees(filename,format,filetype,usedmethod,foundname) + local foundintrees = instance.foundintrees + if usedmethod == "direct" and filename == foundname and fit[foundname] then + -- just an extra lookup after a test on presence + else + local t = { + filename = filename, + format = format ~= "" and format or nil, + filetype = filetype ~= "" and filetype or nil, + usedmethod = usedmethod, + foundname = foundname, + } + fit[foundname] = t + foundintrees[#foundintrees+1] = t end end @@ -12223,12 +12242,54 @@ local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$")) local collect_instance_files +local function find_analyze(filename,askedformat,allresults) + local filetype, wantedfiles, ext = '', { }, fileextname(filename) + -- too tricky as filename can be bla.1.2.3: + -- + -- if not suffixmap[ext] then + -- wantedfiles[#wantedfiles+1] = filename + -- end + wantedfiles[#wantedfiles+1] = filename + if askedformat == "" then + if ext == "" or not suffixmap[ext] then + local defaultsuffixes = resolvers.defaultsuffixes + for i=1,#defaultsuffixes do + local forcedname = filename .. '.' .. defaultsuffixes[i] + wantedfiles[#wantedfiles+1] = forcedname + filetype = resolvers.formatofsuffix(forcedname) + if trace_locating then + report_resolving("forcing filetype '%s'",filetype) + end + end + else + filetype = resolvers.formatofsuffix(filename) + if trace_locating then + report_resolving("using suffix based filetype '%s'",filetype) + end + end + else + if ext == "" or not suffixmap[ext] then + local format_suffixes = suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] + end + end + end + filetype = askedformat + if trace_locating then + report_resolving("using given filetype '%s'",filetype) + end + end + return filetype, wantedfiles +end + local function find_direct(filename,allresults) if not dangerous[askedformat] and isreadable(filename) then if trace_detail then report_resolving("file '%s' found directly",filename) end - return { filename } + return "direct", { filename } end end @@ -12237,7 +12298,10 @@ local function find_wildcard(filename,allresults) if trace_locating then report_resolving("checking wildcard '%s'", filename) end - return resolvers.findwildcardfiles(filename) -- we can use the local + local method, result = resolvers.findwildcardfiles(filename) + if result then + return "wildcard", result + end end end @@ -12252,7 +12316,7 @@ local function find_qualified(filename,allresults) -- this one will be split too if trace_detail then report_resolving("qualified file '%s' found", filename) end - return { filename } + return "qualified", { filename } end if trace_detail then report_resolving("locating qualified file '%s'", filename) @@ -12268,12 +12332,12 @@ local function find_qualified(filename,allresults) -- this one will be split too if trace_locating then report_resolving("no suffix, forcing format filetype '%s'", s) end - return { forcedname } + return "qualified", { forcedname } end end end end - if suffix ~= "" then + if suffix and suffix ~= "" then -- try to find in tree (no suffix manipulation), here we search for the -- matching last part of the name local basename = filebasename(filename) @@ -12307,7 +12371,7 @@ local function find_qualified(filename,allresults) -- this one will be split too end end if #result > 0 then - return result + return "qualified", result end end end @@ -12322,53 +12386,11 @@ local function find_qualified(filename,allresults) -- this one will be split too -- end -- end -- if #result > 0 then - -- return result + -- return "qualified", result -- end end end -local function find_analyze(filename,askedformat,allresults) - local filetype, wantedfiles, ext = '', { }, fileextname(filename) - -- too tricky as filename can be bla.1.2.3: - -- - -- if not suffixmap[ext] then - -- wantedfiles[#wantedfiles+1] = filename - -- end - wantedfiles[#wantedfiles+1] = filename - if askedformat == "" then - if ext == "" or not suffixmap[ext] then - local defaultsuffixes = resolvers.defaultsuffixes - for i=1,#defaultsuffixes do - local forcedname = filename .. '.' .. defaultsuffixes[i] - wantedfiles[#wantedfiles+1] = forcedname - filetype = resolvers.formatofsuffix(forcedname) - if trace_locating then - report_resolving("forcing filetype '%s'",filetype) - end - end - else - filetype = resolvers.formatofsuffix(filename) - if trace_locating then - report_resolving("using suffix based filetype '%s'",filetype) - end - end - else - if ext == "" or not suffixmap[ext] then - local format_suffixes = suffixes[askedformat] - if format_suffixes then - for i=1,#format_suffixes do - wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] - end - end - end - filetype = askedformat - if trace_locating then - report_resolving("using given filetype '%s'",filetype) - end - end - return filetype, wantedfiles -end - local function check_subpath(fname) if isreadable(fname) then if trace_detail then @@ -12499,9 +12521,12 @@ local function find_intree(filename,filetype,wantedfiles,allresults) end -- todo recursive scanning if done and not allresults then - return #result > 0 and result + break end end + if #result > 0 then + return "intree", result + end end end @@ -12520,36 +12545,40 @@ local function find_onpath(filename,filetype,wantedfiles,allresults) end end end - return #result > 0 and result + if #result > 0 then + return "onpath", result + end end local function find_otherwise(filename,filetype,wantedfiles,allresults) -- other text files | any | whatever local filelist = collect_files(wantedfiles) local fl = filelist and filelist[1] if fl then - return { resolvers.resolve(fl[3]) } -- filename + return "otherwise", { resolvers.resolve(fl[3]) } -- filename end end +-- we could have a loop over the 6 functions but then we'd have to +-- always analyze + collect_instance_files = function(filename,askedformat,allresults) -- uses nested - local result, stamp, filetype, wantedfiles askedformat = askedformat or "" filename = collapsepath(filename) if allresults then -- no need for caching, only used for tracing local filetype, wantedfiles = find_analyze(filename,askedformat) local results = { - { method = "direct", list = find_direct (filename,stamp,true) }, - { method = "wildcard", list = find_wildcard (filename,true) }, - { method = "qualified", list = find_qualified(filename,true) }, - { method = "in tree", list = find_intree (filename,filetype,wantedfiles,true) }, - { method = "on path", list = find_onpath (filename,filetype,wantedfiles,true) }, - { method = "otherwise", list = find_otherwise(filename,filetype,wantedfiles,true) }, + { find_direct (filename,true) }, + { find_wildcard (filename,true) }, + { find_qualified(filename,true) }, + { find_intree (filename,filetype,wantedfiles,true) }, + { find_onpath (filename,filetype,wantedfiles,true) }, + { find_otherwise(filename,filetype,wantedfiles,true) }, } local result, status, done = { }, { }, { } for k, r in next, results do - local method, list = r.method, r.list - if list then + local method, list = r[1], r[2] + if method and list then for i=1,#list do local c = collapsepath(list[i]) if not done[c] then @@ -12565,6 +12594,7 @@ collect_instance_files = function(filename,askedformat,allresults) -- uses neste end return result, status else + local method, result, stamp, filetype, wantedfiles if instance.remember then stamp = format("%s--%s", filename, askedformat) result = stamp and instance.found[stamp] @@ -12575,21 +12605,27 @@ collect_instance_files = function(filename,askedformat,allresults) -- uses neste return result end end - result = find_direct (filename,stamp) or - find_wildcard (filename) or - find_qualified(filename) + method, result = find_direct(filename) if not result then - local filetype, wantedfiles = find_analyze(filename,askedformat) - result = find_intree (filename,filetype,wantedfiles) or - find_onpath (filename,filetype,wantedfiles) or - find_otherwise(filename,filetype,wantedfiles) - end - if result then - for k=1,#result do - local rk = collapsepath(result[k]) - result[k] = rk - resolvers.registerintrees(rk) -- for tracing used files + method, result = find_wildcard(filename) + if not result then + method, result = find_qualified(filename) + if not result then + filetype, wantedfiles = find_analyze(filename,askedformat) + method, result = find_intree(filename,filetype,wantedfiles) + if not result then + method, result = find_onpath(filename,filetype,wantedfiles) + if not result then + method, result = find_otherwise(filename,filetype,wantedfiles) + end + end + end end + end + if result and #result > 0 then + local foundname = collapsepath(result[1]) + resolvers.registerintrees(filename,askedformat,filetype,method,foundname) + result = { foundname } else result = { } -- maybe false end @@ -14971,11 +15007,11 @@ function runners.execute_script(fullname,internal,nosplit) environment.ownscript = result dofile(result) else + local binary = runners.applications[file.extname(result)] result = string.quoted(string.unquoted(result)) -- if string.match(result,' ') and not string.match(result,"^\".*\"$") then -- result = '"' .. result .. '"' -- end - local binary = runners.applications[file.extname(result)] if binary and binary ~= "" then result = binary .. " " .. result end diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 543239126..49ea38041 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -26,9 +26,16 @@ local insert, remove = table.insert, table.remove local topoints = number.topoints local utfvalues = string.utfvalues -local trace_export = false trackers.register ("structures.export", function(v) trace_export = v end) -local less_state = false directives.register("structures.export.lessstate", function(v) less_state = v end) -local show_comment = true directives.register("structures.export.comment", function(v) show_comment = v end) +local trace_export = false trackers.register ("export.trace", function(v) trace_export = v end) +local less_state = false directives.register("export.lessstate", function(v) less_state = v end) +local show_comment = true directives.register("export.comment", function(v) show_comment = v end) + +-- maybe we will also support these: +-- +-- local css_hyphens = false directives.register("export.css.hyphens", function(v) css_hyphens = v end) +-- local css_textalign = false directives.register("export.css.textalign", function(v) css_textalign = v end) +-- local css_bodyfontsize = false directives.register("export.css.bodyfontsize", function(v) css_bodyfontsize = v end) +-- local css_textwidth = false directives.register("export.css.textwidth", function(v) css_textwidth = v end) local report_export = logs.reporter("backend","export") @@ -84,6 +91,8 @@ local traverse_id = node.traverse_id local traverse_nodes = node.traverse local slide_nodelist = node.slide local texattribute = tex.attribute +local texdimen = tex.dimen +local texcount = tex.count local unsetvalue = attributes.unsetvalue local locate_node = nodes.locate @@ -113,11 +122,15 @@ local currentparagraph = nil local noftextblocks = 0 local attributehash = { } -- to be considered: set the values at the tex end +local hyphencode = 0xAD local hyphen = utfchar(0xAD) -- todo: also emdash etc local colonsplitter = lpeg.splitat(":") local dashsplitter = lpeg.splitat("-") local threshold = 65536 local indexing = false +local keephyphens = false + +local finetuning = { } local treestack = { } local nesting = { } @@ -138,6 +151,19 @@ local somespace = { [0x20] = true, [" "] = true } -- for testing local entities = { ["&"] = "&", [">"] = ">", ["<"] = "<" } local attribentities = { ["&"] = "&", [">"] = ">", ["<"] = "<", ['"'] = "quot;" } +local alignmapping = { + flushright = "right", + middle = "center", + flushleft = "left", +} + +local numbertoallign = { + [0] = "justify", ["0"] = "justify", [variables.normal ] = "justify", + [1] = "right", ["1"] = "right", [variables.flushright] = "right", + [2] = "center", ["2"] = "center", [variables.middle ] = "center", + [3] = "left", ["3"] = "left", [variables.flushleft ] = "left", +} + local defaultnature = "mixed" -- "inline" setmetatableindex(used, function(t,k) @@ -258,9 +284,23 @@ end -- experiment: styles and images +-- +-- officially we should convert to bp but we round anyway local usedstyles = { } +-- /* padding : ; */ +-- /* text-justify : inter-word ; */ + +local documenttemplate = [[ +document { + font-size : %s !important ; + max-width : %s !important ; + text-align : %s !important ; + hyphens : %s !important ; +} +]] + local styletemplate = [[ %s[detail='%s'] { font-style : %s ; @@ -271,6 +311,36 @@ local styletemplate = [[ local function allusedstyles(xmlfile) local result = { format("/* styles for file %s */",xmlfile) } + -- + local bodyfont = finetuning.bodyfont + local width = finetuning.width + local hyphen = finetuning.hyphen + local align = finetuning.align + -- + if not bodyfont or bodyfont == "" then + bodyfont = "12pt" + elseif type(bodyfont) == "number" then + bodyfont = number.todimen(bodyfont,"pt","%ipt") or "12pt" + end + if not width or width == "" then + width = "50em" + elseif type(width) == "number" then + width = number.todimen(width,"pt","%ipt") or "50em" + end + if hyphen == variables.yes then + hyphen = "manual" + else + hyphen = "inherited" + end + if align then + align = numbertoallign[align] + end + if not align then + align = hyphens and "justify" or "inherited" + end + -- + result[#result+1] = format(documenttemplate,bodyfont,width,align,hyphen) + -- for element, details in table.sortedpairs(usedstyles) do for detail, data in table.sortedpairs(details) do local s = xml.css.fontspecification(data.style) @@ -517,9 +587,9 @@ function extras.image(result,element,detail,n,fulltag,di) if data then result[#result+1] = attribute("name",data.name) if tonumber(data.page) > 1 then - result[#result+1] = format("page='%s'",data.page) + result[#result+1] = format(" page='%s'",data.page) end - result[#result+1] = format("id='%s' width='%s' height='%s'",fulltag,data.width,data.height) + result[#result+1] = format(" id='%s' width='%s' height='%s'",fulltag,data.width,data.height) end end @@ -670,6 +740,8 @@ function extras.link(result,element,detail,n,fulltag,di) end end +-- no settings, as these are obscure ones + local automathrows = true directives.register("backend.export.math.autorows", function(v) automathrows = v end) local automathapply = true directives.register("backend.export.math.autoapply", function(v) automathapply = v end) local automathnumber = true directives.register("backend.export.math.autonumber", function(v) automathnumber = v end) @@ -1065,7 +1137,7 @@ function extras.tablecell(result,element,detail,n,fulltag,di) local v = hash.align if not v or v == 0 then -- normal - elseif v == 1 then + elseif v == 1 then -- use numbertoalign here result[#result+1] = " align='flushright'" elseif v == 2 then result[#result+1] = " align='middle'" @@ -1788,6 +1860,13 @@ local function collectresults(head,list) -- is last used (we also have currentat collectresults(n.list,n) end elseif id == disc_code then -- probably too late + if keephyphens then + local pre = n.pre + if pre and not pre.next and pre.id == glyph_code and pre.char == hyphencode then + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = hyphen + end + end collectresults(n.replace,nil) elseif id == glue_code then -- we need to distinguish between hskips and vskips @@ -1859,7 +1938,9 @@ local function collectresults(head,list) -- is last used (we also have currentat if type(r) == "string" and r ~= " " then local s = utfsub(r,-1) if s == hyphen then - currentcontent[nofcurrentcontent] = utfsub(r,1,-2) + if not keephyphens then + currentcontent[nofcurrentcontent] = utfsub(r,1,-2) + end elseif s ~= "\n" then -- test without this if trace_export then @@ -1958,6 +2039,7 @@ local function wholepreamble() return format(xmlpreamble,tex.jobname,os.date(),environment.version,exportversion) end + local csspreamble = [[ <?xml-stylesheet type="text/css" href="%s"?> ]] @@ -2085,9 +2167,16 @@ local function stopexport(v) local templatefilename = file.replacesuffix(xmlfile,"template") local specificationfilename = file.replacesuffix(xmlfile,"specification") -- + if xhtml and not cssfile then + cssfile = true + end local cssfiles = { } - if type(cssfile) == "string" and cssfile ~= "" then - cssfiles = settings_to_array(cssfile) + if cssfile then + if cssfile == true then + cssfiles = { "export-example.css" } + else + cssfiles = settings_to_array(cssfile or "") + end insert(cssfiles,1,imagefilename) insert(cssfiles,1,stylefilename) end @@ -2145,6 +2234,11 @@ end local appendaction = nodes.tasks.appendaction local enableaction = nodes.tasks.enableaction +function commands.setupexport(t) + table.merge(finetuning,t) + keephyphens = finetuning.hyphen == variables.yes +end + local function startexport(v) if v and not exporting then report_export("enabling export to xml") diff --git a/tex/context/base/back-exp.mkiv b/tex/context/base/back-exp.mkiv index 715ccfd5c..217e32513 100644 --- a/tex/context/base/back-exp.mkiv +++ b/tex/context/base/back-exp.mkiv @@ -119,10 +119,36 @@ % The action: \setupbackend[export=yes] % or filename +% maybe we will move css to setupexport ? or just support both + \def\c!export {export} % maybe: option={css,xhtml} \def\c!css {css} \def\c!xhtml {xhtml} +% maybe some day a definer + +\installparameterhandler \??be {export} +\installsetuphandler \??be {export} + +\setupexport + [\c!align=\number\raggedstatus, + \c!bodyfont=\bodyfontsize, + \c!width=\textwidth, + \c!hyphen=\v!no] + +\def\dosynchronizeexport + {\let\currentexport\empty + \ctxcommand{setupexport{ + align = "\exportparameter\c!align", + bodyfont = \number\dimexpr\exportparameter\c!bodyfont, + width = \number\dimexpr\exportparameter\c!width, + hyphen = "\exportparameter\c!hyphen", + }}} + +\appendtoks + \doifsomething{\backendparameter\c!export}{\dosynchronizeexport}% +\to \everystarttext + \appendtoks \doifsomething{\backendparameter\c!xhtml} {\enabledirectives[backend.export.xhtml=\backendparameter\c!xhtml]}% diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 89141ffae..7cca8bab5 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.06.23 19:25} +\newcontextversion{2011.06.25 11:24} %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 b1f29d26e..b3e8ea877 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.06.23 19:25} +\newcontextversion{2011.06.25 11:24} %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.mkii b/tex/context/base/context.mkii index 5fb8b948c..d19325005 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.06.23 19:25} +\edef\contextversion{2011.06.25 11:24} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index f00b608af..ba826815a 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.06.23 19:25} +\edef\contextversion{2011.06.25 11:24} %D For those who want to use this: diff --git a/tex/context/base/data-env.lua b/tex/context/base/data-env.lua index 108858ccc..7d12f8d5f 100644 --- a/tex/context/base/data-env.lua +++ b/tex/context/base/data-env.lua @@ -231,7 +231,7 @@ end resolvers.updaterelations() -- push this in the metatable -> newindex local function simplified(t,k) - return rawget(t,lower(gsub(k," ",""))) + return k and rawget(t,lower(gsub(k," ",""))) or nil end setmetatableindex(formats, simplified) diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua index 83d30c994..d6de90ef0 100644 --- a/tex/context/base/data-res.lua +++ b/tex/context/base/data-res.lua @@ -872,9 +872,22 @@ local function collect_files(names) return noffiles > 0 and filelist or nil end -function resolvers.registerintrees(name) - if not find(name,"^%.") then - instance.foundintrees[name] = (instance.foundintrees[name] or 0) + 1 -- maybe only one +local fit = { } + +function resolvers.registerintrees(filename,format,filetype,usedmethod,foundname) + local foundintrees = instance.foundintrees + if usedmethod == "direct" and filename == foundname and fit[foundname] then + -- just an extra lookup after a test on presence + else + local t = { + filename = filename, + format = format ~= "" and format or nil, + filetype = filetype ~= "" and filetype or nil, + usedmethod = usedmethod, + foundname = foundname, + } + fit[foundname] = t + foundintrees[#foundintrees+1] = t end end @@ -898,12 +911,54 @@ local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$")) local collect_instance_files +local function find_analyze(filename,askedformat,allresults) + local filetype, wantedfiles, ext = '', { }, fileextname(filename) + -- too tricky as filename can be bla.1.2.3: + -- + -- if not suffixmap[ext] then + -- wantedfiles[#wantedfiles+1] = filename + -- end + wantedfiles[#wantedfiles+1] = filename + if askedformat == "" then + if ext == "" or not suffixmap[ext] then + local defaultsuffixes = resolvers.defaultsuffixes + for i=1,#defaultsuffixes do + local forcedname = filename .. '.' .. defaultsuffixes[i] + wantedfiles[#wantedfiles+1] = forcedname + filetype = resolvers.formatofsuffix(forcedname) + if trace_locating then + report_resolving("forcing filetype '%s'",filetype) + end + end + else + filetype = resolvers.formatofsuffix(filename) + if trace_locating then + report_resolving("using suffix based filetype '%s'",filetype) + end + end + else + if ext == "" or not suffixmap[ext] then + local format_suffixes = suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] + end + end + end + filetype = askedformat + if trace_locating then + report_resolving("using given filetype '%s'",filetype) + end + end + return filetype, wantedfiles +end + local function find_direct(filename,allresults) if not dangerous[askedformat] and isreadable(filename) then if trace_detail then report_resolving("file '%s' found directly",filename) end - return { filename } + return "direct", { filename } end end @@ -912,7 +967,10 @@ local function find_wildcard(filename,allresults) if trace_locating then report_resolving("checking wildcard '%s'", filename) end - return resolvers.findwildcardfiles(filename) -- we can use the local + local method, result = resolvers.findwildcardfiles(filename) + if result then + return "wildcard", result + end end end @@ -927,7 +985,7 @@ local function find_qualified(filename,allresults) -- this one will be split too if trace_detail then report_resolving("qualified file '%s' found", filename) end - return { filename } + return "qualified", { filename } end if trace_detail then report_resolving("locating qualified file '%s'", filename) @@ -943,12 +1001,12 @@ local function find_qualified(filename,allresults) -- this one will be split too if trace_locating then report_resolving("no suffix, forcing format filetype '%s'", s) end - return { forcedname } + return "qualified", { forcedname } end end end end - if suffix ~= "" then + if suffix and suffix ~= "" then -- try to find in tree (no suffix manipulation), here we search for the -- matching last part of the name local basename = filebasename(filename) @@ -982,7 +1040,7 @@ local function find_qualified(filename,allresults) -- this one will be split too end end if #result > 0 then - return result + return "qualified", result end end end @@ -997,53 +1055,11 @@ local function find_qualified(filename,allresults) -- this one will be split too -- end -- end -- if #result > 0 then - -- return result + -- return "qualified", result -- end end end -local function find_analyze(filename,askedformat,allresults) - local filetype, wantedfiles, ext = '', { }, fileextname(filename) - -- too tricky as filename can be bla.1.2.3: - -- - -- if not suffixmap[ext] then - -- wantedfiles[#wantedfiles+1] = filename - -- end - wantedfiles[#wantedfiles+1] = filename - if askedformat == "" then - if ext == "" or not suffixmap[ext] then - local defaultsuffixes = resolvers.defaultsuffixes - for i=1,#defaultsuffixes do - local forcedname = filename .. '.' .. defaultsuffixes[i] - wantedfiles[#wantedfiles+1] = forcedname - filetype = resolvers.formatofsuffix(forcedname) - if trace_locating then - report_resolving("forcing filetype '%s'",filetype) - end - end - else - filetype = resolvers.formatofsuffix(filename) - if trace_locating then - report_resolving("using suffix based filetype '%s'",filetype) - end - end - else - if ext == "" or not suffixmap[ext] then - local format_suffixes = suffixes[askedformat] - if format_suffixes then - for i=1,#format_suffixes do - wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] - end - end - end - filetype = askedformat - if trace_locating then - report_resolving("using given filetype '%s'",filetype) - end - end - return filetype, wantedfiles -end - local function check_subpath(fname) if isreadable(fname) then if trace_detail then @@ -1174,9 +1190,12 @@ local function find_intree(filename,filetype,wantedfiles,allresults) end -- todo recursive scanning if done and not allresults then - return #result > 0 and result + break end end + if #result > 0 then + return "intree", result + end end end @@ -1195,36 +1214,40 @@ local function find_onpath(filename,filetype,wantedfiles,allresults) end end end - return #result > 0 and result + if #result > 0 then + return "onpath", result + end end local function find_otherwise(filename,filetype,wantedfiles,allresults) -- other text files | any | whatever local filelist = collect_files(wantedfiles) local fl = filelist and filelist[1] if fl then - return { resolvers.resolve(fl[3]) } -- filename + return "otherwise", { resolvers.resolve(fl[3]) } -- filename end end +-- we could have a loop over the 6 functions but then we'd have to +-- always analyze + collect_instance_files = function(filename,askedformat,allresults) -- uses nested - local result, stamp, filetype, wantedfiles askedformat = askedformat or "" filename = collapsepath(filename) if allresults then -- no need for caching, only used for tracing local filetype, wantedfiles = find_analyze(filename,askedformat) local results = { - { method = "direct", list = find_direct (filename,stamp,true) }, - { method = "wildcard", list = find_wildcard (filename,true) }, - { method = "qualified", list = find_qualified(filename,true) }, - { method = "in tree", list = find_intree (filename,filetype,wantedfiles,true) }, - { method = "on path", list = find_onpath (filename,filetype,wantedfiles,true) }, - { method = "otherwise", list = find_otherwise(filename,filetype,wantedfiles,true) }, + { find_direct (filename,true) }, + { find_wildcard (filename,true) }, + { find_qualified(filename,true) }, + { find_intree (filename,filetype,wantedfiles,true) }, + { find_onpath (filename,filetype,wantedfiles,true) }, + { find_otherwise(filename,filetype,wantedfiles,true) }, } local result, status, done = { }, { }, { } for k, r in next, results do - local method, list = r.method, r.list - if list then + local method, list = r[1], r[2] + if method and list then for i=1,#list do local c = collapsepath(list[i]) if not done[c] then @@ -1240,6 +1263,7 @@ collect_instance_files = function(filename,askedformat,allresults) -- uses neste end return result, status else + local method, result, stamp, filetype, wantedfiles if instance.remember then stamp = format("%s--%s", filename, askedformat) result = stamp and instance.found[stamp] @@ -1250,21 +1274,27 @@ collect_instance_files = function(filename,askedformat,allresults) -- uses neste return result end end - result = find_direct (filename,stamp) or - find_wildcard (filename) or - find_qualified(filename) + method, result = find_direct(filename) if not result then - local filetype, wantedfiles = find_analyze(filename,askedformat) - result = find_intree (filename,filetype,wantedfiles) or - find_onpath (filename,filetype,wantedfiles) or - find_otherwise(filename,filetype,wantedfiles) - end - if result then - for k=1,#result do - local rk = collapsepath(result[k]) - result[k] = rk - resolvers.registerintrees(rk) -- for tracing used files + method, result = find_wildcard(filename) + if not result then + method, result = find_qualified(filename) + if not result then + filetype, wantedfiles = find_analyze(filename,askedformat) + method, result = find_intree(filename,filetype,wantedfiles) + if not result then + method, result = find_onpath(filename,filetype,wantedfiles) + if not result then + method, result = find_otherwise(filename,filetype,wantedfiles) + end + end + end end + end + if result and #result > 0 then + local foundname = collapsepath(result[1]) + resolvers.registerintrees(filename,askedformat,filetype,method,foundname) + result = { foundname } else result = { } -- maybe false end diff --git a/tex/context/base/export-example.css b/tex/context/base/export-example.css index 503d4279c..a6a366c1c 100644 --- a/tex/context/base/export-example.css +++ b/tex/context/base/export-example.css @@ -32,10 +32,13 @@ document:before { } document { - font-family : "Lucida Bright", "DejaVu Serif", serif ; - font-size : 12pt ; - width : 50em ; - padding : 1em ; + font-family : "DejaVu Serif", "Lucida Bright", serif ; + font-size : 12pt ; + max-width : 50em ; + padding : 1em ; + /* text-align : justify ; */ + /* hyphens : manual ; */ + /* text-justify : inter-word ; */ } document>metadata { diff --git a/tex/context/base/export-example.tex b/tex/context/base/export-example.tex index ae94642dd..3a70b92fd 100644 --- a/tex/context/base/export-example.tex +++ b/tex/context/base/export-example.tex @@ -2,13 +2,19 @@ \usemodule[abr-01] +\setupexport + [%bodyfont=16pt, + width=650pt, + %align=flushleft, + hyphen=yes] + \setupbackend [export=export-example.xml, xhtml=export-example.xhtml, css=export-example.css] -\definedescription - [description] +% \setupalign +% [flushleft] \settaggedmetadata [title=Export Example, @@ -21,9 +27,18 @@ \setupinteraction [state=start] +\setuplayout + [width=middle] + \setupwhitespace [big] +\definedescription + [description] + +\enabledirectives[export.css.hyphens=yes] +\enabledirectives[export.css.textwidth=100em] + \definehighlight[interesting][style=bold,color=red] \starttext diff --git a/tex/context/base/font-ext.lua b/tex/context/base/font-ext.lua index 97bee4d67..bbe10e95d 100644 --- a/tex/context/base/font-ext.lua +++ b/tex/context/base/font-ext.lua @@ -12,8 +12,6 @@ local gmatch, concat = string.gmatch, table.concat local utfchar = utf.char local getparameters = utilities.parsers.getparameters -local allocate = utilities.storage.allocate - local trace_protrusion = false trackers.register("fonts.protrusion", function(v) trace_protrusion = v end) local trace_expansion = false trackers.register("fonts.expansion", function(v) trace_expansion = v end) @@ -34,6 +32,10 @@ local registerotffeature = otffeatures.register local afmfeatures = fonts.constructors.newfeatures("afm") local registerafmfeature = afmfeatures.register +local allocate = utilities.storage.allocate +local settings_to_array = utilities.parsers.settings_to_array +local setmetatableindex = table.setmetatableindex + -- -- -- -- -- -- -- shared -- -- -- -- -- -- @@ -347,7 +349,7 @@ local function map_opbd_onto_protrusion(tfmdata,value,opbd) local p = - (v[1] / 1000) * factor * left characters[k].left_protruding = p if trace_protrusion then - report_protrusions("lfbd -> %s -> 0x%05X (%s) -> %0.03f (%s)",lookup,k,utfchar(k),p,concat(v," ")) + report_protrusions("lfbd -> %s -> U+%05X (%s) -> %0.03f (%s)",lookup,k,utfchar(k),p,concat(v," ")) end end done = true @@ -370,7 +372,7 @@ local function map_opbd_onto_protrusion(tfmdata,value,opbd) local p = (v[1] / 1000) * factor * right characters[k].right_protruding = p if trace_protrusion then - report_protrusions("rtbd -> %s -> 0x%05X (%s) -> %0.03f (%s)",lookup,k,utfchar(k),p,concat(v," ")) + report_protrusions("rtbd -> %s -> U+%05X (%s) -> %0.03f (%s)",lookup,k,utfchar(k),p,concat(v," ")) end end end @@ -487,14 +489,14 @@ registerotffeature { } } -local function initializeitlc(tfmdata,value) +local function initializeitlc(tfmdata,value) -- hm, always value if value then -- the magic 40 and it formula come from Dohyun Kim local parameters = tfmdata.parameters local italicangle = parameters.italicangle if italicangle and italicangle ~= 0 then local uwidth = (parameters.uwidth or 40)/2 - for unicode, d in next, tfmdata.descriptions do + for unicode, d in next, tfmdata.descriptions do -- descriptions ! local it = d.boundingbox[3] - d.width + uwidth if it ~= 0 then d.italic = it @@ -585,6 +587,102 @@ registerafmfeature { } } +-- For Wolfgang Schuster: +-- +-- \definefontfeature[thisway][default][script=hang,language=zhs,dimensions={2,2,2}] +-- \definedfont[file:kozminpr6nregular*thisway] +-- +-- For the moment we don't mess with the descriptions. + +local function manipulatedimensions(tfmdata,key,value) + if type(value) == "string" and value ~= "" then + local characters = tfmdata.characters + local parameters = tfmdata.parameters + local emwidth = parameters.quad + local exheight = parameters.x_height + local spec = settings_to_array(value) + local width = (spec[1] or 0) * emwidth + local height = (spec[2] or 0) * exheight + local depth = (spec[3] or 0) * exheight + if width > 0 then + local resources = tfmdata.resources + local additions = { } + local private = resources.private + for unicode, old_c in next, characters do + local oldwidth = old_c.width + if oldwidth ~= width then + -- Defining the tables in one step is more efficient + -- than adding fields later. + private = private + 1 + local new_c + local commands = { + { "right", (width - oldwidth) / 2 }, + { "slot", 1, private }, + } + if height > 0 then + if depth > 0 then + new_c = { + width = width, + height = height, + depth = depth, + commands = commands, + } + else + new_c = { + width = width, + height = height, + commands = commands, + } + end + else + if depth > 0 then + new_c = { + width = width, + depth = depth, + commands = commands, + } + else + new_c = { + width = width, + commands = commands, + } + end + end + setmetatableindex(new_c,old_c) + characters[unicode] = new_c + additions[private] = old_c + end + end + for k, v in next, additions do + characters[k] = v + end + resources.private = private + elseif height > 0 and depth > 0 then + for unicode, old_c in next, characters do + old_c.height = height + old_c.depth = depth + end + elseif height > 0 then + for unicode, old_c in next, characters do + old_c.height = height + end + elseif depth > 0 then + for unicode, old_c in next, characters do + old_c.depth = depth + end + end + end +end + +registerotffeature { + name = "dimensions", + description = "force dimensions", + manipulators = { + base = manipulatedimensions, + node = manipulatedimensions, + } +} + -- -- historic stuff, move from font-ota (handled differently, typo-rep) -- -- local delete_node = nodes.delete diff --git a/tex/context/base/font-fbk.lua b/tex/context/base/font-fbk.lua index fc12ea2b1..89831e7c2 100644 --- a/tex/context/base/font-fbk.lua +++ b/tex/context/base/font-fbk.lua @@ -122,51 +122,51 @@ local function composecharacters(tfmdata) if cb and ab then local c_llx, c_lly, c_urx, c_ury = scale*cb[1], scale*cb[2], scale*cb[3], scale*cb[4] local a_llx, a_lly, a_urx, a_ury = scale*ab[1], scale*ab[2], scale*ab[3], scale*ab[4] -local done = false -if compose then - local i_compose = compose[i] - local i_anchored = i_compose and i_compose.anchored - if i_anchored then - local c_compose = compose[chr] - local a_compose = compose[acc] - local c_anchors = c_compose and c_compose.anchors - local a_anchors = a_compose and a_compose.anchors - if c_anchors and a_anchors then - local c_anchor = c_anchors[i_anchored] - local a_anchor = a_anchors[i_anchored] - if c_anchor and a_anchor then - local cx = c_anchor.x or 0 - local cy = c_anchor.y or 0 - local ax = a_anchor.x or 0 - local ay = a_anchor.y or 0 - local dx = cx - ax - local dy = cy - ay - if trace_combining_all then - report_combining("building U+%05X (%s) from U+%05X (%s) and U+%05X (%s)",i,utfchar(i),chr,utfchar(chr),acc,utfchar(acc)) - report_combining(" boundingbox:") - report_combining(" chr: %3i %3i %3i %3i",unpack(cb)) - report_combining(" acc: %3i %3i %3i %3i",unpack(ab)) - report_combining(" anchors:") - report_combining(" chr: %3i %3i",cx,cy) - report_combining(" acc: %3i %3i",ax,ay) - report_combining(" delta:") - report_combining(" %s: %3i %3i",i_anchored,dx,dy) - end - if trace_combining then - t.commands = { push, {"right", scale*dx}, {"down",-scale*dy}, green, acc_t, black, pop, chr_t } - -- t.commands = { - -- push, {"right", scale*cx}, {"down", -scale*cy}, red, {"rule",10000,10000,10000}, pop, - -- push, {"right", scale*ax}, {"down", -scale*ay}, blue, {"rule",10000,10000,10000}, pop, - -- push, {"right", scale*dx}, {"down", -scale*dy}, green, acc_t, black, pop, chr_t - -- } - else - t.commands = { push, {"right", scale*dx}, {"down",-scale*dy}, acc_t, pop, chr_t } - end - done = true - end - end - end -end + local done = false + if compose then + local i_compose = compose[i] + local i_anchored = i_compose and i_compose.anchored + if i_anchored then + local c_compose = compose[chr] + local a_compose = compose[acc] + local c_anchors = c_compose and c_compose.anchors + local a_anchors = a_compose and a_compose.anchors + if c_anchors and a_anchors then + local c_anchor = c_anchors[i_anchored] + local a_anchor = a_anchors[i_anchored] + if c_anchor and a_anchor then + local cx = c_anchor.x or 0 + local cy = c_anchor.y or 0 + local ax = a_anchor.x or 0 + local ay = a_anchor.y or 0 + local dx = cx - ax + local dy = cy - ay + if trace_combining_all then + report_combining("building U+%05X (%s) from U+%05X (%s) and U+%05X (%s)",i,utfchar(i),chr,utfchar(chr),acc,utfchar(acc)) + report_combining(" boundingbox:") + report_combining(" chr: %3i %3i %3i %3i",unpack(cb)) + report_combining(" acc: %3i %3i %3i %3i",unpack(ab)) + report_combining(" anchors:") + report_combining(" chr: %3i %3i",cx,cy) + report_combining(" acc: %3i %3i",ax,ay) + report_combining(" delta:") + report_combining(" %s: %3i %3i",i_anchored,dx,dy) + end + if trace_combining then + t.commands = { push, {"right", scale*dx}, {"down",-scale*dy}, green, acc_t, black, pop, chr_t } + -- t.commands = { + -- push, {"right", scale*cx}, {"down", -scale*cy}, red, {"rule",10000,10000,10000}, pop, + -- push, {"right", scale*ax}, {"down", -scale*ay}, blue, {"rule",10000,10000,10000}, pop, + -- push, {"right", scale*dx}, {"down", -scale*dy}, green, acc_t, black, pop, chr_t + -- } + else + t.commands = { push, {"right", scale*dx}, {"down",-scale*dy}, acc_t, pop, chr_t } + end + done = true + end + end + end + end if not done then -- can be sped up for scale == 1 local dx = (c_urx - a_urx - a_llx + c_llx)/2 diff --git a/tex/context/base/font-map.lua b/tex/context/base/font-map.lua index 76733adea..b30462f23 100644 --- a/tex/context/base/font-map.lua +++ b/tex/context/base/font-map.lua @@ -261,9 +261,9 @@ function mappings.addtounicode(data,filename) end end end - if not unicode then - originals[index], tounicode[index] = 0xFFFD, "FFFD" - end + -- if not unicode then + -- originals[index], tounicode[index] = 0xFFFD, "FFFD" + -- end end end if trace_mapping then diff --git a/tex/context/base/font-mis.lua b/tex/context/base/font-mis.lua index 03a8c73ae..06ec1efe4 100644 --- a/tex/context/base/font-mis.lua +++ b/tex/context/base/font-mis.lua @@ -22,7 +22,7 @@ local handlers = fonts.handlers handlers.otf = handlers.otf or { } local otf = handlers.otf -otf.version = otf.version or 2.731 +otf.version = otf.version or 2.732 otf.cache = otf.cache or containers.define("fonts", "otf", otf.version, true) function otf.loadcached(filename,format,sub) diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index ebcdea958..8155a3f1d 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -47,7 +47,7 @@ local otf = fonts.handlers.otf otf.glists = { "gsub", "gpos" } -otf.version = 2.731 -- beware: also sync font-mis.lua +otf.version = 2.732 -- beware: also sync font-mis.lua otf.cache = containers.define("fonts", "otf", otf.version, true) local fontdata = fonts.hashes.identifiers diff --git a/tex/context/base/grph-epd.mkiv b/tex/context/base/grph-epd.mkiv index f3f29ebd8..fa6b9e2ab 100644 --- a/tex/context/base/grph-epd.mkiv +++ b/tex/context/base/grph-epd.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\writestatus{loading}{ConTeXt Graphic Macros / Merging Coodies} +\writestatus{loading}{ConTeXt Graphic Macros / Merging Goodies} \unprotect diff --git a/tex/context/base/luat-fio.lua b/tex/context/base/luat-fio.lua index 1edbc2ef8..2e6beb89c 100644 --- a/tex/context/base/luat-fio.lua +++ b/tex/context/base/luat-fio.lua @@ -10,6 +10,7 @@ local texiowrite_nl = (texio and texio.write_nl) or print local texiowrite = (texio and texio.write) or print local format = string.format +local sequenced = table.sequenced texconfig.kpse_init = false texconfig.shell_escape = 't' @@ -83,10 +84,28 @@ if not resolvers.instance then end -statistics.register("resource resolver", function() - if resolvers.scantime then - return format("loadtime %s seconds, scantime %s seconds", resolvers.loadtime(), resolvers.scantime()) - else - return format("loadtime %s seconds", resolvers.loadtime()) +-- statistics.register("resource resolver", function() +-- if resolvers.scantime then +-- return format("loadtime %s seconds, scantime %s seconds", resolvers.loadtime(), resolvers.scantime()) +-- else +-- return format("loadtime %s seconds", resolvers.loadtime()) +-- end +-- end) + + +luatex.registerstopactions(function() + local foundintrees = resolvers.instance.foundintrees + texiowrite_nl("log","\n") + for i=1,#foundintrees do + texiowrite_nl("log",format("used file %4i > %s",i,sequenced(foundintrees[i]))) end + texiowrite_nl("log","") +end) + +statistics.register("resource resolver", function() + return format("loadtime %s seconds, scantime %s seconds, %s found files", + resolvers.loadtime(), + resolvers.scantime and resolvers.scantime() or 0, + #resolvers.instance.foundintrees + ) end) diff --git a/tex/context/base/mult-de.mkii b/tex/context/base/mult-de.mkii index eaf23937c..bbcf11355 100644 --- a/tex/context/base/mult-de.mkii +++ b/tex/context/base/mult-de.mkii @@ -275,6 +275,7 @@ \setinterfacevariable{marking}{beschriftung} \setinterfacevariable{mathalignment}{mathalignment} \setinterfacevariable{mathcases}{mathcases} +\setinterfacevariable{mathematics}{mathematik} \setinterfacevariable{mathmatrix}{mathmatrix} \setinterfacevariable{max}{max} \setinterfacevariable{maxdepth}{maxdepth} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index 9fa64d1f5..775eb662d 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -13940,6 +13940,16 @@ return { ["pe"]="نشانهگذاری", ["ro"]="marcaje", }, + ["mathematics"]={ + ["cs"]="mathematika", + ["de"]="mathematik", + ["en"]="mathematics", + ["fr"]="mathematique", + ["it"]="matematica", + ["nl"]="wiskunde", + ["pe"]="ریاضی", + ["ro"]="matematica", + }, ["mathalignment"]={ ["cs"]="mathalignment", ["de"]="mathalignment", diff --git a/tex/context/base/mult-en.mkii b/tex/context/base/mult-en.mkii index 04ae75f82..90beed8ed 100644 --- a/tex/context/base/mult-en.mkii +++ b/tex/context/base/mult-en.mkii @@ -275,6 +275,7 @@ \setinterfacevariable{marking}{marking} \setinterfacevariable{mathalignment}{mathalignment} \setinterfacevariable{mathcases}{mathcases} +\setinterfacevariable{mathematics}{mathematics} \setinterfacevariable{mathmatrix}{mathmatrix} \setinterfacevariable{max}{max} \setinterfacevariable{maxdepth}{maxdepth} diff --git a/tex/context/base/mult-fr.mkii b/tex/context/base/mult-fr.mkii index 5f682f1fc..49186ce4f 100644 --- a/tex/context/base/mult-fr.mkii +++ b/tex/context/base/mult-fr.mkii @@ -275,6 +275,7 @@ \setinterfacevariable{marking}{marquage} \setinterfacevariable{mathalignment}{mathalignment} \setinterfacevariable{mathcases}{mathcases} +\setinterfacevariable{mathematics}{mathematique} \setinterfacevariable{mathmatrix}{mathmatrix} \setinterfacevariable{max}{max} \setinterfacevariable{maxdepth}{maxdepth} diff --git a/tex/context/base/mult-it.mkii b/tex/context/base/mult-it.mkii index 754b7ae34..f79030df1 100644 --- a/tex/context/base/mult-it.mkii +++ b/tex/context/base/mult-it.mkii @@ -275,6 +275,7 @@ \setinterfacevariable{marking}{marcatura} \setinterfacevariable{mathalignment}{mathalignment} \setinterfacevariable{mathcases}{mathcases} +\setinterfacevariable{mathematics}{matematica} \setinterfacevariable{mathmatrix}{mathmatrix} \setinterfacevariable{max}{max} \setinterfacevariable{maxdepth}{maxdepth} diff --git a/tex/context/base/mult-nl.mkii b/tex/context/base/mult-nl.mkii index a479ab53b..848be382b 100644 --- a/tex/context/base/mult-nl.mkii +++ b/tex/context/base/mult-nl.mkii @@ -275,6 +275,7 @@ \setinterfacevariable{marking}{markering} \setinterfacevariable{mathalignment}{wiskundeuitlijnen} \setinterfacevariable{mathcases}{mathcases} +\setinterfacevariable{mathematics}{wiskunde} \setinterfacevariable{mathmatrix}{wiskundematrix} \setinterfacevariable{max}{max} \setinterfacevariable{maxdepth}{maxdepth} diff --git a/tex/context/base/mult-pe.mkii b/tex/context/base/mult-pe.mkii index 22416cce3..26e068e30 100644 --- a/tex/context/base/mult-pe.mkii +++ b/tex/context/base/mult-pe.mkii @@ -275,6 +275,7 @@ \setinterfacevariable{marking}{نشانهگذاری} \setinterfacevariable{mathalignment}{تنظیمریاضی} \setinterfacevariable{mathcases}{حالتهایریاضی} +\setinterfacevariable{mathematics}{ریاضی} \setinterfacevariable{mathmatrix}{ماتریشریاضی} \setinterfacevariable{max}{بیشترین} \setinterfacevariable{maxdepth}{maxdepth} diff --git a/tex/context/base/mult-ro.mkii b/tex/context/base/mult-ro.mkii index d9d6e3b62..299c21446 100644 --- a/tex/context/base/mult-ro.mkii +++ b/tex/context/base/mult-ro.mkii @@ -275,6 +275,7 @@ \setinterfacevariable{marking}{marcaje} \setinterfacevariable{mathalignment}{mathalignment} \setinterfacevariable{mathcases}{mathcases} +\setinterfacevariable{mathematics}{matematica} \setinterfacevariable{mathmatrix}{mathmatrix} \setinterfacevariable{max}{max} \setinterfacevariable{maxdepth}{maxdepth} diff --git a/tex/context/base/mult-sys.mkiv b/tex/context/base/mult-sys.mkiv index 06a4912a3..aa0b535a1 100644 --- a/tex/context/base/mult-sys.mkiv +++ b/tex/context/base/mult-sys.mkiv @@ -481,6 +481,7 @@ \definesystemvariable {bt} % BuTton \definesystemvariable {bu} % BUffer \definesystemvariable {bv} % Brieven +\definesystemvariable {bx} % BackendExport \definesystemvariable {by} % Per \definesystemvariable {cb} % CollectBox \definesystemvariable {cc} % Comment diff --git a/tex/context/base/phys-dim.mkiv b/tex/context/base/phys-dim.mkiv index 1e900bdb6..7631316cb 100644 --- a/tex/context/base/phys-dim.mkiv +++ b/tex/context/base/phys-dim.mkiv @@ -220,7 +220,8 @@ \let\digitsseparatorspace\thickspace \fi \ctxcommand{digits(\!!bs\detokenize{#1}\!!es)}% - \endgroup} + \endgroup + \settrue\c_units_dospace} \unexpanded\def\digits {\doifnextbgroupelse\digits_argument\digits_spaced} @@ -282,6 +283,8 @@ %D Depending on needs we can add more tweaks (also depends on to what %D extent we need to be compatible with \MKII. +% only a space when a number is part of the unit + \installcommandhandler \??un {units} \??un \setupunits @@ -292,12 +295,20 @@ %space=..., % (maybe) small medium big ] -\newconstant \c_units_mode % 0=text 1=math 2=textinmath +\newconstant \c_units_mode % 0=text 1=math 2=textinmath 3=mathintext \newconstant \c_units_state % 0=start 1=suffix 2=operator 3=unit 4=prefix 5=number \newconditional\c_units_quantity \newconditional\c_units_number +\newconditional\c_units_dospace + +% [\unit {micro ohm}]\par % no space before unit +% [10\unit {micro ohm}]\par % no space before unit +% [10 \unit{micro ohm}]\par % space before unit +% [ \unit {micro ohm}]\par % space before unit +% [\unit{10 micro ohm}]\par % space before unit \def\unitshalfspace{\thinspace} +\def\unitsfullspace{\thickspace} \def\unitsbackspace{\negthinspace} \newtoks \everyunits % we keep the old \units command so we need a longer one @@ -308,19 +319,27 @@ \unexpanded\def\units_direct#1% {\begingroup + \ifdim\lastskip>\zeropoint + \settrue\c_units_dospace + \removelastskip + \fi \edef\currentunits{#1}% \the\everyunits %\removeunwantedspaces % now ok yet \dosetunitsattributes\c!style\c!color + \edef\currentunitsalternative{\unitsparameter\c!alternative}% \ifmmode - \edef\currentunitsalternative{\unitsparameter\c!alternative}% \ifx\currentunitsalternative\v!text \expandafter\expandafter\expandafter\units_direct_text_in_math \else \expandafter\expandafter\expandafter\units_direct_math \fi \else - \expandafter\units_direct_text + \ifx\currentunitsalternative\v!mathematics + \expandafter\expandafter\expandafter\units_direct_math_in_text + \else + \expandafter\expandafter\expandafter\units_direct_text + \fi \fi} \unexpanded\def\units_direct_text_in_math#1% @@ -344,6 +363,17 @@ \units_finish \endgroup} +\unexpanded\def\units_direct_math_in_text#1% + {\removeunwantedspaces % brr + \startimath + \c_units_mode\plusthree + \rm\tf + \mathtf + \units_indeed{#1}% + \units_finish + \stopimath + \endgroup} + \unexpanded\def\units_direct_nested#1#2% {\units_indeed{#2}} @@ -411,26 +441,35 @@ \fi} \def\unitsraise - {\ifnum\c_units_mode=\plusone + {\ifcase\c_units_mode + \expandafter\high + \or \expandafter\normalsuperscript - \else + \or \expandafter\high + \or + \expandafter\normalsuperscript \fi} \def\unitslower - {\ifnum\c_units_mode=\plusone + {\ifcase\c_units_mode + \expandafter\low + \or \expandafter\normalsubscript - \else + \or \expandafter\low + \or + \expandafter\normalsubscript \fi} \unexpanded\def\units_next {\ifcase\c_units_state % start - \ifdim\lastskip=\zeropoint - \unitshalfspace - \unitshalfspace - \else - % too tricky ... we could remove and add + \ifconditional\c_units_dospace + % \ifdim\lastskip=\zeropoint + \unitsfullspace + % \else + % % too tricky ... we could remove and add + % \fi \fi \or % suffix {\cdot}% \unitshalfspace @@ -439,9 +478,9 @@ {\cdot}% \unitshalfspace \or % prefix \or % number - \unitshalfspace - \unitshalfspace + \unitsfullspace \fi + \setfalse\c_units_dospace \units_start} \unexpanded\def\unitsTIMES diff --git a/tex/context/base/scrp-ini.lua b/tex/context/base/scrp-ini.lua index b0f39c751..0e1d450e2 100644 --- a/tex/context/base/scrp-ini.lua +++ b/tex/context/base/scrp-ini.lua @@ -341,7 +341,9 @@ end -- eventually we might end up with more extensive parsing -- todo: pass t[start..stop] == original -- --- one of the time consuming functiions: +-- one of the time consuming functions: + +-- we can have a fonts.hashes.originals function scripts.preprocess(head) local start = first_glyph(head) @@ -381,7 +383,9 @@ function scripts.preprocess(head) lastfont = f end local c = start.char - if originals then c = originals[c] or c end + if originals then + c = originals[c] or c + end local h = hash[c] if h then set_attribute(start,a_prestat,categorytonumber[h]) diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 94506a086..ce585574e 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex f969e272d..c2b9d6b65 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/supp-fil.lua b/tex/context/base/supp-fil.lua index a2c0b5d7d..449fa4894 100644 --- a/tex/context/base/supp-fil.lua +++ b/tex/context/base/supp-fil.lua @@ -34,6 +34,8 @@ local environment = environment local findbyscheme = resolvers.finders.byscheme +-- needs a cleanup: + function commands.checkfilename(str) -- "/whatever..." "c:..." "http://..." texcount.kindoffile = (find(str,"^/") or find(str,"[%a]:") and 1) or 0 end @@ -239,7 +241,7 @@ function commands.usemodules(prefix,askedname,truename) status = status + 1 else if trace_modules then - report_modules("locating: '%s'",truename) + report_modules("locating: prefix: '%s', askedname: '%s', truename: '%s'",prefix or "", askedname or "", truename or "") end local hasscheme = url.hasscheme(truename) if hasscheme then diff --git a/tex/context/base/trac-tex.lua b/tex/context/base/trac-tex.lua index dcfbf965d..7920bd1cb 100644 --- a/tex/context/base/trac-tex.lua +++ b/tex/context/base/trac-tex.lua @@ -58,7 +58,7 @@ local function saveusedfilesintrees(format) local data = { jobname = environment.jobname or "?", version = environment.version or "?", - files = table.sortedkeys(resolvers.instance.foundintrees) + files = resolvers.instance.foundintrees } local filename = file.replacesuffix(environment.jobname or "context-job",'jlg') if format == "lua" then diff --git a/tex/context/base/util-tab.lua b/tex/context/base/util-tab.lua index 81746630f..3610c24dd 100644 --- a/tex/context/base/util-tab.lua +++ b/tex/context/base/util-tab.lua @@ -13,7 +13,7 @@ local tables = utilities.tables local format, gmatch, rep = string.format, string.gmatch, string.rep local concat, insert, remove = table.concat, table.insert, table.remove local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatable, tonumber, tostring -local type, next, rawset = type, next, rawset +local type, next, rawset, tonumber = type, next, rawset, tonumber function tables.definetable(target) -- defines undefined tables local composed, t, n = nil, { }, 0 @@ -83,10 +83,16 @@ end local function toxml(t,d,result,step) for k, v in table.sortedpairs(t) do if type(v) == "table" then - result[#result+1] = format("%s<%s>",d,k) - toxml(v,d..step,result) - result[#result+1] = format("%s</%s>",d,k) - elseif tonumber(k) then + if type(k) == "number" then + result[#result+1] = format("%s<entry n='%s'>",d,k) + toxml(v,d..step,result,step) + result[#result+1] = format("%s</entry>",d,k) + else + result[#result+1] = format("%s<%s>",d,k) + toxml(v,d..step,result,step) + result[#result+1] = format("%s</%s>",d,k) + end + elseif type(k) == "number" then result[#result+1] = format("%s<entry n='%s'>%s</entry>",d,k,v,k) else result[#result+1] = format("%s<%s>%s</%s>",d,k,tostring(v),k) diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index ce046db2c..a0b9b94b2 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -278,6 +278,7 @@ <cd:variable name='marking' value='znaceni'/> <cd:variable name='mathalignment' value='mathalignment'/> <cd:variable name='mathcases' value='mathcases'/> + <cd:variable name='mathematics' value='mathematika'/> <cd:variable name='mathmatrix' value='mathmatrix'/> <cd:variable name='max' value='max'/> <cd:variable name='maxdepth' value='maxdepth'/> diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index a68e8ca0e..60cf52da9 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -278,6 +278,7 @@ <cd:variable name='marking' value='beschriftung'/> <cd:variable name='mathalignment' value='mathalignment'/> <cd:variable name='mathcases' value='mathcases'/> + <cd:variable name='mathematics' value='mathematik'/> <cd:variable name='mathmatrix' value='mathmatrix'/> <cd:variable name='max' value='max'/> <cd:variable name='maxdepth' value='maxdepth'/> diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 70e6ae219..d8f525567 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -278,6 +278,7 @@ <cd:variable name='marking' value='marking'/> <cd:variable name='mathalignment' value='mathalignment'/> <cd:variable name='mathcases' value='mathcases'/> + <cd:variable name='mathematics' value='mathematics'/> <cd:variable name='mathmatrix' value='mathmatrix'/> <cd:variable name='max' value='max'/> <cd:variable name='maxdepth' value='maxdepth'/> diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index 7bd22aa1e..45c5dad8e 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -278,6 +278,7 @@ <cd:variable name='marking' value='marquage'/> <cd:variable name='mathalignment' value='mathalignment'/> <cd:variable name='mathcases' value='mathcases'/> + <cd:variable name='mathematics' value='mathematique'/> <cd:variable name='mathmatrix' value='mathmatrix'/> <cd:variable name='max' value='max'/> <cd:variable name='maxdepth' value='maxdepth'/> diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 2adfd46e8..aea63860f 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -278,6 +278,7 @@ <cd:variable name='marking' value='marcatura'/> <cd:variable name='mathalignment' value='mathalignment'/> <cd:variable name='mathcases' value='mathcases'/> + <cd:variable name='mathematics' value='matematica'/> <cd:variable name='mathmatrix' value='mathmatrix'/> <cd:variable name='max' value='max'/> <cd:variable name='maxdepth' value='maxdepth'/> diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index eda637059..469c5e592 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -278,6 +278,7 @@ <cd:variable name='marking' value='markering'/> <cd:variable name='mathalignment' value='wiskundeuitlijnen'/> <cd:variable name='mathcases' value='mathcases'/> + <cd:variable name='mathematics' value='wiskunde'/> <cd:variable name='mathmatrix' value='wiskundematrix'/> <cd:variable name='max' value='max'/> <cd:variable name='maxdepth' value='maxdepth'/> diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index 71137281f..365c903d4 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -278,6 +278,7 @@ <cd:variable name='marking' value='نشانهگذاری'/> <cd:variable name='mathalignment' value='تنظیمریاضی'/> <cd:variable name='mathcases' value='حالتهایریاضی'/> + <cd:variable name='mathematics' value='ریاضی'/> <cd:variable name='mathmatrix' value='ماتریشریاضی'/> <cd:variable name='max' value='بیشترین'/> <cd:variable name='maxdepth' value='maxdepth'/> diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index 03c1d7377..9bcedba09 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -278,6 +278,7 @@ <cd:variable name='marking' value='marcaje'/> <cd:variable name='mathalignment' value='mathalignment'/> <cd:variable name='mathcases' value='mathcases'/> + <cd:variable name='mathematics' value='matematica'/> <cd:variable name='mathmatrix' value='mathmatrix'/> <cd:variable name='max' value='max'/> <cd:variable name='maxdepth' value='maxdepth'/> diff --git a/tex/generic/context/luatex-basics-gen.lua b/tex/generic/context/luatex/luatex-basics-gen.lua index a0368c13a..a0368c13a 100644 --- a/tex/generic/context/luatex-basics-gen.lua +++ b/tex/generic/context/luatex/luatex-basics-gen.lua diff --git a/tex/generic/context/luatex-basics-nod.lua b/tex/generic/context/luatex/luatex-basics-nod.lua index 151d98a8f..151d98a8f 100644 --- a/tex/generic/context/luatex-basics-nod.lua +++ b/tex/generic/context/luatex/luatex-basics-nod.lua diff --git a/tex/generic/context/luatex-basics.tex b/tex/generic/context/luatex/luatex-basics.tex index bb34587ff..bb34587ff 100644 --- a/tex/generic/context/luatex-basics.tex +++ b/tex/generic/context/luatex/luatex-basics.tex diff --git a/tex/generic/context/luatex-fonts-cbk.lua b/tex/generic/context/luatex/luatex-fonts-cbk.lua index 9db94f65e..9db94f65e 100644 --- a/tex/generic/context/luatex-fonts-cbk.lua +++ b/tex/generic/context/luatex/luatex-fonts-cbk.lua diff --git a/tex/generic/context/luatex-fonts-def.lua b/tex/generic/context/luatex/luatex-fonts-def.lua index 0c2f0dbd5..0c2f0dbd5 100644 --- a/tex/generic/context/luatex-fonts-def.lua +++ b/tex/generic/context/luatex/luatex-fonts-def.lua diff --git a/tex/generic/context/luatex-fonts-demo-vf-1.lua b/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua index 3878ae648..3878ae648 100644 --- a/tex/generic/context/luatex-fonts-demo-vf-1.lua +++ b/tex/generic/context/luatex/luatex-fonts-demo-vf-1.lua diff --git a/tex/generic/context/luatex-fonts-enc.lua b/tex/generic/context/luatex/luatex-fonts-enc.lua index e20c3a03b..e20c3a03b 100644 --- a/tex/generic/context/luatex-fonts-enc.lua +++ b/tex/generic/context/luatex/luatex-fonts-enc.lua diff --git a/tex/generic/context/luatex-fonts-ext.lua b/tex/generic/context/luatex/luatex-fonts-ext.lua index 951afcc7e..951afcc7e 100644 --- a/tex/generic/context/luatex-fonts-ext.lua +++ b/tex/generic/context/luatex/luatex-fonts-ext.lua diff --git a/tex/generic/context/luatex-fonts-lua.lua b/tex/generic/context/luatex/luatex-fonts-lua.lua index ec3fe38be..ec3fe38be 100644 --- a/tex/generic/context/luatex-fonts-lua.lua +++ b/tex/generic/context/luatex/luatex-fonts-lua.lua diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 455d8ba41..b2115c4a6 100644 --- a/tex/generic/context/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 : 06/23/11 19:25:18 +-- merge date : 06/25/11 11:24:40 do -- begin closure to overcome local limits and interference @@ -4681,9 +4681,9 @@ function mappings.addtounicode(data,filename) end end end - if not unicode then - originals[index], tounicode[index] = 0xFFFD, "FFFD" - end + -- if not unicode then + -- originals[index], tounicode[index] = 0xFFFD, "FFFD" + -- end end end if trace_mapping then @@ -4984,7 +4984,7 @@ local otf = fonts.handlers.otf otf.glists = { "gsub", "gpos" } -otf.version = 2.731 -- beware: also sync font-mis.lua +otf.version = 2.732 -- beware: also sync font-mis.lua otf.cache = containers.define("fonts", "otf", otf.version, true) local fontdata = fonts.hashes.identifiers diff --git a/tex/generic/context/luatex-fonts-syn.lua b/tex/generic/context/luatex/luatex-fonts-syn.lua index 36a74d0f4..36a74d0f4 100644 --- a/tex/generic/context/luatex-fonts-syn.lua +++ b/tex/generic/context/luatex/luatex-fonts-syn.lua diff --git a/tex/generic/context/luatex-fonts-tfm.lua b/tex/generic/context/luatex/luatex-fonts-tfm.lua index b9bb1bd0f..b9bb1bd0f 100644 --- a/tex/generic/context/luatex-fonts-tfm.lua +++ b/tex/generic/context/luatex/luatex-fonts-tfm.lua diff --git a/tex/generic/context/luatex-fonts.lua b/tex/generic/context/luatex/luatex-fonts.lua index 1d844911d..1d844911d 100644 --- a/tex/generic/context/luatex-fonts.lua +++ b/tex/generic/context/luatex/luatex-fonts.lua diff --git a/tex/generic/context/luatex-fonts.tex b/tex/generic/context/luatex/luatex-fonts.tex index a7c8bc2b8..a7c8bc2b8 100644 --- a/tex/generic/context/luatex-fonts.tex +++ b/tex/generic/context/luatex/luatex-fonts.tex diff --git a/tex/generic/context/luatex-mplib.lua b/tex/generic/context/luatex/luatex-mplib.lua index c6628acb3..c6628acb3 100644 --- a/tex/generic/context/luatex-mplib.lua +++ b/tex/generic/context/luatex/luatex-mplib.lua diff --git a/tex/generic/context/luatex-mplib.tex b/tex/generic/context/luatex/luatex-mplib.tex index ef6dfff95..ef6dfff95 100644 --- a/tex/generic/context/luatex-mplib.tex +++ b/tex/generic/context/luatex/luatex-mplib.tex diff --git a/tex/generic/context/luatex-plain.tex b/tex/generic/context/luatex/luatex-plain.tex index e47ad58ad..e47ad58ad 100644 --- a/tex/generic/context/luatex-plain.tex +++ b/tex/generic/context/luatex/luatex-plain.tex diff --git a/tex/generic/context/luatex-preprocessor-test.tex b/tex/generic/context/luatex/luatex-preprocessor-test.tex index 857b28f83..857b28f83 100644 --- a/tex/generic/context/luatex-preprocessor-test.tex +++ b/tex/generic/context/luatex/luatex-preprocessor-test.tex diff --git a/tex/generic/context/luatex-preprocessor.lua b/tex/generic/context/luatex/luatex-preprocessor.lua index 8faa0b47e..8faa0b47e 100644 --- a/tex/generic/context/luatex-preprocessor.lua +++ b/tex/generic/context/luatex/luatex-preprocessor.lua diff --git a/tex/generic/context/luatex-preprocessor.tex b/tex/generic/context/luatex/luatex-preprocessor.tex index 03b483f41..03b483f41 100644 --- a/tex/generic/context/luatex-preprocessor.tex +++ b/tex/generic/context/luatex/luatex-preprocessor.tex diff --git a/tex/generic/context/luatex-test.tex b/tex/generic/context/luatex/luatex-test.tex index 830d30a91..830d30a91 100644 --- a/tex/generic/context/luatex-test.tex +++ b/tex/generic/context/luatex/luatex-test.tex diff --git a/tex/generic/context/m-metapo.tex b/tex/generic/context/m-metapo.tex deleted file mode 100644 index f02830a13..000000000 --- a/tex/generic/context/m-metapo.tex +++ /dev/null @@ -1,89 +0,0 @@ -%D \module -%D [ file=m-metapo, -%D version=1999.03.26, -%D title=\LATEX\ Modules, -%D subtitle=\METAPOST\ Inclusion, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ distribution and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -%D We quit when \CONTEXT\ is found and use some deep down -%D macro to trigger this: - -\ifx\undefined\dodoplaceexternalfigure \else \expandafter \endinput \fi - -%D \macros -%D {includeMPgraphics} -%D -%D This rather small \LATEX\ module is dedicated to David -%D Arnold. It takes care of including the fonts used in -%D \METAPOST\ graphics in the file. This hack is needed when -%D one uses another \DVI\ driver than \DVIPS. This module -%D falls back on the generic \CONTEXT\ support module: - -\ifx\undefined\includeMPfonts \input supp-mps.tex \relax \fi - -%D Instead of using \type {\includegraphics}, one should use its -%D little brother \type {\includeMPgraphics}. This macro takes -%D the same arguments. - -\def\includeMPgraphics#1#% - {\leavevmode\vbox\bgroup\hbox\bgroup - \def\includeMPgraphics##1% - {\includeMPfonts{##1}% - \includegraphics#1{##1}% - \egroup\egroup}% - \includeMPgraphics} - -%D An example of using this module is given below: -%D -%D \starttyping -%D \documentclass[10pt]{article} -%D -%D \usepackage{graphicx} -%D \usepackage{m-metapo} -%D -%D \begin{document} -%D \includeMPgraphics{somefile.1} -%D \includeMPgraphics[angle=90]{somefile.2} -%D \end{document} -%D \stoptyping -%D -%D This module needs \type {supp-mps} and \type {supp-mis}, -%D that both are present in the \CONTEXT\ path. -%D -%D Please do not forget to say \type {prologues:=1} at the -%D top of the metapost file! -%D -%D For non \LATEX\ (and \CONTEXT) users we provide an -%D alternative inclusion macro. This one has no optional -%D arguments. - -\ifx\includegraphics\undefined - - \ifx\undefined\dogetEPSboundingbox \input supp-eps.tex \relax \fi - - \def\includeMPgraphics#1% - {\hbox\bgroup - \includeMPfonts{#1}% - \dogetEPSboundingbox{#1}{\dimen2}{\dimen4}{\dimen6}{\dimen8}% - \vbox to \dimen8 - {\forgetall - \hsize\dimen6 - \vfill - \hbox to \hsize - {\special - {PSfile="#1"\space - llx=\EPSllx\space - lly=\EPSlly\space - urx=\EPSurx\space - ury=\EPSury\space}}}% - \egroup} - -\fi - -\endinput diff --git a/tex/generic/context/mptopdf.tex b/tex/generic/context/mptopdf/mptopdf.tex index 3efe57392..3efe57392 100644 --- a/tex/generic/context/mptopdf.tex +++ b/tex/generic/context/mptopdf/mptopdf.tex diff --git a/tex/generic/context/m-ch-de.tex b/tex/generic/context/ppchtex/m-ch-de.tex index 467cdc670..467cdc670 100644 --- a/tex/generic/context/m-ch-de.tex +++ b/tex/generic/context/ppchtex/m-ch-de.tex diff --git a/tex/generic/context/m-ch-en.tex b/tex/generic/context/ppchtex/m-ch-en.tex index 6bd435319..6bd435319 100644 --- a/tex/generic/context/m-ch-en.tex +++ b/tex/generic/context/ppchtex/m-ch-en.tex diff --git a/tex/generic/context/m-ch-nl.tex b/tex/generic/context/ppchtex/m-ch-nl.tex index c9d77733a..c9d77733a 100644 --- a/tex/generic/context/m-ch-nl.tex +++ b/tex/generic/context/ppchtex/m-ch-nl.tex diff --git a/tex/generic/context/ppchtex.noc b/tex/generic/context/ppchtex/ppchtex.noc index 99d073255..99d073255 100644 --- a/tex/generic/context/ppchtex.noc +++ b/tex/generic/context/ppchtex/ppchtex.noc diff --git a/tex/latex/context/m-metapo.sty b/tex/latex/context/m-metapo.sty deleted file mode 100644 index 2d568df96..000000000 --- a/tex/latex/context/m-metapo.sty +++ /dev/null @@ -1,5 +0,0 @@ -\ProvidesPackage{m-metapo}[2004/07/30 package wrapper for m-metapo.tex] - -\input{m-metapo.tex} - -\endinput
\ No newline at end of file diff --git a/tex/latex/context/m-ch-de.sty b/tex/latex/context/ppchtex/m-ch-de.sty index d35f8cf2d..d35f8cf2d 100644 --- a/tex/latex/context/m-ch-de.sty +++ b/tex/latex/context/ppchtex/m-ch-de.sty diff --git a/tex/latex/context/m-ch-en.sty b/tex/latex/context/ppchtex/m-ch-en.sty index e93a49867..e93a49867 100644 --- a/tex/latex/context/m-ch-en.sty +++ b/tex/latex/context/ppchtex/m-ch-en.sty diff --git a/tex/latex/context/m-ch-nl.sty b/tex/latex/context/ppchtex/m-ch-nl.sty index 6e2b8d43d..6e2b8d43d 100644 --- a/tex/latex/context/m-ch-nl.sty +++ b/tex/latex/context/ppchtex/m-ch-nl.sty diff --git a/tex/latex/context/m-pictex.sty b/tex/latex/context/ppchtex/m-pictex.sty index 18630f2cc..18630f2cc 100644 --- a/tex/latex/context/m-pictex.sty +++ b/tex/latex/context/ppchtex/m-pictex.sty diff --git a/web2c/texlive2011cnf.lua b/web2c/texlive2011cnf.lua index f11e45731..024e04205 100644 --- a/web2c/texlive2011cnf.lua +++ b/web2c/texlive2011cnf.lua @@ -1,4 +1,7 @@ -return { +local liveyear = string.match(resolvers.prefixes.selfautoparent(),"(20%d%d)") or "2011" + +--~ return { +inspect { type = "configuration", version = "1.1.1", @@ -19,17 +22,23 @@ return { -- -- TEXMFCNF = "{selfautodir:{/share,}/texmf-local/web2c,selfautoparent:{/share,}/texmf{-local,}/web2c}", - TEXMFCACHE = "selfautoparent:texmf-var;~/.texlive2011/texmf-cache", - TEXMFCONFIG = "~/.texlive2011/texmf-config", + TEXMFCACHE = string.format("selfautoparent:texmf-var;~/.texlive%s/texmf-cache",liveyear), TEXMFSYSTEM = "selfautoparent:$SELFAUTOSYSTEM", TEXMFCONTEXT = "selfautoparent:texmf-dist", + -- TEXMFLOCAL = "selfautoparent:../texmf-local"), -- should also work TEXMFLOCAL = string.gsub(resolvers.prefixes.selfautoparent(),"20%d%d$","texmf-local"), TEXMFSYSCONFIG = "selfautoparent:texmf-config", - TEXMFSYSVAR = "selfautoparent:texmf-var", + TEXMFCONFIG = string.format("home:.texlive%s/texmf-config",liveyear), + TEXMFVAR = string.format("home:.texlive%s/texmf-var",liveyear), + + -- We have only one cache path but there can be more. The first writable one + -- will be chosen but there can be more readable paths. + + TEXMFCACHE = "$TEXMFSYSVAR;$TEXMFVAR", TEXMF = "{$TEXMFCONFIG,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFPROJECT,!!$TEXMFFONTS,!!$TEXMFLOCAL,!!$TEXMFCONTEXT,!!$TEXMFSYSTEM,!!$TEXMFMAIN}", |