diff options
28 files changed, 1011 insertions, 1229 deletions
diff --git a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex index 8e6c59af6..372aca1e5 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex @@ -1393,7 +1393,7 @@ See the description of \type {node.hpack()} for a few memory allocation caveats. node.dimensions(<node> n, <node> t, <string> dir) \stopfunctioncall -This function calculates the natural in-line dimensions of the node list starting +This function calculates the natural in|-|line dimensions of the node list starting at node \type {n} and terminating just before node \type {t} (or the end of the list, if there is no second argument). The return values are scaled points. An alternative format that starts with glue parameters as the first three arguments @@ -1431,6 +1431,10 @@ example in code like this, which prints the width of the space in between the )) } \stoptyping +You need to keep in mind that this is one of the few places in \TEX\ where floats +are used, which means that you can get small differences in rounding when you +compare the width repported by \type {hpack} with \type {dimensions}. + \subsubsection{\type {node.mlist_to_hlist}} \startfunctioncall diff --git a/scripts/context/lua/mtx-server-ctx-help.lua b/scripts/context/lua/mtx-server-ctx-help.lua index d948c6e46..66051f794 100644 --- a/scripts/context/lua/mtx-server-ctx-help.lua +++ b/scripts/context/lua/mtx-server-ctx-help.lua @@ -10,11 +10,18 @@ if not modules then modules = { } end modules ['mtx-server-ctx-help'] = { -- todo: pickup translations from mult file dofile(resolvers.findfile("trac-lmx.lua","tex")) +dofile(resolvers.findfile("util-sci.lua","tex")) + +local scite = utilities.scite + +local setupstrings = dofile(resolvers.findfile("mult-def.lua","tex")).setupstrings -- problem ... serialize parent stack -local format, match, gsub, find = string.format, string.match, string.gsub, string.find -local concat = table.concat +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") @@ -31,253 +38,12 @@ document.setups.span = { pe = "<span dir='rtl' lang='arabic'>%s</span>" } -document.setups.translations = document.setups.translations or { - - nl = { - ["title"] = "setup", - ["formula"] = "formule", - ["number"] = "getal", - ["list"] = "lijst", - ["dimension"] = "maat", - ["mark"] = "markering", - ["reference"] = "verwijzing", - ["command"] = "commando", - ["file"] = "file", - ["name"] = "naam", - ["identifier"] = "naam", - ["text"] = "tekst", - ["section"] = "sectie", - ["singular"] = "naam enkelvoud", - ["plural"] = "naam meervoud", - ["matrix"] = "n*m", - ["see"] = "zie", - ["inherits"] = "erft van", - ["optional"] = "optioneel", - ["displaymath"] = "formule", - ["index"] = "ingang", - ["math"] = "formule", - ["nothing"] = "leeg", - ["file"] = "file", - ["position"] = "positie", - ["reference"] = "verwijzing", - ["csname"] = "naam", - ["destination"] = "bestemming", - ["triplet"] = "triplet", - ["word"] = "woord", - ["content"] = "tekst", - }, - - en = { - ["title"] = "setup", - ["formula"] = "formula", - ["number"] = "number", - ["list"] = "list", - ["dimension"] = "dimension", - ["mark"] = "mark", - ["reference"] = "reference", - ["command"] = "command", - ["file"] = "file", - ["name"] = "name", - ["identifier"] = "identifier", - ["text"] = "text", - ["section"] = "section", - ["singular"] = "singular name", - ["plural"] = "plural name", - ["matrix"] = "n*m", - ["see"] = "see", - ["inherits"] = "inherits from", - ["optional"] = "optional", - ["displaymath"] = "formula", - ["index"] = "entry", - ["math"] = "formula", - ["nothing"] = "empty", - ["file"] = "file", - ["position"] = "position", - ["reference"] = "reference", - ["csname"] = "name", - ["destination"] = "destination", - ["triplet"] = "triplet", - ["word"] = "word", - ["content"] = "text", - - ["noargument"] = "\\cs", - ["oneargument"] = "\\cs#1{..}", - ["twoarguments"] = "\\cs#1#2{..}{..}", - ["threearguments"] = "\\cs#1#2#3{..}{..}{..}", - - }, - - de = { - ["title"] = "Setup", - ["formula"] = "Formel", - ["number"] = "Nummer", - ["list"] = "Liste", - ["dimension"] = "Dimension", - ["mark"] = "Beschriftung", - ["reference"] = "Referenz", - ["command"] = "Befehl", - ["file"] = "Datei", - ["name"] = "Name", - ["identifier"] = "Name", - ["text"] = "Text", - ["section"] = "Abschnitt", - ["singular"] = "singular", - ["plural"] = "plural", - ["matrix"] = "n*m", - ["see"] = "siehe", - ["inherits"] = "inherits from", - ["optional"] = "optioneel", - ["displaymath"] = "formula", - ["index"] = "entry", - ["math"] = "formula", - ["nothing"] = "empty", - ["file"] = "file", - ["position"] = "position", - ["reference"] = "reference", - ["csname"] = "name", - ["destination"] = "destination", - ["triplet"] = "triplet", - ["word"] = "word", - ["content"] = "text", - }, - - cz = { - ["title"] = "setup", - ["formula"] = "rovnice", - ["number"] = "cislo", - ["list"] = "seznam", - ["dimension"] = "dimenze", - ["mark"] = "znacka", - ["reference"] = "reference", - ["command"] = "prikaz", - ["file"] = "soubor", - ["name"] = "jmeno", - ["identifier"] = "jmeno", - ["text"] = "text", - ["section"] = "sekce", - ["singular"] = "jmeno v singularu", - ["plural"] = "jmeno v pluralu", - ["matrix"] = "n*m", - ["see"] = "viz", - ["inherits"] = "inherits from", - ["optional"] = "optioneel", - ["displaymath"] = "formula", - ["index"] = "entry", - ["math"] = "formula", - ["nothing"] = "empty", - ["file"] = "file", - ["position"] = "position", - ["reference"] = "reference", - ["csname"] = "name", - ["destination"] = "destination", - ["triplet"] = "triplet", - ["word"] = "word", - ["content"] = "text", - }, - - it = { - ["title"] = "setup", - ["formula"] = "formula", - ["number"] = "number", - ["list"] = "list", - ["dimension"] = "dimension", - ["mark"] = "mark", - ["reference"] = "reference", - ["command"] = "command", - ["file"] = "file", - ["name"] = "name", - ["identifier"] = "name", - ["text"] = "text", - ["section"] = "section", - ["singular"] = "singular name", - ["plural"] = "plural name", - ["matrix"] = "n*m", - ["see"] = "see", - ["inherits"] = "inherits from", - ["optional"] = "optioneel", - ["displaymath"] = "formula", - ["index"] = "entry", - ["math"] = "formula", - ["nothing"] = "empty", - ["file"] = "file", - ["position"] = "position", - ["reference"] = "reference", - ["csname"] = "name", - ["destination"] = "destination", - ["triplet"] = "triplet", - ["word"] = "word", - ["content"] = "text", - }, - - ro = { - ["title"] = "setari", - ["formula"] = "formula", - ["number"] = "numar", - ["list"] = "lista", - ["dimension"] = "dimensiune", - ["mark"] = "marcaj", - ["reference"] = "referinta", - ["command"] = "comanda", - ["file"] = "fisier", - ["name"] = "nume", - ["identifier"] = "nume", - ["text"] = "text", - ["section"] = "sectiune", - ["singular"] = "nume singular", - ["plural"] = "nume pluram", - ["matrix"] = "n*m", - ["see"] = "vezi", - ["inherits"] = "inherits from", - ["optional"] = "optioneel", - ["displaymath"] = "formula", - ["index"] = "entry", - ["math"] = "formula", - ["nothing"] = "empty", - ["file"] = "file", - ["position"] = "position", - ["reference"] = "reference", - ["csname"] = "name", - ["destination"] = "destination", - ["triplet"] = "triplet", - ["word"] = "word", - ["content"] = "text", - }, - - fr = { - ["title"] = "réglage", - ["formula"] = "formule", - ["number"] = "numéro", - ["list"] = "liste", - ["dimension"] = "dimension", - ["mark"] = "marquage", - ["reference"] = "reference", - ["command"] = "commande", - ["file"] = "fichier", - ["name"] = "nom", - ["identifier"] = "identificateur", - ["text"] = "texte", - ["section"] = "section", - ["singular"] = "nom singulier", - ["plural"] = "nom pluriel", - ["matrix"] = "n*m", - ["see"] = "vois", - ["inherits"] = "herite de", - ["optional"] = "optionel", - ["displaymath"] = "formule", - ["index"] = "entrée", - ["math"] = "formule", - ["nothing"] = "vide", - ["file"] = "fichier", - ["position"] = "position", - ["reference"] = "réference", - ["csname"] = "nom", - ["destination"] = "destination", - ["triplet"] = "triplet", - ["word"] = "mot", - ["content"] = "texte", - } - -} +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 = { @@ -330,22 +96,24 @@ document.setups.formats = { } local function translate(tag,int,noformat) - local t = document.setups.translations - local te = t["en"] - local ti = t[int] or te + 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 if noformat then - return ti[tag] or te[tag] or tag + return translated else - return format(document.setups.formats.special,ti[tag] or te[tag] or tag) + return formatters[formats.special](translated) end end local function translated(e,int) + local formats = document.setups.formats local attributes = e.at - local s = attributes.type or "?" + local s = attributes.type or "?" local tag = match(s,"^cd:(.*)$") if attributes.default == "yes" then - return format(document.setups.formats.default,tag or "?") + return formatters[formats.default](tag or "?") elseif tag then return translate(tag,int) else @@ -392,37 +160,50 @@ function document.setups.name(ek) if at.generated == "yes" then name = name .. "*" end - return name:lower() + return lower(name) end -function document.setups.csname(ek,int) +local function csname(ek,int) local cs = "" local at = ek.at or { } if at.type == 'environment' then cs = translate("start",int,true) .. cs end - for e in xml.collected(ek,'cd:sequence/(cd:string|variable)') do + local e = xml.first(ek,'cd:sequence/(cd:string|variable)') + if e then if e.tg == "string" then cs = cs .. e.at.value else cs = cs .. e.at.value -- to be translated end + else + cs = cs .. ek.at.name end return cs end +document.setups.csname = csname + function document.setups.names() local current = document.setups.current - local names = current.names + local names = current.names if not names or #names == 0 then + local found = { } + local name = document.setups.name names = { } - local name = document.setups.name - local csname = document.setups.csname for e in xml.collected(current.root,'cd:command') do - names[#names+1] = { e.at.name, csname(e,int) } + 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 end - table.sort(names, function(a,b) return a[2]:lower() < b[2]:lower() end) - current.names = names + sort(names, function(a,b) return lower(a[2]) < lower(b[2]) end) + current.names = names -- can also become a hash end return names end @@ -462,34 +243,36 @@ end function document.setups.resolve(name) local current = document.setups.current if current.root then - local e = xml.filter(current.root,format("cd:define[@name='%s']/text()",name)) + local e = xml.filter(current.root,formatters["cd:define[@name='%s']/text()"](name)) if e then xml.sprint(e) end end end +-- todo: cache definitions + function document.setups.collect(name,int,lastmode) local current = document.setups.current local formats = document.setups.formats - local command = xml.filter(current.root,format("cd:command[@name='%s']/first()",name)) - if command then + local list = { } + for command in xml.collected(current.root,formatters["cd:command[@name='%s']"](name)) do local attributes = command.at or { } local data = { command = command, category = attributes.category or "", } if document.setups.showsources then - data.source = (attributes.file and format(formats.source,attributes.file,lastmode,attributes.file)) or "" + data.source = (attributes.file and formatters[formats.source](attributes.file,lastmode,attributes.file)) or "" else data.source = attributes.file or "" end local n, sequence, tags = 0, { }, { } - sequence[#sequence+1] = format(formats.open_command[lastmode],document.setups.csname(command,int)) + sequence[#sequence+1] = formatters[formats.open_command[lastmode]](document.setups.csname(command,int)) local arguments, tag = { }, "" - for r, d, k in xml.elements(command,"(cd:keywords|cd:assignments)") do + for e in xml.collected(command,"(cd:keywords|cd:assignments)") do n = n + 1 - local attributes = d[k].at + local attributes = e.at if #sequence > 1 then local c = formats.connector[lastmode] if c ~= "" then @@ -498,15 +281,15 @@ function document.setups.collect(name,int,lastmode) end if attributes.optional == 'yes' then if attributes.list == 'yes' then - tag = format(formats.optional_list[lastmode],n) + tag = formatters[formats.optional_list[lastmode]](n) else - tag = format(formats.optional_single[lastmode],n) + tag = formatters[formats.optional_single[lastmode]](n) end else if attributes.list == 'yes' then - tag = format(formats.mandate_list[lastmode],n) + tag = formatters[formats.mandate_list[lastmode]](n) else - tag = format(formats.mandate_single[lastmode],n) + tag = formatters[formats.mandate_single[lastmode]](n) end end sequence[#sequence+1] = tag @@ -515,66 +298,87 @@ function document.setups.collect(name,int,lastmode) sequence[#sequence+1] = formats.close_command[lastmode] data.sequence = concat(sequence, " ") local parameters, n = { }, 0 - for r, d, k in xml.elements(command,"(cd:keywords|cd:assignments)") do - n = n + 1 - if d[k].tg == "keywords" then - local left = tags[n] - local right = { } - for r, d, k in xml.elements(d[k],"(cd:constant|cd:resolve)") do - local tag = d[k].tg - if tag == "resolve" then - local name = d[k].at.name or "" - if name ~= "" then - local resolved = xml.filter(current.root,format("cd:define[@name='%s']",name)) - for r, d, k in xml.elements(resolved,"cd:constant") do - right[#right+1] = translated(d[k],int) - end + + 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)) + if resolved then + process(resolved) end - else - right[#right+1] = translated(d[k],int) end - end - parameters[#parameters+1] = format(formats.parameter,left,"",concat(right, ", ")) - else - local what = tags[n] - for r, d, k in xml.elements(d[k],"(cd:parameter|cd:inherit)") do - local tag = d[k].tg - local left, right = d[k].at.name or "?", { } - if tag == "inherit" then - local name = d[k].at.name or "?" - local url = format(document.setups.formats.href_as_command[lastmode],name,lastmode,name) - if #parameters > 0 and not find(parameters[#parameters],"<br/>") then - parameters[#parameters+1] = format(formats.parameter,"<br/>","","") + 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 + right[#right+1] = translated(e,int) end - parameters[#parameters+1] = format(formats.parameter,what,format(formats.special,translate("inherits",int)),url) - else - for r, d, k in xml.elements(d[k],"(cd:constant|cd:resolve)") do - local tag = d[k].tg - if tag == "resolve" then - local name = d[k].at.name or "" - if name ~= "" then - local resolved = xml.filter(current.root,format("cd:define[@name='%s']",name)) - for r, d, k in xml.elements(resolved,"cd:constant") do - right[#right+1] = translated(d[k],int) + 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) + 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] = 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 + 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 + right[#right+1] = translated(e,int) end - else - right[#right+1] = translated(d[k],int) end + parameters[#parameters+1] = formatters[formats.parameter](what,left,concat(right, ", ")) end - parameters[#parameters+1] = format(formats.parameter,what,left,concat(right, ", ")) + what = "" end - what = "" end + parameters[#parameters+1] = formatters[formats.parameter]("<br/>","","") end - parameters[#parameters+1] = format(formats.parameter,"<br/>","","") end + process(command) data.parameters = parameters or { } data.mode = formats.modes[lastmode or "tex"] - return data - else - return nil + list[#list+1] = data end + return list end -- -- -- @@ -608,12 +412,13 @@ local variables = { --~ return io.loaddata(resolvers.findfile(filename)) -- return resolvers.texdatablob(filename) --~ end -local function doit(configuration,filename,hashed) +local what = { "environment", "category", "source", "mode" } - local formats = document.setups.formats +local function doit(configuration,filename,hashed) local start = os.clock() local detail = hashed.queries or { } + local formats = document.setups.formats if detail then @@ -626,7 +431,8 @@ local function doit(configuration,filename,hashed) if lastinterface then report("checking interface: %s",lastinterface) - document.setups.load(format("cont-%s.xml",lastinterface)) + -- document.setups.load(formatters["cont-%s.xml"](lastinterface)) + document.setups.load(formatters["context-%s.xml"](lastinterface)) end local div = document.setups.div [lastinterface] @@ -635,13 +441,13 @@ local function doit(configuration,filename,hashed) local names, refs, ints = document.setups.names(lastinterface), { }, { } for k=1,#names do local v = names[k] - refs[k] = format(formats.href_in_list[lastmode],v[1],lastmode,v[2]) + refs[k] = formatters[formats.href_in_list[lastmode]](v[1],lastmode,v[2]) end if lastmode ~= "lua" then local sorted = table.sortedkeys(interfaces) for k=1,#sorted do local v = sorted[k] - ints[k] = format(formats.interface,interfaces[v],lastmode,v) + ints[k] = formatters[formats.interface](interfaces[v],lastmode,v) end end @@ -649,8 +455,8 @@ local function doit(configuration,filename,hashed) local i = concat(ints,"<br/><br/>") if div then - variables.names = format(div,n) - variables.interfaces = format(div,i) + variables.names = formatters[div](n) + variables.interfaces = formatters[div](i) else variables.names = n variables.interfaces = i @@ -676,16 +482,19 @@ local function doit(configuration,filename,hashed) end if full == "" then variables.maintitle = lastsource - variables.maintext = format(formats.listing,"no source found") + variables.maintext = formatters[formats.listing]("no source found") else + local data = io.loaddata(full) + data = scite.html(data,file.suffix(full),true) variables.maintitle = name - variables.maintext = format(formats.listing,io.loaddata(full)) + variables.maintext = formatters[formats.listing](data) end lastsource = "" elseif lastcommand and lastcommand ~= "" then - local data = document.setups.collect(lastcommand,lastinterface,lastmode) - if data then - local what, extra = { "environment", "category", "source", "mode" }, { } + local list = document.setups.collect(lastcommand,lastinterface,lastmode) + if list and #list > 0 then + local data = list[1] + local extra = { } for k=1,#what do local v = what[k] if data[v] and data[v] ~= "" then @@ -694,7 +503,7 @@ local function doit(configuration,filename,hashed) end end variables.maintitle = data.sequence - variables.maintext = format(formats.parameters,concat(data.parameters)) + variables.maintext = formatters[formats.parameters](concat(data.parameters)) variables.extra = concat(extra," ") else variables.maintext = "select command" diff --git a/scripts/context/lua/mtx-server.lua b/scripts/context/lua/mtx-server.lua index dba07f1d5..3fb50829a 100644 --- a/scripts/context/lua/mtx-server.lua +++ b/scripts/context/lua/mtx-server.lua @@ -276,7 +276,7 @@ handlers.luc = handlers.lua handlers.html = handlers.htm local indices = { "index.htm", "index.html" } -local portnumber = 31415 -- pi suits tex +local portnumber = 8088 local newline = lpeg.patterns.newline local spacer = lpeg.patterns.spacer @@ -422,4 +422,4 @@ else application.help() end --- mtxrun --script server --start => http://localhost:31415/mtx-server-ctx-startup.lua +-- mtxrun --script server --start => http://localhost:8088/mtx-server-ctx-startup.lua diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index d0251f8b9..5cb5f6356 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -5215,7 +5215,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 36027, stripped down to: 19685 +-- original size: 36053, stripped down to: 19685 if not modules then modules={} end modules ['util-str']={ 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 : 796572 --- stripped bytes : 288919 +-- original bytes : 796598 +-- stripped bytes : 288945 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index d0251f8b9..5cb5f6356 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -5215,7 +5215,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 36027, stripped down to: 19685 +-- original size: 36053, stripped down to: 19685 if not modules then modules={} end modules ['util-str']={ 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 : 796572 --- stripped bytes : 288919 +-- original bytes : 796598 +-- stripped bytes : 288945 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index d0251f8b9..5cb5f6356 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -5215,7 +5215,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 36027, stripped down to: 19685 +-- original size: 36053, stripped down to: 19685 if not modules then modules={} end modules ['util-str']={ 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 : 796572 --- stripped bytes : 288919 +-- original bytes : 796598 +-- stripped bytes : 288945 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index d0251f8b9..5cb5f6356 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -5215,7 +5215,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 36027, stripped down to: 19685 +-- original size: 36053, stripped down to: 19685 if not modules then modules={} end modules ['util-str']={ 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 : 796572 --- stripped bytes : 288919 +-- original bytes : 796598 +-- stripped bytes : 288945 -- end library merge diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 9efcf2403..da86faf6b 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 52051bd43..12e0c7057 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.12 10:12} +\newcontextversion{2016.04.13 16:46} %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 cf4f73a61..5f5b5b20a 100644 --- a/tex/context/base/mkiv/context-help.lmx +++ b/tex/context/base/mkiv/context-help.lmx @@ -60,6 +60,17 @@ padding: 1em ; } </style> + <style type="text/css"> + #main-left { + background-color: #C0C0C0 ; + color: black; + } + <?lua + if utilities and utilities.scite and utilities.scite.css then +p(utilities.scite.css()) + end + ?> + </style> </head> <body> <div id="top"><div id="top-one"><div id="top-two"> diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 86bb83f5c..b2043ced7 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.12 10:12} +\edef\contextversion{2016.04.13 16:46} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua index 0ad1e194f..c5f3d563a 100644 --- a/tex/context/base/mkiv/font-otr.lua +++ b/tex/context/base/mkiv/font-otr.lua @@ -1798,15 +1798,15 @@ otf.unpackoutlines = unpackoutlines -- some properties in order to read following tables. When details is true we also -- initialize the glyphs data. -local function getinfo(maindata,sub,platformnames) +local function getinfo(maindata,sub,platformnames,rawfamilynames) local fontdata = sub and maindata.subfonts and maindata.subfonts[sub] or maindata local names = fontdata.names local info = nil if names then local metrics = fontdata.windowsmetrics or { } - local postscript = fontdata.postscript or { } - local fontheader = fontdata.fontheader or { } - local cffinfo = fontdata.cffinfo or { } + local postscript = fontdata.postscript or { } + local fontheader = fontdata.fontheader or { } + local cffinfo = fontdata.cffinfo or { } local filename = fontdata.filename local weight = getname(fontdata,"weight") or cffinfo.weight or metrics.weight local width = getname(fontdata,"width") or cffinfo.width or metrics.width @@ -1814,9 +1814,15 @@ local function getinfo(maindata,sub,platformnames) local fullname = getname(fontdata,"fullname") local family = getname(fontdata,"family") local subfamily = getname(fontdata,"subfamily") - local familyname = getname(fontdata,"typographicfamily") or family - local subfamilyname = getname(fontdata,"typographicsubfamily") or subfamily - local compatiblename = getname(fontdata,"compatiblefullname") + local familyname = getname(fontdata,"typographicfamily") + local subfamilyname = getname(fontdata,"typographicsubfamily") + local compatiblename = getname(fontdata,"compatiblefullname") -- kind of useless + if rawfamilynames then + -- for PG (for now, as i need to check / adapt context to catch a no-fallback case) + else + if not familyname then familyname = family end + if not subfamilyname then subfamilyname = subfamily end + end info = { -- we inherit some inconsistencies/choices from ff subfontindex = fontdata.subfontindex or sub or 0, -- filename = filename, @@ -2139,31 +2145,34 @@ end function readers.getinfo(filename,specification) -- string, nil|number|table -- platformnames is optional and not used by context (a too unpredictable mess -- that only add to the confusion) .. so it's only for checking things - local subfont = nil - local platformname = false + local subfont = nil + local platformname = false + local rawfamilynames = false if type(specification) == "table" then - subfont = tonumber(specification.subfont) - platformnames = specification.platformnames + subfont = tonumber(specification.subfont) + platformnames = specification.platformnames + rawfamilynames = specification.rawfamilynames else subfont = tonumber(specification) end local fontdata = loadfont { - filename = filename, - details = true, - platformnames = platformnames, + filename = filename, + details = true, + platformnames = platformnames, + -- rawfamilynames = rawfamilynames, } if fontdata then local subfonts = fontdata.subfonts if not subfonts then - return getinfo(fontdata,nil,platformnames) + return getinfo(fontdata,nil,platformnames,rawfamilynames) elseif not subfont then local info = { } for i=1,#subfonts do - info[i] = getinfo(fontdata,i,platformnames) + info[i] = getinfo(fontdata,i,platformnames,rawfamilynames) end return info elseif subfont > 1 and subfont <= #subfonts then - return getinfo(fontdata,subfont,platformnames) + return getinfo(fontdata,subfont,platformnames,rawfamilynames) else return { filename = filename, diff --git a/tex/context/base/mkiv/font-syn.lua b/tex/context/base/mkiv/font-syn.lua index 049fbd101..2d671c397 100644 --- a/tex/context/base/mkiv/font-syn.lua +++ b/tex/context/base/mkiv/font-syn.lua @@ -308,14 +308,12 @@ end but to keep the overview, we define them here.</p> --ldx]]-- --- filters.dfont = get_font_info - filters.otf = fonts.handlers.otf.readers.getinfo filters.ttf = filters.otf filters.ttc = filters.otf --- filters.ttx = filters.otf +-------.ttx = filters.otf -local function normalize(t) +local function normalize(t) -- only for afm parsing local boundingbox = t.fontbbox if boundingbox then for i=1,#boundingbox do @@ -329,7 +327,6 @@ local function normalize(t) fontname = t.fontname, fullname = t.fullname, familyname = t.familyname, - -- subfamilyname = t.subfamilyname, -- nor used / needed weight = t.weight, widtht = t.width, italicangle = tonumber(t.italicangle) or 0, @@ -564,7 +561,7 @@ local function check_name(data,result,filename,modification,suffix,subfont) local family = result.family local subfamily = result.subfamily local familyname = result.familyname - local subfamilyname = result.subfamilyname or result.modifiers + local subfamilyname = result.subfamilyname -- local compatiblename = result.compatiblename local weight = result.weight local italicangle = tonumber(result.italicangle) @@ -585,10 +582,12 @@ local function check_name(data,result,filename,modification,suffix,subfont) -- analyze local a_name, a_weight, a_style, a_width, a_variant = analyzespec(fullname or fontname or familyname) -- check - local width = a_width + local width = a_width local variant = a_variant - local style = subfamilyname and gsub(subfamilyname,"[^%a]","") - if not style and italicangle then + local style = subfamilyname or subfamily -- can re really trust subfamilyname? + if style then + style = gsub(style,"[^%a]","") + elseif italicangle then style = "italic" end if not variant or variant == "" then @@ -624,8 +623,8 @@ local function check_name(data,result,filename,modification,suffix,subfont) rawname = rawname, fullname = fullname, fontname = fontname, - family = family, -- kind of redundant, could be nil if familyname - subfamily = subfamily, -- kind of redundant, could be nil if familyname + family = family, + subfamily = subfamily, familyname = familyname, subfamilyname = subfamilyname, -- compatiblename = compatiblename, -- nor used / needed @@ -793,29 +792,50 @@ local function collecthashes() if specifications then -- maybe multiple passes for index=1,#specifications do - local s = specifications[index] - local format, fullname, fontname, familyname, weight, subfamily = s.format, s.fullname, s.fontname, s.familyname, s.weight, s.subfamily - local mf, ff = mappings[format], fallbacks[format] - if fullname and not mf[fullname] then - mf[fullname], nofmappings = index, nofmappings + 1 - end - if fontname and not mf[fontname] then - mf[fontname], nofmappings = index, nofmappings + 1 - end - if familyname and weight and weight ~= sub(familyname,#familyname-#weight+1,#familyname) then - local madename = familyname .. weight - if not mf[madename] and not ff[madename] then - ff[madename], noffallbacks = index, noffallbacks + 1 - end + local specification = specifications[index] + local format = specification.format + local fullname = specification.fullname + local fontname = specification.fontname + local familyname = specification.familyname or specification.family + local subfamilyname = specification.subfamilyname + local subfamily = specification.subfamily + local weight = specification.weight + local mapping = mappings[format] + local fallback = fallbacks[format] + if fullname and not mapping[fullname] then + mapping[fullname] = index + nofmappings = nofmappings + 1 + end + if fontname and not mapping[fontname] then + mapping[fontname] = index + nofmappings = nofmappings + 1 end - if familyname and subfamily and subfamily ~= sub(familyname,#familyname-#subfamily+1,#familyname) then - local extraname = familyname .. subfamily - if not mf[extraname] and not ff[extraname] then - ff[extraname], noffallbacks = index, noffallbacks + 1 + if familyname then + if weight and weight ~= sub(familyname,#familyname-#weight+1,#familyname) then + local madename = familyname .. weight + if not mapping[madename] and not fallback[madename] then + fallback[madename] = index + noffallbacks = noffallbacks + 1 + end + end + if subfamily and subfamily ~= sub(familyname,#familyname-#subfamily+1,#familyname) then + local extraname = familyname .. subfamily + if not mapping[extraname] and not fallback[extraname] then + fallback[extraname] = index + noffallbacks = noffallbacks + 1 + end + end + if subfamilyname and subfamilyname ~= sub(familyname,#familyname-#subfamilyname+1,#familyname) then + local extraname = familyname .. subfamilyname + if not mapping[extraname] and not fallback[extraname] then + fallback[extraname] = index + noffallbacks = noffallbacks + 1 + end + end + if not mapping[familyname] and not fallback[familyname] then + fallback[familyname] = index + noffallbacks = noffallbacks + 1 end - end - if familyname and not mf[familyname] and not ff[familyname] then - ff[familyname], noffallbacks = index, noffallbacks + 1 end end end diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index 47f6518c4..24c602729 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -17127,4 +17127,548 @@ return { ["ro"]="da", }, }, + ["setupstrings"]={ + ["cd:buffer"]={ + ["cs"]="buffer", + ["de"]="buffer", + ["en"]="buffer", + ["fr"]="buffer", + ["it"]="buffer", + ["nl"]="buffer", + ["ro"]="buffer", + }, + ["cd:category"]={ + ["cs"]="category", + ["de"]="category", + ["en"]="category", + ["fr"]="category", + ["it"]="category", + ["nl"]="category", + ["ro"]="category", + }, + ["cd:character"]={ + ["cs"]="character", + ["de"]="character", + ["en"]="character", + ["fr"]="character", + ["it"]="character", + ["nl"]="karakter", + ["ro"]="character", + }, + ["cd:color"]={ + ["cs"]="color", + ["de"]="color", + ["en"]="color", + ["fr"]="color", + ["it"]="color", + ["nl"]="kleur", + ["ro"]="color", + }, + ["cd:column"]={ + ["cs"]="column", + ["de"]="column", + ["en"]="column", + ["fr"]="column", + ["it"]="column", + ["nl"]="kolom", + ["ro"]="column", + }, + ["cd:command"]={ + ["cs"]="Befehl", + ["de"]="Befehl", + ["en"]="command", + ["fr"]="Befehl", + ["it"]="Befehl", + ["nl"]="commando", + ["ro"]="Befehl", + }, + ["cd:content"]={ + ["cs"]="content", + ["de"]="content", + ["en"]="content", + ["fr"]="content", + ["it"]="content", + ["nl"]="inhoud", + ["ro"]="content", + }, + ["cd:csname"]={ + ["cs"]="csname", + ["de"]="csname", + ["en"]="csname", + ["fr"]="csname", + ["it"]="csname", + ["nl"]="naam", + ["ro"]="csname", + }, + ["cd:destination"]={ + ["cs"]="destination", + ["de"]="destination", + ["en"]="destination", + ["fr"]="destination", + ["it"]="destination", + ["nl"]="bestemming", + ["ro"]="destination", + }, + ["cd:dimension"]={ + ["cs"]="Dimension", + ["de"]="Dimension", + ["en"]="dimension", + ["fr"]="Dimension", + ["it"]="Dimension", + ["nl"]="maat", + ["ro"]="Dimension", + }, + ["cd:displaymath"]={ + ["cs"]="formula", + ["de"]="formula", + ["en"]="formula", + ["fr"]="formula", + ["it"]="formula", + ["nl"]="formule", + ["ro"]="formula", + }, + ["cd:false"]={ + ["cs"]="false", + ["de"]="false", + ["en"]="false", + ["fr"]="false", + ["it"]="false", + ["nl"]="false", + ["ro"]="false", + }, + ["cd:file"]={ + ["cs"]="file", + ["de"]="file", + ["en"]="file", + ["fr"]="file", + ["it"]="file", + ["nl"]="file", + ["ro"]="file", + }, + ["cd:first"]={ + ["cs"]="first", + ["de"]="first", + ["en"]="first", + ["fr"]="first", + ["it"]="first", + ["nl"]="eerste", + ["ro"]="first", + }, + ["cd:font"]={ + ["cs"]="font", + ["de"]="font", + ["en"]="font", + ["fr"]="font", + ["it"]="font", + ["nl"]="font", + ["ro"]="font", + }, + ["cd:formula"]={ + ["cs"]="Formel", + ["de"]="Formel", + ["en"]="formula", + ["fr"]="Formel", + ["it"]="Formel", + ["nl"]="formule", + ["ro"]="Formel", + }, + ["cd:identifier"]={ + ["cs"]="Name", + ["de"]="Name", + ["en"]="identifier", + ["fr"]="Name", + ["it"]="Name", + ["nl"]="naam", + ["ro"]="Name", + }, + ["cd:index"]={ + ["cs"]="entry", + ["de"]="entry", + ["en"]="entry", + ["fr"]="entry", + ["it"]="entry", + ["nl"]="ingang", + ["ro"]="entry", + }, + ["cd:inherits"]={ + ["cs"]="inherits", + ["de"]="inherits", + ["en"]="inherits", + ["fr"]="inherits", + ["it"]="inherits", + ["nl"]="erft", + ["ro"]="inherits", + }, + ["cd:key"]={ + ["cs"]="key", + ["de"]="key", + ["en"]="key", + ["fr"]="key", + ["it"]="key", + ["nl"]="parameter", + ["ro"]="key", + }, + ["cd:language"]={ + ["cs"]="sprache", + ["de"]="sprache", + ["en"]="language", + ["fr"]="sprache", + ["it"]="sprache", + ["nl"]="taal", + ["ro"]="sprache", + }, + ["cd:last"]={ + ["cs"]="last", + ["de"]="last", + ["en"]="last", + ["fr"]="last", + ["it"]="last", + ["nl"]="laatste", + ["ro"]="last", + }, + ["cd:list"]={ + ["cs"]="Liste", + ["de"]="Liste", + ["en"]="list", + ["fr"]="Liste", + ["it"]="Liste", + ["nl"]="lijst", + ["ro"]="Liste", + }, + ["cd:lpath"]={ + ["cs"]="lpath", + ["de"]="lpath", + ["en"]="lpath", + ["fr"]="lpath", + ["it"]="lpath", + ["nl"]="lpath", + ["ro"]="lpath", + }, + ["cd:luafunction"]={ + ["cs"]="luafunction", + ["de"]="luafunction", + ["en"]="luafunction", + ["fr"]="luafunction", + ["it"]="luafunction", + ["nl"]="luafunction", + ["ro"]="luafunction", + }, + ["cd:mark"]={ + ["cs"]="Beschriftung", + ["de"]="Beschriftung", + ["en"]="mark", + ["fr"]="Beschriftung", + ["it"]="Beschriftung", + ["nl"]="markering", + ["ro"]="Beschriftung", + }, + ["cd:marking"]={ + ["cs"]="marking", + ["de"]="marking", + ["en"]="marking", + ["fr"]="marking", + ["it"]="marking", + ["nl"]="markering", + ["ro"]="marking", + }, + ["cd:math"]={ + ["cs"]="formula", + ["de"]="formula", + ["en"]="formula", + ["fr"]="formula", + ["it"]="formula", + ["nl"]="formule", + ["ro"]="formula", + }, + ["cd:matrix"]={ + ["cs"]="n*m", + ["de"]="n*m", + ["en"]="n*m", + ["fr"]="n*m", + ["it"]="n*m", + ["nl"]="n*m", + ["ro"]="n*m", + }, + ["cd:name"]={ + ["cs"]="Name", + ["de"]="Name", + ["en"]="name", + ["fr"]="Name", + ["it"]="Name", + ["nl"]="naam", + ["ro"]="Name", + }, + ["cd:node"]={ + ["cs"]="node", + ["de"]="node", + ["en"]="node", + ["fr"]="node", + ["it"]="node", + ["nl"]="node", + ["ro"]="node", + }, + ["cd:nothing"]={ + ["cs"]="empty", + ["de"]="empty", + ["en"]="empty", + ["fr"]="empty", + ["it"]="empty", + ["nl"]="leeg", + ["ro"]="empty", + }, + ["cd:number"]={ + ["cs"]="Nummer", + ["de"]="Nummer", + ["en"]="number", + ["fr"]="Nummer", + ["it"]="Nummer", + ["nl"]="getal", + ["ro"]="Nummer", + }, + ["cd:optional"]={ + ["cs"]="opt", + ["de"]="opt", + ["en"]="opt", + ["fr"]="opt", + ["it"]="opt", + ["nl"]="opt", + ["ro"]="opt", + }, + ["cd:plural"]={ + ["cs"]="plural", + ["de"]="plural", + ["en"]="plural", + ["fr"]="plural", + ["it"]="plural", + ["nl"]="naam", + ["ro"]="plural", + }, + ["cd:position"]={ + ["cs"]="position", + ["de"]="position", + ["en"]="position", + ["fr"]="position", + ["it"]="position", + ["nl"]="positie", + ["ro"]="position", + }, + ["cd:processor"]={ + ["cs"]="processor", + ["de"]="processor", + ["en"]="processor", + ["fr"]="processor", + ["it"]="processor", + ["nl"]="verwerker", + ["ro"]="processor", + }, + ["cd:reference"]={ + ["cs"]="reference", + ["de"]="reference", + ["en"]="reference", + ["fr"]="reference", + ["it"]="reference", + ["nl"]="verwijzing", + ["ro"]="reference", + }, + ["cd:row"]={ + ["cs"]="row", + ["de"]="row", + ["en"]="row", + ["fr"]="row", + ["it"]="row", + ["nl"]="rij", + ["ro"]="row", + }, + ["cd:section"]={ + ["cs"]="Abschnitt", + ["de"]="Abschnitt", + ["en"]="section", + ["fr"]="Abschnitt", + ["it"]="Abschnitt", + ["nl"]="sectie", + ["ro"]="Abschnitt", + }, + ["cd:sectionblock"]={ + ["cs"]="sectionblock", + ["de"]="sectionblock", + ["en"]="sectionblock", + ["fr"]="sectionblock", + ["it"]="sectionblock", + ["nl"]="sectieblok", + ["ro"]="sectionblock", + }, + ["cd:see"]={ + ["cs"]="siehe", + ["de"]="siehe", + ["en"]="see", + ["fr"]="siehe", + ["it"]="siehe", + ["nl"]="zie", + ["ro"]="siehe", + }, + ["cd:setup"]={ + ["cs"]="setup", + ["de"]="setup", + ["en"]="setup", + ["fr"]="setup", + ["it"]="setup", + ["nl"]="setup", + ["ro"]="setup", + }, + ["cd:singular"]={ + ["cs"]="singular", + ["de"]="singular", + ["en"]="singular", + ["fr"]="singular", + ["it"]="singular", + ["nl"]="naam", + ["ro"]="singular", + }, + ["cd:style"]={ + ["cs"]="style", + ["de"]="style", + ["en"]="style", + ["fr"]="style", + ["it"]="style", + ["nl"]="letter", + ["ro"]="style", + }, + ["cd:template"]={ + ["cs"]="template", + ["de"]="template", + ["en"]="template", + ["fr"]="template", + ["it"]="template", + ["nl"]="sjabloon", + ["ro"]="template", + }, + ["cd:text"]={ + ["cs"]="Text", + ["de"]="Text", + ["en"]="text", + ["fr"]="Text", + ["it"]="Text", + ["nl"]="tekst", + ["ro"]="Text", + }, + ["cd:title"]={ + ["cs"]="Setup", + ["de"]="Setup", + ["en"]="setup", + ["fr"]="Setup", + ["it"]="Setup", + ["nl"]="setup", + ["ro"]="Setup", + }, + ["cd:triplet"]={ + ["cs"]="triplet", + ["de"]="triplet", + ["en"]="triplet", + ["fr"]="triplet", + ["it"]="triplet", + ["nl"]="triplet", + ["ro"]="triplet", + }, + ["cd:true"]={ + ["cs"]="true", + ["de"]="true", + ["en"]="true", + ["fr"]="true", + ["it"]="true", + ["nl"]="true", + ["ro"]="true", + }, + ["cd:url"]={ + ["cs"]="url", + ["de"]="url", + ["en"]="url", + ["fr"]="url", + ["it"]="url", + ["nl"]="url", + ["ro"]="url", + }, + ["cd:userdata"]={ + ["cs"]="userdata", + ["de"]="userdata", + ["en"]="userdata", + ["fr"]="userdata", + ["it"]="userdata", + ["nl"]="gebruikersdata", + ["ro"]="userdata", + }, + ["cd:value"]={ + ["cs"]="value", + ["de"]="value", + ["en"]="value", + ["fr"]="value", + ["it"]="value", + ["nl"]="waarde", + ["ro"]="value", + }, + ["cd:word"]={ + ["cs"]="word", + ["de"]="word", + ["en"]="word", + ["fr"]="word", + ["it"]="word", + ["nl"]="woord", + ["ro"]="word", + }, + ["cd:xmlsetup"]={ + ["cs"]="xmlsetup", + ["de"]="xmlsetup", + ["en"]="xmlsetup", + ["fr"]="xmlsetup", + ["it"]="xmlsetup", + ["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 = "[..,..=>..,..]" }, + } } diff --git a/tex/context/base/mkiv/mult-ini.lua b/tex/context/base/mkiv/mult-ini.lua index 99703b488..3fb5416ba 100644 --- a/tex/context/base/mkiv/mult-ini.lua +++ b/tex/context/base/mkiv/mult-ini.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['mult-ini'] = { license = "see context related readme files" } -local format, gmatch, match = string.format, string.gmatch, string.match +local format, gmatch, match, find, sub = string.format, string.gmatch, string.match, string.find, string.sub local lpegmatch = lpeg.match local serialize, concat = table.serialize, table.concat local rawget, type = rawget, type @@ -18,6 +18,7 @@ local implement = interfaces.implement local allocate = utilities.storage.allocate local mark = utilities.storage.mark local prtcatcodes = catcodes.numbers.prtcatcodes +local vrbcatcodes = catcodes.numbers.vrbcatcodes local contextsprint = context.sprint local setmetatableindex = table.setmetatableindex local formatters = string.formatters @@ -30,6 +31,7 @@ interfaces.variables = mark(interfaces.variables or { }) interfaces.elements = mark(interfaces.elements or { }) interfaces.formats = mark(interfaces.formats or { }) interfaces.translations = mark(interfaces.translations or { }) +interfaces.setupstrings = mark(interfaces.setupstrings or { }) interfaces.corenamespaces = mark(interfaces.corenamespaces or { }) local registerstorage = storage.register @@ -40,6 +42,7 @@ local variables = interfaces.variables local elements = interfaces.elements local formats = interfaces.formats local translations = interfaces.translations +local setupstrings = interfaces.setupstrings local corenamespaces = interfaces.corenamespaces local reporters = { } -- just an optimization @@ -48,6 +51,7 @@ registerstorage("interfaces/variables", variables, "interfaces.variabl registerstorage("interfaces/elements", elements, "interfaces.elements") registerstorage("interfaces/formats", formats, "interfaces.formats") registerstorage("interfaces/translations", translations, "interfaces.translations") +registerstorage("interfaces/setupstrings", setupstrings, "interfaces.setupstrings") registerstorage("interfaces/corenamespaces", corenamespaces, "interfaces.corenamespaces") interfaces.interfaces = { @@ -87,6 +91,7 @@ setmetatableindex(constants, valueiskey) setmetatableindex(elements, valueiskey) setmetatableindex(formats, valueiskey) setmetatableindex(translations, valueiskey) +setmetatableindex(setupstrings, valueiskey) function interfaces.registernamespace(n,namespace) corenamespaces[n] = namespace @@ -133,6 +138,12 @@ function interfaces.setformat(tag,values) add(formats,tag,values) end +local function getsetupstring(tag) + return setupstrings[tag] or tag +end + +interfaces.getsetupstring = getsetupstring + -- the old method: local replacer = lpeg.replacer { { "--", "%%a" } } @@ -198,61 +209,11 @@ end logs.setmessenger(context.verbatim.ctxreport) --- initialization - --- function interfaces.setuserinterface(interface,response) --- sharedstorage.currentinterface, currentinterface = interface, interface --- sharedstorage.currentresponse, currentresponse = response, response --- if environment.initex then --- local nofconstants = 0 --- for given, constant in next, complete.constants do --- constant = constant[interface] or constant.en or given --- constants[constant] = given -- breedte -> width --- contextsprint(prtcatcodes,"\\ui_c{",given,"}{",constant,"}") -- user interface constant --- nofconstants = nofconstants + 1 --- end --- local nofvariables = 0 --- for given, variable in next, complete.variables do --- variable = variable[interface] or variable.en or given --- variables[given] = variable -- ja -> yes --- contextsprint(prtcatcodes,"\\ui_v{",given,"}{",variable,"}") -- user interface variable --- nofvariables = nofvariables + 1 --- end --- local nofelements = 0 --- for given, element in next, complete.elements do --- element = element[interface] or element.en or given --- elements[element] = given --- contextsprint(prtcatcodes,"\\ui_e{",given,"}{",element,"}") -- user interface element --- nofelements = nofelements + 1 --- end --- local nofcommands = 0 --- for given, command in next, complete.commands do --- command = command[interface] or command.en or given --- if command ~= given then --- contextsprint(prtcatcodes,"\\ui_m{",given,"}{",command,"}") -- user interface macro --- end --- nofcommands = nofcommands + 1 --- end --- local nofformats = 0 --- for given, format in next, complete.messages.formats do --- formats[given] = format[interface] or format.en or given --- nofformats = nofformats + 1 --- end --- local noftranslations = 0 --- for given, translation in next, complete.messages.translations do --- translations[given] = translation[interface] or translation.en or given --- noftranslations = noftranslations + 1 --- end --- report_interface("definitions: %a constants, %a variables, %a elements, %a commands, %a formats, %a translations", --- nofconstants,nofvariables,nofelements,nofcommands,nofformats,noftranslations) --- else --- report_interface("the language(s) can only be set when making the format") --- end --- end +-- todo: use setmacro function interfaces.setuserinterface(interface,response) sharedstorage.currentinterface, currentinterface = interface, interface - sharedstorage.currentresponse, currentresponse = response, response + sharedstorage.currentresponse, currentresponse = response, response if environment.initex then local nofconstants = 0 local nofvariables = 0 @@ -260,6 +221,7 @@ function interfaces.setuserinterface(interface,response) local nofcommands = 0 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}"] @@ -314,8 +276,14 @@ function interfaces.setuserinterface(interface,response) noftranslations = noftranslations + 1 end -- - report_interface("definitions: %a constants, %a variables, %a elements, %a commands, %a formats, %a translations", - nofconstants,nofvariables,nofelements,nofcommands,nofformats,noftranslations) + for given, setupstring in next, complete.setupstrings do + setupstring = setupstring[interface] or setupstring.en or given + setupstrings[given] = setupstring + nofsetupstrings = nofsetupstrings + 1 + end + -- + report_interface("definitions: %a constants, %a variables, %a elements, %a commands, %a formats, %a translations, %a setupstrings", + nofconstants,nofvariables,nofelements,nofcommands,nofformats,noftranslations,nofsetupstrings) else report_interface("the language(s) can only be set when making the format") end @@ -400,6 +368,14 @@ implement { arguments = "string", } +implement { + name = "getsetupstring", + actions = function(s) + contextsprint(vrbcatcodes,getsetupstring(s)) + end, + arguments = "string", +} + local function showassignerror(namespace,key,line) local ns, instance = match(namespace,"^(%d+)[^%a]+(%a*)") if ns then diff --git a/tex/context/base/mkiv/mult-ini.mkiv b/tex/context/base/mkiv/mult-ini.mkiv index 9d7db394c..8675834a5 100644 --- a/tex/context/base/mkiv/mult-ini.mkiv +++ b/tex/context/base/mkiv/mult-ini.mkiv @@ -392,6 +392,8 @@ \unexpanded\def\inlinemessage #1{\dontleavehmode{\tttf#1}} \unexpanded\def\displaymessage#1{\blank\inlinemessage{#1}\blank} +\let\getsetupstring\clf_getsetupstring + %D \macros %D {ifshowwarnings, ifshowmessages} %D diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 1d3ebe8d3..b39796806 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 7cc6c115e..eb4cadf97 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/typo-dha.lua b/tex/context/base/mkiv/typo-dha.lua index fa17b1e06..25e92bd28 100644 --- a/tex/context/base/mkiv/typo-dha.lua +++ b/tex/context/base/mkiv/typo-dha.lua @@ -52,7 +52,7 @@ local nutstring = nuts.tostring local getnext = nuts.getnext local getprev = nuts.getprev -local getfont = nuts.getfont +local getchar = nuts.getchar local getid = nuts.getid local getsubtype = nuts.getsubtype local getlist = nuts.getlist @@ -73,8 +73,9 @@ local end_of_math = nuts.end_of_math local nodepool = nuts.pool local nodecodes = nodes.nodecodes -local mathcodes = nodes.mathcodes +local skipcodes = nodes.skipcodes +local glyph_code = nodecodes.glyph local math_code = nodecodes.math local penalty_code = nodecodes.penalty local kern_code = nodecodes.kern @@ -84,6 +85,8 @@ local vlist_code = nodecodes.vlist local dir_code = nodecodes.dir local localpar_code = nodecodes.localpar +local parfillskip_code = skipcodes.parfillskip + local new_textdir = nodepool.textdir local hasbit = number.hasbit @@ -158,7 +161,8 @@ local function process(start) local fences = { } while current do - local character, id = isglyph(current) + -- no isglyph here as we test for skips first + local id = getid(current) local next = getnext(current) if id == math_code then current = getnext(end_of_math(next)) @@ -176,8 +180,9 @@ local function process(start) prevattr = attr end end - if character then + if id == glyph_code then if attr and attr > 0 then + local character, font = isglyph(current) if character == 0 then -- skip signals setprop(current,"direction",true) @@ -198,7 +203,7 @@ local function process(start) end if direction == "on" then local mirror = charmirrors[character] - if mirror and fontchar[getfont(current)][mirror] then + if mirror and fontchar[font][mirror] then local class = charclasses[character] if class == "open" then if nextisright(current) then @@ -304,11 +309,15 @@ local function process(start) setprop(current,"direction",true) end elseif id == glue_code then - setprop(current,"direction",'g') + if getsubtype(current) == parfillskip_code then + setprop(current,"direction",'!') + else + setprop(current,"direction",'g') + end elseif id == kern_code then setprop(current,"direction",'k') elseif id == dir_code then - local dir = getfield(current,"dir") + local dir = getfield(current,"dir") if dir == "+TRT" then autodir = -1 elseif dir == "+TLT" then @@ -408,7 +417,7 @@ local function process(start) state = "r" done = true end - last = false + last = false elseif collapse then if cp == "k" or cp == "g" then last = last or current @@ -430,10 +439,13 @@ local function process(start) if next then current = next else - if state == "r" then - head = insert_node_after(head,current,stopdir("TRT")) - elseif state == "l" then - head = insert_node_after(head,current,stopdir("TLT")) + local sd = (state == "r" and stopdir("TRT")) or (state == "l" and stopdir("TLT")) + if sd then + if id == glue_code and getsubtype(current) == parfillskip_code then + head = insert_node_before(head,current,sd) + else + head = insert_node_after(head,current,sd) + end end break end diff --git a/tex/context/base/mkiv/typo-dir.mkiv b/tex/context/base/mkiv/typo-dir.mkiv index 7290c8313..c5fd6fa41 100644 --- a/tex/context/base/mkiv/typo-dir.mkiv +++ b/tex/context/base/mkiv/typo-dir.mkiv @@ -22,6 +22,7 @@ \registerctxluafile{typo-dha}{1.001} \registerctxluafile{typo-dua}{1.001} \registerctxluafile{typo-dub}{1.001} +\registerctxluafile{typo-duc}{1.001} \definesystemattribute[directions][public] diff --git a/tex/context/base/mkiv/typo-dua.lua b/tex/context/base/mkiv/typo-dua.lua index 4e2fc4600..f697ac562 100644 --- a/tex/context/base/mkiv/typo-dua.lua +++ b/tex/context/base/mkiv/typo-dua.lua @@ -75,9 +75,9 @@ local getnext = nuts.getnext local getid = nuts.getid local getsubtype = nuts.getsubtype local getlist = nuts.getlist +local getchar = nuts.getchar local getfield = nuts.getfield local getprop = nuts.getprop -local isglyph = nuts.isglyph -- or ischar local setfield = nuts.setfield local setprop = nuts.setprop @@ -100,7 +100,7 @@ local vlist_code = nodecodes.vlist local math_code = nodecodes.math local dir_code = nodecodes.dir local localpar_code = nodecodes.localpar -local parfillskip_code = skipcodes.skipcodes +local parfillskip_code = skipcodes.parfillskip ----- object_replacement = 0xFFFC -- object replacement character local maximum_stack = 60 -- probably spec but not needed @@ -204,7 +204,7 @@ local function build_list(head) -- todo: store node pointer ... saves loop local size = 0 while current do size = size + 1 - local chr, id = isglyph(current) + local id = getid(current) if getprop(current,"directions") then local skip = 0 local last = id @@ -224,7 +224,8 @@ local function build_list(head) -- todo: store node pointer ... saves loop else list[size] = { char = 0xFFFC, direction = "on", original = "on", level = 0, skip = skip, id = id, last = last } end - elseif chr then + elseif id == glyph_code then + local chr = getchar(current) local dir = directiondata[chr] list[size] = { char = chr, direction = dir, original = dir, level = 0 } current = getnext(current) diff --git a/tex/context/base/mkiv/typo-dub.lua b/tex/context/base/mkiv/typo-dub.lua index ac33173fd..7ac339799 100644 --- a/tex/context/base/mkiv/typo-dub.lua +++ b/tex/context/base/mkiv/typo-dub.lua @@ -63,10 +63,10 @@ local getnext = nuts.getnext local getid = nuts.getid local getsubtype = nuts.getsubtype local getlist = nuts.getlist +local getchar = nuts.getchar local getattr = nuts.getattr local getfield = nuts.getfield local getprop = nuts.getprop -local isglyph = nuts.isglyph -- or ischar local setfield = nuts.setfield local setprop = nuts.setprop @@ -89,7 +89,7 @@ local vlist_code = nodecodes.vlist local math_code = nodecodes.math local dir_code = nodecodes.dir local localpar_code = nodecodes.localpar -local parfillskip_code = skipcodes.skipcodes +local parfillskip_code = skipcodes.parfillskip local maximum_stack = 0xFF -- unicode: 60, will be jumped to 125, we don't care too much @@ -259,7 +259,7 @@ local function build_list(head) -- todo: store node pointer ... saves loop local size = 0 while current do size = size + 1 - local chr, id = isglyph(current) + local id = getid(current) if getprop(current,"directions") then local skip = 0 local last = id @@ -279,7 +279,8 @@ local function build_list(head) -- todo: store node pointer ... saves loop else list[size] = { char = 0xFFFC, direction = "on", original = "on", level = 0, skip = skip, id = id, last = last } end - elseif chr then + elseif id == glyph_code then + local chr = getchar(current) local dir = directiondata[chr] list[size] = { char = chr, direction = dir, original = dir, level = 0 } current = getnext(current) diff --git a/tex/context/base/mkiv/typo-duc.lua b/tex/context/base/mkiv/typo-duc.lua index 6f388eb34..fce40932f 100644 --- a/tex/context/base/mkiv/typo-duc.lua +++ b/tex/context/base/mkiv/typo-duc.lua @@ -63,11 +63,11 @@ local nutstring = nuts.tostring local getnext = nuts.getnext local getid = nuts.getid local getsubtype = nuts.getsubtype +local getchar = nuts.getchar local getlist = nuts.getlist local getattr = nuts.getattr local getfield = nuts.getfield local getprop = nuts.getprop -local isglyph = nuts.isglyph -- or ischar local setfield = nuts.setfield local setprop = nuts.setprop @@ -92,7 +92,7 @@ local vlist_code = nodecodes.vlist local math_code = nodecodes.math local dir_code = nodecodes.dir local localpar_code = nodecodes.localpar -local parfillskip_code = skipcodes.skipcodes +local parfillskip_code = skipcodes.parfillskip local maximum_stack = 0xFF -- unicode: 60, will be jumped to 125, we don't care too much @@ -261,9 +261,9 @@ local function build_list(head) -- todo: store node pointer ... saves loop local size = 0 while current do size = size + 1 - local chr, id = isglyph(current) + local id = getid(current) + local p = properties[current] local t - local p = properties[current] if p and p.directions then local skip = 0 local last = id @@ -279,40 +279,33 @@ local function build_list(head) -- todo: store node pointer ... saves loop end end if id == last then -- the start id --- t = { level = 0, skip = skip, id = id } t = { skip = skip, id = id } else t = { skip = skip, id = id, last = last } --- t = { level = 0, skip = skip, id = id, last = last } end setmetatable(t,mt_object) - elseif chr or id == glyph_code then + elseif id == glyph_code then + local chr = getchar(current) local dir = directiondata[chr] --- t = { level = 0, char = chr, direction = dir, original = dir, level = 0 } t = { char = chr, direction = dir, original = dir, level = 0 } current = getnext(current) -- if not list[dir] then list[dir] = true end -- not faster when we check for usage elseif id == glue_code then -- and how about kern --- t = { level = 0 } t = { } setmetatable(t,mt_space) current = getnext(current) elseif id == dir_code then local dir = getfield(current,"dir") if dir == "+TLT" then --- t = { level = 0 } t = { } setmetatable(t,mt_lre) elseif dir == "+TRT" then --- t = { level = 0 } t = { } setmetatable(t,mt_rle) elseif dir == "-TLT" or dir == "-TRT" then --- t = { level = 0 } t = { } setmetatable(t,mt_pdf) else --- t = { level = 0, id = id } t = { id = id } setmetatable(t,mt_object) end @@ -326,7 +319,6 @@ local function build_list(head) -- todo: store node pointer ... saves loop end skip = skip + 1 current = getnext(current) --- t = { level = 0, id = id, skip = skip } t = { id = id, skip = skip } setmetatable(t,mt_object) else @@ -346,10 +338,8 @@ local function build_list(head) -- todo: store node pointer ... saves loop if skip == 0 then t = { id = id } elseif id == last then -- the start id --- t = { level = 0, id = id, skip = skip } t = { id = id, skip = skip } else --- t = { level = 0, id = id, skip = skip, last = last } t = { id = id, skip = skip, last = last } end setmetatable(t,mt_object) diff --git a/tex/context/base/mkiv/util-str.lua b/tex/context/base/mkiv/util-str.lua index 95534c8d8..28b75dbc5 100644 --- a/tex/context/base/mkiv/util-str.lua +++ b/tex/context/base/mkiv/util-str.lua @@ -822,6 +822,8 @@ end -- aA b cC d eE f gG hH iI jJ lL mM N o p qQ r sS tT uU wW xX z +-- extensions : %!tag! + local builder = Cs { "start", start = ( ( diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 80039ab23..9aa19b30c 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 62e5bc306..809d8caad 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/mkiv/x-setups-basics.mkiv b/tex/context/modules/mkiv/x-setups-basics.mkiv index c3adb6881..da4bc3262 100644 --- a/tex/context/modules/mkiv/x-setups-basics.mkiv +++ b/tex/context/modules/mkiv/x-setups-basics.mkiv @@ -12,482 +12,9 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% we can make this module a bit cleaner using more recent features -% like sorting the xml directly .. will happen stepwise - -% \startluacode -% collectgarbage("stop") -% function collectgarbage() return 0 end -% \stopluacode - -% todo: for fun: pure lua interface, but as this style evolved over 15 years -% it's a waste of time -% -% todo: -% -% \setup{setupinterlinespace} -% \setup{setupinterlinespace:1} -% \setup{setupinterlinespace:2} -% -% cd:include -> filename -% cd:choice -% -% register, interaction - -\startmessages dutch library: setup - title: setup - formula: formule - number: getal - list: lijst - dimension: maat - mark: markering - reference: verwijzing - command: commando - file: file - name: naam - identifier: naam - text: tekst - section: sectie - singular: naam enkelvoud - plural: naam meervoud - matrix: n*m - see: zie - inherits: erft van - 1: de karakters < en > zijn globaal actief! - 2: -- wordt verwerkt - 3: -- is niet gedefinieerd - 4: -- wordt nogmaals verwerkt - optional: opt - displaymath: formule - index: ingang - math: formule - nothing: leeg - file: file - position: positie - reference: verwijzing - csname: naam - destination: bestemming - triplet: triplet - word: woord - content: inhoud - % - language: taal - processor: verwerker - style: letter - font: font - character: karakter - userdata: gebruikersdata - key: parameter - value: waarde - color: kleur - template: sjabloon - node: node - lpath: lpath - xmlsetup: xmlsetup - luafunction: luafunction - marking: markering - sectionblock: sectieblok - row: rij - column: kolom - url: url - first: eerste - last: laatste - setup: setup - buffer: buffer - true: true - false: false - category: category -\stopmessages - -\startmessages english library: setup - title: setup - formula: formula - number: number - list: list - dimension: dimension - mark: mark - reference: reference - command: command - file: file - name: name - identifier: identifier - text: text - section: section - singular: singular name - plural: plural name - matrix: n*m - see: see - inherits: inherits from - 1: the characters < and > are globally active! - 2: -- is processed - 3: -- is undefined - 4: -- is processed again - optional: opt - displaymath: formula - index: entry - math: formula - nothing: empty - file: file - position: position - reference: reference - csname: csname - destination: destination - triplet: triplet - word: word - content: content - % - language: language - processor: processor - style: style - font: font - character: character - userdata: userdata - key: key - value: value - color: color - template: template - node: node - lpath: lpath - xmlsetup: xmlsetup - luafunction: luafunction - marking: marking - sectionblock: sectionblock - row: row - column: column - url: url - first: first - last: last - setup: setup - buffer: buffer - true: true - false: false - category: category -\stopmessages - -\startmessages german library: setup - title: Setup - formula: Formel - number: Nummer - list: Liste - dimension: Dimension - mark: Beschriftung - reference: Referenz - command: Befehl - file: Datei - name: Name - identifier: Name - text: Text - section: Abschnitt - singular: singular - plural: plural - matrix: n*m - see: siehe - inherits: inherits from - 1: Die Zeichen < und > gelten global! - 2: -- wird verarbeitet - 3: -- ist undefiniert - 4: -- ist mehrmals verarbeitet - optional: opt - displaymath: formula - index: entry - math: formula - nothing: empty - file: file - position: position - reference: reference - csname: csname - destination: destination - triplet: triplet - word: word - content: content - % - language: sprache - processor: processor - style: style - font: font - character: character - userdata: userdata - key: key - value: value - color: color - template: template - node: node - lpath: lpath - xmlsetup: xmlsetup - luafunction: luafunction - marking: marking - sectionblock: sectionblock - row: row - column: column - url: url - first: first - last: last - setup: setup - buffer: buffer - true: true - false: false - category: category -\stopmessages - -\startmessages czech library: setup - title: setup - formula: rovnice - number: cislo - list: seznam - dimension: dimenze - mark: znacka - reference: reference - command: prikaz - file: soubor - name: jmeno - identifier: jmeno - text: text - section: sekce - singular: jmeno v singularu - plural: jmeno v pluralu - matrix: n*m - see: viz - inherits: inherits from - 1: znaky < a > jsou globalne aktivni! - 2: -- je zpracovano - 3: -- je nedefinovano - 4: -- je zpracovano znovu - optional: opt - displaymath: formula - index: entry - math: formula - nothing: empty - file: file - position: position - reference: reference - csname: csname - destination: destination - triplet: triplet - word: word - content: content - % - language: language - processor: processor - style: style - font: font - character: character - userdata: userdata - key: key - value: value - color: color - template: template - node: node - lpath: lpath - xmlsetup: xmlsetup - luafunction: luafunction - marking: marking - sectionblock: sectionblock - row: row - column: column - url: url - first: first - last: last - setup: setup - buffer: buffer - true: true - false: false - category: category -\stopmessages - -\startmessages italian library: setup - title: setup - formula: formula - number: number - list: list - dimension: dimension - mark: mark - reference: reference - command: command - file: file - name: name - identifier: name - text: text - section: section - singular: singular name - plural: plural name - matrix: n*m - see: see - inherits: inherits from - 1: the characters < and > are globally active! - 2: -- is processed - 3: -- is undefined - 4: -- is processed again - optional: opt - displaymath: formula - index: entry - math: formula - nothing: empty - file: file - position: position - reference: reference - csname: csname - destination: destination - triplet: triplet - word: word - content: content - % - language: language - processor: processor - style: style - font: font - character: character - userdata: userdata - key: key - value: value - color: color - template: template - node: node - lpath: lpath - xmlsetup: xmlsetup - luafunction: luafunction - marking: marking - sectionblock: sectionblock - row: row - column: column - url: url - first: first - last: last - setup: setup - buffer: buffer - true: true - false: false - category: category -\stopmessages - -\startmessages romanian library: setup - title: setari - formula: formula - number: numar - list: lista - dimension: dimensiune - mark: marcaj - reference: referinta - command: comanda - file: fisier - name: nume - identifier: nume - text: text - section: sectiune - singular: nume singular - plural: nume pluram - matrix: n*m - see: vezi - inherits: inherits from - 1: caracterele < si > sunt active global! - 2: este procesat -- - 3: -- este nedefinit - 4: -- este procesat din nou - optional: opt - displaymath: formula - index: entry - math: formula - nothing: empty - file: file - position: position - reference: reference - csname: csname - destination: destination - triplet: triplet - word: word - content: content - % - language: language - processor: processor - style: style - font: font - character: character - userdata: userdata - key: key - value: value - color: color - template: template - node: node - lpath: lpath - xmlsetup: xmlsetup - luafunction: luafunction - marking: marking - sectionblock: sectionblock - row: row - column: column - url: url - first: first - last: last - setup: setup - buffer: buffer - true: true - false: false - category: category -\stopmessages - -\startmessages french library: setup - title: réglage - formula: formule - number: numéro - list: liste - dimension: dimension - mark: marquage - reference: reference - command: commande - file: fichier - name: nom - identifier: identificateur - text: texte - section: section - singular: nom singulier - plural: nom pluriel - matrix: n*m - see: vois - inherits: herite de - 1: les caractères < et > sont globalement actifs ! - 2: -- est traité - 3: -- n'est pas défini - 4: -- est traité de nouveau - optional: opt - displaymath: formule - index: entrée - math: formule - nothing: vide - file: fichier - position: position - reference: réference - csname: csnom - destination: destination - triplet: triplet - word: mot - content: content - % - language: language - processor: processor - style: style - font: font - character: character - userdata: userdata - key: key - value: value - color: color - template: template - node: node - lpath: lpath - xmlsetup: xmlsetup - luafunction: luafunction - marking: marking - sectionblock: sectionblock - row: row - column: column - url: url - first: first - last: last - setup: setup - buffer: buffer - true: true - false: false - category: category -\stopmessages +% We can make this module a bit cleaner using more recent features +% or we go \LUA\ completely but as this style evolved over 15 years +% it's a waste of time. \unprotect @@ -501,17 +28,14 @@ \unexpanded\def\setupalwcolor{} \unexpanded\def\setupoptcolor{darkgray} +\unexpanded\def\setupvarword#1{{\sl\detokenize{#1}}} +\unexpanded\def\setupintword#1{\WORD{\detokenize{#1}}} +\unexpanded\def\setuptxtword#1{\detokenize{#1}} + \installcorenamespace{interfacesetup} -\installcorenamespace{interfacesetupreserved} \installsetuponlycommandhandler \??interfacesetup {setup} % \??interfacesetup -\unexpanded\def\cmd_define_reserved#1#2% - {\setvalue{\??interfacesetupreserved#1}{#2}} - -\unexpanded\def\cmd_reserved_value#1% - {\executeifdefined{\??interfacesetupreserved#1}{#1}} - \unexpanded\def\cmd_internal_value#1% {\dontleavehmode \begingroup @@ -525,7 +49,7 @@ \endgroup} \unexpanded\def\cmd_command_value#1% - {{\setupvarfont{\texescape...#1}}} + {{\setupvarfont{#1}}} \defineregister [texmacro] @@ -566,15 +90,10 @@ \let\currentSETUPprefix\empty } \edef\currentSETUPname{\xmlatt{#1}{name}} -% \doifelse {\xmlatt{#1}{generated}} {yes} { -% \def\currentSETUPgenerated{*} -% } { - \let\currentSETUPgenerated\empty -% } + \let\currentSETUPgenerated\empty \doifelsenothing {\xmlatt{#1}{variant}} { \let\currentSETUPvariant\empty } { - %\def\currentSETUPvariant{:\xmlatt{#1}{variant}} \def\currentSETUPvariant{:\xmllastatt} } \edef\currentSETUPfullname { @@ -593,6 +112,16 @@ \startluacode + local find, gsub = string.find, string.gsub + + local context = context + + local setupvarword = context.formatted.setupvarword + local setupintword = context.formatted.setupintword + local setuptxtword = context.formatted.setuptxtword + + local getsetupstring = interfaces.getsetupstring + -- normally a lookup is fast enough but here we can have many setups -- spread over many files so we do a little speedup here @@ -646,13 +175,12 @@ replace('cd:variable', 'type', variables) replace('cd:inherit', 'name', commands, elements) - end if tex.modes["setups:save"] and environment.currentrun == 1 then local s = tostring(x) - s = string.gsub(s,"\n*%s*(</cd:interface>)%s+(<cd:interface)", "\n\n %1\n\n %2") - s = string.gsub(s,"\n*%s*(</cd:interface>)%s+(</cd:interface>)","\n\n %1\n\n %2") + s = gsub(s,"\n*%s*(</cd:interface>)%s+(<cd:interface)", "\n\n %1\n\n %2") + s = gsub(s,"\n*%s*(</cd:interface>)%s+(</cd:interface>)","\n\n %1\n\n %2") io.savedata("context-"..interface..".xml",s) end @@ -679,6 +207,29 @@ 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 + setupvarword(g) + else + setupintword(g) + end + end, + overload = true, + arguments = "string", + } + \stopluacode % <?xml version="1.0" encoding="UTF-8"?> @@ -694,12 +245,8 @@ \loadsetups[\xmlatt{#1}{filename}] \stopxmlsetups -% todo: option to expand - \startxmlsetups xml:setups:basics -% \xmlcommand {#1}{interface/interfacefile}{xml:setups:interfacefile} -% \xmlinclude {#1}{include}{filename} - \xmlincludeoptions {#1}{interfacefile|include}{filename}{recurse,basename} + \xmlincludeoptions{#1}{interfacefile|include}{filename}{recurse,basename} \xmlsetsetup{#1}{*}{xml:setups:*} \xmlfunction{#1}{setups_define} \stopxmlsetups @@ -981,37 +528,40 @@ \xmlatt{#1}{value}\ignorespaces \stopxmlsetups -\startxmlsetups xml:setups:content \showSETUPcomponent{#1}{content} {content} \stopxmlsetups -\startxmlsetups xml:setups:displaymath \showSETUPcomponent{#1}{displaymath}{display math}\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 name} \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 -% \startxmlsetups xml:setups:to \showSETUPcomponent{#1}{to} {to} \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} { - \showSETUPline{\letterbackslash\xmlatt{#1}{name}} + \kern.5\emwidth + \letterbackslash\xmlatt{#1}{name} } \ignorespaces \stopxmlsetups \unexpanded\def\showSETUPcomponent#1#2#3% {\doifelsemode{setups-pass-one} - {\getvalue{showSETUP#2}{#1}} - {\simpleSETUPargument{#3}}} + {\getvalue{showSETUP#2}{#1}} % top line + {\simpleSETUPargument{#3}}} % column %D This is the second pass; here we generate the table. @@ -1080,9 +630,9 @@ \startxmlsetups xml:setups:parameter \doifmodeelse {setups-measure} { - \cmd_reserved_value{\xmlatt{#1}{name}}\par + \getsetupstring{\xmlatt{#1}{name}}\par } { - \startsecondSETUPcolumn{\cmd_reserved_value{\xmlatt{#1}{name}}}{=} + \startsecondSETUPcolumn{\getsetupstring{\xmlatt{#1}{name}}}{=} \ignorespaces \xmlflush{#1} \doifmode{interface:setup:defaults} { @@ -1111,21 +661,21 @@ \xmlmapvalue{setups:method}{none} {} \startxmlsetups xml:setups:constant:value - \cmd_reserved_value{\xmlatt{#1}{type}} + \getsetupstring{\xmlatt{#1}{type}} \stopxmlsetups \startxmlsetups xml:setups:constant \doifelsemode {setups-pass-one} { } { \doifsomethingelse{\xmlatt{#1}{prefix}} { - \cmd_reserved_value{\xmllastatt} + \getsetupstring{\xmllastatt} \xmlmappedvalue{setups:method}{\xmlatt{#1}{method}}{none} } { \doif {\xmlatt{#1}{default}} {yes} { \underbar % next needs to be {braced} } } - {\cmd_reserved_value{\xmlatt{#1}{type}}} + {\getsetupstring{\xmlatt{#1}{type}}} \space \ignorespaces } @@ -1135,7 +685,7 @@ \doifelsemode {setups-pass-one} { \expanded{\setupintfont{\xmlatt{#1}{value}}}\ignorespaces } { - \cmd_reserved_value{\xmlatt{#1}{value}} + \getsetupstring{\xmlatt{#1}{value}} \space \ignorespaces } @@ -1143,7 +693,7 @@ \startxmlsetups xml:setups:inherit \secondSETUPcolumn { - \cmd_text_value{\getmessage{setup}{inherits}} + \cmd_text_value{\getsetupstring{cd:inherits}} \enspace \letterbackslash \xmlatt{#1}{name} @@ -1158,67 +708,15 @@ \blank[\v!halfline] \ignorespaces} -\cmd_define_reserved {cd:command} {\cmd_internal_value{\getmessage{setup}{command}}} -\cmd_define_reserved {cd:dimension} {\cmd_internal_value{\getmessage{setup}{dimension}}} -\cmd_define_reserved {cd:file} {\cmd_internal_value{\getmessage{setup}{file}}} -\cmd_define_reserved {cd:buffer} {\cmd_internal_value{\getmessage{setup}{buffer}}} -\cmd_define_reserved {cd:name} {\cmd_internal_value{\getmessage{setup}{identifier}}} -\cmd_define_reserved {cd:character} {\cmd_internal_value{\getmessage{setup}{character}}} -\cmd_define_reserved {cd:mark} {\cmd_internal_value{\getmessage{setup}{mark}}} -\cmd_define_reserved {cd:number} {\cmd_internal_value{\getmessage{setup}{number}}} -\cmd_define_reserved {cd:first} {\cmd_internal_value{\getmessage{setup}{first}}} -\cmd_define_reserved {cd:last} {\cmd_internal_value{\getmessage{setup}{last}}} -\cmd_define_reserved {cd:reference} {\cmd_internal_value{\getmessage{setup}{reference}}} -\cmd_define_reserved {cd:plural} {\cmd_internal_value{\getmessage{setup}{plural}}} -\cmd_define_reserved {cd:singular} {\cmd_internal_value{\getmessage{setup}{singular}}} -\cmd_define_reserved {cd:text} {\cmd_internal_value{\getmessage{setup}{text}}} -\cmd_define_reserved {cd:formula} {\cmd_internal_value{\getmessage{setup}{formula}}} -\cmd_define_reserved {cd:file} {\cmd_internal_value{\getmessage{setup}{file}}} -\cmd_define_reserved {cd:matrix} {\cmd_internal_value{\getmessage{setup}{matrix}}} -\cmd_define_reserved {cd:list} {\cmd_internal_value{\getmessage{setup}{list}}} -\cmd_define_reserved {cd:section} {\cmd_internal_value{\getmessage{setup}{section}}} -\cmd_define_reserved {cd:language} {\cmd_internal_value{\getmessage{setup}{language}}} -\cmd_define_reserved {cd:section} {\cmd_internal_value{\getmessage{setup}{section}}} -\cmd_define_reserved {cd:language} {\cmd_internal_value{\getmessage{setup}{language}}} -\cmd_define_reserved {cd:processor} {\cmd_internal_value{\getmessage{setup}{processor}}} -\cmd_define_reserved {cd:style} {\cmd_internal_value{\getmessage{setup}{style}}} -\cmd_define_reserved {cd:font} {\cmd_internal_value{\getmessage{setup}{font}}} -\cmd_define_reserved {cd:character} {\cmd_internal_value{\getmessage{setup}{character}}} -\cmd_define_reserved {cd:userdata} {\cmd_internal_value{\getmessage{setup}{userdata}}} -\cmd_define_reserved {cd:key} {\cmd_internal_value{\getmessage{setup}{key}}} -\cmd_define_reserved {cd:value} {\cmd_internal_value{\getmessage{setup}{value}}} -\cmd_define_reserved {cd:color} {\cmd_internal_value{\getmessage{setup}{color}}} -\cmd_define_reserved {cd:template} {\cmd_internal_value{\getmessage{setup}{template}}} -\cmd_define_reserved {cd:node} {\cmd_internal_value{\getmessage{setup}{node}}} -\cmd_define_reserved {cd:lpath} {\cmd_internal_value{\getmessage{setup}{lpath}}} -\cmd_define_reserved {cd:setup} {\cmd_internal_value{\getmessage{setup}{setup}}} -\cmd_define_reserved {cd:xmlsetup} {\cmd_internal_value{\getmessage{setup}{xmlsetup}}} -\cmd_define_reserved {cd:luafunction} {\cmd_internal_value{\getmessage{setup}{luafunction}}} -\cmd_define_reserved {cd:marking} {\cmd_internal_value{\getmessage{setup}{marking}}} -\cmd_define_reserved {cd:sectionblock} {\cmd_internal_value{\getmessage{setup}{sectionblock}}} -\cmd_define_reserved {cd:row} {\cmd_internal_value{\getmessage{setup}{row}}} -\cmd_define_reserved {cd:column} {\cmd_internal_value{\getmessage{setup}{column}}} -\cmd_define_reserved {cd:url} {\cmd_internal_value{\getmessage{setup}{url}}} -\cmd_define_reserved {cd:true} {\cmd_internal_value{\getmessage{setup}{true}}} -\cmd_define_reserved {cd:false} {\cmd_internal_value{\getmessage{setup}{false}}} -\cmd_define_reserved {cd:category} {\cmd_internal_value{\getmessage{setup}{category}}} -\cmd_define_reserved {cd:csname} {\cmd_internal_value{\getmessage{setup}{csname}}} -\cmd_define_reserved {cd:content} {\cmd_internal_value{\getmessage{setup}{content}}} - -%cmd_define_reserved {cd:noargument} {\cmd_command_value {}} -\cmd_define_reserved {cd:oneargument} {\cmd_command_value {\texthash1}} -\cmd_define_reserved {cd:twoarguments} {\cmd_command_value {\texthash1\texthash2}} -\cmd_define_reserved {cd:threearguments} {\cmd_command_value {\texthash1\texthash2\texthash3}} - -\cmd_define_reserved {cd:sign} {[-+]} - %D Auxiliary. -\unexpanded\def\showSETUP#1#2#3% +\unexpanded\def\showSETUP#1#2% {\bgroup \doglobal\increment\currentSETUPargument \setbox0=\hbox - {\doifelse{\xmlatt{#1}{list}}{yes}{#3}{#2}}% + {\doifelse{\xmlatt{#1}{list}}{yes} + {\getsetupstring{s:#2}}% + {\getsetupstring{l:#2}}}% \setbox2=\hbox to \wd0 {\hss \raise1.25\exheight\hbox @@ -1232,7 +730,7 @@ \bgroup \txx \doif {\xmlatt{#1}{optional}} {yes} - {\cmd_internal_value{\getmessage{setup}{optional}}}% + {\getsetupstring{cd:optional}}% \egroup \hss}% \ht2\ht\strutbox @@ -1246,9 +744,9 @@ \egroup \ignorespaces} -\unexpanded\def\showSETUPline#1% +\unexpanded\def\showSETUPline#1#2% {\kern.5\emwidth - #1% + \getsetupstring{s:#2}% \ignorespaces} \unexpanded\def\showSETUPnumber @@ -1266,6 +764,8 @@ \xmlmapvalue {setups:keyword} {parentheses} {\showSETUPkeywordparentheses} \xmlmapvalue {setups:keyword} {none} {\showSETUPkeywordnone} +% todo: replace = by lower + \unexpanded\def\setupEQsymbol % we raise the number already {.\lower.25\exheight\hpack{=}.} @@ -1274,41 +774,33 @@ \starttexdefinition unexpanded showSETUPassignmentbraces #1 \ifcase\kindofsetup - \showSETUPline{\letterleftbrace\setupEQsymbol\letterrightbrace} + \showSETUPline{#1}{bracedassignment} \else - \showSETUP{#1} - {\letterleftbrace\setupEQsymbol\letterrightbrace} - {\letterleftbrace..,\setupEQsymbol,..\letterrightbrace} + \showSETUP {#1}{bracedassignment} \fi \stoptexdefinition \starttexdefinition unexpanded showSETUPassignmentbrackets #1 \ifcase\kindofsetup - \showSETUPline{[\setupEQsymbol]} + \showSETUPline{#1}{bracketedassignment} \else - \showSETUP{#1} - {[\setupEQsymbol]} - {[..,\setupEQsymbol,..]} + \showSETUP {#1}{bracketedassignment} \fi \stoptexdefinition \starttexdefinition unexpanded showSETUPkeywordparentheses #1 \ifcase\kindofsetup - \showSETUPline{(...)} + \showSETUPline{#1}{parenthesizedassignment} \else - \showSETUP{#1} - {(...)} - {(...,...)} + \showSETUP {#1}{parenthesizedassignment} \fi \stoptexdefinition \starttexdefinition unexpanded showSETUPkeywordnone #1 \ifcase\kindofsetup - \showSETUPline{...} + \showSETUPline{#1}{none} \else - \showSETUP{#1} - {...} - {.. ... ..} + \showSETUP {#1}{none} \fi \stoptexdefinition @@ -1330,21 +822,17 @@ \starttexdefinition unexpanded showSETUPkeywordbraces #1 \ifcase\kindofsetup - \showSETUPline{\letterleftbrace...\letterrightbrace} + \showSETUPline{#1}{braces} \else - \showSETUP{#1} - {\letterleftbrace...\letterrightbrace} - {\letterleftbrace...,...\letterrightbrace} + \showSETUP {#1}{braces} \fi \stoptexdefinition \starttexdefinition unexpanded showSETUPkeywordbrackets #1 \ifcase\kindofsetup - \showSETUPline{[...]} + \showSETUPline{#1}{brackets} \else - \showSETUP{#1} - {[...]} - {[...,...]} + \showSETUP {#1}{brackets} \fi \stoptexdefinition @@ -1358,121 +846,26 @@ % arguments -% \unexpanded\def\showSETUPargument#1% -% {\ifcase\kindofsetup -% \showSETUPline{% -% \letterleftbrace -% \xmlfilter{#1}{/cd:constant/command(xml:setups:constant:value)}% always one -% \letterrightbrace -% } -% \else -% \showSETUP{#1} -% {\letterleftbrace..\letterrightbrace} -% {\letterleftbrace..,...,..\letterrightbrace}% -% \fi} - -\unexpanded\def\showSETUPdisplaymath#1% - {\showSETUP{#1} - {\letterdollar\letterdollar...\letterdollar\letterdollar} - {\letterdollar\letterdollar...\letterdollar\letterdollar}} - -\unexpanded\def\showSETUPindex#1% - {\showSETUP{#1} - {\letterleftbrace...\letterrightbrace} - {\letterleftbrace..+...+..\letterrightbrace}} - -\unexpanded\def\showSETUPmath#1% - {\showSETUP{#1} - {\letterdollar...\letterdollar} - {\letterdollar...\letterdollar}} - -\unexpanded\def\showSETUPnothing#1% - {\showSETUP{#1} - {...} - {}} - -\unexpanded\def\showSETUPfile#1% - {\showSETUP{#1} - {~...~} - {}} - -\unexpanded\def\showSETUPposition#1% - {\showSETUP{#1} - {(...)} - {(...,...)}} - -\unexpanded\def\showSETUPtemplate#1 - {\showSETUP{#1} - {[\letterbar...\letterbar]} - {[\letterbar...\letterbar...\letterbar]}} - -\unexpanded\def\showSETUPangles#1% - {\showSETUP{#1} - {<<...>>} - {<<...>>}} - -\unexpanded\def\showSETUPreference#1% - {\showSETUP{#1} - {[...]} - {[...,...]}} - -\unexpanded\def\showSETUPapply#1% - {\showSETUP{#1} - {[\setupAPPLYsymbol]} - {[..,\setupAPPLYsymbol,...]}} - -\unexpanded\def\showSETUPtwowords#1% - {\showSETUP{#1} - {[..+..]} - {[..+..]}} - -\unexpanded\def\showSETUPthreewords#1% - {\showSETUP{#1} - {[..+..+..]} - {[..+..+..]}} - -\unexpanded\def\showSETUPcsname#1% - {\showSETUP{#1} - {{\cmd_command_value{}}} - {}} - -\unexpanded\def\showSETUPdestination#1% - {\showSETUP{#1} - {[\letterleftbrace..[ref]\letterrightbrace]} - {[..,\letterleftbrace..[ref,..]\letterrightbrace,..]}} - -\unexpanded\def\showSETUPtriplet#1% - {\showSETUP{#1} - {[x:y:z=]} - {[x:y:z=,..]}} - -\unexpanded\def\showSETUPword#1% - {\showSETUP{#1} - {\letterleftbrace...\letterrightbrace} - {\letterleftbrace.. ... ..\letterrightbrace}} - -\unexpanded\def\showSETUPcontent#1% - {\showSETUP{#1} - {\letterleftbrace...\letterrightbrace} - {\letterleftbrace.. ... ..\letterrightbrace}} - -\unexpanded\def\showSETUPtext#1% - {\showSETUP{#1} - {...} - {.. ... ..}} - -% \unexpanded\def\showSETUPto#1% -% {\showSETUP{#1} -% {\texescape to } -% {\texescape to }} - -\unexpanded\def\showSETUPto#1% - {\showSETUPline{\texescape to}} - -\unexpanded\def\showSETUPmacro#1% - {\showSETUP{#1} - {\texescape macro } - {\texescape macro }} +\unexpanded\def\showSETUPdisplaymath#1{\showSETUP {#1}{displaymath}} +\unexpanded\def\showSETUPindex #1{\showSETUP {#1}{index}} +\unexpanded\def\showSETUPmath #1{\showSETUP {#1}{math}} +\unexpanded\def\showSETUPnothing #1{\showSETUP {#1}{nothing}} +\unexpanded\def\showSETUPfile #1{\showSETUP {#1}{file}} +\unexpanded\def\showSETUPposition #1{\showSETUP {#1}{position}} +\unexpanded\def\showSETUPtemplate #1{\showSETUP {#1}{template}} +\unexpanded\def\showSETUPangles #1{\showSETUP {#1}{angle}} +\unexpanded\def\showSETUPreference #1{\showSETUP {#1}{reference}} +\unexpanded\def\showSETUPapply #1{\showSETUP {#1}{apply}} +\unexpanded\def\showSETUPtwowords #1{\showSETUP {#1}{twowords}} +\unexpanded\def\showSETUPthreewords #1{\showSETUP {#1}{threewords}} +\unexpanded\def\showSETUPcsname #1{\showSETUP {#1}{noargument}} +\unexpanded\def\showSETUPdestination#1{\showSETUP {#1}{destination}} +\unexpanded\def\showSETUPtriplet #1{\showSETUP {#1}{triplet}} +\unexpanded\def\showSETUPword #1{\showSETUP {#1}{word}} +\unexpanded\def\showSETUPcontent #1{\showSETUP {#1}{content}} +\unexpanded\def\showSETUPtext #1{\showSETUP {#1}{textual}} +\unexpanded\def\showSETUPto #1{\showSETUPline{#1}{to}} +\unexpanded\def\showSETUPmacro #1{\showSETUP {#1}{macro}} % A prelude to a rewrite and some more: @@ -1554,7 +947,7 @@ % official interface \unexpanded\def\cmdinternal#1% - {{\tttf\cmd_reserved_value{#1}}} % todo color .. highlight + {{\tttf\getsetupstring{#1}}} % todo color .. highlight \let\cmdbasicsetup\basicsetup \let\cmdshortsetup\shortsetup diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index de818d1da..b76b15cd6 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/12/16 10:12:07 +-- merge date : 04/13/16 16:46:44 do -- begin closure to overcome local limits and interference @@ -9292,15 +9292,15 @@ local function unpackoutlines(data) end otf.packoutlines=packoutlines otf.unpackoutlines=unpackoutlines -local function getinfo(maindata,sub,platformnames) +local function getinfo(maindata,sub,platformnames,rawfamilynames) local fontdata=sub and maindata.subfonts and maindata.subfonts[sub] or maindata local names=fontdata.names local info=nil if names then local metrics=fontdata.windowsmetrics or {} - local postscript=fontdata.postscript or {} - local fontheader=fontdata.fontheader or {} - local cffinfo=fontdata.cffinfo or {} + local postscript=fontdata.postscript or {} + local fontheader=fontdata.fontheader or {} + local cffinfo=fontdata.cffinfo or {} local filename=fontdata.filename local weight=getname(fontdata,"weight") or cffinfo.weight or metrics.weight local width=getname(fontdata,"width") or cffinfo.width or metrics.width @@ -9308,9 +9308,14 @@ local function getinfo(maindata,sub,platformnames) local fullname=getname(fontdata,"fullname") local family=getname(fontdata,"family") local subfamily=getname(fontdata,"subfamily") - local familyname=getname(fontdata,"typographicfamily") or family - local subfamilyname=getname(fontdata,"typographicsubfamily") or subfamily - local compatiblename=getname(fontdata,"compatiblefullname") + local familyname=getname(fontdata,"typographicfamily") + local subfamilyname=getname(fontdata,"typographicsubfamily") + local compatiblename=getname(fontdata,"compatiblefullname") + if rawfamilynames then + else + if not familyname then familyname=family end + if not subfamilyname then subfamilyname=subfamily end + end info={ subfontindex=fontdata.subfontindex or sub or 0, version=getname(fontdata,"version"), @@ -9606,9 +9611,11 @@ end function readers.getinfo(filename,specification) local subfont=nil local platformname=false + local rawfamilynames=false if type(specification)=="table" then subfont=tonumber(specification.subfont) platformnames=specification.platformnames + rawfamilynames=specification.rawfamilynames else subfont=tonumber(specification) end @@ -9620,15 +9627,15 @@ function readers.getinfo(filename,specification) if fontdata then local subfonts=fontdata.subfonts if not subfonts then - return getinfo(fontdata,nil,platformnames) + return getinfo(fontdata,nil,platformnames,rawfamilynames) elseif not subfont then local info={} for i=1,#subfonts do - info[i]=getinfo(fontdata,i,platformnames) + info[i]=getinfo(fontdata,i,platformnames,rawfamilynames) end return info elseif subfont>1 and subfont<=#subfonts then - return getinfo(fontdata,subfont,platformnames) + return getinfo(fontdata,subfont,platformnames,rawfamilynames) else return { filename=filename, |