diff options
34 files changed, 961 insertions, 674 deletions
diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index a83d8fc48..4411e268c 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -14,8 +14,8 @@ local suffix, addsuffix, removesuffix, replacesuffix = file.suffix, file.addsuff local nameonly, basename, joinpath, collapsepath = file.nameonly, file.basename, file.join, file.collapsepath local lower = string.lower -local otfversion = 2.819 -local otlversion = 3.013 +local otfversion = 2.824 +local otlversion = 3.017 local helpinfo = [[ <?xml version="1.0"?> diff --git a/scripts/context/lua/mtx-server-ctx-help.lua b/scripts/context/lua/mtx-server-ctx-help.lua index 66051f794..0a3081428 100644 --- a/scripts/context/lua/mtx-server-ctx-help.lua +++ b/scripts/context/lua/mtx-server-ctx-help.lua @@ -6,153 +6,105 @@ if not modules then modules = { } end modules ['mtx-server-ctx-help'] = { license = "see context related readme files" } --- todo in lua interface: noargument, oneargument, twoarguments, threearguments --- todo: pickup translations from mult file +local gsub, find, lower = string.gsub, string.find, string.lower +local concat, sort = table.concat, table.sort dofile(resolvers.findfile("trac-lmx.lua","tex")) dofile(resolvers.findfile("util-sci.lua","tex")) +dofile(resolvers.findfile("char-def.lua","tex")) +dofile(resolvers.findfile("char-ini.lua","tex")) +dofile(resolvers.findfile("char-utf.lua","tex")) + +local scite = utilities.scite +local formatters = string.formatters +local sortedkeys = table.sortedkeys +local setmetatableindex = table.setmetatableindex +local lowercase = characters.lower +local uppercase = characters.upper +local setupstrings = dofile(resolvers.findfile("mult-def.lua","tex")).setupstrings +local report = logs.reporter("ctx-help") +local gettime = os.gettimeofday or os.clock + +local xmlcollected = xml.collected +local xmlfirst = xml.first +local xmltext = xml.text +local xmlload = xml.load + +document = document or { } +document.setups = document.setups or { } -local scite = utilities.scite - -local setupstrings = dofile(resolvers.findfile("mult-def.lua","tex")).setupstrings - --- problem ... serialize parent stack - -local format, match, gsub, find, lower = string.format, string.match, string.gsub, string.find, string.lower -local concat, sort = table.concat, table.sort - -local formatters = string.formatters - -local report = logs.reporter("ctx-help") - --- -- -- make this a module: cont-xx.lua +local f_divs_t = { + pe = formatters["<div dir='rtl' lang='arabic'>%s</div>"], +} -document = document or { } -document.setups = document.setups or { } +local f_spans_t = { + pe = formatters["<span dir='rtl' lang='arabic'>%s</span>"] +} -document.setups.div = { - pe = "<div dir='rtl' lang='arabic'>%s</div>" +local f_href_in_list_t = { + tex = formatters[ [[<a class="setupmenuurl" href='mtx-server-ctx-help.lua?command=%s&mode=%s'>%s</a>]] ], + lua = formatters[ [[<a class="setupmenuurl" href='mtx-server-ctx-help.lua?command=%s&mode=%s'>%s</a>]] ], } -document.setups.span = { - pe = "<span dir='rtl' lang='arabic'>%s</span>" +local f_href_as_command_t = { + tex = formatters[ [[<a class="setuplisturl" href='mtx-server-ctx-help.lua?command=%s&mode=%s'>\%s</a>]] ], + lua = formatters[ [[<a class="setuplisturl" href='mtx-server-ctx-help.lua?command=%s&mode=%s'>context.%s</a>]] ], } -document.setups.translations = table.setmetatableindex(setupstrings, { - ["noargument"] = { en = "\\cs" }, - ["oneargument"] = { en = "\\cs#1{..}" }, - ["twoarguments"] = { en = "\\cs#1#2{..}{..}" }, - ["threearguments"] = { en = "\\cs#1#2#3{..}{..}{..}" }, -}) - -document.setups.formats = { - open_command = { - tex = [[\%s]], - lua = [[context.%s (]], - }, - close_command = { - tex = [[]], - lua = [[ )]], - }, - connector = { - tex = [[]], - lua = [[, ]], - }, - href_in_list = { - tex = [[<a href='mtx-server-ctx-help.lua?command=%s&mode=%s'>%s</a>]], - lua = [[<a href='mtx-server-ctx-help.lua?command=%s&mode=%s'>%s</a>]], - }, - href_as_command = { - tex = [[<a href='mtx-server-ctx-help.lua?command=%s&mode=%s'>\%s</a>]], - lua = [[<a href='mtx-server-ctx-help.lua?command=%s&mode=%s'>context.%s</a>]], - }, - modes = { - tex = [[<a href='mtx-server-ctx-help.lua?mode=lua'>lua mode</a>]], - lua = [[<a href='mtx-server-ctx-help.lua?mode=tex'>tex mode</a>]], - }, - optional_single = { - tex = "[optional string %s]", - lua = "{optional string %s}", - }, - optional_list = { - tex = "[optional list %s]", - lua = "{optional table %s}" , - } , - mandate_single = { - tex = "[mandate string %s]", - lua = "{mandate string %s}", - }, - mandate_list = { - tex = "[mandate list %s]", - lua = "{mandate list %s}", - }, - interface = [[<a href='mtx-server-ctx-help.lua?interface=%s&mode=%s'>%s</a>]], - source = [[<a href='mtx-server-ctx-help.lua?source=%s&mode=%s'>%s</a>]], - parameter = [[<tr><td width='15%%'>%s</td><td width='15%%'>%s</td><td width='70%%'>%s</td></tr>]], - parameters = [[<table width='100%%'>%s</table>]], - listing = [[<pre><t>%s</t></listing>]], - special = [[<i>%s</i>]], - default = [[<u>%s</u>]], +local s_modes_t = { + tex = [[<a class="setupmodeurl" href='mtx-server-ctx-help.lua?mode=lua'>lua mode</a>]], + lua = [[<a class="setupmodeurl" href='mtx-server-ctx-help.lua?mode=tex'>tex mode</a>]], } -local function translate(tag,int,noformat) - local formats = document.setups.formats - local translations = document.setups.translations - local translation = translations[tag] - local translated = translation and (translation[tag] or translation[tag]) or tag +local f_interface = formatters[ [[<a href='mtx-server-ctx-help.lua?interface=%s&mode=%s'>%s</a>]] ] +local f_source = formatters[ [[<a href='mtx-server-ctx-help.lua?source=%s&mode=%s'>%s</a>]] ] +local f_keyword = formatters[ [[<tr><td width='15%%'>%s</td><td width='85%%' colspan='2'>%s</td></tr>]] ] +local f_parameter = formatters[ [[<tr><td width='15%%'>%s</td><td width='15%%'>%s</td><td width='70%%'>%s</td></tr>]] ] +local f_parameters = formatters[ [[<table width='100%%'>%s</table>]] ] +local f_listing = formatters[ [[<pre><t>%s</t></listing>]] ] +local f_special = formatters[ [[<i>%s</i>]] ] +local f_url = formatters[ [[<tr><td width='15%%'>%s</td><td width='85%%' colspan='2'><i>%s</i>: %s</td></tr>]] ] +local f_default = formatters[ [[<u>%s</u>]] ] + +local function translate(tag,int,noformat) -- to be checked + local translation = setupstrings[tag] + local translated = translation and (translation[tag] or translation[tag]) or tag if noformat then return translated else - return formatters[formats.special](translated) + return f_special(translated) end end -local function translated(e,int) - local formats = document.setups.formats +local function translated(e,int) -- to be checked local attributes = e.at local s = attributes.type or "?" - local tag = match(s,"^cd:(.*)$") - if attributes.default == "yes" then - return formatters[formats.default](tag or "?") - elseif tag then - return translate(tag,int) + if find(s,"^cd:") then + local t = setupstrings[s] + local f = t and (t[int] or t.en) or s + if attributes.default == "yes" then + return f_default(f) + elseif tag then + return f_default(f) + else + return f + end else - return s - end -end - -document.setups.loaded = document.setups.loaded or { } - -document.setups.current = { } -document.setups.showsources = true -document.setups.mode = "tex" - -function document.setups.load(filename) - filename = resolvers.findfile(filename) or "" - if filename ~= "" then - local current = document.setups.loaded[filename] - if not current then - local loaded = xml.load(filename) - if loaded then - -- xml.inject(document.setups.root,"/",loaded) - current = { - file = filename, - root = loaded, - names = { }, - used = { }, - } - document.setups.loaded[filename] = current - end + if attributes.default == "yes" then + return f_default(translate(s,int) or "?") + elseif tag then + return translate(s,int) + else + return s end - document.setups.current = current or { } end end -function document.setups.name(ek) - local at = ek.at +local function makename(e) -- to be checked + local at = e.at local name = at.name if at.type == 'environment' then - name = "start" .. name + name = "start" .. name -- todo: elements.start end if at.variant then name = name .. ":" .. at.variant @@ -163,230 +115,358 @@ function document.setups.name(ek) return lower(name) end -local function csname(ek,int) +local function csname(e,int) -- to be checked local cs = "" - local at = ek.at or { } + local at = e.at if at.type == 'environment' then - cs = translate("start",int,true) .. cs + cs = "start" .. cs -- todo: elements.start end - local e = xml.first(ek,'cd:sequence/(cd:string|variable)') - if e then - if e.tg == "string" then - cs = cs .. e.at.value + local f = xmlfirst(e,'cd:sequence/(cd:string|variable)') + if f then + if f.tg == "string" then + cs = cs .. f.at.value else - cs = cs .. e.at.value -- to be translated + cs = cs .. f.at.value -- to be translated end else - cs = cs .. ek.at.name + cs = cs .. at.name end return cs end -document.setups.csname = csname - -function document.setups.names() - local current = document.setups.current - local names = current.names - if not names or #names == 0 then - local found = { } - local name = document.setups.name - names = { } - for e in xml.collected(current.root,'cd:command') do - local name = e.at.name - local csname = csname(e,int) - local done = found[csname] - if not done then - names[#names+1] = { name, csname } - found[csname] = name - else - -- variant - end +local function getnames(root) + local found = { } + local names = { } + for e in xmlcollected(root,'cd:command') do + local name = e.at.name + local csname = csname(e,int) + if not found[csname] then + names[#names+1] = { name, csname } + found[csname] = name + else + -- variant end - sort(names, function(a,b) return lower(a[2]) < lower(b[2]) end) - current.names = names -- can also become a hash end + sort(names, function(a,b) return lower(a[2]) < lower(b[2]) end) return names end -function document.setups.show(name) - local current = document.setups.current - if current.root then - local name = gsub(name,"[<>]","") - local setup = xml.first(current.root,"cd:command[@name='" .. name .. "']") - current.used[#current.used+1] = setup - xml.sprint(setup) +local function getdefinitions(root) + local definitions = { } + for e in xmlcollected(root,"cd:define") do + definitions[e.at.name] = e end + return definitions end -function document.setups.showused() - local current = document.setups.current - if current.root and next(current.used) then - local sorted = table.sortedkeys(current.used) - for i=1,#sorted do - xml.sprint(current.used[sorted[i]]) - end - end -end -function document.setups.showall() - local current = document.setups.current - if current.root then - local list = { } - for e in xml.collected(current.root,"cd:command") do - list[document.setups.name(e)] = e - end - local sorted = table.sortedkeys(list) - for i=1,#sorted do - xml.sprint(list[sorted[i]]) +local loaded = setmetatableindex(function(loaded,interface) + local starttime = gettime() + local filename = formatters["context-%s.xml"](interface) + local fullname = resolvers.findfile(filename) or "" + local current = false + if fullname ~= "" then + local root = xmlload(fullname) + if root then + current = { + intercace = interface, + filename = filename, + fullname = fullname, + root = root, + names = getnames(root), + definitions = getdefinitions(root), + } end end -end -function document.setups.resolve(name) - local current = document.setups.current - if current.root then - local e = xml.filter(current.root,formatters["cd:define[@name='%s']/text()"](name)) - if e then - xml.sprint(e) - end + if current then + report("data file %a loaded for interface %a in %0.3f seconds",filename,interface,gettime()-starttime) + else + report("no valid interface file for %a",interface) end -end - --- todo: cache definitions + loaded[filename] = current + return current +end) -function document.setups.collect(name,int,lastmode) - local current = document.setups.current - local formats = document.setups.formats - local list = { } - for command in xml.collected(current.root,formatters["cd:command[@name='%s']"](name)) do +local function collect(current,name,int,lastmode) + local list = { } + for command in xmlcollected(current.root,formatters["cd:command[@name='%s']"](name)) do local attributes = command.at or { } local data = { - command = command, + command = command, category = attributes.category or "", + source = attributes.file and f_source(attributes.file,lastmode,attributes.file) or "" } - if document.setups.showsources then - data.source = (attributes.file and formatters[formats.source](attributes.file,lastmode,attributes.file)) or "" - else - data.source = attributes.file or "" + + local sequence = { } + local tags = { } + local arguments = { } + local tag = "" + + local generated = attributes.generated == "yes" + local environment = attributes.type == "environment" + + -- first pass: construct the top line + + local start = environment and (attributes["begin"] or "start") or "" -- elements.start + local stop = environment and (attributes["end"] or "stop" ) or "" -- elements.stop + local name = attributes.name + local valid = true + local texmode = lastmode == "tex" + + local first = xmlfirst(command,"/sequence") + + if first then + name = xmltext(xmlfirst(first)) end - local n, sequence, tags = 0, { }, { } - sequence[#sequence+1] = formatters[formats.open_command[lastmode]](document.setups.csname(command,int)) - local arguments, tag = { }, "" - for e in xml.collected(command,"(cd:keywords|cd:assignments)") do - n = n + 1 - local attributes = e.at - if #sequence > 1 then - local c = formats.connector[lastmode] - if c ~= "" then - sequence[#sequence+1] = c + + -- translate name + + local function process(e) + for e in xmlcollected(e,"/*") do + if not e.special then + local tag = e.tg + local attributes = e.at + if tag == "resolve" then + local resolved = current.definitions[e.at.name or ""] + if resolved then + process(resolved) + end + else + -- we need a 'lua' tag i.e. we only support a subset of string/table + local delimiters = attributes.delimiters or "brackets" + local optional = attributes.optional == "yes" + local list = attributes.list == "yes" + if texmode then + local okay + if tag == "keywords" then + -- todo = optional + okay = setupstrings["cd:" .. delimiters .. (list and "-l" or "-s")] + elseif tag == "assignments" then + -- todo = optional + okay = setupstrings["cd:assignment" .. delimiters .. (list and "-l" or "-s")] + elseif tag == "delimiter" then + tag = "\\" .. attributes.name + elseif tag == "string" then + tag = attributes.value + else + -- todo = optional + okay = setupstrings["cd:" .. tag .. (list and "-l" or "-s")] + or setupstrings["cd:" .. tag] + end + if okay then + tag = okay.en or tag + end + else + local okay + if tag == "keywords" then + -- todo = optional + okay = setupstrings["cd:" .. delimiters .. (list and "-l" or "-s")] + elseif tag == "assignments" then + -- todo = optional + okay = setupstrings["cd:assignment" .. delimiters .. (list and "-l" or "-s")] + elseif tag == "delimiter" then + okay = false + elseif tag == "string" then + okay = false + else + -- todo = optional + okay = setupstrings["cd:" .. tag .. (list and "-l" or "-s")] + or setupstrings["cd:" .. tag] + end + if okay then + local luatag = okay.lua + if luatag then + tag = luatag + else + tag = "unsupported" + valid = false + end + else + tag = "unsupported" + valid = false + end + end + if tag then + sequence[#sequence+1] = tag + tags[#tags+1] = tag + end + end end + end + end + + if start and start ~= "" then + if texmode then + sequence[#sequence+1] = formatters["\\%s%s"](start,name) + else + sequence[#sequence+1] = formatters["context.%s%s("](start,name) end - if attributes.optional == 'yes' then - if attributes.list == 'yes' then - tag = formatters[formats.optional_list[lastmode]](n) - else - tag = formatters[formats.optional_single[lastmode]](n) - end + else + if texmode then + sequence[#sequence+1] = formatters["\\%s"](name) else - if attributes.list == 'yes' then - tag = formatters[formats.mandate_list[lastmode]](n) - else - tag = formatters[formats.mandate_single[lastmode]](n) - end + sequence[#sequence+1] = formatters["context.%s("](name) end - sequence[#sequence+1] = tag - tags[#tags+1] = tag end - sequence[#sequence+1] = formats.close_command[lastmode] - data.sequence = concat(sequence, " ") - local parameters, n = { }, 0 - local function process(e) - for e in xml.collected(e,"(cd:keywords|cd:assignments|cd:resolve)") do - n = n + 1 - local tag = e.tg - if tag == "resolve" then - local name = e.at.name or "" - if name ~= "" then - local resolved = xml.first(current.root,formatters["cd:define[@name='%s']"](name)) + for e in xmlcollected(command,"/cd:arguments") do + process(e) + end + + if texmode then + if stop and stop ~= "" then + sequence[#sequence+1] = "\\" .. stop .. name + end + else + for i=2,#sequence-1 do + sequence[i] = sequence[i] .. ", " + end + + if stop and stop ~= "" then + sequence[#sequence+1] = formatters[") context.%s%s()"](stop,name) + else + sequence[#sequence+1] = ")" + end + end + + if valid then + + data.sequence = concat(sequence," ") + + -- second pass: construct the descriptions + + local parameters = { } + local n = 0 + + local function process(e) + for e in xmlcollected(e,"/*") do + local tag = e.tg + + if tag == "resolve" then + + local resolved = current.definitions[e.at.name or ""] if resolved then process(resolved) end - end - elseif tag == "keywords" then - local left = tags[n] - local right = { } - for e in xml.collected(e,"(cd:constant|cd:resolve)") do - local tag = e.tg - if tag == "resolve" then - local name = e.at.name or "" - if name ~= "" then - local resolved = xml.first(current.root,formatters["cd:define[@name='%s']"](name)) - for e in xml.collected(resolved,"cd:constant") do - right[#right+1] = translated(e,int) - end - end - else + + elseif tag == "keywords" then + + n = n + 1 + local left = tags[n] + local right = { } + + local function processkeyword(e) right[#right+1] = translated(e,int) end - end - parameters[#parameters+1] = formatters[formats.parameter](left,"",concat(right, ", ")) - else - local what = tags[n] - for e in xml.collected(e,"(cd:parameter|cd:inherit|cd:resolve)") do - local tag = e.tg - local left = e.at.name or "?" - local right = { } - if tag == "resolve" then - local name = e.at.name or "" - if name ~= "" then - local resolved = xml.first(current.root,formatters["cd:define[@name='%s']"](name)) - if resolved then - process(resolved) + + for e in xmlcollected(e,"/*") do + if not e.special then + local tag = e.tg + if tag == "resolve" then + local resolved = current.definitions[e.at.name or ""] + if resolved then + processkeyword(resolved) + end + elseif tag == "constant" then + processkeyword(e) + else + right[#right+1] = "KEYWORD TODO" end end - elseif tag == "inherit" then - local name = e.at.name or "?" - local url = formatters[formats.href_as_command[lastmode]](name,lastmode,name) - if #parameters > 0 and not find(parameters[#parameters],"<br/>") then - parameters[#parameters+1] = formatters[formats.parameter]("<br/>","","") + end + parameters[#parameters+1] = f_keyword(left,concat(right, ", ")) + + elseif tag == "assignments" then + + n = n + 1 + local what = tags[n] + local done = false + + local function processparameter(e,right) + for e in xmlcollected(e,"/*") do + if not e.special then + local tag = e.tg + if tag == "resolve" then + local resolved = current.definitions[e.at.name or ""] + if resolved then + processparameter(resolved,right) + end + elseif tag == "constant" then + right[#right+1] = translated(e,int) + else + right[#right+1] = "PARAMETER TODO" + end + end end - parameters[#parameters+1] = formatters[formats.parameter](what,formatters[formats.special](translate("inherits",int)),url) - else - for e in xml.collected(e,"(cd:constant|cd:resolve)") do - local tag = e.tg + end + + for e in xmlcollected(e,"/*") do + if not e.special then + local tag = e.tg + local left = e.at.name or "?" + local right = { } if tag == "resolve" then - local name = e.at.name or "" - if name ~= "" then - local resolved = xml.first(current.root,formatters["cd:define[@name='%s']"](name)) - for e in xml.collected(resolved,"cd:constant") do - right[#right+1] = translated(e,int) - end + local resolved = current.definitions[e.at.name or ""] + if resolved then + -- todo + process(resolved) end + elseif tag == "inherit" then + local name = e.at.name or "?" + local url = f_href_as_command_t[lastmode](name,lastmode,name) + parameters[#parameters+1] = f_url(what,translate("inherits",int),url) + elseif tag == "parameter" then + processparameter(e,right) + parameters[#parameters+1] = f_parameter(what,left,concat(right, ", ")) else - right[#right+1] = translated(e,int) + parameters[#parameters+1] = "PARAMETER TODO" + end + if not done then + done = true + what = "" end end - parameters[#parameters+1] = formatters[formats.parameter](what,left,concat(right, ", ")) end + what = "" + else + + n = n + 1 + local left = tags[n] + local right = setupstrings["cd:"..tag] + + if right then + right = uppercase(right[int] or right.en or tag) + end + + parameters[#parameters+1] = f_keyword(left,right) + end end - parameters[#parameters+1] = formatters[formats.parameter]("<br/>","","") end + + for e in xmlcollected(command,"/cd:arguments") do + process(e) + end + + data.parameters = parameters + else + if texmode then + data.sequence = formatters["unsupported command '%s%s'"](start or "",name) + else + data.sequence = formatters["unsupported function '%s%s'"](start or "",name) + end + data.parameters = { } end - process(command) - data.parameters = parameters or { } - data.mode = formats.modes[lastmode or "tex"] + + data.mode = s_modes_t[lastmode or "tex"] list[#list+1] = data + end return list end -- -- -- -tex = tex or { } - --- -- -- - local interfaces = { czech = 'cz', dutch = 'nl', @@ -398,8 +478,6 @@ local interfaces = { romanian = 'ro', } -local lastinterface, lastcommand, lastsource, lastmode = "en", "", "", "tex" - local variables = { ['color-background-main-left'] = '#3F3F3F', ['color-background-main-right'] = '#5F5F5F', @@ -408,68 +486,59 @@ local variables = { ['title'] = 'ConTeXt Help Information', } ---~ function lmx.loadedfile(filename) ---~ return io.loaddata(resolvers.findfile(filename)) -- return resolvers.texdatablob(filename) ---~ end - local what = { "environment", "category", "source", "mode" } -local function doit(configuration,filename,hashed) +local function generate(configuration,filename,hashed) - local start = os.clock() + local start = gettime() local detail = hashed.queries or { } - local formats = document.setups.formats if detail then - lastinterface = detail.interface or lastinterface - lastcommand = detail.command or lastcommand - lastsource = detail.source or lastsource - lastmode = detail.mode or lastmode or "tex" + local lastinterface = detail.interface or "en" + local lastcommand = detail.command or "" + local lastsource = detail.source or "" + local lastmode = detail.mode or "tex" + + local current = loaded[lastinterface] lastcommand = gsub(lastcommand,"%s*^\\*(.+)%s*","%1") - if lastinterface then - report("checking interface: %s",lastinterface) - -- document.setups.load(formatters["cont-%s.xml"](lastinterface)) - document.setups.load(formatters["context-%s.xml"](lastinterface)) - end + local f_div = f_divs_t[lastinterface] + ----- f_span = f_spans[lastinterface] - local div = document.setups.div [lastinterface] - local span = document.setups.span[lastinterface] + local names = current.names + local refs = { } + local ints = { } - local names, refs, ints = document.setups.names(lastinterface), { }, { } for k=1,#names do local v = names[k] - refs[k] = formatters[formats.href_in_list[lastmode]](v[1],lastmode,v[2]) + refs[k] = f_href_in_list_t[lastmode](v[1],lastmode,v[2]) end + if lastmode ~= "lua" then - local sorted = table.sortedkeys(interfaces) + local sorted = sortedkeys(interfaces) for k=1,#sorted do local v = sorted[k] - ints[k] = formatters[formats.interface](interfaces[v],lastmode,v) + ints[k] = f_interface(interfaces[v],lastmode,v) end end local n = concat(refs,"<br/>") local i = concat(ints,"<br/><br/>") - if div then - variables.names = formatters[div](n) - variables.interfaces = formatters[div](i) + if f_div then + variables.names = f_div(n) + variables.interfaces = f_div(i) else variables.names = n variables.interfaces = i end - -- first we need to add information about mkii/mkiv + -- we only support mkiv - variables.maintitle = "no definition" - variables.maintext = "" - variables.extra = "" + if lastsource and lastsource ~= "" then - if document.setups.showsources and lastsource and lastsource ~= "" then - -- todo: mkii, mkiv, tex (can be different) local name = lastsource local full = resolvers.findfile(name) if full == "" and file.suffix(lastsource) == "tex" then @@ -482,16 +551,20 @@ local function doit(configuration,filename,hashed) end if full == "" then variables.maintitle = lastsource - variables.maintext = formatters[formats.listing]("no source found") + variables.maintext = f_listing("no source found") else local data = io.loaddata(full) data = scite.html(data,file.suffix(full),true) variables.maintitle = name - variables.maintext = formatters[formats.listing](data) + variables.maintext = f_listing(data) end - lastsource = "" + lastsource = "" + variables.extra = "mode: " .. s_modes_t.tex .. " " .. s_modes_t.lua + elseif lastcommand and lastcommand ~= "" then - local list = document.setups.collect(lastcommand,lastinterface,lastmode) + + + local list = collect(current,lastcommand,lastinterface,lastmode) if list and #list > 0 then local data = list[1] local extra = { } @@ -503,11 +576,18 @@ local function doit(configuration,filename,hashed) end end variables.maintitle = data.sequence - variables.maintext = formatters[formats.parameters](concat(data.parameters)) + variables.maintext = f_parameters(concat(data.parameters)) variables.extra = concat(extra," ") else - variables.maintext = "select command" + variables.maintitle = "no command" + variables.maintext = "select command" + variables.extra = "" end + + else + variables.maintitle = "no definition" + variables.maintext = "" + variables.extra = "" end else @@ -520,9 +600,9 @@ local function doit(configuration,filename,hashed) local content = lmx.convert('context-help.lmx',false,variables) - report("time spent on page: %0.03f seconds",os.clock()-start) + report("time spent on building page: %0.03f seconds",gettime()-start) return { content = content } end -return doit, true +return generate, true diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 5cb5f6356..2249c154f 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -8765,7 +8765,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 6916, stripped down to: 5484 +-- original size: 6917, stripped down to: 5484 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -18735,8 +18735,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 796598 --- stripped bytes : 288945 +-- original bytes : 796599 +-- stripped bytes : 288946 -- end library merge diff --git a/scripts/context/stubs/mswin/contextjit.exe b/scripts/context/stubs/mswin/contextjit.exe Binary files differnew file mode 100644 index 000000000..0e7882cf9 --- /dev/null +++ b/scripts/context/stubs/mswin/contextjit.exe diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 5cb5f6356..2249c154f 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -8765,7 +8765,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 6916, stripped down to: 5484 +-- original size: 6917, stripped down to: 5484 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -18735,8 +18735,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 796598 --- stripped bytes : 288945 +-- original bytes : 796599 +-- stripped bytes : 288946 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 5cb5f6356..2249c154f 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -8765,7 +8765,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 6916, stripped down to: 5484 +-- original size: 6917, stripped down to: 5484 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -18735,8 +18735,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 796598 --- stripped bytes : 288945 +-- original bytes : 796599 +-- stripped bytes : 288946 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 5cb5f6356..2249c154f 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -8765,7 +8765,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 6916, stripped down to: 5484 +-- original size: 6917, stripped down to: 5484 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -18735,8 +18735,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 796598 --- stripped bytes : 288945 +-- original bytes : 796599 +-- stripped bytes : 288946 -- end library merge diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex da86faf6b..dcd95477a 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/mkiv/char-tex.lua b/tex/context/base/mkiv/char-tex.lua index 562f9c8b8..60f324be2 100644 --- a/tex/context/base/mkiv/char-tex.lua +++ b/tex/context/base/mkiv/char-tex.lua @@ -792,7 +792,7 @@ local function overload(c,u,code,codes) end local t = nil if n == 1 then - t = u[1] + t = tonumber(u[1]) else t = { } for i=1,n do diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 12e0c7057..c5b7003fc 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2016.04.13 16:46} +\newcontextversion{2016.04.16 15:27} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context-help.lmx b/tex/context/base/mkiv/context-help.lmx index 5f5b5b20a..7d54fca4d 100644 --- a/tex/context/base/mkiv/context-help.lmx +++ b/tex/context/base/mkiv/context-help.lmx @@ -65,6 +65,10 @@ background-color: #C0C0C0 ; color: black; } + a.setuplisturl { + color: #000000 ; + text-decoration: underline ; + } <?lua if utilities and utilities.scite and utilities.scite.css then p(utilities.scite.css()) diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index b2043ced7..02f56afe0 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2016.04.13 16:46} +\edef\contextversion{2016.04.16 15:27} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua index d08c61eac..f36f75077 100644 --- a/tex/context/base/mkiv/font-con.lua +++ b/tex/context/base/mkiv/font-con.lua @@ -63,8 +63,7 @@ constructors.keys = { properties = { encodingbytes = "number", embedding = "number", - cidinfo = { - }, + cidinfo = { }, format = "string", fontname = "string", fullname = "string", @@ -683,7 +682,7 @@ function constructors.scale(tfmdata,specification) chr.unicode = isunicode chr.tounicode = tounicode(isunicode) -- in luatex > 0.85 we can do this: --- chr.tounicode = isunicode + -- chr.tounicode = isunicode end if hasquality then -- we could move these calculations elsewhere (saves calculations) diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua index 77ddea12b..14e816d5e 100644 --- a/tex/context/base/mkiv/font-dsp.lua +++ b/tex/context/base/mkiv/font-dsp.lua @@ -1147,7 +1147,7 @@ local function handlemark(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyp local b = basecoverage[i] if components then for c=1,#components do - local classes = components[i] + local classes = components[c] if classes then for i=1,nofclasses do local anchor = readanchor(f,classes[i]) diff --git a/tex/context/base/mkiv/font-fbk.lua b/tex/context/base/mkiv/font-fbk.lua index 56f002558..9ef0706d2 100644 --- a/tex/context/base/mkiv/font-fbk.lua +++ b/tex/context/base/mkiv/font-fbk.lua @@ -46,6 +46,9 @@ local force_composed = false local cache = { } -- we could make these weak local fraction = 0.15 -- 30 units for lucida +-- todo: we also need to update the feature hashes ... i'll do that when i'm in the mood +-- and/or when i need it + local function composecharacters(tfmdata) -- this assumes that slot 1 is self, there will be a proper self some day local characters = tfmdata.characters diff --git a/tex/context/base/mkiv/font-map.lua b/tex/context/base/mkiv/font-map.lua index a91e5234f..ce84ca692 100644 --- a/tex/context/base/mkiv/font-map.lua +++ b/tex/context/base/mkiv/font-map.lua @@ -438,6 +438,95 @@ function mappings.addtounicode(data,filename,checklookups) checklookups(data,missing,nofmissing) end -- todo: go lowercase + + local unset = { } + for unic, glyph in next, descriptions do + if not glyph.unicode and glyph.class == "ligature" then + unset[unic] = glyph + end + end + if next(unset) then + local sequences = resources.sequences + local collected = { } + for i=1,#sequences do + local sequence = sequences[i] + if sequence.type == "gsub_ligature" then + local steps = sequence.steps + if steps then + local l = { } + local function traverse(p,k,v) + if k == "ligature" then + collected[v] = { unpack(l) } + else + table.insert(l,k) + for k, vv in next, v do + traverse(p,k,vv) + end + table.remove(l) + end + end + for i=1,#steps do + -- we actually had/have this in base mode + local coverage = steps[i].coverage + if coverage then + for k, v in next, coverage do + traverse(k,k,v) + end + end + end + end + end + end + if next(collected) then + while true do + local done = false + for k, v in next, collected do + for i=1,#v do + local vi = v[i] + if vi == k then + collected[k] = nil + unset[k] = nil + else + local c = collected[vi] + if c then + done = true + local t = { } + local n = i - 1 + for j=1,n do + t[j] = t[j] + end + for j=1,#c do + n = n + 1 + t[n] = c[j] + end + for j=i+1,#v do + n = n + 1 + t[n] = t[j] + end + collected[k] = t + break + end + end + end + end + if not done then + break + end + end + local n = 0 + for k, v in next, unset do + u = collected[k] + if u then + v.unicode = u + n = n + 1 + end + end + if trace_mapping and n > 0 then + report_fonts("%n ligature tounicode mappings deduced from gsub ligature feaures",n) + end + end + end + if trace_mapping then for unic, glyph in table.sortedhash(descriptions) do local name = glyph.name diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua index 7d73b457e..9d9c39c58 100644 --- a/tex/context/base/mkiv/font-mis.lua +++ b/tex/context/base/mkiv/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.823 +otf.version = otf.version or 2.824 otf.cache = otf.cache or containers.define("fonts", "otf", otf.version, true) local fontloader = fontloader diff --git a/tex/context/base/mkiv/font-otd.lua b/tex/context/base/mkiv/font-otd.lua index db041c722..2257caa8c 100644 --- a/tex/context/base/mkiv/font-otd.lua +++ b/tex/context/base/mkiv/font-otd.lua @@ -133,6 +133,8 @@ local wildcard = "*" -- what about analyze in local and not in font +-- needs checking: some added features can pass twice + local function initialize(sequence,script,language,s_enabled,a_enabled,font,attr,dynamic,ra,autoscript,autolanguage) local features = sequence.features if features then diff --git a/tex/context/base/mkiv/font-otf.lua b/tex/context/base/mkiv/font-otf.lua index e71a57cbe..cbdc79678 100644 --- a/tex/context/base/mkiv/font-otf.lua +++ b/tex/context/base/mkiv/font-otf.lua @@ -58,7 +58,7 @@ local otf = fonts.handlers.otf otf.glists = { "gsub", "gpos" } -otf.version = 2.823 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 2.824 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otf", otf.version, true) local hashes = fonts.hashes diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua index 0deb4bce0..210abfe48 100644 --- a/tex/context/base/mkiv/font-otl.lua +++ b/tex/context/base/mkiv/font-otl.lua @@ -53,7 +53,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.016 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.017 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) local otfreaders = otf.readers diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index d67db6dd6..2e648c0c8 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -2385,7 +2385,6 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) end break end - current = getnext(current) elseif char == false then if discfound then notmatchreplace[discfound] = true diff --git a/tex/context/base/mkiv/luat-run.lua b/tex/context/base/mkiv/luat-run.lua index 54450b28d..7e81350f0 100644 --- a/tex/context/base/mkiv/luat-run.lua +++ b/tex/context/base/mkiv/luat-run.lua @@ -25,9 +25,11 @@ local luatex = luatex local startactions = { } local stopactions = { } +local dumpactions = { } function luatex.registerstartactions(...) insert(startactions, ...) end function luatex.registerstopactions (...) insert(stopactions, ...) end +function luatex.registerdumpactions (...) insert(dumpactions, ...) end local function start_run() if logs.start_run then @@ -76,6 +78,9 @@ end -- end local function pre_dump_actions() + for i=1,#dumpactions do + dumpactions[i]() + end lua.finalize(trace_lua_dump and report_lua or nil) -- statistics.savefmtstatus("\jobname","\contextversion","context.tex") end diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index 24c602729..332f3d230 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -17200,6 +17200,15 @@ return { ["nl"]="naam", ["ro"]="csname", }, + ["cd:delimiter"]={ + ["cs"]="delimiter", + ["de"]="delimiter", + ["en"]="delimiter", + ["fr"]="delimiter", + ["it"]="delimiter", + ["nl"]="delimiter", + ["ro"]="delimiter", + }, ["cd:destination"]={ ["cs"]="destination", ["de"]="destination", @@ -17623,52 +17632,71 @@ return { ["nl"]="xmlsetup", ["ro"]="xmlsetup", }, - ["s:sign"] = { en = "[-+]" }, - ["s:noargument"] = { en = "\\..." }, - ["s:oneargument"] = { en = "\\...#1" }, - ["s:twoarguments"] = { en = "\\...#1#2" }, - ["s:threearguments"] = { en = "\\...#1#2#3" }, - ["s:braces"] = { en = "{...}" }, - ["l:braces"] = { en = "{...,...}" }, - ["s:brackets"] = { en = "[...]" }, - ["l:brackets"] = { en = "[...,...]" }, - ["s:index"] = { en = "[...]" }, - ["l:index"] = { en = "[..+...+..]" }, - ["s:math"] = { en = "$...$" }, - ["s:inlinemath"] = { en = "$...$" }, - ["s:displaymath"] = { en = "$$...$$" }, - ["s:template"] = { en = "[|...|]" }, - ["l:template"] = { en = "[|...|...|]" }, - ["s:twowords"] = { en = "[..+..]" }, - ["s:threewords"] = { en = "[..+..+..]" }, - ["s:angle"] = { en = "<<...>>" }, - ["s:reference"] = { en = "[...]" }, - ["l:reference"] = { en = "[...,...]" }, - ["s:position"] = { en = "(...)" }, - ["l:position"] = { en = "(...,...)" }, - ["s:triplet"] = { en = "[x:y:z=]" }, - ["l:triplet"] = { en = "[x:y:z=,..]" }, - ["s:word"] = { en = "{...}" }, - ["l:word"] = { en = "{.. ... ..}" }, - ["s:content"] = { en = "{...}" }, - ["l:content"] = { en = "{.. ... ..}" }, - ["s:textual"] = { en = "..." }, - ["l:textual"] = { en = ".. ... .." }, - ["s:none"] = { en = "..." }, - ["l:none"] = { en = ".. ... .." }, - ["s:macro"] = { en = "\\... " }, - ["s:to"] = { en = "\\to " }, - ["s:destination"] = { en = "[{..[ref]}]" }, - ["l:destination"] = { en = "[..,{..[ref,..]},..]" }, - ["s:nothing"] = { en = "..." }, - ["s:file"] = { en = " ... " }, - ["s:bracedassignment"] = { en = "{..=..}" }, - ["l:bracedassignment"] = { en = "{..,..=..,..}" }, - ["s:bracketedassignment"] = { en = "[..=..]" }, - ["l:bracketedassignment"] = { en = "[..,..=..,..]" }, - ["s:parenthesizedassignment"] = { en = "[..=..]" }, - ["l:parenthesizedassignment"] = { en = "[..,..=..,..]" }, - ["s:apply"] = { en = "[..=>..]" }, - ["l:apply"] = { en = "[..,..=>..,..]" }, + ["cd:sign-s"] = { en = "[-+]" }, + ["cd:sign-l"] = { en = "[-+]" }, + ["cd:csname-s"] = { en = "\\..." }, + ["cd:csname-l"] = { en = "\\..." }, + ["cd:noargument-s"] = { en = "\\..." }, + ["cd:noargument-l"] = { en = "\\..." }, + ["cd:oneargument-s"] = { en = "\\...#1" }, + ["cd:oneargument-l"] = { en = "\\...#1" }, + ["cd:twoarguments-s"] = { en = "\\...#1#2" }, + ["cd:twoarguments-l"] = { en = "\\...#1#2" }, + ["cd:threearguments-s"] = { en = "\\...#1#2#3" }, + ["cd:threearguments-l"] = { en = "\\...#1#2#3" }, + ["cd:braces-s"] = { en = "{...}", lua = '"..."' }, + ["cd:braces-l"] = { en = "{...,...}", lua = '".. ... .."' }, + ["cd:brackets-s"] = { en = "[...]", lua = "{ ... }" }, + ["cd:brackets-l"] = { en = "[...,...]", lua = "{..., ...}" }, + ["cd:index-s"] = { en = "[...]" }, + ["cd:index-l"] = { en = "[..+...+..]" }, + ["cd:math-s"] = { en = "$...$" }, + ["cd:math-l"] = { en = "$...$" }, + ["cd:inlinemath-s"] = { en = "$...$" }, + ["cd:inlinemath-l"] = { en = "$...$" }, + ["cd:displaymath-s"] = { en = "$$...$$" }, + ["cd:displaymath-l"] = { en = "$$...$$" }, + ["cd:template-s"] = { en = "[|...|]" }, + ["cd:template-l"] = { en = "[|...|...|]" }, + ["cd:twowords-s"] = { en = "[..+..]" }, + ["cd:twowords-l"] = { en = "[..+..]" }, + ["cd:threewords-s"] = { en = "[..+..+..]" }, + ["cd:threewords-l"] = { en = "[..+..+..]" }, + ["cd:angle-s"] = { en = "<<...>>" }, + ["cd:angle-l"] = { en = "<<...>>" }, + ["cd:reference-s"] = { en = "[...]", lua = "{ ... }" }, + ["cd:reference-l"] = { en = "[...,...]", lua = "{..., ...}" }, + ["cd:position-s"] = { en = "(...)" }, + ["cd:position-l"] = { en = "(...,...)" }, + ["cd:triplet-s"] = { en = "[x:y:z]" }, + ["cd:triplet-l"] = { en = "[x:y:z,..]" }, + ["cd:word-s"] = { en = "{...}", lua = '"..."' }, + ["cd:word-l"] = { en = "{.. ... ..}", lua = '".. ... .."' }, + ["cd:content-s"] = { en = "{...}", lua = '"..."' }, + ["cd:content-l"] = { en = "{.. ... ..}", lua = '".. ... .."' }, + ["cd:textual-s"] = { en = "..." }, + ["cd:textual-l"] = { en = ".. ... .." }, + ["cd:none-s"] = { en = "..." }, + ["cd:none-l"] = { en = ".. ... .." }, + ["cd:macro-s"] = { en = "\\... " }, + ["cd:macro-l"] = { en = "\\... " }, + ["cd:to-s"] = { en = "\\to " }, + ["cd:to-l"] = { en = "\\to " }, + ["cd:destination-s"] = { en = "[{..[ref]}]" }, + ["cd:destination-l"] = { en = "[..,{..[ref,..]},..]" }, + ["cd:nothing-s"] = { en = "..." }, + ["cd:nothing-l"] = { en = "..." }, + ["cd:file-s"] = { en = " ... " }, + ["cd:file-l"] = { en = " ... " }, + ["cd:assignment-s"] = { en = "[..=..]", lua = "{ ..=.. } " }, + ["cd:assignment-l"] = { en = "[..,..=..,..]", lua = "{ ..,..=..,.. } " }, + ["cd:assignmentbraces-s"] = { en = "{..=..}" }, + ["cd:assignmentbraces-l"] = { en = "{..,..=..,..}" }, + ["cd:assignmentbrackets-s"] = { en = "[..=..]", lua = "{ ..=.. } " }, + ["cd:assignmentbrackets-l"] = { en = "[..,..=..,..]", lua = "{ ..,..=..,.. } " }, + ["cd:assignmentparentheses-s"] = { en = "(..=..)" }, + ["cd:assignmentparentheses-l"] = { en = "(..,..=..,..)" }, + ["cd:apply-s"] = { en = "[..=>..]" }, + ["cd:apply-l"] = { en = "[..,..=>..,..]" }, } } diff --git a/tex/context/base/mkiv/mult-ini.lua b/tex/context/base/mkiv/mult-ini.lua index 3fb5416ba..409c735b7 100644 --- a/tex/context/base/mkiv/mult-ini.lua +++ b/tex/context/base/mkiv/mult-ini.lua @@ -215,6 +215,8 @@ function interfaces.setuserinterface(interface,response) sharedstorage.currentinterface, currentinterface = interface, interface sharedstorage.currentresponse, currentresponse = response, response if environment.initex then + local setmacro = false + -- local setmacro = interfaces.setmacro -- cleaner (but we need to test first) local nofconstants = 0 local nofvariables = 0 local nofelements = 0 @@ -222,49 +224,91 @@ function interfaces.setuserinterface(interface,response) local nofformats = 0 local noftranslations = 0 local nofsetupstrings = 0 - local t, n, f, s -- - t, n, f, s = { }, 0, formatters["\\ui_c{%s}{%s}"], formatters["\\ui_s{%s}"] - for given, constant in next, complete.constants do - constant = constant[interface] or constant.en or given - constants[constant] = given -- breedte -> width - nofconstants = nofconstants + 1 - if given == constant then - t[nofconstants] = s(given) - else - t[nofconstants] = f(given,constant) + if setmacro then + for given, constant in next, complete.constants do + constant = constant[interface] or constant.en or given + constants[constant] = given -- breedte -> width + nofconstants = nofconstants + 1 + setmacro("c!"..given,given) + if currentinterface ~= "en" then + setmacro("k!"..constant,given) + end + end + else + local t, f, s = { }, formatters["\\ui_c{%s}{%s}"], formatters["\\ui_s{%s}"] + for given, constant in next, complete.constants do + constant = constant[interface] or constant.en or given + constants[constant] = given -- breedte -> width + nofconstants = nofconstants + 1 + if given == constant then + t[nofconstants] = s(given) + else + t[nofconstants] = f(given,constant) + end end + contextsprint(prtcatcodes,concat(t)) end - contextsprint(prtcatcodes,concat(t)) -- - t, n, f = { }, 0, formatters["\\ui_v{%s}{%s}"] - for given, variable in next, complete.variables do - variable = variable[interface] or variable.en or given - variables[given] = variable -- ja -> yes - nofvariables = nofvariables + 1 - t[nofvariables] = f(given,variable) + if setmacro then + for given, variable in next, complete.variables do + variable = variable[interface] or variable.en or given + variables[given] = variable -- ja -> yes + nofvariables = nofvariables + 1 + setmacro("v!"..given,variable) + end + else + local t, f = { }, formatters["\\ui_v{%s}{%s}"] + for given, variable in next, complete.variables do + variable = variable[interface] or variable.en or given + variables[given] = variable -- ja -> yes + nofvariables = nofvariables + 1 + t[nofvariables] = f(given,variable) + end + contextsprint(prtcatcodes,concat(t)) end - contextsprint(prtcatcodes,concat(t)) -- - t, n, f = { }, 0, formatters["\\ui_e{%s}{%s}"] - for given, element in next, complete.elements do - element = element[interface] or element.en or given - elements[element] = given - nofelements = nofelements + 1 - t[nofelements] = f(given,element) + if setmacro then + for given, element in next, complete.elements do + element = element[interface] or element.en or given + elements[element] = given + nofelements = nofelements + 1 + setmacro("e!"..given,element) + end + else + local t, f = { }, formatters["\\ui_e{%s}{%s}"] + for given, element in next, complete.elements do + element = element[interface] or element.en or given + elements[element] = given + nofelements = nofelements + 1 + t[nofelements] = f(given,element) + end + contextsprint(prtcatcodes,concat(t)) end - contextsprint(prtcatcodes,concat(t)) -- - t, n, f = { }, 0, formatters["\\ui_m{%s}{%s}"] - for given, command in next, complete.commands do - command = command[interface] or command.en or given - if command ~= given then - n = n + 1 - t[n] = f(given,command) + if setmacro then + -- this can only work ok when we already have defined the command + luatex.registerdumpactions(function() + for given, command in next, complete.commands do + command = command[interface] or command.en or given + if command ~= given then + setmacro(prtcatcodes,given,"\\"..command) + end + nofcommands = nofcommands + 1 + end + end) + else + local t, n, f = { }, 0, formatters["\\ui_m{%s}{%s}"] + for given, command in next, complete.commands do + command = command[interface] or command.en or given + if command ~= given then + n = n + 1 + t[n] = f(given,command) + end + nofcommands = nofcommands + 1 end - nofcommands = nofcommands + 1 + contextsprint(prtcatcodes,concat(t)) end - contextsprint(prtcatcodes,concat(t)) -- for given, format in next, complete.messages.formats do formats[given] = format[interface] or format.en or given diff --git a/tex/context/base/mkiv/mult-ini.mkiv b/tex/context/base/mkiv/mult-ini.mkiv index 8675834a5..8ed147c63 100644 --- a/tex/context/base/mkiv/mult-ini.mkiv +++ b/tex/context/base/mkiv/mult-ini.mkiv @@ -804,9 +804,9 @@ % \stopinterface \def\ui_c#1#2{\expandafter\gdef\csname\c!prefix!#1\endcsname{#1}% - \expandafter\gdef\csname\k!prefix!#2\endcsname{#1}} % backmapping from non english + \expandafter\gdef\csname\k!prefix!#2\endcsname{#1}} % backmapping from non english \def\ui_s #1{\expandafter\gdef\csname\c!prefix!#1\endcsname{#1}% - \expandafter\gdef\csname\k!prefix!#1\endcsname{#1}} % backmapping from non english + \expandafter\gdef\csname\k!prefix!#1\endcsname{#1}} % backmapping from non english \def\ui_v#1#2{\expandafter\gdef\csname\v!prefix!#1\endcsname{#2}} \def\ui_e#1#2{\expandafter\gdef\csname\e!prefix!#1\endcsname{#2}} \def\ui_m#1#2{\expandafter\gdef\csname#2\expandafter\endcsname\expandafter{\csname#1\endcsname}} diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex b39796806..d775f0087 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex eb4cadf97..2d597ef30 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/trac-inf.lua b/tex/context/base/mkiv/trac-inf.lua index f4c4e5557..401fd01e7 100644 --- a/tex/context/base/mkiv/trac-inf.lua +++ b/tex/context/base/mkiv/trac-inf.lua @@ -14,7 +14,7 @@ if not modules then modules = { } end modules ['trac-inf'] = { local type, tonumber, select = type, tonumber, select local format, lower, find = string.format, string.lower, string.find local concat = table.concat -local clock = os.gettimeofday or os.clock -- should go in environment +local clock = os.gettimeofday or os.clock -- should go in environment local setmetatableindex = table.setmetatableindex local serialize = table.serialize diff --git a/tex/context/base/mkiv/typo-bld.lua b/tex/context/base/mkiv/typo-bld.lua index ab57a46f7..006576f88 100644 --- a/tex/context/base/mkiv/typo-bld.lua +++ b/tex/context/base/mkiv/typo-bld.lua @@ -52,7 +52,8 @@ storage.register("builders/paragraphs/constructors/numbers", numbers, "builders. local trace_page_builder = false trackers.register("builders.page", function(v) trace_page_builder = v end) local trace_post_builder = false trackers.register("builders.post", function(v) trace_post_builder = v end) -local report_parbuilders = logs.reporter("parbuilders") +local report_par_builder = logs.reporter("builders","par") +local report_page_builder = logs.reporter("builders","page") local mainconstructor = nil -- not stored in format local nofconstructors = 0 @@ -84,7 +85,7 @@ function constructors.start(name) if mainconstructor ~= unsetvalue then constructors.enable() end - -- report_parbuilders("start %a",name) + -- report_par_builder("start %a",name) end function constructors.stop() @@ -94,7 +95,7 @@ function constructors.stop() if mainconstructor == unsetvalue then constructors.disable() end - -- report_parbuilders("stop") + -- report_par_builder("stop") end -- return values: @@ -115,7 +116,7 @@ function constructors.handler(head,followed_by_display) if handler then return handler(head,followed_by_display) else - report_parbuilders("contructor method %a is not defined",tostring(method)) + report_par_builder("contructor method %a is not defined",tostring(method)) return true -- let tex break end end diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 9aa19b30c..7149f966c 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 809d8caad..e4273d667 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/mkiv/s-lingual-de.mkiv b/tex/context/modules/mkiv/s-lingual-de.mkiv new file mode 100644 index 000000000..f01afa468 --- /dev/null +++ b/tex/context/modules/mkiv/s-lingual-de.mkiv @@ -0,0 +1,32 @@ +% Some experimental code for Wolfgang to play with: + +\startluacode + fonts.handlers.otf.addfeature { + name = "sz", + type = "multiple", + data = { + ["ẞ"] = { "S", "S" } + } + } +\stopluacode + +\definefontfeature[sz][sz=yes] + +\unexpanded\def\composedSZ {\overloaduppercase{0xDF}{0x1E9E}} +\unexpanded\def\decomposedSZ{\overloaduppercase{0xDF}{0x53,0x53}} + +\continueifinputfile{s-lingual-de.mkiv} + +\setupbodyfont[libertine] + +\starttext + %\definefontfeature[default][default][sz=yes] + \dorecurse{10} { + \decomposedSZ \WORD{Gruß}\par + \composedSZ \WORD{Gruß}\par + } + + \composedSZ + {\addfeature{sz}Straße \WORD{Straße} STRAẞE}\par + {Straße \WORD{Straße} STRAẞE}\par +\stoptext diff --git a/tex/context/modules/mkiv/x-setups-basics.mkiv b/tex/context/modules/mkiv/x-setups-basics.mkiv index da4bc3262..326323259 100644 --- a/tex/context/modules/mkiv/x-setups-basics.mkiv +++ b/tex/context/modules/mkiv/x-setups-basics.mkiv @@ -18,6 +18,40 @@ \unprotect +\defineregister + [texmacro] +% [texmacros] + +\definesorting + [texcommand] +% [texcommands] + +\setupsorting + [texcommand] + [\c!command=\showsetupinlist, + \c!criterium=\setupparameter\c!criterium] + +\pushmacro\setuptext + +\defineframedtext + [setuptext] + [\c!width=\hsize, + \c!height=\v!fit, + \c!align=\v!right, + \c!offset=0.75\emwidth] + +\popmacro\setuptext + +\installcorenamespace{interfacesetup} + +\installsetuponlycommandhandler \??interfacesetup {setup} % \??interfacesetup + +\setupsetup + [\c!before=, + \c!after=, + \c!command=\setup, + \c!criterium=\v!used] + % general \unexpanded\def\setupnumfont {} @@ -32,10 +66,6 @@ \unexpanded\def\setupintword#1{\WORD{\detokenize{#1}}} \unexpanded\def\setuptxtword#1{\detokenize{#1}} -\installcorenamespace{interfacesetup} - -\installsetuponlycommandhandler \??interfacesetup {setup} % \??interfacesetup - \unexpanded\def\cmd_internal_value#1% {\dontleavehmode \begingroup @@ -49,31 +79,9 @@ \endgroup} \unexpanded\def\cmd_command_value#1% - {{\setupvarfont{#1}}} - -\defineregister - [texmacro] -% [texmacros] - -\definesorting - [texcommand] -% [texcommands] - -\setupsorting - [texcommand] - [\c!command=\showsetupinlist, - \c!criterium=\setupparameter\c!criterium] - -\pushmacro\setuptext - -\defineframedtext - [setuptext] - [\c!width=\hsize, - \c!height=\v!fit, - \c!align=\v!right, - \c!offset=0.75\emwidth] - -\popmacro\setuptext + {\begingroup + \setupvarfont{#1}% + \endgroup} %D Loading: @@ -207,23 +215,16 @@ context(n) end - local cmd = table.tohash { - "cd:noargument", - "cd:oneargument", - "cd:twoarguments", - "cd:threearguments", - } - interfaces.implement { name = "getsetupstring", actions = function(s) local g = getsetupstring(s) if not find(s,"^cd:") then setuptxtword(g) - elseif cmd[s] then + elseif find(s,"%-.$") then setupvarword(g) else - setupintword(g) + setupintword(g) -- cap end end, overload = true, @@ -271,24 +272,28 @@ \xmlfilter{setups:#1}{/interface//command/command(xml:setups:register)}% }}} -\newconstant\kindofsetup - -\unexpanded\def\basicsetup{\kindofsetup\zerocount\cmd_show_setup} -\unexpanded\def\shortsetup{\kindofsetup\plusone \cmd_show_setup} -\unexpanded\def\setup {\kindofsetup\plustwo \cmd_show_setup} -\unexpanded\def\showsetup {\kindofsetup\plustwo \cmd_show_setup} +\newconstant \c_cmd_kind +\newconditional\c_cmd_doing_line +\newconditional\c_cmd_measuring +\newconditional\c_cmd_show_setup +\newcount \c_cmd_current_argument +\newcount \c_cmd_maximum_argument +\newdimen \d_cmd_current_width +\let \m_cmd_current_hash \empty +\let \m_cmd_current_file \empty + +\unexpanded\def\basicsetup{\c_cmd_kind\zerocount\cmd_show_setup} +\unexpanded\def\shortsetup{\c_cmd_kind\plusone \cmd_show_setup} +\unexpanded\def\setup {\c_cmd_kind\plustwo \cmd_show_setup} +\unexpanded\def\showsetup {\c_cmd_kind\plustwo \cmd_show_setup} \unexpanded\def\showsetupinlist#1#2#3% - {\kindofsetup\plustwo\xmlsetup{#3}{xml:setups:typeset}\par} - -% todo: only references in lists - -\newconditional\c_cmd_showsetup + {\c_cmd_kind\plustwo\xmlsetup{#3}{xml:setups:typeset}\par} \installtextracker {cmd.showsetup} - {\settrue\c_cmd_showsetup} - {\setfalse\c_cmd_showsetup} + {\settrue\c_cmd_show_setup} + {\setfalse\c_cmd_show_setup} \unexpanded\def\cmd_show_setup {\doifelsenextoptionalcs\cmd_show_setup_yes\cmd_show_setup_nop} @@ -302,7 +307,7 @@ \def\cmd_show_setup_nop#1% this will trigger 'used' {\registersort[texcommand][stp:x:#1]% - \ifconditional\c_cmd_showsetup + \ifconditional\c_cmd_show_setup \writestatus{setup}{#1 / \rawsynonymname{texcommand}{stp:x:#1}}% \fi \startelement[setup][name=#1]% @@ -319,15 +324,6 @@ %D Typesetting: -% \setupxml -% [\c!default=\v!hidden, % ignore elements that are not defined -% \c!compress=\v!yes] - -\newcounter\currentSETUPargument -\newcounter\maximumSETUPargument - -\def\currentSETUPwidth{0pt} - \startxmlsetups xml:setups:typeset \doifelsenothing {#1} { \xmlsetup{#1}{xml:setups:typeset:nop} @@ -345,9 +341,9 @@ \startxmlsetups xml:setups:typeset:line \ttbf \nohyphens - \edef\currentSETUPhash{\xmlatt{#1}{hash}} + \edef\m_cmd_current_hash{\xmlatt{#1}{hash}} \bgroup - \enablemode[setups-pass-one]% + \settrue\c_cmd_doing_line \doif {\xmlatt{#1}{generated}} {yes} { \ttbs } @@ -368,15 +364,15 @@ \egroup \xmldoif{#1}{/arguments} { \bgroup - \enablemode[setups-pass-one] - \doglobal\newcounter\currentSETUPargument + \settrue\c_cmd_doing_line + \global\c_cmd_current_argument\zerocount \ignorespaces \xmlfilter{#1}{/arguments/text()} \egroup } \doif {\xmlatt{#1}{type}} {environment} { \bgroup - \enablemode[setups-pass-one]% + \settrue\c_cmd_doing_line \hskip.5em\unknown\hskip.5em \doif {\xmlatt{#1}{generated}} {yes} { \ttbs @@ -397,18 +393,17 @@ } \stopxmlsetups -\let\currentSETUPfilename\empty - \startxmlsetups xml:setups:typeset:raw \tttf \nohyphens \veryraggedright - \doglobal\newcounter\currentSETUPargument - \xdef\maximumSETUPargument{\xmlfilter{#1}{/arguments/*/s_count()}} - \edef\currentSETUPhash{\xmlatt{#1}{hash}} - \xdef\currentSETUPfilename{\xmlatt{#1}{file}}% + \global\c_cmd_current_argument\zerocount + \global\c_cmd_maximum_argument\xmlfilter{#1}{/arguments/*/s_count()}\relax + \edef\m_cmd_current_hash{\xmlatt{#1}{hash}} + \xdef\m_cmd_current_file{\xmlatt{#1}{file}}% + % can be made faster : \bgroup - \enablemode[setups-pass-one]% + \settrue\c_cmd_doing_line \doif {\xmlatt{#1}{generated}} {yes} { \ttsl } @@ -428,16 +423,16 @@ \ignorespaces \egroup \xmldoif{#1}{/arguments} { + \settrue\c_cmd_doing_line \bgroup - \enablemode[setups-pass-one] - \doglobal\newcounter\currentSETUPargument + \global\c_cmd_current_argument\zerocount \ignorespaces \xmlfilter{#1}{/arguments/text()} \egroup } \doif {\xmlatt{#1}{type}} {environment} { + \settrue\c_cmd_doing_line \bgroup - \enablemode[setups-pass-one]% \hskip.5em\unknown\hskip.5em \doif {\xmlatt{#1}{generated}} {yes} { \ttsl @@ -461,8 +456,8 @@ \startxmlsetups xml:setups:typeset:detail \xmldoif{#1}{/arguments} { \bgroup - \enablemode[setups-pass-two] - \doglobal\newcounter\currentSETUPargument + \setfalse\c_cmd_doing_line + \global\c_cmd_current_argument\zerocount %\blank[\v!line] % packed mode (we could do \startunpacked ...) \godown[.75\lineheight] \switchtobodyfont[\v!small] @@ -472,8 +467,8 @@ \stopxmlsetups \startxmlsetups xml:setups:typeset:yes - \glet\currentSETUPfilename\empty - \ifcase\kindofsetup + \glet\m_cmd_current_file\empty + \ifcase\c_cmd_kind \xmlsetup{#1}{xml:setups:typeset:line} \or \getvalue{\e!start setuptext} @@ -486,7 +481,7 @@ \xmlsetup{#1}{xml:setups:typeset:detail} \getvalue{\e!stop setuptext} \fi - \glet\currentSETUPfilename\empty + \glet\m_cmd_current_file\empty \stopxmlsetups \defineoverlay @@ -498,16 +493,10 @@ \hbox to \overlaywidth {\strut \hss - \currentSETUPfilename + \m_cmd_current_file \hskip\dimexpr\scratchdimen+\strutdp\relax}% \vskip\scratchdimen}] -\setupsetup - [\c!before=, - \c!after=, - \c!command=\setup, - \c!criterium=\v!used] - \startxmlsetups xml:setups:resolve \ignorespaces \ctxlua{moduledata.setups.resolved('\xmlatt{#1}{name}')} @@ -528,40 +517,42 @@ \xmlatt{#1}{value}\ignorespaces \stopxmlsetups -\startxmlsetups xml:setups:content \showSETUPcomponent{#1}{content} {content} \stopxmlsetups -\startxmlsetups xml:setups:displaymath \showSETUPcomponent{#1}{displaymath}{displaymath}\stopxmlsetups -\startxmlsetups xml:setups:index \showSETUPcomponent{#1}{index} {index} \stopxmlsetups -\startxmlsetups xml:setups:math \showSETUPcomponent{#1}{math} {math} \stopxmlsetups -\startxmlsetups xml:setups:nothing \showSETUPcomponent{#1}{nothing} {nothing} \stopxmlsetups -\startxmlsetups xml:setups:file \showSETUPcomponent{#1}{file} {file} \stopxmlsetups -\startxmlsetups xml:setups:position \showSETUPcomponent{#1}{position} {position} \stopxmlsetups -\startxmlsetups xml:setups:reference \showSETUPcomponent{#1}{reference} {reference} \stopxmlsetups -\startxmlsetups xml:setups:csname \showSETUPcomponent{#1}{csname} {csname} \stopxmlsetups -\startxmlsetups xml:setups:destination \showSETUPcomponent{#1}{destination}{destination}\stopxmlsetups -\startxmlsetups xml:setups:triplet \showSETUPcomponent{#1}{triplet} {triplet} \stopxmlsetups -\startxmlsetups xml:setups:word \showSETUPcomponent{#1}{word} {word} \stopxmlsetups -\startxmlsetups xml:setups:template \showSETUPcomponent{#1}{template} {template} \stopxmlsetups -\startxmlsetups xml:setups:angles \showSETUPcomponent{#1}{angles} {angles} \stopxmlsetups -\startxmlsetups xml:setups:apply \showSETUPcomponent{#1}{apply} {apply} \stopxmlsetups -\startxmlsetups xml:setups:twowords \showSETUPcomponent{#1}{twowords} {twowords} \stopxmlsetups -\startxmlsetups xml:setups:threewords \showSETUPcomponent{#1}{threewords} {threewords} \stopxmlsetups -\startxmlsetups xml:setups:text \showSETUPcomponent{#1}{text} {text} \stopxmlsetups - -% todo: cd:par => \\par -% todo: cd:sep => \\\\ - \startxmlsetups xml:setups:delimiter - \doifmode{setups-pass-one} { + \ifconditional\c_cmd_doing_line \kern.5\emwidth \letterbackslash\xmlatt{#1}{name} - } + \fi \ignorespaces \stopxmlsetups -\unexpanded\def\showSETUPcomponent#1#2#3% - {\doifelsemode{setups-pass-one} - {\getvalue{showSETUP#2}{#1}} % top line - {\simpleSETUPargument{#3}}} % column +\startxmlsetups xml:setups:content \showSETUPcomponent{#1}{content} \stopxmlsetups +\startxmlsetups xml:setups:displaymath \showSETUPcomponent{#1}{displaymath}\stopxmlsetups +\startxmlsetups xml:setups:index \showSETUPcomponent{#1}{index} \stopxmlsetups +\startxmlsetups xml:setups:math \showSETUPcomponent{#1}{math} \stopxmlsetups +\startxmlsetups xml:setups:nothing \showSETUPcomponent{#1}{nothing} \stopxmlsetups +\startxmlsetups xml:setups:file \showSETUPcomponent{#1}{file} \stopxmlsetups +\startxmlsetups xml:setups:position \showSETUPcomponent{#1}{position} \stopxmlsetups +\startxmlsetups xml:setups:reference \showSETUPcomponent{#1}{reference} \stopxmlsetups +\startxmlsetups xml:setups:csname \showSETUPcomponent{#1}{csname} \stopxmlsetups +\startxmlsetups xml:setups:destination \showSETUPcomponent{#1}{destination}\stopxmlsetups +\startxmlsetups xml:setups:triplet \showSETUPcomponent{#1}{triplet} \stopxmlsetups +\startxmlsetups xml:setups:word \showSETUPcomponent{#1}{word} \stopxmlsetups +\startxmlsetups xml:setups:template \showSETUPcomponent{#1}{template} \stopxmlsetups +\startxmlsetups xml:setups:angles \showSETUPcomponent{#1}{angles} \stopxmlsetups +\startxmlsetups xml:setups:apply \showSETUPcomponent{#1}{apply} \stopxmlsetups +\startxmlsetups xml:setups:twowords \showSETUPcomponent{#1}{twowords} \stopxmlsetups +\startxmlsetups xml:setups:threewords \showSETUPcomponent{#1}{threewords} \stopxmlsetups +\startxmlsetups xml:setups:text \showSETUPcomponent{#1}{text} \stopxmlsetups + +% todo: cd:par => \par +% todo: cd:sep => \\ + +\unexpanded\def\showSETUPcomponent#1#2% + {\ifconditional\c_cmd_doing_line + \getvalue{showSETUP#2}{#1}% + \else + \simpleSETUPargument{#2}% + \fi} %D This is the second pass; here we generate the table. @@ -578,7 +569,7 @@ \unexpanded\def\startsecondSETUPcolumn#1#2% {\bgroup \scratchdimen2.5\emwidth - \advance\hangindent\dimexpr\currentSETUPwidth+\scratchdimen\relax + \advance\hangindent\dimexpr\d_cmd_current_width+\scratchdimen\relax \noindent \hbox to \hangindent{#1\hss\hbox to \scratchdimen{\hss#2\hss}}} \unexpanded\def\stopsecondSETUPcolumn @@ -588,69 +579,73 @@ \unexpanded\def\secondSETUPcolumn#1#2% {\startsecondSETUPcolumn{#1}{#2}\stopsecondSETUPcolumn} -\def\previousSETUPargument{\currentSETUPargument} - \startxmlsetups xml:setups:assignments - \doifelsemode{setups-pass-one} { - \showSETUPassignment{#1} - } { - \xdef\currentSETUPwidth{0pt}% + \ifconditional\c_cmd_doing_line + \ifcase\c_cmd_kind + \expandafter\showSETUPline + \else + \expandafter\showSETUP + \fi{#1}{assignment\xmlattdef{#1}{delimiters}{brackets}} + \else + \global\d_cmd_current_width\zeropoint \setbox\scratchbox\vbox\bgroup - \setmode{setups-measure} + \settrue\c_cmd_measuring \xmlall{#1}{/(parameter|resolve)} \egroup - \xdef\currentSETUPwidth{\themaxboxwidth\scratchbox}% + \global\d_cmd_current_width\themaxboxwidth\scratchbox\relax \startfirstSETUPcolumn{\showSETUPnumber}% \ignorespaces - \xmldoifelse {#1} {/(parameter|inherit)} { - \xmlflush{#1} + \xmldoifelse {#1} {/(parameter|inherit|resolve)} { + \xmlflush{#1} } { - ... + \unknown } - \let\previousSETUPargument\currentSETUPargument \stopfirstSETUPcolumn \blank[\v!halfline] \ignorespaces - } + \fi \stopxmlsetups \startxmlsetups xml:setups:keywords - \doifelsemode{setups-pass-one} { - \showSETUPkeyword{#1} - } { + \ifconditional\c_cmd_doing_line + \ifcase\c_cmd_kind + \expandafter\showSETUPline + \else + \expandafter\showSETUP + \fi{#1}{\xmlattdef{#1}{delimiters}{brackets}} + \else \startfirstSETUPcolumn{\showSETUPnumber}% \ignorespaces \xmlflush{#1} - \let\previousSETUPargument\currentSETUPargument \stopfirstSETUPcolumn \blank[\v!halfline] \ignorespaces - } + \fi \stopxmlsetups \startxmlsetups xml:setups:parameter - \doifmodeelse {setups-measure} { - \getsetupstring{\xmlatt{#1}{name}}\par - } { - \startsecondSETUPcolumn{\getsetupstring{\xmlatt{#1}{name}}}{=} + \ifconditional\c_cmd_measuring + \getsetupstring{\xmlatt{#1}{name}}\par + \else + \startsecondSETUPcolumn{\getsetupstring{\xmlatt{#1}{name}}}{=} \ignorespaces \xmlflush{#1} \doifmode{interface:setup:defaults} { - \ifx\currentSETUPhash\empty \else + \ifx\m_cmd_current_hash\empty \else \begingroup % todo, make a one level expansion of parameter \let\emwidth \relax \let\exheight\relax - \edef\currentSETUPvalue{\csname named\currentSETUPhash parameter\endcsname\empty{\xmlatt{#1}{name}}} - \ifx\currentSETUPvalue\empty \else + \edef\temp{\csname named\m_cmd_current_hash parameter\endcsname\empty{\xmlatt{#1}{name}}} + \ifx\temp\empty \else =\space - \detokenize\expandafter{\currentSETUPvalue} + \detokenize\expandafter{\temp} \fi \endgroup \fi } \stopsecondSETUPcolumn - } + \fi \ignorespaces \stopxmlsetups @@ -712,16 +707,16 @@ \unexpanded\def\showSETUP#1#2% {\bgroup - \doglobal\increment\currentSETUPargument + \global\advance\c_cmd_current_argument\plusone \setbox0=\hbox {\doifelse{\xmlatt{#1}{list}}{yes} - {\getsetupstring{s:#2}}% - {\getsetupstring{l:#2}}}% + {\getsetupstring{cd:#2-l}}% + {\getsetupstring{cd:#2-s}}}% \setbox2=\hbox to \wd0 {\hss \raise1.25\exheight\hbox - {\txx\ifcase\maximumSETUPargument\relax - \or*\else\currentSETUPargument + {\txx\ifcase\c_cmd_maximum_argument \relax + \or*\else\the\c_cmd_current_argument \fi}% \hss}% \setbox4=\hbox to \wd0 @@ -746,24 +741,17 @@ \unexpanded\def\showSETUPline#1#2% {\kern.5\emwidth - \getsetupstring{s:#2}% + \getsetupstring{cd:#2-s}% \ignorespaces} \unexpanded\def\showSETUPnumber - {\doglobal\increment\currentSETUPargument + {\global\advance\c_cmd_current_argument\plusone \hbox to 2\emwidth - {\ifcase\maximumSETUPargument\relax - \or*\else\currentSETUPargument + {\ifcase\c_cmd_maximum_argument \relax + \or*\else\the\c_cmd_current_argument \fi \hss}} -% assignments - -\xmlmapvalue {setups:assignment} {braces} {\showSETUPassignmentbraces} -\xmlmapvalue {setups:assignment} {brackets} {\showSETUPassignmentbrackets} -\xmlmapvalue {setups:keyword} {parentheses} {\showSETUPkeywordparentheses} -\xmlmapvalue {setups:keyword} {none} {\showSETUPkeywordnone} - % todo: replace = by lower \unexpanded\def\setupEQsymbol % we raise the number already @@ -772,78 +760,6 @@ \unexpanded\def\setupAPPLYsymbol % we raise the number already {..\lower.25\exheight\hpack{=>}..} -\starttexdefinition unexpanded showSETUPassignmentbraces #1 - \ifcase\kindofsetup - \showSETUPline{#1}{bracedassignment} - \else - \showSETUP {#1}{bracedassignment} - \fi -\stoptexdefinition - -\starttexdefinition unexpanded showSETUPassignmentbrackets #1 - \ifcase\kindofsetup - \showSETUPline{#1}{bracketedassignment} - \else - \showSETUP {#1}{bracketedassignment} - \fi -\stoptexdefinition - -\starttexdefinition unexpanded showSETUPkeywordparentheses #1 - \ifcase\kindofsetup - \showSETUPline{#1}{parenthesizedassignment} - \else - \showSETUP {#1}{parenthesizedassignment} - \fi -\stoptexdefinition - -\starttexdefinition unexpanded showSETUPkeywordnone #1 - \ifcase\kindofsetup - \showSETUPline{#1}{none} - \else - \showSETUP {#1}{none} - \fi -\stoptexdefinition - -\starttexdefinition unexpanded showSETUPassignment #1 - \xmlvalue - {setups:assignment} - {\xmlattdef{#1}{delimiters}{brackets}} - {\showSETUPkeywordbrackets} - {#1} -\stoptexdefinition - -% we could also add specifying separatos (default comma) but let's do -% this stepwise - -% keywords - -\xmlmapvalue {setups:keyword} {braces} {\showSETUPkeywordbraces} -\xmlmapvalue {setups:keyword} {brackets} {\showSETUPkeywordbrackets} - -\starttexdefinition unexpanded showSETUPkeywordbraces #1 - \ifcase\kindofsetup - \showSETUPline{#1}{braces} - \else - \showSETUP {#1}{braces} - \fi -\stoptexdefinition - -\starttexdefinition unexpanded showSETUPkeywordbrackets #1 - \ifcase\kindofsetup - \showSETUPline{#1}{brackets} - \else - \showSETUP {#1}{brackets} - \fi -\stoptexdefinition - -\starttexdefinition unexpanded showSETUPkeyword #1 - \xmlvalue - {setups:keyword} - {\xmlattdef{#1}{delimiters}{brackets}} - {\showSETUPkeywordbrackets} - {#1} -\stoptexdefinition - % arguments \unexpanded\def\showSETUPdisplaymath#1{\showSETUP {#1}{displaymath}} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index b76b15cd6..24729032d 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 04/13/16 16:46:44 +-- merge date : 04/16/16 15:27:56 do -- begin closure to overcome local limits and interference @@ -6673,6 +6673,92 @@ function mappings.addtounicode(data,filename,checklookups) if type(checklookups)=="function" then checklookups(data,missing,nofmissing) end + local unset={} + for unic,glyph in next,descriptions do + if not glyph.unicode and glyph.class=="ligature" then + unset[unic]=glyph + end + end + if next(unset) then + local sequences=resources.sequences + local collected={} + for i=1,#sequences do + local sequence=sequences[i] + if sequence.type=="gsub_ligature" then + local steps=sequence.steps + if steps then + local l={} + local function traverse(p,k,v) + if k=="ligature" then + collected[v]={ unpack(l) } + else + table.insert(l,k) + for k,vv in next,v do + traverse(p,k,vv) + end + table.remove(l) + end + end + for i=1,#steps do + local coverage=steps[i].coverage + if coverage then + for k,v in next,coverage do + traverse(k,k,v) + end + end + end + end + end + end + if next(collected) then + while true do + local done=false + for k,v in next,collected do + for i=1,#v do + local vi=v[i] + if vi==k then + collected[k]=nil + unset[k]=nil + else + local c=collected[vi] + if c then + done=true + local t={} + local n=i-1 + for j=1,n do + t[j]=t[j] + end + for j=1,#c do + n=n+1 + t[n]=c[j] + end + for j=i+1,#v do + n=n+1 + t[n]=t[j] + end + collected[k]=t + break + end + end + end + end + if not done then + break + end + end + local n=0 + for k,v in next,unset do + u=collected[k] + if u then + v.unicode=u + n=n+1 + end + end + if trace_mapping and n>0 then + report_fonts("%n ligature tounicode mappings deduced from gsub ligature feaures",n) + end + end + end if trace_mapping then for unic,glyph in table.sortedhash(descriptions) do local name=glyph.name @@ -12506,7 +12592,7 @@ local function handlemark(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyp local b=basecoverage[i] if components then for c=1,#components do - local classes=components[i] + local classes=components[c] if classes then for i=1,nofclasses do local anchor=readanchor(f,classes[i]) @@ -15378,7 +15464,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_de local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf -otf.version=3.016 +otf.version=3.017 otf.cache=containers.define("fonts","otl",otf.version,true) local otfreaders=otf.readers local hashes=fonts.hashes @@ -20017,7 +20103,6 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode) end break end - current=getnext(current) elseif char==false then if discfound then notmatchreplace[discfound]=true |