From e3467ba8810e788b01d8e7ce2e16d3c8ffdd3e2a Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sat, 26 Jan 2008 02:30:00 +0100 Subject: stable 2008.01.26 02:30 --- context/data/context.properties | 8 +- scripts/context/lua/luatools.lua | 206 ++++++- scripts/context/lua/mtx-context.lua | 4 +- scripts/context/lua/mtxrun.lua | 160 +++++- scripts/context/ruby/ctxtools.rb | 10 +- tex/context/base/char-def.tex | 1 + tex/context/base/char-map.lua | 1072 +++++++++++++++++++++++++++++++++++ tex/context/base/cont-log.tex | 75 ++- tex/context/base/cont-new.tex | 284 +--------- tex/context/base/context.tex | 3 +- tex/context/base/core-blk.tex | 16 +- tex/context/base/core-buf.mkii | 17 +- tex/context/base/core-fig.tex | 18 +- tex/context/base/core-grd.tex | 129 +++-- tex/context/base/core-int.tex | 18 +- tex/context/base/core-job.lua | 55 ++ tex/context/base/core-job.mkii | 86 +++ tex/context/base/core-job.mkiv | 22 + tex/context/base/core-job.tex | 140 +---- tex/context/base/core-lst.tex | 10 +- tex/context/base/core-mat.tex | 41 +- tex/context/base/core-new.tex | 33 +- tex/context/base/core-par.tex | 6 +- tex/context/base/core-ref.tex | 8 +- tex/context/base/core-reg.tex | 18 +- tex/context/base/core-sec.tex | 6 +- tex/context/base/core-spa.mkiv | 48 +- tex/context/base/core-spa.tex | 301 ++-------- tex/context/base/core-swd.tex | 6 +- tex/context/base/core-syn.tex | 6 +- tex/context/base/core-sys.tex | 99 ++-- tex/context/base/core-tab.tex | 33 +- tex/context/base/core-uti.mkii | 4 +- tex/context/base/core-uti.tex | 55 +- tex/context/base/core-var.tex | 1 + tex/context/base/core-ver.mkii | 2 +- tex/context/base/core-ver.tex | 4 +- tex/context/base/enco-agr.tex | 2 +- tex/context/base/enco-def.tex | 2 +- tex/context/base/font-def.lua | 25 +- tex/context/base/font-ini.tex | 30 +- tex/context/base/font-otf.lua | 515 ++++++++--------- tex/context/base/java-ini.tex | 2 +- tex/context/base/l-file.lua | 4 + tex/context/base/l-os.lua | 7 +- tex/context/base/l-xml.lua | 20 +- tex/context/base/lang-ini.lua | 10 +- tex/context/base/lang-ini.tex | 7 + tex/context/base/lang-mis.tex | 210 +------ tex/context/base/lang-url.lua | 82 +++ tex/context/base/lang-url.mkii | 232 ++++++++ tex/context/base/lang-url.mkiv | 64 +++ tex/context/base/lang-url.tex | 70 +++ tex/context/base/luat-env.lua | 9 +- tex/context/base/luat-inp.lua | 122 +++- tex/context/base/m-chart.tex | 4 +- tex/context/base/m-cweb.tex | 10 +- tex/context/base/m-database.tex | 2 +- tex/context/base/math-run.tex | 4 +- tex/context/base/math-tex.tex | 61 +- tex/context/base/meta-ini.tex | 20 +- tex/context/base/meta-pdf.mkii | 2 +- tex/context/base/meta-pdf.mkiv | 4 +- tex/context/base/meta-tex.tex | 2 +- tex/context/base/meta-xml.tex | 2 +- tex/context/base/page-flt.tex | 4 +- tex/context/base/page-ini.tex | 24 +- tex/context/base/page-txt.tex | 2 +- tex/context/base/sort-ini.mkii | 4 +- tex/context/base/spec-fdf.mkii | 2 +- tex/context/base/spec-fdf.tex | 12 +- tex/context/base/spec-mis.tex | 2 +- tex/context/base/supp-fil.mkii | 1 - tex/context/base/supp-fun.tex | 4 +- tex/context/base/supp-lan.tex | 34 +- tex/context/base/supp-mis.tex | 4 +- tex/context/base/syst-ext.tex | 98 ++-- tex/context/base/syst-gen.tex | 4 +- tex/context/base/syst-new.tex | 10 +- tex/context/base/syst-omg.tex | 8 - tex/context/base/todo-mkii.tex | 1 + tex/context/base/todo-mkiv.tex | 6 + tex/context/base/x-fo.tex | 2 +- tex/context/base/x-mmp.mkiv | 2 +- tex/context/base/x-newmml.tex | 4 +- tex/context/base/x-newmmo.tex | 2 +- tex/context/base/x-res-08.tex | 2 +- tex/context/base/x-res-20.tex | 2 +- tex/context/base/x-set-11.mkii | 2 +- tex/context/base/x-xml-02.tex | 4 +- tex/context/base/xtag-ext.tex | 25 +- tex/context/base/xtag-ini.tex | 24 +- tex/context/base/xtag-map.tex | 2 +- tex/context/base/xtag-mml.tex | 2 +- tex/context/base/xtag-mmp.tex | 4 +- tex/context/interface/cont-cz.xml | 1 - tex/context/interface/cont-de.xml | 1 - tex/context/interface/cont-en.xml | 1 - tex/context/interface/cont-fr.xml | 1 - tex/context/interface/cont-it.xml | 1 - tex/context/interface/cont-nl.xml | 1 - tex/context/interface/cont-ro.xml | 1 - tex/context/interface/keys-cz.xml | 2 +- tex/context/interface/keys-de.xml | 2 +- tex/context/interface/keys-en.xml | 2 +- tex/context/interface/keys-fr.xml | 2 +- tex/context/interface/keys-it.xml | 2 +- tex/context/interface/keys-nl.xml | 2 +- tex/context/interface/keys-ro.xml | 2 +- 109 files changed, 3109 insertions(+), 1738 deletions(-) create mode 100644 tex/context/base/char-map.lua create mode 100644 tex/context/base/core-job.lua create mode 100644 tex/context/base/core-job.mkii create mode 100644 tex/context/base/core-job.mkiv create mode 100644 tex/context/base/lang-url.lua create mode 100644 tex/context/base/lang-url.mkii create mode 100644 tex/context/base/lang-url.mkiv create mode 100644 tex/context/base/lang-url.tex create mode 100644 tex/context/base/todo-mkii.tex create mode 100644 tex/context/base/todo-mkiv.tex diff --git a/context/data/context.properties b/context/data/context.properties index 184da51b9..484c9cd09 100644 --- a/context/data/context.properties +++ b/context/data/context.properties @@ -370,12 +370,12 @@ Alt+F12|IDM_STOPEXECUTE|\ # install: fonts/truetype/hoekwater/lm/LMTypewriter10-Regular.ttf if PLAT_WIN - font.monospace=font:LMTypewriter10-Regular,size:16 - font.errorfont=font:LMTypewriter10-Regular,size:12 + font.monospace=font:LMMono10-Regular,size:16 + font.errorfont=font:LMMono10-Regular,size:12 if PLAT_GTK - font.monospace=font:!lmtypewriter10 regular,size:16 - font.errorfont=font:!lmtypewriter10 regular,size:12 + font.monospace=font:!lm mono 10 regular,size:16 + font.errorfont=font:!lm mono 10 regular,size:12 font.base=$(font.monospace) #~ font.small=$(font.monospace) diff --git a/scripts/context/lua/luatools.lua b/scripts/context/lua/luatools.lua index 099f254e5..165221fb4 100644 --- a/scripts/context/lua/luatools.lua +++ b/scripts/context/lua/luatools.lua @@ -1036,6 +1036,14 @@ function table.count(t) return n end +function table.swapped(t) + local s = { } + for k, v in pairs(t) do + s[v] = k + end + return s +end + --~ function table.are_equal(a,b) --~ return table.serialize(a) == table.serialize(b) --~ end @@ -1446,9 +1454,12 @@ function os.resultof(command) return io.popen(command,"r"):read("*all") end ---~ if not os.exec then -- still not ok +if not os.exec then -- still not ok os.exec = os.execute ---~ end +end +if not os.spawn then -- still not ok + os.spawn = os.execute +end function os.launch(str) if os.platform == "windows" then @@ -1551,6 +1562,10 @@ function file.basename(name) return name:match("^.+[/\\](.-)$") or name end +function file.nameonly(name) + return ((name:match("^.+[/\\](.-)$") or name):gsub("%..*$","")) +end + function file.extname(name) return name:match("^.+%.([^/\\]-)$") or "" end @@ -3310,22 +3325,121 @@ function input.unexpanded_path(instance,str) return file.join_path(input.unexpanded_path_list(instance,str)) end +--~ function input.expanded_path_list(instance,str) +--~ if not str then +--~ return { } +--~ elseif instance.savelists then +--~ -- engine+progname hash +--~ str = str:gsub("%$","") +--~ if not instance.lists[str] then -- cached +--~ local lst = input.split_path(input.expansion(instance,str)) +--~ instance.lists[str] = input.aux.expanded_path(instance,lst) +--~ end +--~ return instance.lists[str] +--~ else +--~ local lst = input.split_path(input.expansion(instance,str)) +--~ return input.aux.expanded_path(instance,lst) +--~ end +--~ end + +do + local done = { } + + function input.reset_extra_path(instance) + local ep = instance.extra_paths + if not ep then + ep, done = { }, { } + instance.extra_paths = ep + elseif #ep > 0 then + instance.lists, done = { }, { } + end + end + + function input.register_extra_path(instance,paths,subpaths) + if paths and paths ~= "" then + local ep = instance.extra_paths + if not ep then + ep = { } + instance.extra_paths = ep + end + local n = #ep + if subpath and subpaths ~= "" then + for p in paths:gmatch("[^,]+") do + for s in subpaths:gmatch("[^,]+") do + local ps = p .. "/" .. s + if not done[ps] then + ep[#ep+1] = input.clean_path(ps) + done[ps] = true + end + end + end + else + for p in paths:gmatch("[^,]+") do + if not done[p] then + ep[#ep+1] = input.clean_path(p) + done[p] = true + end + end + end + if n < #ep then + instance.lists = { } + end + end + end + +end + function input.expanded_path_list(instance,str) + local function made_list(list) + local ep = instance.extra_paths + if not ep or #ep == 0 then + return list + else + local done, new = { }, { } + -- honour . .. ../.. but only when at the start + for k, v in ipairs(list) do + if not done[v] then + if v:find("^[%.%/]$") then + done[v] = true + new[#new+1] = v + else + break + end + end + end + -- first the extra paths + for k, v in ipairs(ep) do + if not done[v] then + done[v] = true + new[#new+1] = v + end + end + -- next the formal paths + for k, v in ipairs(list) do + if not done[v] then + done[v] = true + new[#new+1] = v + end + end + return new + end + end if not str then - return { } + return ep or { } elseif instance.savelists then -- engine+progname hash str = str:gsub("%$","") if not instance.lists[str] then -- cached - local lst = input.split_path(input.expansion(instance,str)) + local lst = made_list(input.split_path(input.expansion(instance,str))) instance.lists[str] = input.aux.expanded_path(instance,lst) end return instance.lists[str] else local lst = input.split_path(input.expansion(instance,str)) - return input.aux.expanded_path(instance,lst) + return made_list(input.aux.expanded_path(instance,lst)) end end + function input.expand_path(instance,str) return file.join_path(input.expanded_path_list(instance,str)) end @@ -4192,7 +4306,11 @@ end function input.clean_path(str) --~ return (((str:gsub("\\","/")):gsub("^!+","")):gsub("//+","//")) - return ((str:gsub("\\","/")):gsub("^!+","")) + if str then + return ((str:gsub("\\","/")):gsub("^!+","")) + else + return nil + end end function input.do_with_path(name,func) @@ -4282,6 +4400,76 @@ end --~ print(table.serialize(input.aux.splitpathexpr("/usr/share/texmf-{texlive,tetex}", {}))) +-- command line resolver: + +--~ print(input.resolve("abc env:tmp file:cont-en.tex path:cont-en.tex full:cont-en.tex rel:zapf/one/p-chars.tex")) + +do + + local resolvers = { } + + resolvers.environment = function(instance,str) + return input.clean_path(os.getenv(str) or os.getenv(str:upper()) or os.getenv(str:lower()) or "") + end + resolvers.relative = function(instance,str,n) + if io.exists(str) then + -- nothing + elseif io.exists("./" .. str) then + str = "./" .. str + else + local p = "../" + for i=1,n or 2 do + if io.exists(p .. str) then + str = p .. str + break + else + p = p .. "../" + end + end + end + return input.clean_path(str) + end + resolvers.locate = function(instance,str) + local fullname = input.find_given_file(instance,str) or "" + return input.clean_path((fullname ~= "" and fullname) or str) + end + resolvers.filename = function(instance,str) + local fullname = input.find_given_file(instance,str) or "" + return input.clean_path(file.basename((fullname ~= "" and fullname) or str)) + end + resolvers.pathname = function(instance,str) + local fullname = input.find_given_file(instance,str) or "" + return input.clean_path(file.dirname((fullname ~= "" and fullname) or str)) + end + + resolvers.env = resolvers.environment + resolvers.rel = resolvers.relative + resolvers.loc = resolvers.locate + resolvers.kpse = resolvers.locate + resolvers.full = resolvers.locate + resolvers.file = resolvers.filename + resolvers.path = resolvers.pathname + + function resolve(instance,str) + if type(str) == "table" then + for k, v in pairs(str) do + str[k] = resolve(instance,v) or v + end + elseif str and str ~= "" then + str = str:gsub("([a-z]+):([^ ]+)", function(method,target) + if resolvers[method] then + return resolvers[method](instance,target) + else + return method .. ":" .. target + end + end) + end + return str + end + + input.resolve = resolve + +end if not modules then modules = { } end modules ['luat-tmp'] = { @@ -5911,7 +6099,8 @@ function input.my_make_format(instance,texname) -- flags[#flags+1] = "--mkii" -- web2c error flags[#flags+1] = "--progname=" .. instance.progname else - flags[#flags+1] = "--lua=" .. string.quote(luaname) + -- flags[#flags+1] = "--lua=" .. string.quote(luaname) + flags[#flags+1] = string.quote("--lua=" .. luaname) -- flags[#flags+1] = "--progname=" .. instance.progname -- potential fallback end local bs = (environment.platform == "unix" and "\\\\") or "\\" -- todo: make a function @@ -5951,7 +6140,8 @@ function input.my_run_format(instance,name,data,more) if f then f:close() -- bug, no .fmt ! - local command = "luatex --fmt=" .. string.quote(barename) .. " --lua=" .. string.quote(luaname) .. " " .. string.quote(data) .. " " .. string.quote(more) + -- local command = "luatex --fmt=" .. string.quote(barename) .. " --lua=" .. string.quote(luaname) .. " " .. string.quote(data) .. " " .. string.quote(more) + local command = "luatex " .. string.quote("--fmt=" .. barename) .. " " .. string.quote("--lua=" .. luaname) .. " " .. string.quote(data) .. " " .. string.quote(more) input.report("running command: " .. command) os.exec(command) else diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index fbcad1111..9ecaa7198 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -600,8 +600,6 @@ function scripts.context.ctx() scripts.context.run(ctxdata) end -input.verbose = false - banner = banner .. " | context tools " messages.help = [[ @@ -621,7 +619,7 @@ elseif environment.argument("ctx") then scripts.context.ctx() elseif environment.argument("help") then input.help(banner,messages.help) -elseif environment.filename then +elseif environment.files[1] then scripts.context.run() else input.help(banner,messages.help) diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index a52d3e882..0b6720a4e 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -1050,6 +1050,14 @@ function table.count(t) return n end +function table.swapped(t) + local s = { } + for k, v in pairs(t) do + s[v] = k + end + return s +end + --~ function table.are_equal(a,b) --~ return table.serialize(a) == table.serialize(b) --~ end @@ -1480,9 +1488,12 @@ function os.resultof(command) return io.popen(command,"r"):read("*all") end ---~ if not os.exec then -- still not ok +if not os.exec then -- still not ok os.exec = os.execute ---~ end +end +if not os.spawn then -- still not ok + os.spawn = os.execute +end function os.launch(str) if os.platform == "windows" then @@ -1565,6 +1576,10 @@ function file.basename(name) return name:match("^.+[/\\](.-)$") or name end +function file.nameonly(name) + return ((name:match("^.+[/\\](.-)$") or name):gsub("%..*$","")) +end + function file.extname(name) return name:match("^.+%.([^/\\]-)$") or "" end @@ -3411,14 +3426,20 @@ do function xml.include(xmldata,pattern,attribute,recursive,findfile) -- parse="text" (default: xml), encoding="" (todo) - pattern = pattern or 'include' - attribute = attribute or 'href' + pattern = pattern or 'include' + -- attribute = attribute or 'href' local function include(r,d,k) local ek, name = d[k], nil - if ek.at then - for a in attribute:gmatch("([^|]+)") do - name = ek.at[a] - if name then break end + if not attribute or attribute == "" then + local ekdt = ek.dt + name = (type(ekdt) == "table" and ekdt[1]) or ekdt + end + if not name then + if ek.at then + for a in (attribute or "href"):gmatch("([^|]+)") do + name = ek.at[a] + if name then break end + end end end if name then @@ -3439,6 +3460,8 @@ do else xml.empty(d,k) end + else + xml.empty(d,k) end else xml.empty(d,k) @@ -5109,22 +5132,121 @@ function input.unexpanded_path(instance,str) return file.join_path(input.unexpanded_path_list(instance,str)) end +--~ function input.expanded_path_list(instance,str) +--~ if not str then +--~ return { } +--~ elseif instance.savelists then +--~ -- engine+progname hash +--~ str = str:gsub("%$","") +--~ if not instance.lists[str] then -- cached +--~ local lst = input.split_path(input.expansion(instance,str)) +--~ instance.lists[str] = input.aux.expanded_path(instance,lst) +--~ end +--~ return instance.lists[str] +--~ else +--~ local lst = input.split_path(input.expansion(instance,str)) +--~ return input.aux.expanded_path(instance,lst) +--~ end +--~ end + +do + local done = { } + + function input.reset_extra_path(instance) + local ep = instance.extra_paths + if not ep then + ep, done = { }, { } + instance.extra_paths = ep + elseif #ep > 0 then + instance.lists, done = { }, { } + end + end + + function input.register_extra_path(instance,paths,subpaths) + if paths and paths ~= "" then + local ep = instance.extra_paths + if not ep then + ep = { } + instance.extra_paths = ep + end + local n = #ep + if subpath and subpaths ~= "" then + for p in paths:gmatch("[^,]+") do + for s in subpaths:gmatch("[^,]+") do + local ps = p .. "/" .. s + if not done[ps] then + ep[#ep+1] = input.clean_path(ps) + done[ps] = true + end + end + end + else + for p in paths:gmatch("[^,]+") do + if not done[p] then + ep[#ep+1] = input.clean_path(p) + done[p] = true + end + end + end + if n < #ep then + instance.lists = { } + end + end + end + +end + function input.expanded_path_list(instance,str) + local function made_list(list) + local ep = instance.extra_paths + if not ep or #ep == 0 then + return list + else + local done, new = { }, { } + -- honour . .. ../.. but only when at the start + for k, v in ipairs(list) do + if not done[v] then + if v:find("^[%.%/]$") then + done[v] = true + new[#new+1] = v + else + break + end + end + end + -- first the extra paths + for k, v in ipairs(ep) do + if not done[v] then + done[v] = true + new[#new+1] = v + end + end + -- next the formal paths + for k, v in ipairs(list) do + if not done[v] then + done[v] = true + new[#new+1] = v + end + end + return new + end + end if not str then - return { } + return ep or { } elseif instance.savelists then -- engine+progname hash str = str:gsub("%$","") if not instance.lists[str] then -- cached - local lst = input.split_path(input.expansion(instance,str)) + local lst = made_list(input.split_path(input.expansion(instance,str))) instance.lists[str] = input.aux.expanded_path(instance,lst) end return instance.lists[str] else local lst = input.split_path(input.expansion(instance,str)) - return input.aux.expanded_path(instance,lst) + return made_list(input.aux.expanded_path(instance,lst)) end end + function input.expand_path(instance,str) return file.join_path(input.expanded_path_list(instance,str)) end @@ -5991,7 +6113,11 @@ end function input.clean_path(str) --~ return (((str:gsub("\\","/")):gsub("^!+","")):gsub("//+","//")) - return ((str:gsub("\\","/")):gsub("^!+","")) + if str then + return ((str:gsub("\\","/")):gsub("^!+","")) + else + return nil + end end function input.do_with_path(name,func) @@ -7191,12 +7317,11 @@ function input.runners.execute_script(instance,fullname,internal) result = binary .. " " .. result end local before, after = environment.split_arguments(fullname) - -- environment.initialize_arguments(after) - -- local command = result .. " " .. environment.reconstruct_commandline(environment.original_arguments) -- bugged local command = result .. " " .. environment.reconstruct_commandline(after) input.report("") input.report("executing: " .. command) input.report("\n \n") + io.flush() local code = os.exec(command) return code == 0 end @@ -7217,11 +7342,12 @@ function input.runners.execute_program(instance,fullname) local before, after = environment.split_arguments(fullname) environment.initialize_arguments(after) fullname = fullname:gsub("^bin:","") - local command = fullname .. " " .. environment.reconstruct_commandline(environment.original_arguments) + local command = fullname .. " " .. environment.reconstruct_commandline(after) input.report("") ---~ input.report("executing: " .. command) + input.report("executing: " .. command) input.report("\n \n") - local code = os.exec(command) + io.flush() + local code = os.exec(command) -- (fullname,unpack(after)) does not work return code == 0 end end diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb index 598bfac20..4998b21b9 100644 --- a/scripts/context/ruby/ctxtools.rb +++ b/scripts/context/ruby/ctxtools.rb @@ -1608,8 +1608,8 @@ class Commands # ghyphen.readme ghyph31.readme grphyph @@languagedata['hr' ] = [ 'ec' , ['hrhyph.tex'] ] @@languagedata['hu' ] = [ 'ec' , ['huhyphn.tex'] ] - @@languagedata['en' ] = [ 'default' , ['ushyphmax.tex'],['ushyph.tex'],['hyphen.tex'] ] - @@languagedata['us' ] = [ 'default' , ['ushyphmax.tex'],['ushyph.tex'],['hyphen.tex'] ] + @@languagedata['en' ] = [ 'default' , [['ushyphmax.tex'],['ushyph.tex'],['hyphen.tex']] ] + @@languagedata['us' ] = [ 'default' , [['ushyphmax.tex'],['ushyph.tex'],['hyphen.tex']] ] # inhyph.tex @@languagedata['is' ] = [ 'ec' , ['ishyph.tex'] ] @@languagedata['it' ] = [ 'ec' , ['ithyph.tex'] ] @@ -1617,12 +1617,12 @@ class Commands # mnhyph @@languagedata['nl' ] = [ 'ec' , ['nehyph96.tex'] ] # @@languagedata['no' ] = [ 'ec' , ['nohyphbx.tex'],['nohyphb.tex'],['nohyph2.tex'],['nohyph1.tex'],['nohyph.tex'] ] - @@languagedata['no' ] = [ 'ec' , ['asxsx.tex','nohyphbx.tex'],['nohyphb.tex'],['nohyph2.tex'],['nohyph1.tex'],['nohyph.tex'] ] - @@languagedata['agr'] = [ 'agr' , [['grahyph4.tex','oldgrhyph.tex']] ] # new, todo + @@languagedata['no' ] = [ 'ec' , [['asxsx.tex','nohyphbx.tex'],['nohyphb.tex'],['nohyph2.tex'],['nohyph1.tex'],['nohyph.tex']] ] + @@languagedata['agr'] = [ 'agr' , [['grahyph4.tex'], ['oldgrhyph.tex']] ] # new, todo @@languagedata['pl' ] = [ 'ec' , ['plhyph.tex'] ] @@languagedata['pt' ] = [ 'ec' , ['pthyph.tex'] ] @@languagedata['ro' ] = [ 'ec' , ['rohyph.tex'] ] - @@languagedata['sl' ] = [ 'ec' , ['slhyph.tex'], ['sihyph.tex'] ] + @@languagedata['sl' ] = [ 'ec' , [['slhyph.tex'], ['sihyph.tex']] ] @@languagedata['sk' ] = [ 'ec' , ['skhyphen.tex','skhyphen.ex'] ] # sorhyph.tex / upper sorbian # srhyphc.tex / cyrillic diff --git a/tex/context/base/char-def.tex b/tex/context/base/char-def.tex index 1f8563c79..1c0b061dc 100644 --- a/tex/context/base/char-def.tex +++ b/tex/context/base/char-def.tex @@ -23,6 +23,7 @@ \global\uccode #1=#3 } \registerctxluafile{char-def}{1.001} +\registerctxluafile{char-map}{1.001} \registerctxluafile{char-syn}{1.001} %D The codes are stored in the format, so we don't need to reinitialize diff --git a/tex/context/base/char-map.lua b/tex/context/base/char-map.lua new file mode 100644 index 000000000..e463158c5 --- /dev/null +++ b/tex/context/base/char-map.lua @@ -0,0 +1,1072 @@ +-- filename : char-map.lua +-- comment : companion to char-def.tex (in ConTeXt) +-- author : Hans Hagen, PRAGMA-ADE, Hasselt NL +-- copyright: PRAGMA ADE / ConTeXt Development Team +-- license : see context related readme files + +-- remark : derived from 'specialcasing.txt', se Arthurs comments in char-map.txt + + +if not versions then versions = { } end versions['char-map'] = 1.001 +if not characters then characters = { } end + + +characters.casemap={ + [0x0049]={ + ["az"]={ + ["not_before_dot"]={ + ["lower"]={ 0x0131 }, + ["title"]={ 0x0049 }, + ["upper"]={ 0x0049 }, + }, + }, + ["lt"]={ + ["more_above"]={ + ["lower"]={ 0x0069, 0x0307 }, + ["title"]={ 0x0049 }, + ["upper"]={ 0x0049 }, + }, + }, + ["tr"]={ + ["not_before_dot"]={ + ["lower"]={ 0x0131 }, + ["title"]={ 0x0049 }, + ["upper"]={ 0x0049 }, + }, + }, + }, + [0x004A]={ + ["lt"]={ + ["more_above"]={ + ["lower"]={ 0x006A, 0x0307 }, + ["title"]={ 0x004A }, + ["upper"]={ 0x004A }, + }, + }, + }, + [0x0069]={ + ["az"]={ + ["all"]={ + ["lower"]={ 0x0069 }, + ["title"]={ 0x0130 }, + ["upper"]={ 0x0130 }, + }, + }, + ["tr"]={ + ["all"]={ + ["lower"]={ 0x0069 }, + ["title"]={ 0x0130 }, + ["upper"]={ 0x0130 }, + }, + }, + }, + [0x00CC]={ + ["lt"]={ + ["all"]={ + ["lower"]={ 0x0069, 0x0307, 0x0300 }, + ["title"]={ 0x00CC }, + ["upper"]={ 0x00CC }, + }, + }, + }, + [0x00CD]={ + ["lt"]={ + ["all"]={ + ["lower"]={ 0x0069, 0x0307, 0x0301 }, + ["title"]={ 0x00CD }, + ["upper"]={ 0x00CD }, + }, + }, + }, + [0x00DF]={ + [""]={ + ["all"]={ + ["lower"]={ 0x00DF }, + ["title"]={ 0x0053, 0x0073 }, + ["upper"]={ 0x0053, 0x0053 }, + }, + }, + }, + [0x0128]={ + ["lt"]={ + ["all"]={ + ["lower"]={ 0x0069, 0x0307, 0x0303 }, + ["title"]={ 0x0128 }, + ["upper"]={ 0x0128 }, + }, + }, + }, + [0x012E]={ + ["lt"]={ + ["more_above"]={ + ["lower"]={ 0x012F, 0x0307 }, + ["title"]={ 0x012E }, + ["upper"]={ 0x012E }, + }, + }, + }, + [0x0130]={ + [""]={ + ["all"]={ + ["lower"]={ 0x0069, 0x0307 }, + ["title"]={ 0x0130 }, + ["upper"]={ 0x0130 }, + }, + }, + ["az"]={ + ["all"]={ + ["lower"]={ 0x0069 }, + ["title"]={ 0x0130 }, + ["upper"]={ 0x0130 }, + }, + }, + ["tr"]={ + ["all"]={ + ["lower"]={ 0x0069 }, + ["title"]={ 0x0130 }, + ["upper"]={ 0x0130 }, + }, + }, + }, + [0x0149]={ + [""]={ + ["all"]={ + ["lower"]={ 0x0149 }, + ["title"]={ 0x02BC, 0x004E }, + ["upper"]={ 0x02BC, 0x004E }, + }, + }, + }, + [0x01F0]={ + [""]={ + ["all"]={ + ["lower"]={ 0x01F0 }, + ["title"]={ 0x004A, 0x030C }, + ["upper"]={ 0x004A, 0x030C }, + }, + }, + }, + [0x0307]={ + ["az"]={ + ["after_i"]={ + ["lower"]={}, + ["title"]={ 0x0307 }, + ["upper"]={ 0x0307 }, + }, + }, + ["lt"]={ + ["after_soft_dotted"]={ + ["lower"]={ 0x0307 }, + ["title"]={}, + ["upper"]={}, + }, + }, + ["tr"]={ + ["after_i"]={ + ["lower"]={}, + ["title"]={ 0x0307 }, + ["upper"]={ 0x0307 }, + }, + }, + }, + [0x0390]={ + [""]={ + ["all"]={ + ["lower"]={ 0x0390 }, + ["title"]={ 0x0399, 0x0308, 0x0301 }, + ["upper"]={ 0x0399, 0x0308, 0x0301 }, + }, + }, + }, + [0x03A3]={ + ["final_sigma"]={ + ["all"]={ + ["lower"]={ 0x03C2 }, + ["title"]={ 0x03A3 }, + ["upper"]={ 0x03A3 }, + }, + }, + }, + [0x03B0]={ + [""]={ + ["all"]={ + ["lower"]={ 0x03B0 }, + ["title"]={ 0x03A5, 0x0308, 0x0301 }, + ["upper"]={ 0x03A5, 0x0308, 0x0301 }, + }, + }, + }, + [0x0587]={ + [""]={ + ["all"]={ + ["lower"]={ 0x0587 }, + ["title"]={ 0x0535, 0x0582 }, + ["upper"]={ 0x0535, 0x0552 }, + }, + }, + }, + [0x1E96]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1E96 }, + ["title"]={ 0x0048, 0x0331 }, + ["upper"]={ 0x0048, 0x0331 }, + }, + }, + }, + [0x1E97]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1E97 }, + ["title"]={ 0x0054, 0x0308 }, + ["upper"]={ 0x0054, 0x0308 }, + }, + }, + }, + [0x1E98]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1E98 }, + ["title"]={ 0x0057, 0x030A }, + ["upper"]={ 0x0057, 0x030A }, + }, + }, + }, + [0x1E99]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1E99 }, + ["title"]={ 0x0059, 0x030A }, + ["upper"]={ 0x0059, 0x030A }, + }, + }, + }, + [0x1E9A]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1E9A }, + ["title"]={ 0x0041, 0x02BE }, + ["upper"]={ 0x0041, 0x02BE }, + }, + }, + }, + [0x1F50]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F50 }, + ["title"]={ 0x03A5, 0x0313 }, + ["upper"]={ 0x03A5, 0x0313 }, + }, + }, + }, + [0x1F52]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F52 }, + ["title"]={ 0x03A5, 0x0313, 0x0300 }, + ["upper"]={ 0x03A5, 0x0313, 0x0300 }, + }, + }, + }, + [0x1F54]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F54 }, + ["title"]={ 0x03A5, 0x0313, 0x0301 }, + ["upper"]={ 0x03A5, 0x0313, 0x0301 }, + }, + }, + }, + [0x1F56]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F56 }, + ["title"]={ 0x03A5, 0x0313, 0x0342 }, + ["upper"]={ 0x03A5, 0x0313, 0x0342 }, + }, + }, + }, + [0x1F80]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F80 }, + ["title"]={ 0x1F88 }, + ["upper"]={ 0x1F08, 0x0399 }, + }, + }, + }, + [0x1F81]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F81 }, + ["title"]={ 0x1F89 }, + ["upper"]={ 0x1F09, 0x0399 }, + }, + }, + }, + [0x1F82]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F82 }, + ["title"]={ 0x1F8A }, + ["upper"]={ 0x1F0A, 0x0399 }, + }, + }, + }, + [0x1F83]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F83 }, + ["title"]={ 0x1F8B }, + ["upper"]={ 0x1F0B, 0x0399 }, + }, + }, + }, + [0x1F84]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F84 }, + ["title"]={ 0x1F8C }, + ["upper"]={ 0x1F0C, 0x0399 }, + }, + }, + }, + [0x1F85]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F85 }, + ["title"]={ 0x1F8D }, + ["upper"]={ 0x1F0D, 0x0399 }, + }, + }, + }, + [0x1F86]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F86 }, + ["title"]={ 0x1F8E }, + ["upper"]={ 0x1F0E, 0x0399 }, + }, + }, + }, + [0x1F87]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F87 }, + ["title"]={ 0x1F8F }, + ["upper"]={ 0x1F0F, 0x0399 }, + }, + }, + }, + [0x1F88]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F80 }, + ["title"]={ 0x1F88 }, + ["upper"]={ 0x1F08, 0x0399 }, + }, + }, + }, + [0x1F89]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F81 }, + ["title"]={ 0x1F89 }, + ["upper"]={ 0x1F09, 0x0399 }, + }, + }, + }, + [0x1F8A]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F82 }, + ["title"]={ 0x1F8A }, + ["upper"]={ 0x1F0A, 0x0399 }, + }, + }, + }, + [0x1F8B]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F83 }, + ["title"]={ 0x1F8B }, + ["upper"]={ 0x1F0B, 0x0399 }, + }, + }, + }, + [0x1F8C]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F84 }, + ["title"]={ 0x1F8C }, + ["upper"]={ 0x1F0C, 0x0399 }, + }, + }, + }, + [0x1F8D]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F85 }, + ["title"]={ 0x1F8D }, + ["upper"]={ 0x1F0D, 0x0399 }, + }, + }, + }, + [0x1F8E]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F86 }, + ["title"]={ 0x1F8E }, + ["upper"]={ 0x1F0E, 0x0399 }, + }, + }, + }, + [0x1F8F]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F87 }, + ["title"]={ 0x1F8F }, + ["upper"]={ 0x1F0F, 0x0399 }, + }, + }, + }, + [0x1F90]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F90 }, + ["title"]={ 0x1F98 }, + ["upper"]={ 0x1F28, 0x0399 }, + }, + }, + }, + [0x1F91]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F91 }, + ["title"]={ 0x1F99 }, + ["upper"]={ 0x1F29, 0x0399 }, + }, + }, + }, + [0x1F92]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F92 }, + ["title"]={ 0x1F9A }, + ["upper"]={ 0x1F2A, 0x0399 }, + }, + }, + }, + [0x1F93]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F93 }, + ["title"]={ 0x1F9B }, + ["upper"]={ 0x1F2B, 0x0399 }, + }, + }, + }, + [0x1F94]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F94 }, + ["title"]={ 0x1F9C }, + ["upper"]={ 0x1F2C, 0x0399 }, + }, + }, + }, + [0x1F95]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F95 }, + ["title"]={ 0x1F9D }, + ["upper"]={ 0x1F2D, 0x0399 }, + }, + }, + }, + [0x1F96]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F96 }, + ["title"]={ 0x1F9E }, + ["upper"]={ 0x1F2E, 0x0399 }, + }, + }, + }, + [0x1F97]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F97 }, + ["title"]={ 0x1F9F }, + ["upper"]={ 0x1F2F, 0x0399 }, + }, + }, + }, + [0x1F98]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F90 }, + ["title"]={ 0x1F98 }, + ["upper"]={ 0x1F28, 0x0399 }, + }, + }, + }, + [0x1F99]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F91 }, + ["title"]={ 0x1F99 }, + ["upper"]={ 0x1F29, 0x0399 }, + }, + }, + }, + [0x1F9A]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F92 }, + ["title"]={ 0x1F9A }, + ["upper"]={ 0x1F2A, 0x0399 }, + }, + }, + }, + [0x1F9B]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F93 }, + ["title"]={ 0x1F9B }, + ["upper"]={ 0x1F2B, 0x0399 }, + }, + }, + }, + [0x1F9C]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F94 }, + ["title"]={ 0x1F9C }, + ["upper"]={ 0x1F2C, 0x0399 }, + }, + }, + }, + [0x1F9D]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F95 }, + ["title"]={ 0x1F9D }, + ["upper"]={ 0x1F2D, 0x0399 }, + }, + }, + }, + [0x1F9E]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F96 }, + ["title"]={ 0x1F9E }, + ["upper"]={ 0x1F2E, 0x0399 }, + }, + }, + }, + [0x1F9F]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1F97 }, + ["title"]={ 0x1F9F }, + ["upper"]={ 0x1F2F, 0x0399 }, + }, + }, + }, + [0x1FA0]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA0 }, + ["title"]={ 0x1FA8 }, + ["upper"]={ 0x1F68, 0x0399 }, + }, + }, + }, + [0x1FA1]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA1 }, + ["title"]={ 0x1FA9 }, + ["upper"]={ 0x1F69, 0x0399 }, + }, + }, + }, + [0x1FA2]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA2 }, + ["title"]={ 0x1FAA }, + ["upper"]={ 0x1F6A, 0x0399 }, + }, + }, + }, + [0x1FA3]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA3 }, + ["title"]={ 0x1FAB }, + ["upper"]={ 0x1F6B, 0x0399 }, + }, + }, + }, + [0x1FA4]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA4 }, + ["title"]={ 0x1FAC }, + ["upper"]={ 0x1F6C, 0x0399 }, + }, + }, + }, + [0x1FA5]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA5 }, + ["title"]={ 0x1FAD }, + ["upper"]={ 0x1F6D, 0x0399 }, + }, + }, + }, + [0x1FA6]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA6 }, + ["title"]={ 0x1FAE }, + ["upper"]={ 0x1F6E, 0x0399 }, + }, + }, + }, + [0x1FA7]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA7 }, + ["title"]={ 0x1FAF }, + ["upper"]={ 0x1F6F, 0x0399 }, + }, + }, + }, + [0x1FA8]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA0 }, + ["title"]={ 0x1FA8 }, + ["upper"]={ 0x1F68, 0x0399 }, + }, + }, + }, + [0x1FA9]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA1 }, + ["title"]={ 0x1FA9 }, + ["upper"]={ 0x1F69, 0x0399 }, + }, + }, + }, + [0x1FAA]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA2 }, + ["title"]={ 0x1FAA }, + ["upper"]={ 0x1F6A, 0x0399 }, + }, + }, + }, + [0x1FAB]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA3 }, + ["title"]={ 0x1FAB }, + ["upper"]={ 0x1F6B, 0x0399 }, + }, + }, + }, + [0x1FAC]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA4 }, + ["title"]={ 0x1FAC }, + ["upper"]={ 0x1F6C, 0x0399 }, + }, + }, + }, + [0x1FAD]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA5 }, + ["title"]={ 0x1FAD }, + ["upper"]={ 0x1F6D, 0x0399 }, + }, + }, + }, + [0x1FAE]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA6 }, + ["title"]={ 0x1FAE }, + ["upper"]={ 0x1F6E, 0x0399 }, + }, + }, + }, + [0x1FAF]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FA7 }, + ["title"]={ 0x1FAF }, + ["upper"]={ 0x1F6F, 0x0399 }, + }, + }, + }, + [0x1FB2]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FB2 }, + ["title"]={ 0x1FBA, 0x0345 }, + ["upper"]={ 0x1FBA, 0x0399 }, + }, + }, + }, + [0x1FB3]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FB3 }, + ["title"]={ 0x1FBC }, + ["upper"]={ 0x0391, 0x0399 }, + }, + }, + }, + [0x1FB4]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FB4 }, + ["title"]={ 0x0386, 0x0345 }, + ["upper"]={ 0x0386, 0x0399 }, + }, + }, + }, + [0x1FB6]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FB6 }, + ["title"]={ 0x0391, 0x0342 }, + ["upper"]={ 0x0391, 0x0342 }, + }, + }, + }, + [0x1FB7]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FB7 }, + ["title"]={ 0x0391, 0x0342, 0x0345 }, + ["upper"]={ 0x0391, 0x0342, 0x0399 }, + }, + }, + }, + [0x1FBC]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FB3 }, + ["title"]={ 0x1FBC }, + ["upper"]={ 0x0391, 0x0399 }, + }, + }, + }, + [0x1FC2]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FC2 }, + ["title"]={ 0x1FCA, 0x0345 }, + ["upper"]={ 0x1FCA, 0x0399 }, + }, + }, + }, + [0x1FC3]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FC3 }, + ["title"]={ 0x1FCC }, + ["upper"]={ 0x0397, 0x0399 }, + }, + }, + }, + [0x1FC4]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FC4 }, + ["title"]={ 0x0389, 0x0345 }, + ["upper"]={ 0x0389, 0x0399 }, + }, + }, + }, + [0x1FC6]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FC6 }, + ["title"]={ 0x0397, 0x0342 }, + ["upper"]={ 0x0397, 0x0342 }, + }, + }, + }, + [0x1FC7]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FC7 }, + ["title"]={ 0x0397, 0x0342, 0x0345 }, + ["upper"]={ 0x0397, 0x0342, 0x0399 }, + }, + }, + }, + [0x1FCC]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FC3 }, + ["title"]={ 0x1FCC }, + ["upper"]={ 0x0397, 0x0399 }, + }, + }, + }, + [0x1FD2]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FD2 }, + ["title"]={ 0x0399, 0x0308, 0x0300 }, + ["upper"]={ 0x0399, 0x0308, 0x0300 }, + }, + }, + }, + [0x1FD3]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FD3 }, + ["title"]={ 0x0399, 0x0308, 0x0301 }, + ["upper"]={ 0x0399, 0x0308, 0x0301 }, + }, + }, + }, + [0x1FD6]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FD6 }, + ["title"]={ 0x0399, 0x0342 }, + ["upper"]={ 0x0399, 0x0342 }, + }, + }, + }, + [0x1FD7]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FD7 }, + ["title"]={ 0x0399, 0x0308, 0x0342 }, + ["upper"]={ 0x0399, 0x0308, 0x0342 }, + }, + }, + }, + [0x1FE2]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FE2 }, + ["title"]={ 0x03A5, 0x0308, 0x0300 }, + ["upper"]={ 0x03A5, 0x0308, 0x0300 }, + }, + }, + }, + [0x1FE3]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FE3 }, + ["title"]={ 0x03A5, 0x0308, 0x0301 }, + ["upper"]={ 0x03A5, 0x0308, 0x0301 }, + }, + }, + }, + [0x1FE4]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FE4 }, + ["title"]={ 0x03A1, 0x0313 }, + ["upper"]={ 0x03A1, 0x0313 }, + }, + }, + }, + [0x1FE6]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FE6 }, + ["title"]={ 0x03A5, 0x0342 }, + ["upper"]={ 0x03A5, 0x0342 }, + }, + }, + }, + [0x1FE7]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FE7 }, + ["title"]={ 0x03A5, 0x0308, 0x0342 }, + ["upper"]={ 0x03A5, 0x0308, 0x0342 }, + }, + }, + }, + [0x1FF2]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FF2 }, + ["title"]={ 0x1FFA, 0x0345 }, + ["upper"]={ 0x1FFA, 0x0399 }, + }, + }, + }, + [0x1FF3]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FF3 }, + ["title"]={ 0x1FFC }, + ["upper"]={ 0x03A9, 0x0399 }, + }, + }, + }, + [0x1FF4]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FF4 }, + ["title"]={ 0x038F, 0x0345 }, + ["upper"]={ 0x038F, 0x0399 }, + }, + }, + }, + [0x1FF6]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FF6 }, + ["title"]={ 0x03A9, 0x0342 }, + ["upper"]={ 0x03A9, 0x0342 }, + }, + }, + }, + [0x1FF7]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FF7 }, + ["title"]={ 0x03A9, 0x0342, 0x0345 }, + ["upper"]={ 0x03A9, 0x0342, 0x0399 }, + }, + }, + }, + [0x1FFC]={ + [""]={ + ["all"]={ + ["lower"]={ 0x1FF3 }, + ["title"]={ 0x1FFC }, + ["upper"]={ 0x03A9, 0x0399 }, + }, + }, + }, + [0xFB00]={ + [""]={ + ["all"]={ + ["lower"]={ 0xFB00 }, + ["title"]={ 0x0046, 0x0066 }, + ["upper"]={ 0x0046, 0x0046 }, + }, + }, + }, + [0xFB01]={ + [""]={ + ["all"]={ + ["lower"]={ 0xFB01 }, + ["title"]={ 0x0046, 0x0069 }, + ["upper"]={ 0x0046, 0x0049 }, + }, + }, + }, + [0xFB02]={ + [""]={ + ["all"]={ + ["lower"]={ 0xFB02 }, + ["title"]={ 0x0046, 0x006C }, + ["upper"]={ 0x0046, 0x004C }, + }, + }, + }, + [0xFB03]={ + [""]={ + ["all"]={ + ["lower"]={ 0xFB03 }, + ["title"]={ 0x0046, 0x0066, 0x0069 }, + ["upper"]={ 0x0046, 0x0046, 0x0049 }, + }, + }, + }, + [0xFB04]={ + [""]={ + ["all"]={ + ["lower"]={ 0xFB04 }, + ["title"]={ 0x0046, 0x0066, 0x006C }, + ["upper"]={ 0x0046, 0x0046, 0x004C }, + }, + }, + }, + [0xFB05]={ + [""]={ + ["all"]={ + ["lower"]={ 0xFB05 }, + ["title"]={ 0x0053, 0x0074 }, + ["upper"]={ 0x0053, 0x0054 }, + }, + }, + }, + [0xFB06]={ + [""]={ + ["all"]={ + ["lower"]={ 0xFB06 }, + ["title"]={ 0x0053, 0x0074 }, + ["upper"]={ 0x0053, 0x0054 }, + }, + }, + }, + [0xFB13]={ + [""]={ + ["all"]={ + ["lower"]={ 0xFB13 }, + ["title"]={ 0x0544, 0x0576 }, + ["upper"]={ 0x0544, 0x0546 }, + }, + }, + }, + [0xFB14]={ + [""]={ + ["all"]={ + ["lower"]={ 0xFB14 }, + ["title"]={ 0x0544, 0x0565 }, + ["upper"]={ 0x0544, 0x0535 }, + }, + }, + }, + [0xFB15]={ + [""]={ + ["all"]={ + ["lower"]={ 0xFB15 }, + ["title"]={ 0x0544, 0x056B }, + ["upper"]={ 0x0544, 0x053B }, + }, + }, + }, + [0xFB16]={ + [""]={ + ["all"]={ + ["lower"]={ 0xFB16 }, + ["title"]={ 0x054E, 0x0576 }, + ["upper"]={ 0x054E, 0x0546 }, + }, + }, + }, + [0xFB17]={ + [""]={ + ["all"]={ + ["lower"]={ 0xFB17 }, + ["title"]={ 0x0544, 0x056D }, + ["upper"]={ 0x0544, 0x053D }, + }, + }, + }, +} diff --git a/tex/context/base/cont-log.tex b/tex/context/base/cont-log.tex index 37aabbbb6..fb821331d 100644 --- a/tex/context/base/cont-log.tex +++ b/tex/context/base/cont-log.tex @@ -21,7 +21,7 @@ \unprotect -\convertargument cmr\to\someCMRfont +\defconvertedargument\someCMRfont{cmr} % hm, we now have lm % \def\doifCMRfontelse#1#2% % {\doifinstringelse{\someCMRfont}{\fontname\font} @@ -161,10 +161,10 @@ \unexpanded\def\setMFPfont% more sensitive for low level changes {\font\logofont=logo% \ifx\fontalternative\c!bf\else + \ifx\fontalternative\c!it\else \ifx\fontalternative\c!sl\else - \ifx\fontalternative\c!sl\else - \ifx\fontalternative\c!bs\else \ifx\fontalternative\c!bi\else + \ifx\fontalternative\c!bs\else \fi\fi\fi\fi\fi 10 at \currentfontscale\bodyfontsize \logofont} @@ -230,22 +230,67 @@ \def\luaTeX {lua\TeX} \unexpanded\def\XeTeX {X\lower.5ex\hbox{\kern-.15em\mirror{E}}\kern-.1667em\TeX} +% Better, since lm has a mirrored E (don't ask me why) + +% \unexpanded\def\XeTeX +% {X\lower.5ex +% \hbox +% {\kern-.15em +% \ifx\XeTeXcharglyph\undefined +% \mirror{E}% +% \else\ifcase\XeTeXcharglyph"018E\relax +% \mirror{E}% +% \else +% \char"018E% +% \fi}% +% \kern-.1667em \TeX} + +% Adapted from a patch by Mojca: + +\def\@XeTeX@ + {\setbox\scratchbox\hbox{E}% + \raise\dimexpr\ht\scratchbox+\dp\scratchbox\relax\hbox{\rotate[\c!rotation=180]{\box\scratchbox}}} + +\beginNEWTEX + +\unexpanded\def\XeTeX + {X\lower.5ex + \hbox + {\kern-.15em + \iffontchar\font"018E\relax + \char"018E% + \else + \ifx\fontalternative\c!bf\mirror{E}\else + \ifx\fontalternative\c!it \@XeTeX@\else + \ifx\fontalternative\c!sl \@XeTeX@\else + \ifx\fontalternative\c!bi \@XeTeX@\else + \ifx\fontalternative\c!bs \@XeTeX@\else + \mirror{E}\fi\fi\fi\fi\fi + \fi}% + \kern-.1667em \TeX} + +\endNEWTEX + +\beginOLDTEX + +\unexpanded\def\XeTeX + {X\lower.5ex + \hbox + {\kern-.15em + \ifx\fontalternative\c!bf\mirror{E}\else + \ifx\fontalternative\c!it \@XeTeX@\else + \ifx\fontalternative\c!sl \@XeTeX@\else + \ifx\fontalternative\c!bi \@XeTeX@\else + \ifx\fontalternative\c!bs \@XeTeX@\else + \mirror{E}\fi\fi\fi\fi\fi}% + \kern-.1667em \TeX} + +\endOLDTEX + \let\ETEX \eTeX \let\PDFTEX \pdfTeX \let\PDFETEX \pdfeTeX \let\LUATEX \luaTeX \let\XETEX \XeTeX -\beginXETEX depth adjustment of logos - - % The next patch by Adam Lindsay is needed to satisfy XeTeX's - % feelings about what depths and heights are supposed to be. - - \let\NormalTeXLogo\TeX - - \unexpanded\def\TeX {T\smash[d]{\kern-.1667em\lower.5ex\hbox{E}}\kern-.125emX} - \unexpanded\def\XeTeX{X\smash[d]{\lower.5ex\hbox{\kern-.15em\mirror{E}}}\kern-.1667em\TeX} - -\endXETEX - \protect \endinput diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index a9a9c80ae..09a7a2887 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2008.01.16 13:49} +\newcontextversion{2008.01.26 02:30} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new @@ -39,42 +39,6 @@ \doPDFpageattribute{/Group << /S /Transparency /I true /K true>>}% \to \everyshipout} -% very experimental, used in \testpagesync which is used in splitting (e.g. core-ntb) - -% \installoutput\flushpagesofar -% {\ifvoid\normalpagebox\else -% \global\setbox\normalpagebox\vbox -% {\unvbox\normalpagebox -% \setbox\scratchbox\lastbox}% -% \unvbox\normalpagebox -% \fi} - -% \let\normalflushpagesofar\flushpagesofar - -% \def\flushpagesofar -% {\ifdim\pagetotal>\pagegoal -% \endgraf -% \begingroup -% \forgetall -% \normalvbox{\hsize\zeropoint\strut\endgraf\strut}% -% %normalvbox{\hsize\zeropoint\strut flush }% -% %normalvbox{\hsize\zeropoint\strut flush page so far}% -% \endgroup -% \endgraf -% \normalflushpagesofar -% \fi} - -\def\flushpagesofar - {\endgraf - \ifdim\pagetotal>\pagegoal - \ifdim\dimexpr\pagetotal-\pageshrink\relax>\pagegoal - \goodbreak % \penalty0 - \else - \page - \fi - \else - \fi} - % \setupcaption [figure] [align=flushleft] % \setupcaption [figure-1] [align=flushleft,leftmargin=10mm] % \setupcaption [figure-2] [align=flushleft,leftmargin=10mm,rightmargin=-10mm,width=\textwidth] @@ -100,40 +64,6 @@ \def\placesetupfloat[##1]{\placefloat[##1][#2][#3]{#4}{\floatsetupcontent}}% #4 and not \floatsetupcaption (unexpanded) \dowithnextbox{\setups[#1]}\vbox} -\chardef\baselinegridmode=0 % option in layout / 1=permit_half_lines - -\def\dodosetupwhitespace - {\ifgridsnapping - \witruimteflexibelfalse - \ctxparskip1\ctxparskip - \ifdim\ctxparskip>\zeropoint - \ifcase\baselinegridmode - \ctxparskip\baselineskip % normal ! ! ! ! !! - \or - \ifdim\scratchdimen=\baselineskip % maybe range - \ctxparskip\baselineskip % normal ! ! ! ! !! - \else - \ctxparskip\numexpr\ctxparskip/\dimexpr.5\lineheight\relax\relax\dimexpr.5\lineheight\relax - \fi - \else - \ctxparskip\baselineskip % normal ! ! ! ! !! - \fi - \fi - \else - \ifwitruimteflexibel \else \ctxparskip1\ctxparskip \fi - \fi - \parskip\ctxparskip} - -\def\defXMLexpanded#1#2% - {\begingroup - \let\getXMLentity\expandedXMLentity - \expanded{\endgroup\edef\noexpand#1{#2}}} - -\def\gdefXMLexpanded#1#2% - {\begingroup - \let\getXMLentity\expandedXMLentity - \expanded{\endgroup\xdef\noexpand#1{#2}}} - \def\dividedsize#1#2#3% size gap n {\dimexpr \ifnum\dimexpr#1\relax>\plusone @@ -193,29 +123,6 @@ \prependtoks \restoreendofline \to \everybeforeshipout -% The following may be a solution for the fact that one cannot -% change catcodes of characters like : and ; inside an environment. - -\appendtoks - \enablelanguagespecifics[\currentlanguage]% -\to \everystarttext - -% Peter M\"unster's test case: -% -% \defineoverlay[Draft][{\scale[factor=max]{\rotate[rotation=60]{~MY||DRAFT~}}}] -% \setupbackgrounds[page][background=Draft] -% \starttext -% \starttables[|l|] -% \dorecurse{200}{\NC hallo \NC\AR} -% \stoptables -% \stoptext -% -% \let\normalactivetilde~ -% \let\normalactivebar | -% -% \appendtoks\let~\normalactivetilde\to\everypagebody -% \appendtoks\let|\normalactivebar \to\everypagebody - \let\cs\getvalue % experimental so this may change @@ -312,105 +219,6 @@ % % \shapesynonym{eacute} -\chardef\baselinecorrectionmode\plusone - -\def\onbaselinecorrection {\chardef\baselinecorrectionmode\plusone } -\def\offbaselinecorrection {\chardef\baselinecorrectionmode\plustwo } -\def\forcebaselinecorrection{\chardef\baselinecorrectionmode\plusthree} - -\def\topbaselinecorrection - {\ifvmode \ifdim\pagegoal<\maxdimen - \forcedtopbaselinecorrection - \fi \fi} - -\def\forcedtopbaselinecorrection - {\ifvmode - \bgroup - \setbaselinecorrections - \whitespace - \nointerlineskip - \dotopbaselinecorrection - \egroup - \fi} - -\let\forcedbotbaselinecorrection\botbaselinecorrection - -\def\startbaselinecorrection - {\ifcase\baselinecorectionmode - \or % normal - \baselinecorrection - \ifvmode - \bgroup - \setbox\scratchbox\vbox\bgroup - \ignorespaces - \let\stopbaselinecorrection\donormalstopbaselinecorrection - \else - \bgroup - \let\stopbaselinecorrection\egroup - \fi - \or % off - \bgroup - \let\stopbaselinecorrection\egroup - \or % force - \baselinecorrection - \ifvmode - \bgroup - \setbox\scratchbox\vbox\bgroup - \ignorespaces - \let\stopbaselinecorrection\doforcedstopbaselinecorrection - \else - \bgroup - \let\stopbaselinecorrection\egroup - \fi - \fi} - -\def\startbaselinecorrection - {\bgroup - \let\stopbaselinecorrection\egroup - \ifcase\baselinecorrectionmode - \or % normal - \baselinecorrection - \ifvmode - \setbox\scratchbox\vbox\bgroup\ignorespaces - \let\stopbaselinecorrection\donormalstopbaselinecorrection - \fi - \or % off - \or % force - \baselinecorrection - \ifvmode - \setbox\scratchbox\vbox\bgroup\ignorespaces - \let\stopbaselinecorrection\doforcedstopbaselinecorrection - \fi - \fi} - -\let\stopbaselinecorrection\relax - -\def\donormalstopbaselinecorrection % I have to check columns yet. - {\egroup - \topbaselinecorrection - \box\scratchbox - \botbaselinecorrection - \egroup} - -\def\doforcedstopbaselinecorrection % I have to check columns yet. - {\egroup - \forcedtopbaselinecorrection - \box\scratchbox - \forcedbotbaselinecorrection - \egroup} - -% core-grd: - -\let\normalstartbaselinecorrection=\startbaselinecorrection - -\def\startbaselinecorrection - {\ifgridsnapping - \centertogrid\bgroup - \let\stopbaselinecorrection\egroup - \else - \normalstartbaselinecorrection - \fi} - % \page[left] % \definecolumntextarea[intro][left][x=1,y=1,nx=4,ny=20,state=start,background=introlayer] % \setupcolumntextareatext[intro][left][\setups{intro}] @@ -528,47 +336,6 @@ {\XMLexpanded{\scratchtoks{\enableXML#2}}% \expanded{\normalsetnormalmark{#1}{\the\scratchtoks}}} -\ifx\pagediscards\undefined \let\pagediscards\relax \fi - -\installoutput\synchronizeoutput % maybe add pagediscards - {\ifvoid\normalpagebox\else - \unvbox\normalpagebox - \pagediscards % maybe not needed ? - \fi} - -% temp hack, else no proper default fall back (like \textmultiply); todo: sync encoding - -\def\dealwithmathtextencoding - {\expanded{\everyhbox{\the\everyhbox\noexpand\fastenableencoding{\currentencoding}}}% - \def\dealwithmathtextencoding{\let\characterencoding\nocharacterencoding}% - \dealwithmathtextencoding} - -\appendtoks - \dealwithmathtextencoding -\to \everymathematics - -\let\outerencoding\empty - -\def\checkoutermathencoding - {\ifx\outerencoding\empty - \ifx\outerencoding\s!default\else - \edef\outerencoding{\currentencoding}% - \fi - \fi} - -\prependtoks - \checkoutermathencoding -\to \everymathematics - -% \startmathcollection[eul:texnansi] -% \definemathsymbol [breve] [accent] [tf] ["15] -% \stopmathcollection -% \startmathcollection[eul:ec] -% \definemathsymbol [breve] [accent] [tf] ["08] -% \stopmathcollection -% -% $\breve e$ - % \separatestring123 456\to\test [\test] % \def\separatestring#1\to#2% @@ -824,34 +591,6 @@ % % \endETEX -% cleaner -% -% \long\def\doMPTEXcheck#1% -% {\long\def\dodoMPTEXcheck##1#1##2##3\war{\if##2@\else\@EA\donoMPTEXcheck\fi}% -% \@EA\dodoMPTEXcheck\MPascii#1@@\war} - -% \long\def\donoMPTEXcheck#1\relax -% {\global\MPTEXgraphictrue} - -% \MPTEXgrapicchecks\emptytoks - -% \def\forceMPTEXcheck#1% -% {\convertargument#1\to\ascii -% \@EA\appendtoks\@EA\doMPTEXcheck\@EA{\ascii}\to\MPTEXgrapicchecks} - -% \forceMPTEXcheck{etex} -% \forceMPTEXcheck{textext} -% \forceMPTEXcheck{graphictext} - -% \long\def\checkMPTEXgraphic#1% -% {\ifforceMPTEXgraphic -% \global\MPTEXgraphictrue -% \else -% \global\MPTEXgraphicfalse -% \expandafter\convertargument#1\to\MPascii -% \the\MPTEXgrapicchecks\relax % \relax is end condition! -% \fi} - % no, wrong! never! % % \def\tightlayer[#1]% @@ -863,19 +602,6 @@ % \hbox to \hsize{\composedlayer{#1}}% % \endgroup} -\let\locatedfilepath\empty - -\def\locatefilepath#1% - {\let\locatedfilepath\empty - \ifx\allinputpaths\empty \else - \def\docommand##1% - {\doiffileelse{\pathplusfile{##1}{#1}}{\donetrue\def\locatedfilepath{##1}}\donefalse - \ifdone\expandafter\quitcommalist\fi}% - \doifparentfileelse{#1} % new - {\processcommacommand [\allinputpaths]\docommand} - {\processcommacommand[.,\allinputpaths]\docommand}% - \fi} - % todo : share symbols % \definecolor[rollover:n][red] @@ -1053,7 +779,7 @@ \def\buttonframed{\dodoubleempty\localframed[\??bt]} % goodie -\unexpanded\def\asciistr#1{\convertargument#1\to\ascii{\verbatimfont\ascii}} +\unexpanded\def\asciistr#1{\dontleavehmode{\defconvertedargument\ascii{#1}\verbatimfont\ascii}} % messy, will be improved: @@ -1086,12 +812,12 @@ \ifx\scantextokens\undefined \ifx\scantokens\undefined - \unexpanded\def\retype#1{\bgroup\convertargument#1\to\ascii\@EA\normaltype\@EA{\ascii}\egroup} + \unexpanded\def\retype#1{\dontleavehmode{\defconvertedargument\ascii{#1}\@EA\normaltype\@EA{\ascii}}} \else - \unexpanded\def\retype#1{\scantokens{\normaltype{#1}\ignorespaces}\relax} + \unexpanded\def\retype#1{\dontleavehmode\scantokens{\normaltype{#1}\ignorespaces}\relax} \fi \else - \unexpanded\def\retype#1{\scantextokens{\normaltype{#1}}} + \unexpanded\def\retype#1{\dontleavehmode\scantextokens{\normaltype{#1}}} \fi \def\simplifytype{\let\type\retype} diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 541d89280..d0291934f 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -42,7 +42,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2008.01.16 13:49} +\edef\contextversion{2008.01.26 02:30} %D For those who want to use this: @@ -307,6 +307,7 @@ %D we'll have to be more space conservative. \loadcorefile{lang-mis.tex} +\loadcorefile{lang-url.tex} \loadcorefile{lang-spe.tex} \loadcorefile{lang-lab.tex} diff --git a/tex/context/base/core-blk.tex b/tex/context/base/core-blk.tex index a6e391e6e..8de1099e6 100644 --- a/tex/context/base/core-blk.tex +++ b/tex/context/base/core-blk.tex @@ -289,7 +289,7 @@ {\immediate\write\outblocks} \long\def\processnextblocklineAB#1% #2#3% - {\convertargument#1 \to\next + {\defconvertedargument\next{#1 }% \doifinstringelse\endofblockA\next \firstoftwoarguments {\doifinstringelse\endofblockB\next @@ -304,7 +304,7 @@ \egroup \long\def\processnextblockline#1% #2#3% - {\convertargument#1 \to\next + {\defconvertedargument\next{#1 }% \ifx\next\emptybufferline \expandafter\secondoftwoarguments% #3% \else @@ -324,8 +324,7 @@ \def\skipblock#1% {\checkcopyingblocks - \@EA\convertargument\string\thiswasblock{#1}\to\endofblock - %testen : \expanded{\convertargument\string\thiswasblock{#1}\noexpand\to\noexpand\endofblock}% + \defconvertedcommand\endofblock{\string\thiswasblock{#1}}% command expands once ! \let\openblock\begingroup \let\closeblock\endgroup \openblock @@ -344,9 +343,8 @@ \def\saveblock#1#2% {\checkcopyingblocks \obeylines - \@EA\@EA\@EA\convertargument\@EA\string\csname\e!end#1\endcsname\to\endofblockA - %testen: \expanded{\convertargument\string\csname\e!end#1\endcsname\to\endofblockA}% - \@EA\convertargument\string\endblock[#1]\to\endofblockB % MULTI LINGUAL MAKEN + \@EA\defconvertedcommand\@EA\endofblockA\@EA{\@EA\string\csname\e!end#1\endcsname}% + \defconvertedcommand\endofblockB{\string\endblock[#1]}% % MULTI LINGUAL MAKEN \def\openblock {\dobeforeblock{#1}{#2}% \opentmpblock @@ -670,8 +668,8 @@ {\egroup\setblocklevel-}% \checkcopyingblocks \obeylines - \@EA\@EA\@EA\convertargument\@EA\string\csname\e!end#1\endcsname\to\endofblockA - \@EA\convertargument\string\endblock[#1]\to\endofblockB % MULTI LINGUAL MAKEN + \@EA\defconvertedcommand\@EA\endofblockA\@EA{\@EA\string\csname\e!end#1\endcsname}% + \defconvertedcommand\endofblockB{\string\endblock[#1]} % MULTI LINGUAL MAKEN \setupcopyblock \skipblocklineAB} diff --git a/tex/context/base/core-buf.mkii b/tex/context/base/core-buf.mkii index 9a803764c..8745155a1 100644 --- a/tex/context/base/core-buf.mkii +++ b/tex/context/base/core-buf.mkii @@ -19,23 +19,23 @@ \long\def\mksetbuffer#1% {\edef\bufferfilename{\TEXbufferfile{\currentbuffer}}% \immediate\openout\tmpblocks\bufferfilename - \convertargument#1\to\ascii + \defconvertedargument\ascii{#1}% \immediate\write\tmpblocks{\ascii}% \immediate\closeout\tmpblocks} \def\mkstartbuffer#1#2#3#4#5% ook grabben a la mkiv / no, we need to add par anchors {\doifelsenothing{#4} {\letbeundefined{\e!stop\v!buffer}% % \let\stopbuffer=\relax % \undefined - \@EA\@EA\@EA\convertargument\@EA\e!start\v!buffer\to\beginofblock % else a space - \@EA\@EA\@EA\convertargument\@EA\e!stop \v!buffer\to\endofblock + \edefconvertedargument\beginofblock{\e!start\v!buffer}% + \edefconvertedargument\endofblock {\e!stop \v!buffer}% \ifcase\buffernestmode \let\processnextbufferline\processnextbufferlineB \else \let\processnextbufferline\processnextbufferlineA \fi} {\letbeundefined{#4}% \letvalue{#4}=\relax % \undefined - \@EA\convertargument\csname#3\endcsname\to\beginofblock - \@EA\convertargument\csname#4\endcsname\to\endofblock + \@EA\defconvertedargument\@EA\beginofblock\@EA{\csname#3\endcsname}% we could use defconvertedcommand here (no \@EA) + \@EA\defconvertedargument\@EA\endofblock \@EA{\csname#4\endcsname}% we could use defconvertedcommand here (no \@EA) \ifcase\buffernestmode \let\processnextbufferline\processnextbufferlineB \or @@ -73,7 +73,8 @@ % support macros -\expandafter \convertargument \gobbleoneargument @ \to \emptybufferline +% \expandafter \convertargument \gobbleoneargument @ \to \emptybufferline +\edefconvertedargument\emptybufferline{ } \ifx\tmpblocks\undefined \newwrite\tmpblocks \fi @@ -99,7 +100,7 @@ \long\def\processnextbufferlineA#1% {\relax % checken waarom eerdere macro dit nodig heeft / supp-mps run - \convertargument#1 \to\next + \defconvertedargument\next{#1 }% \doifinstringelse{\delcharacter\letterpercent}{\delcharacter\next} {\secondoftwoarguments} {\doifincsnameelse\endofblock\next @@ -115,7 +116,7 @@ {\secondoftwoarguments}}}} \long\def\processnextbufferlineB#1% #2#3% - {\convertargument#1 \to\next + {\defconvertedargument\next{#1 }% \ifx\next\emptybufferline \ifsegmentatebuffer \emptybufferlinetrue \fi \expandafter\secondoftwoarguments% #3% diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex index defcb3a5e..975d9429a 100644 --- a/tex/context/base/core-fig.tex +++ b/tex/context/base/core-fig.tex @@ -643,6 +643,7 @@ \restorecatcodes % collected resets (token list) \resetfigurevariables +\resetwantedconversionvariables % new here % analyze filename and set wanted variables \analyzefigurefilename{#3}{#2}% \doanalyzefiguredimensionsfromfile @@ -656,8 +657,7 @@ % now we really start \checkiffigureobjectpresent % first guess, we may not yet know the typespec \checkifknownfigureobjectpresent - \checkforconvertedfigure - \checkforfigurefile + \checkforfigurefilepresence \checkiffigureobjectpresent % to be sure, in case we now know the typespec \checkfigurerenderingoptions % was later, moved here \checknaturalfiguredimensions % inherit from global values and/or fallbacks @@ -677,6 +677,10 @@ \poppublicfigurevariables \doshowfigurestate{end}} +\def\checkforfigurefilepresence + {\checkforconvertedfigure + \checkforfigurefile} + %D Figure objects. \def\setfigureobject @@ -919,13 +923,13 @@ \fi \let\wantedfiguretype \empty \let\wantedfiguretypelist\figuretypes % hm, why needed + \ifx\figurepathlist\empty + \let\figurepathlist\wantedfigurepath + \else + \edef\figurepathlist{\wantedfigurepath,\figurepathlist}% + \fi \doshowfigurestate{conversion path : \wantedconversionpath}% \doshowfigurestate{conversion name : \wantedconversionname}}% -\ifx\figurepathlist\empty - \let\figurepathlist\wantedfigurepath -\else - \edef\figurepathlist{\wantedfigurepath,\figurepathlist}% -\fi \doshowfigurestate{new figure path : \wantedfigurepath}% \fi} diff --git a/tex/context/base/core-grd.tex b/tex/context/base/core-grd.tex index 16dc750c0..864da8021 100644 --- a/tex/context/base/core-grd.tex +++ b/tex/context/base/core-grd.tex @@ -154,33 +154,74 @@ % m-steps.tex, where we apply a \localhsize to the \vbox, in % order to follow narrower and side floats ! +% \def\startbaselinecorrection +% {\baselinecorrection +% \ifvmode +% \bgroup +% \setbox\scratchbox\vbox\bgroup +% \ignorespaces +% \let\stopbaselinecorrection\dostopbaselinecorrection +% \else +% \let\stopbaselinecorrection\relax +% \fi} + +% \def\dostopbaselinecorrection % I have to check columns yet. +% {\endgraf +% \egroup +% \topbaselinecorrection +% \box\scratchbox +% \botbaselinecorrection +% \egroup} + +% \let\stopbaselinecorrection=\relax + \def\startbaselinecorrection - {\baselinecorrection - \ifvmode - \bgroup - \setbox\scratchbox\vbox\bgroup - \ignorespaces - \let\stopbaselinecorrection\dostopbaselinecorrection - \else - \let\stopbaselinecorrection\relax + {\bgroup + \let\stopbaselinecorrection\egroup + \ifcase\baselinecorrectionmode + \or % normal + \baselinecorrection + \ifvmode + \setbox\scratchbox\vbox\bgroup\ignorespaces + \let\stopbaselinecorrection\donormalstopbaselinecorrection + \fi + \or % off + \or % force + \baselinecorrection + \ifvmode + \setbox\scratchbox\vbox\bgroup\ignorespaces + \let\stopbaselinecorrection\doforcedstopbaselinecorrection + \fi \fi} -%D We do a bit more checking than needed. The pageborder check -%D is not needed, but I want to look the visualization as good -%D as possible too. +\let\stopbaselinecorrection\relax -\def\dostopbaselinecorrection % I have to check columns yet. - {\endgraf - \egroup +\def\donormalstopbaselinecorrection % I have to check columns yet. + {\egroup \topbaselinecorrection \box\scratchbox \botbaselinecorrection \egroup} -\let\stopbaselinecorrection=\relax +\def\doforcedstopbaselinecorrection % I have to check columns yet. + {\egroup + \forcedtopbaselinecorrection + \box\scratchbox + \forcedbotbaselinecorrection + \egroup} + +%D We do a bit more checking than needed. The pageborder check +%D is not needed, but I want to look the visualization as good +%D as possible too. -\def\offbaselinecorrection % Can be used inside correction. - {\def\startbaselinecorrection{\bgroup\let\stopbaselinecorrection\egroup}} +% \def\offbaselinecorrection % Can be used inside correction. +% {\def\startbaselinecorrection{\bgroup\let\stopbaselinecorrection\egroup}} + +\chardef\baselinecorrectionmode\plusone + +\def\onbaselinecorrection {\chardef\baselinecorrectionmode\plusone } +\def\offbaselinecorrection {\chardef\baselinecorrectionmode\plustwo } +\def\forcebaselinecorrection{\chardef\baselinecorrectionmode\plusthree} %D \macros %D {topbaselinecorrection,botbaselinecorrection} @@ -188,58 +229,30 @@ %D The actual top and bottom corrections are implemented as: % \def\topbaselinecorrection -% {\ifvmode +% {\ifvmode \ifdim\pagegoal<\maxdimen % \bgroup % \setbaselinecorrections -% \ifdim\pagegoal<\maxdimen -% \ifdim\pagetotal<\pagegoal -% \dimen2=\ht\scratchbox -% \advance\dimen2 \dp\scratchbox -% \advance\dimen2 \parskip -% \advance\dimen2 \thetopbaselinecorrection -% \advance\dimen2 \thebotbaselinecorrection -% \dimen0=\pagetotal -% \advance\dimen0 \dimen2 -% % \ifdim\dimen0<\pagegoal % does more harm than good -% \witruimte -% \nointerlineskip -% \dotopbaselinecorrection -% % \else -% % \ifinsidecolumns -% % % \vskip\dimen2 % this could definitely -% % % \penalty\outputpenalty % be improved -% % \else -% % % % -% % % \vfill\eject % pretty old and wrong -% % % -% % % \nobreak % needed for headings -% % % \vskip\parskip % but often splits -% % % \vskip\dimen2 % normal paragraphs -% % % \penalty\outputpenalty % and therefore -% % % \vskip-\dimen2 % obsolete -% % % -% % % do nothing, sub optimal spacing after headings -% % % still to be sorted out; use manuals as test case -% % \fi -% % \fi -% \else % probably a preceding -% \witruimte % one-liner -% \nointerlineskip -% \dotopbaselinecorrection -% \fi -% \fi +% \whitespace +% \nointerlineskip +% \dotopbaselinecorrection % \egroup -% \fi} +% \fi \fi} + \def\topbaselinecorrection {\ifvmode \ifdim\pagegoal<\maxdimen + \forcedtopbaselinecorrection + \fi \fi} + +\def\forcedtopbaselinecorrection + {\ifvmode \bgroup \setbaselinecorrections \whitespace \nointerlineskip \dotopbaselinecorrection \egroup - \fi \fi} + \fi} \def\botbaselinecorrection {\ifvmode @@ -251,6 +264,8 @@ \egroup \fi} +\let\forcedbotbaselinecorrection\botbaselinecorrection + %D Still very experimental and therefore undocumented. \newif\ifgridsnapping % UNDER DEVELOPMENT, USE WITH CARE diff --git a/tex/context/base/core-int.tex b/tex/context/base/core-int.tex index 428df8e08..38763ea4b 100644 --- a/tex/context/base/core-int.tex +++ b/tex/context/base/core-int.tex @@ -451,22 +451,6 @@ \definelist[\@@bookmark] -% \appendtoks\flushpostponedbookmark\to\everypar -% \appendtoks\flushpostponedbookmark\to\neverypar -% -% \let\flushpostponedbookmark\relax -% -% \def\simplebookmark#1% -% {\ifx\flushpostponedbookmark\relax \else -% \bgroup -% \convertargument#1\to\ascii -% \writestatus\m!systems{clashing bookmarks: \ascii}% ECHTE MESSAGE MAKEN -% \egroup -% \fi -% \doglobal\prependtoks -% \writetolist[\@@bookmark]{}{#1}% -% \to\postponedbookmarks} - \newtoks\postponedbookmarks \def\flushpostponedbookmark @@ -1134,7 +1118,7 @@ {\dotripleempty\dodefineinteractionmenu} \def\dodefineinteractionmenu[#1][#2]% compatibility hack - {\convertargument#2\to\ascii % will disappear soon + {\defconvertedargument\ascii{#2}% will disappear soon \doifinstringelse[\ascii \dodosetupinteractionlistmenux \dododefineinteractionmenu diff --git a/tex/context/base/core-job.lua b/tex/context/base/core-job.lua new file mode 100644 index 000000000..ce2952ff6 --- /dev/null +++ b/tex/context/base/core-job.lua @@ -0,0 +1,55 @@ +if not modules then modules = { } end modules ['core-job'] = { + version = 1.001, + comment = "companion to core-job.tex", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- will move + +function commands.doifelse(b) + if b then + tex.sprint(tex.texcatcodes,"\\firstoftwoarguments") + else + tex.sprint(tex.texcatcodes,"\\secondoftwoarguments") + end +end +function commands.doif(b) + if b then + tex.sprint(tex.texcatcodes,"\\firstoftwoarguments") + end +end +function commands.doifnot(b) + if not b then + tex.sprint(tex.texcatcodes,"\\firstoftwoarguments") + end +end +cs.testcase = commands.doifelse + +-- main code + +function commands.processfile(name) + name = input.find_file(texmf.instance,name) or "" + if name ~= "" then + tex.sprint(tex.ctxcatcodes,string.format("\\input %s\\relax",name)) + end +end + +function commands.doifinputfileelse(name) + commands.doifelse((input.find_file(texmf.instance,name) or "") ~= "") +end + +function commands.locatefilepath(name) + tex.sprint(tex.texcatcodes,file.dirname(input.find_file(texmf.instance,name) or "")) +end + +function commands.usepath(paths) + input.register_extra_path(texmf.instance,paths) + tex.sprint(tex.texcatcodes,table.concat(texmf.instance.extra_paths or {}, "")) +end + +function commands.usesubpath(subpaths) + input.register_extra_path(texmf.instance,nil,subpaths) + tex.sprint(tex.texcatcodes,table.concat(texmf.instance.extra_paths or {}, "")) +end diff --git a/tex/context/base/core-job.mkii b/tex/context/base/core-job.mkii new file mode 100644 index 000000000..3a0f4e2f4 --- /dev/null +++ b/tex/context/base/core-job.mkii @@ -0,0 +1,86 @@ +%D \module +%D [ file=core-job, % copied from main-001, +%D version=2008.01.25, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Job Handling, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +\def\processfile#1% + {\ifx\allinputpaths\empty + \def\next{\processlocalfile\readlocfile}% + \else + \let\filepath\empty + \def\docommand##1% + {\doiffileelse{\pathplusfile{##1}{#1}}{\donetrue\def\filepath{##1}}\donefalse + \ifdone\expandafter\quitcommalist\fi}% + \doifparentfileelse{#1} % new + {\processcommacommand [\allinputpaths]\docommand} + {\processcommacommand[.,\allinputpaths]\docommand}% + \ifx\filepath\empty + \def\next{\processlocalfile\readlocfile}% fall back ../../.. + \else + \def\next{\processlocalfile{\readsetfile\filepath}}% file found + \fi + \fi + \next{#1}} + +\def\doifinputfileelse#1% rarely used + {\ifx\allinputpaths\empty + \@EA\secondoftwoarguments + \else + \let\filepath\empty + \def\docommand##1% + {\doiffileelse{\pathplusfile{##1}{#1}}{\donetrue\def\filepath{##1}}\donefalse + \ifdone\expandafter\quitcommalist\fi}% + \processcommacommand[.,\allinputpaths]\docommand + \ifx\filepath\empty + \@EAEAEA\secondoftwoarguments + \else + \@EAEAEA\firstoftwoarguments + \fi + \fi} + +\let\locatedfilepath\empty + +\def\locatefilepath#1% + {\let\locatedfilepath\empty + \ifx\allinputpaths\empty \else + \def\docommand##1% + {\doiffileelse{\pathplusfile{##1}{#1}}{\donetrue\def\locatedfilepath{##1}}\donefalse + \ifdone\expandafter\quitcommalist\fi}% + \doifparentfileelse{#1} % new + {\processcommacommand [\allinputpaths]\docommand} + {\processcommacommand[.,\allinputpaths]\docommand}% + \fi} + +\def\usepath[#1]% + {\def\docommand##1% + {\doifelse{##1}\v!reset + {\let\allinputpaths\empty} + {\sanitizefilename#1\to\ascii + \defconvertedcommand\ascii\ascii + \addtocommalist\ascii\allinputpaths}}% + \processcommalist[#1]\docommand} + +\def\usesubpath[#1]% test for a real long time, permits ../{name} i.e. braces + {\ifx\allinputpaths\empty + \sanitizefilename#1\to\allinputpaths + \else + \def\docommand##1% + {\def\dodocommand####1% + {\sanitizefilename####1\to\ascii + \defconvertedcommand\ascii\ascii + \addtocommalist{##1/\ascii}\allinputpaths}% + \processcommalist[#1]\dodocommand}% + \processcommacommand[\allinputpaths]\docommand + \fi} + +\protect \endinput diff --git a/tex/context/base/core-job.mkiv b/tex/context/base/core-job.mkiv new file mode 100644 index 000000000..d9cc308f1 --- /dev/null +++ b/tex/context/base/core-job.mkiv @@ -0,0 +1,22 @@ +%D \module +%D [ file=core-job, +%D version=2008.01.25, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Job Handling, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\registerctxluafile{core-job}{1.001} + +\def\processfile #1{\ctxlua{commands.processfile("#1")}} +\def\doifinputfileelse#1{\ctxlua{commands.doifinputfileelse("#1")}} +\def\locatefilepath #1{\edef\locatedfilepath{\ctxlua{commands.locatefilepath("#1")}}} +\def\usepath [#1]{\edef\allinputpaths{\ctxlua{commands.usepath("#1")}}} +\def\usesubpath [#1]{\edef\allinputpaths{\ctxlua{commands.usesubpath("#1")}}} + +\endinput diff --git a/tex/context/base/core-job.tex b/tex/context/base/core-job.tex index 9fe31da6d..526e015aa 100644 --- a/tex/context/base/core-job.tex +++ b/tex/context/base/core-job.tex @@ -15,6 +15,8 @@ \writestatus{loading}{Context Core Macros / Job Handling} +\loadmarkfile{core-job} + \unprotect \let \currentproject \empty @@ -27,6 +29,9 @@ \let \nomorefiles \relax +\let \allinputpaths \empty +\let \locatedfilepath \empty + \newcounter\textlevel \newcounter\fileprocesslevel @@ -35,13 +40,6 @@ \def\processedfile % is used in styles, don't change ! {\getvalue{\c!file::\fileprocesslevel}} -%\def\processfile#1% -% {\doglobal\increment\fileprocesslevel -% \setxvalue{\c!file::\fileprocesslevel}{#1}% -% \@EA\doglobal\@EA\addtocommalist\@EA{#1}\processedfiles -% \readlocfile{#1}{}{} -% \doglobal\decrement\fileprocesslevel} - \def\dostarttextfile#1% {\doglobal\increment\fileprocesslevel \setxvalue{\c!file::\fileprocesslevel}{#1}% @@ -51,87 +49,13 @@ {\doglobal\decrement\fileprocesslevel} \def\processlocalfile#1#2% - {% #1=\readlocfile|\readsetfile{dir} #2=filename - % #1{#2}\donothing\donothing - #1{#2}\donothing{\readfile{#2}\donothing\donothing}} - -\def\processfile#1% - {\ifx\allinputpaths\empty - \def\next{\processlocalfile\readlocfile}% - \else - \let\filepath\empty - \def\docommand##1% - {\doiffileelse{\pathplusfile{##1}{#1}}{\donetrue\def\filepath{##1}}\donefalse - \ifdone\expandafter\quitcommalist\fi}% - \doifparentfileelse{#1} % new - {\processcommacommand [\allinputpaths]\docommand} - {\processcommacommand[.,\allinputpaths]\docommand}% - \ifx\filepath\empty - \def\next{\processlocalfile\readlocfile}% fall back ../../.. - \else - \def\next{\processlocalfile{\readsetfile\filepath}}% file found - \fi - \fi - \next{#1}} - -\def\doifinputfileelse#1% rarely used - {\ifx\allinputpaths\empty - \@EA\secondoftwoarguments - \else - \let\filepath\empty - \def\docommand##1% - {\doiffileelse{\pathplusfile{##1}{#1}}{\donetrue\def\filepath{##1}}\donefalse - \ifdone\expandafter\quitcommalist\fi}% - \processcommacommand[.,\allinputpaths]\docommand - \ifx\filepath\empty - \@EAEAEA\secondoftwoarguments - \else - \@EAEAEA\firstoftwoarguments - \fi - \fi} - -\let\allinputpaths\empty + {#1{#2}\donothing{\readfile{#2}\donothing\donothing}} -% \def\usepath[#1]% -% {\def\docommand##1% -% {\doifelse{##1}\v!reset -% {\let\allinputpaths\empty} -% {\addtocommalist{##1}\allinputpaths}}% -% \processcommalist[#1]\docommand} -% -% \def\usesubpath[#1]% new, see webschrift for usage -% {\ifx\allinputpaths\empty -% \edef\allinputpaths{#1}% -% \else -% \def\docommand##1% -% {\def\dodocommand####1{\addtocommalist{##1/####1}\allinputpaths}% -% \processcommalist[#1]\dodocommand}% -% \processcommacommand[\allinputpaths]\docommand -% \fi} -% -% the following alternatives permit ../{name} i.e. braces - -\def\usepath[#1]% - {\def\docommand##1% - {\doifelse{##1}\v!reset - {\let\allinputpaths\empty} - {\sanitizefilename#1\to\ascii - \convertcommand\ascii\to\ascii - \addtocommalist\ascii\allinputpaths}}% - \processcommalist[#1]\docommand} - -\def\usesubpath[#1]% test for a real long time, permits ../{name} i.e. braces - {\ifx\allinputpaths\empty - \sanitizefilename#1\to\allinputpaths - \else - \def\docommand##1% - {\def\dodocommand####1% - {\sanitizefilename####1\to\ascii - \convertcommand\ascii\to\ascii - \addtocommalist{##1/\ascii}\allinputpaths}% - \processcommalist[#1]\dodocommand}% - \processcommacommand[\allinputpaths]\docommand - \fi} +\ifx\processfile \undefined \let\processfile \gobbleoneargument \fi +\ifx\doifinputfileelse\undefined \let\doifinputfileelse \gobbleoneargument \fi +\ifx\locatefilepath \undefined \let\locatefilepath \gobbleoneargument \fi +\ifx\usepath \undefined \def\usepath [#1]{} \fi +\ifx\usesubpath \undefined \def\usesubpath [#1]{} \fi \def\registerfileinfo[#1#2]#3% geen \showmessage ? {\writestatus\m!systems{#1#2 file #3 at line \the\inputlineno}% @@ -299,26 +223,6 @@ \newcounter\filelevel -% \def\donextlevel#1#2#3#4#5#6\\% -% {\beforesplitstring#6\at.\to#1 -% \ifcase\filelevel\relax -% \starttext -% \def\project ##1 {#2{##1}}% -% \def\environment ##1 {#3{##1}}% -% \def\product ##1 {#4{##1}}% -% \def\component ##1 {#5{##1}}% -% \fi -% \increment\filelevel\relax -% \fullexpandoneargafter\addtocommalist{#1}\loadedfiles} -% -% \def\doprevlevel -% {\ifnum\filelevel=\plusone -% \expandafter\stoptext -% \else -% \decrement\filelevel\relax -% \expandafter\endinput -% \fi} - \let\currentcomponent \v!text \let\currentcomponentpath\f!currentpath @@ -355,28 +259,6 @@ \expandafter\endinput \fi} -% \def\startproject #1 % -% {\donextlevel\currentproject -% \donotexecutefile\doexecutefileonce -% \doexecutefileonce\doexecutefile#1\\} -% -% \def\startproduct #1 % -% {\doateverystarttext -% \donextlevel\currentproduct -% \doexecutefileonce\doexecutefileonce -% \donotexecutefile\doexecutefile#1\\} -% -% \def\startcomponent #1 % -% {\doateverystarttext -% \donextlevel\currentcomponent -% \doexecutefileonce\doexecutefileonce -% \donotexecutefile\doexecutefile#1\\} -% -% \def\startenvironment #1 % -% {\donextlevel\currentenvironment -% \donotexecutefile\doexecutefileonce -% \donotexecutefile\donotexecutefile#1\\} - \def\startproject #1 % {\donextlevel\v!project\currentproject \donotexecutefile\doexecutefileonce diff --git a/tex/context/base/core-lst.tex b/tex/context/base/core-lst.tex index b73ed388a..5f08146dc 100644 --- a/tex/context/base/core-lst.tex +++ b/tex/context/base/core-lst.tex @@ -43,7 +43,7 @@ {\begingroup \expanded{\everylistentry\emptytoks\the\everylistentry}% \emptytoks, else loop \def\currentlist{#1}% evt naar dowritetolist - \convertexpanded{\getvalue{\??li\currentlist\c!expansion}}{#3}\asciilistentry + \defconvertexpanded\asciilistentry{\getvalue{\??li\currentlist\c!expansion}}{#3}% \makesectionformat \doifelse\@@nmstate\v!start {\def\dopagenummer{\noexpand\pagenumber}} @@ -93,7 +93,7 @@ \def\dowritebetweenlist#1#2% {\doifvalue{\??li#1\c!state}\v!start {\begingroup - \convertargument#2\to\ascii + \defconvertedargument\ascii{#2}% \makesectionformat \doifelse{\@@nmstate}\v!start {\def\dopagenummer{\noexpand\pagenumber}} @@ -111,7 +111,7 @@ \def\immediatetolist[#1]#2#3#4% {\begingroup - \convertexpanded{\getvalue{\??li#1\c!expansion}}{#3}\asciilistentry + \defconvertexpanded\asciilistentry{\getvalue{\??li#1\c!expansion}}{#3}% \makesectionformat \immediatewriteutilitycommand {\listentry @@ -122,7 +122,7 @@ \def\immediatebetweenlist[#1]#2% {\begingroup - \convertargument#2\to\asciilistentry + \defconvertedargument\asciilistentry{#2}% \makesectionformat \immediatewriteutilitycommand {\listbetween @@ -859,7 +859,7 @@ \def\writetolist[#1]#2#3% {\doifsomething{#1} - {\convertargument#2\to\firstlistelement + {\defconvertedargument\firstlistelement{#2}% \@EA\dowritetolist\@EA{#1}{\firstlistelement}{#3}{\v!head}}} \def\dobetweenlist#1#2#3#4% pas op: wordt ook elders gedefinieerd diff --git a/tex/context/base/core-mat.tex b/tex/context/base/core-mat.tex index 8f077ffe3..da4ba9a58 100644 --- a/tex/context/base/core-mat.tex +++ b/tex/context/base/core-mat.tex @@ -523,9 +523,6 @@ % \placeformula {f} \startspformule \fakespacingformula \stopspformule % \fakewords{20}{40} -% \convertcommand\next\to\ascii \getfirstcharacter\ascii -% \ifx\firstcharacter\letterbackslash % a \cs - \def\placeformula {\settrue\incrementformulanumber \dodoubleempty\doplaceformula} @@ -2836,6 +2833,44 @@ \def\boldsymbol {\mathortext\mathboldsymbol\bold} +%D Some encoding hackery (for Mojca. who else): +%D +%D \starttyping +%D \startmathcollection[eul:texnansi] +%D \definemathsymbol [breve] [accent] [tf] ["15] +%D \stopmathcollection +%D \startmathcollection[eul:ec] +%D \definemathsymbol [breve] [accent] [tf] ["08] +%D \stopmathcollection +%D +%D $\breve e$ +%D \stoptyping + +\let\outerencoding\empty + +\def\checkoutermathencoding + {\ifx\outerencoding\empty + \ifx\outerencoding\s!default\else + \edef\outerencoding{\currentencoding}% + \fi + \fi} + +\prependtoks + \checkoutermathencoding +\to \everymathematics + +%D More. (A temp hack, else no proper default fall back (like \type +%D {\textmultiply}); todo: sync encoding. + +\def\dealwithmathtextencoding + {\expanded{\everyhbox{\the\everyhbox\noexpand\fastenableencoding{\currentencoding}}}% + \def\dealwithmathtextencoding{\let\characterencoding\nocharacterencoding}% + \dealwithmathtextencoding} + +\appendtoks + \dealwithmathtextencoding +\to \everymathematics + %D How negative such a symbol looks is demonstrated in: %D $\negative 10^{\negative 10^{\negative 10}}$. diff --git a/tex/context/base/core-new.tex b/tex/context/base/core-new.tex index 1dd989c37..b9b3ee43a 100644 --- a/tex/context/base/core-new.tex +++ b/tex/context/base/core-new.tex @@ -33,12 +33,39 @@ \def\dosetupsB[#1]{\cleanuplabel{#1}\processcommacommand[\cleanlabel]\dosetups} % [..] \def\dosetupsC[#1]{\cleanuplabel{#1}\dosetups\cleanlabel} % [..] +% \def\dosetups#1% the grid option will be extended to other main modes +% {\executeifdefined{\??su\ifgridsnapping\v!grid\fi:#1} +% {\executeifdefined{\??su :#1}\gobbleoneargument}\empty} % takes one argument +% +% \def\setupwithargument#1% the grid option will be extended to other main modes +% {\executeifdefined{\??su:#1}\gobbleoneargument} + +% better: + +% \def\dosetups#1% the grid option will be extended to other main modes +% {\executeifdefined{\??su\ifgridsnapping\v!grid\fi:#1} +% {\executeifdefined{\??su :#1}\gobbleoneargument}\empty} % takes one argument +% +% \def\setupwithargument#1% the grid option will be extended to other main modes +% {\executeifdefined{\??su:#1}\gobbleoneargument} + +% faster: + +\letvalue{\??su:\letterpercent}\gobbleoneargument + \def\dosetups#1% the grid option will be extended to other main modes - {\executeifdefined{\??su\ifgridsnapping\v!grid\fi:#1} - {\executeifdefined{\??su :#1}\gobbleoneargument}\empty} % takes one argument + {\csname\??su + \ifgridsnapping + \ifcsname\??su\v!grid:#1\endcsname\v!grid:#1\else\ifcsname\??su:#1\endcsname:#1\else:\letterpercent\fi\fi + \else + \ifcsname\??su:#1\endcsname:#1\else:\letterpercent\fi + \fi + \endcsname\empty} % takes one argument \def\setupwithargument#1% the grid option will be extended to other main modes - {\executeifdefined{\??su:#1}\gobbleoneargument} + {\csname\??su:\ifcsname\??su:#1\endcsname#1\else\letterpercent\fi\endcsname} + +\let\directsetup\dosetups % somehow fails ... % diff --git a/tex/context/base/core-par.tex b/tex/context/base/core-par.tex index 403aeca6f..aa58ebb1e 100644 --- a/tex/context/base/core-par.tex +++ b/tex/context/base/core-par.tex @@ -114,10 +114,10 @@ \ifx#1\undefined \let#1\relax \fi - \convertargument#1\to\asciia - \convertargument{ }\to\asciib % lege regel + \defconvertedargument\asciia{#1}% + \defconvertedargument\asciib{ }% % lege regel \def\dopushparagraph##1\par - {\convertargument##1\to\asciic + {\defconvertedargument\asciic{##1}% \doifelse\asciic\asciia {#1} {\doifsomething\asciic % lege paragraaf diff --git a/tex/context/base/core-ref.tex b/tex/context/base/core-ref.tex index 85175cc88..4308426e9 100644 --- a/tex/context/base/core-ref.tex +++ b/tex/context/base/core-ref.tex @@ -175,7 +175,7 @@ \def\dotextreference[#1]#2% {\bgroup \def\asciia{#1}% - \convertexpanded\@@rfexpansion{#2}\asciib + \defconvertexpanded\asciib\@@rfexpansion{#2}% \@EA\rawtextreference\@EA\s!txt\@EA\asciia\@EA{\asciib}% \egroup} @@ -185,7 +185,7 @@ \def\doreference[#1]#2% {\bgroup \def\asciia{#1}% - \convertexpanded\@@rfexpansion{#2}\asciib + \defconvertexpanded\asciib\@@rfexpansion{#2}% \@EA\rawreference\@EA\s!ref\@EA\asciia\@EA{\asciib}% \egroup} @@ -838,7 +838,7 @@ %D For debugging purposes we provide a showcase macro: \long\def\dodoshowcurrentreference#1\from#2\with#3% - {\convertcommand#2\to\ascii + {\defconvertedcommand\ascii{#2}% \edef\currentreferenceshow{\currentreferenceshow/#1/\ascii/#3/}} \long\def\doshowcurrentreference#1% @@ -2918,7 +2918,7 @@ \else \let\@@programfile\currentreferenceoperation \fi - \convertcommand\@@programfile\to\ascii + \defconvertedcommand\ascii\@@programfile \dohandlegoto {#2}% {\dostartrunprogram\buttonwidth\buttonheight{\@@prdirectory\ascii}\currentreferencearguments}% diff --git a/tex/context/base/core-reg.tex b/tex/context/base/core-reg.tex index 6d42a7169..f183c12bd 100644 --- a/tex/context/base/core-reg.tex +++ b/tex/context/base/core-reg.tex @@ -94,11 +94,11 @@ \begingroup \thisisnextinternal\s!ind \ifduplicate\getlastregisterentry{#3}\fi - \convertexpanded{\registerparameter\c!keyexpansion}{#1}\asciiregisterentryA - \convertexpanded{\registerparameter\c!expansion }{#3}\asciiregisterentryB + \defconvertexpanded\asciiregisterentryA{\registerparameter\c!keyexpansion}{#1}% + \defconvertexpanded\asciiregisterentryB{\registerparameter\c!expansion }{#3}% \doifsomething{\registerparameter\c!keyexpansion} {\ifx\asciiregisterentryA\empty - \convertexpanded{\registerparameter\c!keyexpansion}{#3}\asciiregisterentryA + \defconvertexpanded\asciiregisterentryA{\registerparameter\c!keyexpansion}{#3}% \fi}% \makesectionformat \doifelse{\registerparameter\c!ownnumber}\v!yes @@ -187,12 +187,12 @@ \begingroup \thisisnextinternal\s!ind \ifduplicate\getlastregisterentry{#2}\fi - \convertexpanded{\registerparameter\c!keyexpansion}{#1}\asciiregisterentryA - \convertexpanded{\registerparameter\c!expansion }{#2}\asciiregisterentryB - \convertexpanded{\registerparameter\c!expansion }{#3}\asciiregisterentryC + \defconvertexpanded\asciiregisterentryA{\registerparameter\c!keyexpansion}{#1}% + \defconvertexpanded\asciiregisterentryB{\registerparameter\c!expansion }{#2}% + \defconvertexpanded\asciiregisterentryC{\registerparameter\c!expansion }{#3}% \doifsomething{\registerparameter\c!keyexpansion} {\ifx\asciiregisterentryA\empty - \convertexpanded{\registerparameter\c!keyexpansion}{#2}\asciiregisterentryA + \defconvertexpanded\asciiregisterentryA{\registerparameter\c!keyexpansion}{#2}% \fi}% \makesectionformat \mksaveregistersee @@ -709,7 +709,7 @@ {\dosetfilterlevel{\getvalue{\??id#1\c!criterium}}\empty} \def\getalllistreferences#1#2% - {\doglobal\convertexpanded{\getvalue{\??id#1\c!expansion}}{#2}\currentregisterentry + {\gdefconvertexpanded\currentregisterentry{\getvalue{\??id#1\c!expansion}}{#2}% \doifdefinedelse{\??id#1\??id\currentregisterentry} {\edef\alllistreferences% {\getvalue{\??id#1\??id\currentregisterentry}}% @@ -813,7 +813,7 @@ \global\firstregisterpagetrue \setvalue{#1\s!entrya}##1% {\global\firstregisterpagetrue - \doglobal\convertargument##1\to\currentregisterentry % \doglobal nodig? + \gdefconvertedargument\currentregisterentry{##1}% global nodig? \doglobal\increment\internallistreference}% \setvalue{#1\s!from}% {\getvalue{#1\s!page}}% diff --git a/tex/context/base/core-sec.tex b/tex/context/base/core-sec.tex index 04703b496..f522087b2 100644 --- a/tex/context/base/core-sec.tex +++ b/tex/context/base/core-sec.tex @@ -1414,7 +1414,7 @@ \unexpanded\def\\{\space} \def\emptyheadcorrection % experimental, should work - {\ifemptyhead % well with na=\blank + {\ifemptyhead % well with na=\blank \vskip-\lineheight \dosomebreak\nobreak \kern\zeropoint @@ -1487,7 +1487,7 @@ \else \headnumberfalse \fi - \convertexpanded{\getvalue{\??ko#1\c!expansion}}{#4}\asciititle + \defconvertexpanded\asciititle{\getvalue{\??ko#1\c!expansion}}{#4}% % \gdef\currentheadtext{#4}% scheelt args \globallet\currentheadnumber\empty @@ -2388,7 +2388,7 @@ % The next check prevents hard to trace problems. I once % set \c!command to nothing and (quite natural) got the % wrong references etc. The whole bunch should be boxed! - \expandafter\convertcommand\csname\??ko#1\c!command\endcsname\to\ascii + \expandafter\defconvertedcommand\expandafter\ascii\csname\??ko#1\c!command\endcsname \doifnothing\ascii{\setvalue{\??ko#1\c!command}{\normalplacehead}}} \def\setuphead diff --git a/tex/context/base/core-spa.mkiv b/tex/context/base/core-spa.mkiv index 20a172310..e3e91c145 100644 --- a/tex/context/base/core-spa.mkiv +++ b/tex/context/base/core-spa.mkiv @@ -280,30 +280,30 @@ \def\dovspacing[#1]% {\ctxlua{vspacing.analyse("\iffirstargument#1\else default\fi")}} -\definevspacingamount[big] [\bigskipamount] [\openlineheight] -\definevspacingamount[medium] [\medskipamount] [.50\openlineheight] -\definevspacingamount[small] [\smallskipamount][.25\openlineheight] -\definevspacingamount[line] [\openlineheight] [\openlineheight] -\definevspacingamount[formula][\medskipamount] [.50\openlineheight] -\definevspacingamount[white] [\parskip] [\openlineheight] - -\definevspacing[halfline][.5*line] -\definevspacing[weak] [order:0] -\definevspacing[strong] [order:100] -\definevspacing[samepage][penalty:10000] -\definevspacing[force] [category:2] -\definevspacing[disable] [category:5] -\definevspacing[nowhite] [category:6] -\definevspacing[goback] [category:7] -\definevspacing[always] [category:0] - -\definevspacing[default][big] - -\definevspacing[whatever][4*big] -\vspacing[2*big,-medium,-3*small,whatever,halfline,order:10,category:4,strong,samepage] -\vspacing[2*big,category:disable] -\vspacing[2*big,disable] -\vspacing[2*big,back] +\definevspacingamount[\v!big] [\bigskipamount] [\openlineheight] +\definevspacingamount[\v!medium] [\medskipamount] [.50\openlineheight] +\definevspacingamount[\v!small] [\smallskipamount][.25\openlineheight] +\definevspacingamount[\v!line] [\openlineheight] [\openlineheight] +\definevspacingamount[\v!formula][\medskipamount] [.50\openlineheight] +\definevspacingamount[\v!white] [\parskip] [\openlineheight] + +\definevspacing[\v!halfline][.5*\v!line] +\definevspacing[weak] [order:0] +\definevspacing[strong] [order:100] +\definevspacing[samepage] [penalty:10000] +\definevspacing[\v!force] [category:2] +\definevspacing[\v!disable] [category:5] +\definevspacing[\v!nowhite] [category:6] +\definevspacing[goback] [category:7] +\definevspacing[\v!always] [category:0] + +\definevspacing[\s!default][\v!big] + +% \definevspacing[whatever][4*big] +% \vspacing[2*big,-medium,-3*small,whatever,halfline,order:10,category:4,strong,samepage] +% \vspacing[2*big,category:disable] +% \vspacing[2*big,disable] +% \vspacing[2*big,back] \protect \endinput diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex index f9048ce33..4c13568f3 100644 --- a/tex/context/base/core-spa.tex +++ b/tex/context/base/core-spa.tex @@ -298,186 +298,6 @@ \smallskipamount\medskipamount\bigskipamount \fi}} -%%%% dus niet weg - -% replaced -% -% \def\dosingleblanko#1% -% {\doassignsomeskip#1\to\blankskipamount -% \global\advance\blankskip \blankskipamount} -% -% \def\doblank#1% -% {\processallactionsinset % is maar een actie -% [#1] -% [ \v!groot=>\dosingleblanko\v!groot, % happens often -% \v!buiten=>\ifvmode\ifinner\blankoutertrue\fi\fi, -% \v!reset=>\global\blankresettrue, -% \v!flexibel=>\global\localblankflexibletrue, -% \v!vast=>\global\localblankfixedtrue, -% \v!back=>\geenblanko, -% \v!wit=>\global\advance\blankskip \parskip, -% \v!formule=>\global\advance\blankskip \medskipamount, -% \v!geenwit=>\global\blanknowhitetrue, -% -\v!wit=>\global\advance\blankskip -\parskip, -% \v!blokkeer=>\global\blankdisabletrue, -% \v!forceer=>\global\blankforcetrue, -% \v!regel=>\global\advance\blankskip \lineheight, -% \v!halveregel=>\ifgridsnapping\global\fuzzyvskiptrue\fi -% \global\advance\blankskip .5\lineheight, -% \s!unknown=>\doindirectblanko{#1}]} -% -% \def\docomplexdoblank[#1]% pas op \relax's zijn nodig ivm volgende \if -% {\global\blankresetfalse -% \global\blankdisablefalse -% \global\blanknowhitefalse -% \global\localblankflexiblefalse -% \global\localblankfixedfalse -% \global\blankskip\zeropoint -% \global\blankforcefalse -% \blankouterfalse -% \processcommalist[#1]\doblank -% \ifdim\blankskip=\zeropoint\relax -% \iflocalblankflexible \dosingleblanko\currentblank \fi -% \iflocalblankfixed \dosingleblanko\currentblank \fi -% \fi -% \ifblankouter -% \else -% \par -% \ifvmode %in pos fonts gaat dit mis -% \ifblankforce %\ifdim\prevdepth>\zeropoint\else -% % -1000pt signals top of page or column (\ejectcolumn) -% \verticalstrut\kern-\struttotal -% \fi -% \ifblankdisable -% \global\blankindeedfalse -% \edef\oldprevdepth{\the\prevdepth}% -% \prevdepth=\newprevdepth -% \else -% \global\blankindeedtrue -% \fi -% \ifblankreset -% \global\blankindeedtrue -% \ifdim\prevdepth=\newprevdepth -% \prevdepth=\oldprevdepth -% \fi -% \fi -% \ifblankindeed -% \ifdim\lastskip<\blankskip\relax -% % else when \blanko[2*groot] + \blanko[3*groot] with parskip -% % equaling 1*groot, gives a groot=\parskip so adding a small -% % value makes it distinguishable; can also be done at parskip -% % setting time (better) -% \global\advance\blankskip by \mindimen\relax % = skip -% % test this on 2* + 3* and parskip groot -% \ifblanknowhite -% \global\advance\blankskip by -\parskip -% \else -% \ifdim\lastskip=\parskip -% \else % force this due to previous comment -% \ifdim\parskip>\zeropoint\relax -% \ifdim\blankskip<\parskip\relax -% \global\blankskip\zeropoint -% \else -% \global\advance\blankskip by -\parskip -% \fi -% \fi -% \fi -% \fi -% \ifblankflexible \else -% \blankskip=1\blankskip -% \fi -% \iflocalblankfixed -% \blankskip=1\blankskip -% \fi -% \iflocalblankflexible -% \blankskip=1\blankskip -% \!!plus\skipgluefactor\blankskip -% \!!minus\skipgluefactor\blankskip -% \fi -% \ifdim\prevdepth=\newprevdepth -% \else -% \iffuzzyvskip -% \removelastfuzzyvskip -% \fuzzyvskip\blankskip\relax -% \else -% \removelastskip -% \vskip\blankskip\relax -% \fi -% \fi -% \else -% \iffuzzyvskip -% \removelastfuzzyvskip -% \fuzzyvskip\blankskip\relax -% \fi -% \fi -% \fi -% \fi -% \fi -% \global\fuzzyvskipfalse -% \presetindentation} -% -% \def\complexdodoblank[#1]% -% {\flushnotes -% \ifopelkaar -% \ifinpagebody -% \expanded{\docomplexdoblank[#1]}% \expanded=nieuw -% \else -% \par -% \fi -% \else -% \expanded{\docomplexdoblank[#1]}% \expanded = nieuw -% \fi} -% -% % old -% % -% % \def\doindirectblanko#1% -% % {\ifundefined{\??bo#1}% <-etex \expandafter\ifx\csname\??bo#1\endcsname\relax -% % \expanded{\complexdodoblank[#1]}% -% % \else -% % \expandafter\complexdoblank\expandafter[\csname\??bo#1\endcsname]% -% % \fi} -% % -% % \def\complexdoblank[#1]% enables [force,8\bodyfontsize] -% % {\doifinstringelse{,}{#1} -% % {\expanded{\complexdodoblank[#1]}} -% % {\doifnumberelse{#1} -% % {\expanded{\complexdodoblank[#1]}} -% % {\doindirectblanko{#1}}}} -% % -% % new, more robust -% % -% % \def\doindirectblanko#1% -% % {\edef\ascii{#1}\convertcommand\ascii\to\ascii -% % \ifundefined{\??bo\ascii}% <-etex \expandafter\ifx\csname\??bo#1\endcsname\rel -% % \dorepeatwithcommand[#1]\dosingleblanko -% % \else -% % \expandafter\complexdoblank\expandafter[\csname\??bo\ascii\endcsname]% -% % \fi} -% % -% % even more robust -% -% \def\doindirectblanko#1% -% {\edef\ascii{#1}\convertcommand\ascii\to\ascii -% \ifundefined{\??bo\ascii}% <-etex \expandafter\ifx\csname\??bo#1\endcsname -% \expanded{\dorepeatwithcommand[#1]\noexpand\dosingleblanko}% -% \else -% \expandafter\complexdoblank\expandafter[\csname\??bo\ascii\endcsname]% -% \fi} - -% \def\TestBlank[#1]% -% {blank : {\convertargument#1\to\ascii\tttf\ascii}\blanko[#1]} -% -% \defineblank[whatever][2*big,2*big] -% \TestBlank[] -% \TestBlank[big] -% \TestBlank[2*big] -% \TestBlank[big,big,2*big] -% \TestBlank[big] -% \TestBlank[whatever] -% \TestBlank[2*big,whatever] -% \TestBlank[3\lineheight] - -% this will be replaced/enhanced \def\addblankskip#1#2#3{\global\advance\blankskip#1\ifgridsnapping#3\else#2\fi} @@ -529,7 +349,7 @@ \addblankskip+\bigskipamount\openlineheight} \def\doblank#1% - {\edef\ascii{#1}\convertcommand\ascii\to\ascii + {\edefconvertedargument\ascii{#1}% \ifx\ascii\empty\else \ifcsname\??bo\??bo\ascii\endcsname % internal def \csname\??bo\??bo\ascii\endcsname @@ -541,7 +361,7 @@ \fi} \def\redoblank#1% - {\edef\ascii{#1}\convertcommand\ascii\to\ascii + {\edefconvertedargument\ascii{#1}% \ifx\ascii\empty\else \ifcsname\??bo\??bo\ascii\endcsname % internal def \csname\??bo\??bo\ascii\endcsname @@ -999,7 +819,7 @@ \medskipamount \bigskipamount \divide\medskipamount \plustwo \smallskipamount\bigskipamount \divide\smallskipamount\plusfour}% -\def\complexsetupblank[#1]% more \let's +\def\complexsetupblank[#1]% more \let's -> this also wil become installable {\ifgridsnapping \blankflexiblefalse \else @@ -1013,32 +833,24 @@ [ \v!flexible=>\dosetupblank\appliedblankskip, \v!fixed=>\dosetupblank\appliedblankskip, \v!line=>\edef\appliedblankskip{\linedistance}% - \dosetupblank\appliedblankskip - ,%\let\deblanko\v!big, + \dosetupblank\appliedblankskip, \v!halfline=>\scratchskip.5\linedistance \edef\appliedblankskip{\the\scratchskip}% - \dosetupblank\appliedblankskip - ,%\let\deblanko\v!medium, + \dosetupblank\appliedblankskip, \v!big=>\ifgridsnapping \edef\appliedblankskip{\linedistance}% \dosetupblank\appliedblankskip \fi - \let\currentblank\v!big % was \def, why ? - ,%\let\deblanko\v!big, - \v!medium=>\let\currentblank\v!medium % was \def, why ? - ,%\let\deblanko\v!medium, - \v!small=>\let\currentblank\v!small % was \def, why ? - ,%\let\deblanko\v!small, - \v!normal=>\dosetupblank\appliedblankskip - ,%\let\deblanko\v!big, + \let\currentblank\v!big, + \v!medium=>\let\currentblank\v!medium, + \v!small=>\let\currentblank\v!small, + \v!global=>\let\currentblank\v!global, + \v!normal=>\dosetupblank\appliedblankskip, \v!standard=>\edef\appliedblankskip{\skipfactor\linedistance}% - \dosetupblank\appliedblankskip - ,%\let\deblanko\v!big, - \s!default=>\dosetupblank\appliedblankskip - ,%\let\deblanko\v!big, + \dosetupblank\appliedblankskip, + \s!default=>\dosetupblank\appliedblankskip, \s!unknown=>\let\appliedblankskip\commalistelement - \dosetupblank\appliedblankskip - ]%\let\deblanko\v!big]% + \dosetupblank\appliedblankskip]% \simplesetupwhitespace} % \definecomplexorsimpleempty\setupblank @@ -1247,16 +1059,14 @@ \toggleindentation}} \def\docomplexsetupindentingA#1% - {\edef\!!stringa{#1}% catch #1=\somedimen - \convertcommand\!!stringa\to\!!stringa + {\edefconvertedargument\!!stringa{#1}% \doifundefined{\??in:\!!stringa}% {\edef\currentindentation{#1}% \let\normalindentation\currentindentation \simplesetupindenting}} \def\docomplexsetupindentingB#1% - {\edef\!!stringa{#1}% catch #1=\somedimen - \convertcommand\!!stringa\to\!!stringa + {\edefconvertedargument\!!stringa{#1}% catch #1=\somedimen \executeifdefined{\??in:\!!stringa}\donothing} \def\simplesetupindenting % empty case, a it strange, needed this way? @@ -1693,58 +1503,13 @@ \newskip\ctxparskip \ctxparskip\zeropoint -\newif\ifwitruimteflexibel \witruimteflexibeltrue +\settrue\flexiblewhitespace \def\blankokleinmaat {\smallskipamount} \def\blankomiddelmaat {\medskipamount} \def\blankogrootmaat {\bigskipamount} \def\currentwhitespace {\zeropoint} -% \def\stelwitruimteopnieuwin -% {\expanded{\setupwhitespace[\currentwhitespace]}} -% -% \newif\ifwitruimteflexibel \witruimteflexibeltrue -% -% \definecomplexorsimple\setupwhitespace -% -% \def\complexsetupwhitespace[#1]% -% {\expanded{\dosetupwhitespace[#1]}% -% \dodosetupwhitespace} -% -% \def\dosetupwhitespace[#1]% -% {\processallactionsinset -% [#1] -% [\v!herstel=>, -% \v!vast=>\witruimteflexibelfalse, -% \v!flexibel=>\witruimteflexibeltrue, -% \v!regel=>\ctxparskip\baselineskip, -% \v!halveregel=>\ctxparskip.5\baselineskip, -% \s!default=>\doifnot\currentwhitespace\v!geen\stelwitruimteopnieuwin, -% \s!unknown=>\@EA\assigndimension\@EA{\commalistelement} % \@EA is nodig -% \ctxparskip\blankokleinmaat\blankomiddelmaat\blankogrootmaat]} % te vangen -% -% \def\dodosetupwhitespace -% {\edef\currentwhitespace -% {\ifdim\ctxparskip=\zeropoint -% \v!geen -% \else -% \ifgridsnapping\the\baselineskip\else\the\ctxparskip\fi -% \fi}% -% \ifgridsnapping -% \witruimteflexibelfalse -% \ctxparskip1\ctxparskip -% \ifdim\ctxparskip>\zeropoint -% \ctxparskip\baselineskip -% \fi -% \else -% \ifwitruimteflexibel \else \ctxparskip1\ctxparskip \fi -% \fi -% \parskip\ctxparskip} -% -% \def\simplesetupwhitespace% == snelle \setupwhitespace[\s!default] -% {\doifnot\currentwhitespace\v!geen\stelwitruimteopnieuwin -% \dodosetupwhitespace} - \definecomplexorsimple\setupwhitespace \def\simplesetupwhitespace @@ -1760,15 +1525,27 @@ {\processcommacommand[\currentwhitespace]\dowhitespacemethod \dodosetupwhitespace} +\chardef\baselinegridmode=0 % option in layout / 1=permit_half_lines + \def\dodosetupwhitespace {\ifgridsnapping - \witruimteflexibelfalse + \setfalse\flexiblewhitespace \ctxparskip1\ctxparskip \ifdim\ctxparskip>\zeropoint - \ctxparskip\baselineskip + \ifcase\baselinegridmode + \ctxparskip\baselineskip % normal ! ! ! ! !! + \or + \ifdim\scratchdimen=\baselineskip % maybe range + \ctxparskip\baselineskip % normal ! ! ! ! !! + \else + \ctxparskip\numexpr\ctxparskip/\dimexpr.5\lineheight\relax\relax\dimexpr.5\lineheight\relax + \fi + \else + \ctxparskip\baselineskip % normal ! ! ! ! !! + \fi \fi \else - \ifwitruimteflexibel \else \ctxparskip1\ctxparskip \fi + \ifconditional\flexiblewhitespace \else \ctxparskip1\ctxparskip \fi \fi \parskip\ctxparskip} @@ -1777,8 +1554,8 @@ \def\definewhitespacemethod[#1]#2{\setvalue{\??ws\??ws#1}{#2}} \definewhitespacemethod [\v!fix] {} -\definewhitespacemethod [\v!fixed] {\witruimteflexibelfalse} -\definewhitespacemethod [\v!flexible] {\witruimteflexibeltrue} +\definewhitespacemethod [\v!fixed] {\setfalse\flexiblewhitespace} +\definewhitespacemethod [\v!flexible] {\settrue\flexiblewhitespace} \definewhitespacemethod [\v!line] {\ctxparskip \baselineskip} \definewhitespacemethod [\v!halfline] {\ctxparskip.5\baselineskip} \definewhitespacemethod [\v!none] {\ctxparskip \zeropoint} @@ -1814,10 +1591,10 @@ {\ctxparskip\the\ctxparskip \parskip\the\parskip \noexpand\def\noexpand\currentwhitespace{\currentwhitespace}% - \ifwitruimteflexibel - \noexpand\witruimteflexibeltrue + \ifconditional\flexiblewhitespace + \noexpand\settrue\flexiblewhitespace \else - \noexpand\witruimteflexibelfalse + \noexpand\setfalse\flexiblewhitespace \fi}} % deze variant is nodig binnen \startopelkaar @@ -3194,8 +2971,7 @@ % \relax} \def\dosetleftskipadaption#1% - {\edef\ascii{@lsa@#1}% - \convertcommand\ascii\to\ascii + {\edefconvertedargument\ascii{@lsa@#1}% \leftskipadaption \ifcsname\ascii\endcsname \csname\ascii\endcsname @@ -3205,8 +2981,7 @@ \relax} \def\dosetrightskipadaption#1% - {\edef\ascii{@rsa@#1}% - \convertcommand\ascii\to\ascii + {\edefconvertedargument\ascii{@rsa@#1}% \rightskipadaption \ifcsname\ascii\endcsname \csname\ascii\endcsname diff --git a/tex/context/base/core-swd.tex b/tex/context/base/core-swd.tex index 275c5a4b5..62a98976b 100644 --- a/tex/context/base/core-swd.tex +++ b/tex/context/base/core-swd.tex @@ -49,9 +49,9 @@ \@EA\@EA\@EA\@EA\@EA\@EA\@EA#1\@EA\@EA\@EA\@EA\@EA\@EA\@EA{\@EA\@EA\@EA\csexpandeda\@EA\@EA\@EA}\@EA\@EA\@EA{\@EA\csexpandedb\@EA}\@EA{\csexpandedc}} % \def\xx{XX}\setvalue{xx:yy}{abc \xx def}\def\param#1{\csname xx:#1\endcsname} -% \def\testa #1{\convertargument#1\to\ascii{\tttf\ascii}} -% \def\testb #1#2{\convertargument#1 #2\to\ascii{\tttf\ascii}} -% \def\testc#1#2#3{\convertargument#1 #2 #3\to\ascii{\tttf\ascii}} +% \def\testa #1{\defconvertedargument\ascii{#1}{\tttf\ascii}} +% \def\testb #1#2{\defconvertedargument\ascii{#1 #2}{\tttf\ascii}} +% \def\testc#1#2#3{\defconvertedargument\ascii{#1 #2 #3}{\tttf\ascii}} % \noindent 1 \csnameexpandedoneargument \testa{\param{yy}} % \noindent 2 \csnameexpandedtwoarguments \testb{\param{yy}}{\param{yy}} % \noindent 3 \csnameexpandedthreearguments\testc{\param{yy}}{\param{yy}}{\param{yy}} diff --git a/tex/context/base/core-syn.tex b/tex/context/base/core-syn.tex index 6d1b88c94..8d2817438 100644 --- a/tex/context/base/core-syn.tex +++ b/tex/context/base/core-syn.tex @@ -115,8 +115,8 @@ \def\dowritesynonym#1#2#3#4% {\begingroup % anders in mathmode lege \hbox - \convertexpanded{\getvalue{\??sm#1\c!expansion}}{#3}\asciisynonym - \convertexpanded{\getvalue{\??sm#1\c!expansion}}{#4}\asciimeaning + \defconvertexpanded\asciisynonym{\getvalue{\??sm#1\c!expansion}}{#3}% + \defconvertexpanded\asciimeaning{\getvalue{\??sm#1\c!expansion}}{#4}% \mksavesortedlistentry{#1}{#2}{\asciisynonym}{\asciimeaning}% \endgroup} @@ -284,7 +284,7 @@ \def\dowritesort#1#2#3% {\bgroup - \convertexpanded{\getvalue{\??so#1\c!expansion}}{#3}\asciisynonym + \defconvertexpanded\asciisynonym{\getvalue{\??so#1\c!expansion}}{#3}% \mksavesortedlistentry{#1}{#2}{\asciisynonym}{}% \egroup} diff --git a/tex/context/base/core-sys.tex b/tex/context/base/core-sys.tex index 92d2b650c..65afae1ca 100644 --- a/tex/context/base/core-sys.tex +++ b/tex/context/base/core-sys.tex @@ -51,11 +51,11 @@ \def\splitjobfilename % todo: mkiv {\resetsystemmode{suffix-\jobfilesuffix}% - \edef\ascii{\inputfilename}\convertcommand\ascii\to\ascii + \edef\ascii{\inputfilename}\defconvertedcommand\ascii\ascii \splitstring\ascii\at.\to\jobfilename\and\jobfilesuffix \lowercasestring\jobfilesuffix\to\jobfilesuffix \doifnothing\jobfilename {\let\jobfilename \jobname}% - % todo and totest: \convertcommand\jobfilename\to\jobfilename + % todo and totest: \defconvertedcommand\jobfilename\jobfilename \doifnothing\jobfilesuffix{\let\jobfilesuffix\c!tex}% \setsystemmode{suffix-\jobfilesuffix}} @@ -284,50 +284,83 @@ %D Since this feature is used in XML processing, it made sense %D to support this faster alternative. It's installable as well. -\def\installexpander#1#2{\setvalue{\s!do\c!expansion#1}{#2}} - -% \long\def\convertexpanded#1#2#3% hm, first we need to make sure -% {\csname % that we assign all exp a value -% \s!do\c!expansion -% \ifforcefileexpansion -% \v!yes -% \else\@EA\ifx\csname\s!do\c!expansion\csname#1\c!expansion\endcsname\endcsname\relax -% \s!default -% \else -% \csname#1\c!expansion\endcsname -% \fi\fi -% \endcsname#2\to#3} - -\long\def\convertexpanded#1#2#3% hm, first we need to make sure +\def\installexpander#1#2#3% changed, no longer \convert..\to... + {\setvalue{\s!do\c!expansion#1l}{#2}% + \setvalue{\s!do\c!expansion#1g}{#3}}% + +% \convertexpanded is obsolete + +\long\def\doconvertexpanded#1#2#3% #4 % [l|g] \cs {kind} {data} {\csname % that we assign all exp a value \s!do\c!expansion \ifforcefileexpansion \v!yes - \else\@EA\ifx\csname\s!do\c!expansion#1\endcsname\relax - \s!default + \else\ifcsname\s!do\c!expansion#3#1\endcsname + #3% \else - #1% + \s!default \fi\fi - \endcsname#2\to#3} - -\installexpander\v!command{\convertcommand } -\installexpander\s!default{\convertargument} -\installexpander\empty {\convertargument} -\installexpander\v!no {\convertargument} -\installexpander\v!yes {\convertmeaning } -\installexpander\v!yes {\convertmeaning } % something lost ? -\installexpander\v!strict {\reduceargument } -\installexpander {utf} {\reducetoutf} + #1% + \endcsname#2}% #3 + +\long\def\defconvertexpanded {\doconvertexpanded l} +\long\def\gdefconvertexpanded{\doconvertexpanded g} + +\installexpander\v!command \defconvertedcommand \gdefconvertedcommand +\installexpander\s!default \defconvertedargument \gdefconvertedargument +\installexpander\empty \defconvertedargument \gdefconvertedargument +\installexpander\v!no \defconvertedargument \gdefconvertedargument +\installexpander\v!yes \defconvertedmeaning \gdefconvertedmeaning +\installexpander\v!yes \defconvertedmeaning \gdefconvertedmeaning +\installexpander\v!strict \defreducedargument \gdefreducedargument +\installexpander {utf} \defreducedtoutf \gdefreducedtoutf + %installexpander {xml} {see xtag-ext} -\def\convertmeaning#1\to % watch the double expansion ! +\def\dodefconvertedmeaning#1#2#3% watch the double expansion ! + {\bgroup + \honorunexpanded + \convertencodedtokens % can be overloaded + \xdef\@@globalexpanded{#3}% + \xdef\@@globalexpanded{\@@globalexpanded}% + \egroup + #1#2\@@globalexpanded} + +\def\defconvertedmeaning {\dodefconvertedmeaning\defconvertedcommand} +\def\gdefconvertedmeaning{\dodefconvertedmeaning\gdefconvertedcommand} + +\def\dodefreducedargument#1#2#3% + {\begingroup + \reducetocoding[raw]% + \edef\ascii{#3}% + \expandafter\endgroup\expandafter#1\expandafter#2\expandafter{\ascii}} + +\def\defreducedargument {\dodefreducedargument\edef} +\def\gdefreducedargument{\dodefreducedargument\xdef} + +% \setupindex[expansion=utf]\index{\eacute} + +\def\dodefreducedtoutf#1#2#3% + {\begingroup + \reducetocoding[uc]% + \let\uchar\uchartoutf + \let\unicodechar\numbertoutf + \edef\ascii{#3}% + \expandafter\endgroup\expandafter#1\expandafter#2\expandafter{\ascii}} + +\def\defreducedtoutf {\dodefreducedtoutf\edef} +\def\gdefreducedtoutf{\dodefreducedtoutf\xdef} + +% old syntax: + +\def\convertmeaning#1\to#2% watch the double expansion ! {\bgroup \honorunexpanded \convertencodedtokens % can be overloaded \xdef\@@globalexpanded{#1}% \xdef\@@globalexpanded{\@@globalexpanded}% \egroup - \convertcommand\@@globalexpanded\to} + \defconvertedcommand#2\@@globalexpanded} \def\reduceargument#1\to#2% {\begingroup @@ -335,8 +368,6 @@ \edef\ascii{#1}% \expandafter\endgroup\expandafter\edef\expandafter#2\expandafter{\ascii}} -% \setupindex[expansion=utf]\index{\eacute} - \def\reducetoutf#1\to#2% {\begingroup \reducetocoding[uc]% diff --git a/tex/context/base/core-tab.tex b/tex/context/base/core-tab.tex index b95482c04..89e6a556d 100644 --- a/tex/context/base/core-tab.tex +++ b/tex/context/base/core-tab.tex @@ -1104,18 +1104,6 @@ \fi \fi \TABLEnoalign{\globalpopmacro\simpleTableHL}} -% \def\complexsecondstagestartTABLE#1[#2]% -% {\convertargument|\to\asciia -% \convertargument#2\to\asciib -% \global\setfalse\someTABLEhead -% \global\setfalse\someTABLEtail -% \doifinstringelse\asciia\asciib -% {\gdef\restartTABLE{\dorestartTABLE{\thirdstagestartTABLE{#2}}}} -% {\doifdefinedelse{\c!Table#2} -% {\gdef\restartTABLE{\getvalue{\c!Table#2}}} -% {\gdef\restartTABLE{\dorestartTABLE{\getvalue{#2}}}}}% -% \restartTABLE} - \bgroup \catcode`|=\@@other \catcode`"=\@@other \gdef\complexsecondstagestartTABLE#1[#2]% brr nested mess @@ -1444,8 +1432,8 @@ \def\checkTABLErow#1% pure for message purposes {\unskip % added \ifTABLEgraydone - \convertargument #1\to\asciia - \convertcommand\TABLEendBCL\to\asciib + \defconvertedargument\asciia{#1}% + \defconvertedcommand \asciib\TABLEendBCL \ifx\asciia\asciib \else \writestatus\m!TABLE{confusing \asciia\space and \asciib}% \gdef\TABLEgraylineerror% @@ -1650,21 +1638,6 @@ %D if the bar is active or not.\footnote{Normally it is, but %D \TABLE\ changes the catcode when needed.} -% \bgroup -% \catcode`\|=\@@active -% \gdef\protectTABLEbar{\let|\letterbar} -% \catcode`\|=\@@other -% \gdef\getTABLEnofcolumns#1% -% {\bgroup -% \cleanupfeatures % needed ! -% \protectTABLEbar % is still a feature -% \expanded{\convertargument#1}\to\ascii -% \@EA\doglobal\@EA\counttoken\@EA|\@EA\in\ascii\to\maxTABLEcolumn -% \global\advance\maxTABLEcolumn \minusone -% % in case of & counting, divide by 2 -% \egroup} -% \egroup - \bgroup \catcode`\|=\@@other \gdef\@@otherbar {|} \catcode`\"=\@@other \gdef\@@otherquite {"} @@ -1679,7 +1652,7 @@ \cleanupfeatures % needed ! \@@useotherbar \@@useotherquote - \expanded{\convertargument#1}\to\ascii + \expanded{\defconvertedargument\noexpand\ascii{#1}}% \@EA\doglobal\@EA\counttoken\@EA|\@EA\in\ascii\to\maxTABLEcolumn \global\advance\maxTABLEcolumn \minusone % in case of & counting, divide by 2 diff --git a/tex/context/base/core-uti.mkii b/tex/context/base/core-uti.mkii index decb5ceb1..8d8fc6dcb 100644 --- a/tex/context/base/core-uti.mkii +++ b/tex/context/base/core-uti.mkii @@ -28,8 +28,8 @@ \def\thisisbytesequence#1% {\ifx\testbytesequence\empty\else - \convertcommand\testbytesequence\to\testbytesequence - \convertargument#1\to\ascii + \defconvertedcommand\testbytesequence\testbytesequence + \defconvertedargument\ascii{#1}% \ifx\testbytesequence\ascii \else \writestatus\m!systems{possible problem with 8 bit output}% \fi diff --git a/tex/context/base/core-uti.tex b/tex/context/base/core-uti.tex index b91abdd3a..4ad12c31f 100644 --- a/tex/context/base/core-uti.tex +++ b/tex/context/base/core-uti.tex @@ -66,8 +66,8 @@ \def\thisissectionseparator#1% {\bgroup \globallet\checksectionseparator\relax - \convertcommand \sectionseparator\to\asciia - \convertargument #1\to\asciib + \defconvertedcommand \asciia\sectionseparator + \defconvertedargument\asciib{#1}% \expanded{\gdef\noexpand\dosplitofffoliopart[####1\sectionseparator \sectionseparator####2\sectionseparator\sectionseparator####3]{####3}}% \ifx\asciia\asciib @@ -189,43 +189,6 @@ \newif\ifdoinpututilities \newif\ifunprotectutilities % voor't geval er \v!xxxxxx's zijn -% no longer needed, since texutil is now multi platform -% -% \def\utilitycheckmessage -% {\showmessage\m!systems{12}{}% -% \globallet\utilitycheckmessage=\relax} -% -% \def\saveutilityline#1 #2\txen% tricky maar ok, want achter \command -% {\if #1c% commands % in \ascii staat een spatie; #1 kan -% \write\scratchwrite{#2}% % \par in stringvorm zijn (eof)! -% \else\if#1s% synoniems -% \utilitycheckmessage -% \else\if#1r% registers -% \utilitycheckmessage -% \fi\fi\fi} -% -% \def\checkutilityfile -% {\doiflocfileelse{\jobname.\f!outputextension} -% {} -% {\doiflocfileelse{\jobname.\f!inputextension} -% {\bgroup -% \showmessage\m!systems{11}{}% -% \openout\scratchwrite\jobname.\f!outputextension -% \openlocin\scratchread{\jobname.\f!inputextension}% -% \def\doprocessline% -% {\ifeof\scratchread -% \def\doprocessline{\closein\scratchread}% -% \else -% \read\scratchread to \ascii -% \convertcommand\ascii\to\ascii -% \expandafter\saveutilityline\ascii\txen -% \fi -% \doprocessline}% -% \doprocessline -% \closeout\scratchwrite -% \egroup} -% {}}} - \def\currentutilityfilename{\jobname} % \long\def\doutilities#1#2#3#4#5% % introduceren in utility file @@ -329,20 +292,6 @@ \blank}}% \fi \endgroup} - -% Saving the sort vector: - -% \def\savesortkeys -% {\startnointerference -% \def\flushsortkey##1##2##3##4% -% {\convertargument{##1}{##2}{##3}{##4}\to\ascii -% \immediatewriteutility{k {\currentlanguage}{\currentencoding}\ascii}}% -% \let\definesortkey\flushsortkey -% \flushsortkeys -% \globallet\savesortkeys\relax -% \stopnointerference} -% -% \prependtoks \savesortkeys \to \everystarttext % Default-instellingen (verborgen) diff --git a/tex/context/base/core-var.tex b/tex/context/base/core-var.tex index 0b0c7e2ca..6b6583a8b 100644 --- a/tex/context/base/core-var.tex +++ b/tex/context/base/core-var.tex @@ -276,6 +276,7 @@ \newevery \everyfont \relax \newevery \everybodyfont \EveryBodyFont +\newevery \everyglobalbodyfont \relax \newevery \everyfontswitch \EveryFontSwitch \newevery \everydefinedfont \relax diff --git a/tex/context/base/core-ver.mkii b/tex/context/base/core-ver.mkii index 739bd103c..4e51c934c 100644 --- a/tex/context/base/core-ver.mkii +++ b/tex/context/base/core-ver.mkii @@ -139,7 +139,7 @@ \def\redotypeAB {\egroup - \expandafter\convertargument\the\globalscratchtoks\to\ascii + \expandafter\defconvertedargument\expandafter\ascii\expandafter{\the\globalscratchtoks}% == \edefconvertedargument\ascii{\the\globalscratchtoks}% \ifx\scantokens\undefined\ascii\else\everyeof{\hskip-\spaceskip}\scantokens\expandafter{\ascii}\fi \egroup} diff --git a/tex/context/base/core-ver.tex b/tex/context/base/core-ver.tex index 615602751..745c578d5 100644 --- a/tex/context/base/core-ver.tex +++ b/tex/context/base/core-ver.tex @@ -761,7 +761,7 @@ \def\reporttypingerror#1% temp hack {\blank \dontleavehmode\hbox\bgroup - \expanded{\convertargument#1}\to\ascii + \expanded{\defconvertedargument\noexpand\ascii{#1}}% \tttf[\makemessage\m!verbatims1\ascii]% \showmessage\m!verbatims1\ascii \egroup @@ -835,7 +835,7 @@ %D And a bonus macro: -\def\verbatim#1{\convertargument#1\to\ascii\ascii} +\def\verbatim#1{\defconvertedargument\ascii{#1}\ascii} %D Plugins diff --git a/tex/context/base/enco-agr.tex b/tex/context/base/enco-agr.tex index 77fe0a826..cfd86dfd3 100644 --- a/tex/context/base/enco-agr.tex +++ b/tex/context/base/enco-agr.tex @@ -57,7 +57,7 @@ \definecharacter greekoxia 47 -\definecharacter greekanoteleia 59 +\definecharacter greekanoteleia 59 \definecharacter greekdasia 60 \definecharacter greekpsili 62 diff --git a/tex/context/base/enco-def.tex b/tex/context/base/enco-def.tex index 9511f0f58..5d0dd51df 100644 --- a/tex/context/base/enco-def.tex +++ b/tex/context/base/enco-def.tex @@ -101,7 +101,7 @@ \definecharacter perthousand {\fakeperthousand} \definecharacter softhyphen 45 -\definecharacter periodcentered {\mathematics\cdot} +\definecharacter periodcentered {\hbox{\mathematics\cdot}} \definecharacter compoundwordmark 23 \definecharacter textasciicircum 94 diff --git a/tex/context/base/font-def.lua b/tex/context/base/font-def.lua index f93abd2b8..7bf595842 100644 --- a/tex/context/base/font-def.lua +++ b/tex/context/base/font-def.lua @@ -442,6 +442,8 @@ input.storage.register(false,"fonts/numbers", fonts.define.specify.context_numbe --~ end --~ end +fonts.triggers = fonts.triggers or { } + function fonts.define.specify.preset_context(name,parent,features) if features == "" then if parent:find("=") then @@ -466,13 +468,30 @@ function fonts.define.specify.preset_context(name,parent,features) end end end + -- these are auto set so in order to prevent redundant definitions + -- we need to preset them (we hash the features and adding a default + -- setting during initialization may result in a different hash) + local default = fonts.otf.features.default + for k,v in pairs(fonts.triggers) do + if type(t[v]) == "nil" then + local vv = default[v] + if vv then t[v] = vv end + end + end + -- sparse 'm so that we get a better hash and less test (experimental + -- optimization) + local tt = { } + for k,v in pairs(t) do + if v then tt[k] = v end + end + -- needed for dynamic features if number == 0 then numbers[#numbers+1] = name - t.number = #numbers + tt.number = #numbers else - t.number = number + tt.number = number end - setups[name] = t + setups[name] = tt end --~ function fonts.define.specify.context_number(name) diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex index 1ee7105f9..d528d51d4 100644 --- a/tex/context/base/font-ini.tex +++ b/tex/context/base/font-ini.tex @@ -2721,7 +2721,7 @@ %D easily be made \ETEX\ aware. %D \macros -%D {everybodyfont,Everybodyfont} +%D {everybodyfont,Everybodyfont,everyglobalbodyfont} %D %D Every change in bodyfont size has conseqences for the baseline %D distance and skips between paragraphs. These are initialized @@ -2792,27 +2792,10 @@ \chardef\fontdigits=1 -% \def\donormalizedbodyfontsize#1.#2#3#4\to#5% -% {\edef#5% -% {#1% -% \ifcase\fontdigits\space -% \or -% \ifcase#2 \else.#2\fi % and not: \ifcase#2\else ... -% \else -% \ifcase#2#3 \else.#2\ifcase#3 \else#3\fi\fi % not: \ifcase#2#3\else ... -% \fi -% pt}} -% -% \def\normalizebodyfontsize#1\to#2% -% {\scratchdimen#1\relax -% \@EA\@EA\@EA\donormalizedbodyfontsize -% \@EA\WITHOUTPT\the\scratchdimen00\to#2} - \def\normalizebodyfontsize#1\to#2% {\scratchdimen#1\relax \ifcase\fontdigits\advance\scratchdimen.5\points\fi - \@EA\@EA\@EA\donormalizedbodyfontsize - \@EA\WITHOUTPT\the\scratchdimen00\to#2} + \@EA\@EA\@EA\donormalizedbodyfontsize\@EA\WITHOUTPT\the\scratchdimen00\to#2} \def\donormalizedbodyfontsize#1.#2#3#4\to#5% \points ? {\edef#5% @@ -2965,6 +2948,7 @@ \doswitchpoints[\normalizedbodyfontsize]% \doswitchstyle[\fontstyle]% \the\everybodyfont + \the\everyglobalbodyfont \saveinterlinespace \global\let\preloadfonts\relax} @@ -3470,7 +3454,8 @@ \normalizebodyfontsize\globalbodyfontsize\to\normalizedglobalbodyfontsize \let\globalfontstyle\fontstyle \ifloadingfonts\else - \the\everybodyfont % indeed needed in case \dosetfont is not executed + \the\everybodyfont + \the\everyglobalbodyfont \saveinterlinespace \fi}} @@ -3702,6 +3687,7 @@ {\doswitchpoints[\normalizedbodyfontsize]% \doswitchstyle[\fontstyle]% \the\everybodyfont + \the\everyglobalbodyfont \saveinterlinespace} %D \macros @@ -3722,7 +3708,9 @@ \doswitchpoints[\normalizedglobalbodyfontsize]% \doswitchstyle[\globalfontstyle]% \redoconvertfont % just in case a pagebreak occurs - \tf \the\everybodyfont + \tf + \the\everybodyfont + \the\everyglobalbodyfont \saveinterlinespace} \def\partialrestoreglobalbodyfont diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index 9e4bb40d4..58edc4ea2 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -942,9 +942,9 @@ function fonts.otf.enhance.unpack(data) end local c = vv.coverage if c then - if c.before then c.before = t[c.before] end - if c.after then c.after = t[c.after] end - if c.current then c.current = t[c.current] end + local cc = c.before if cc then c.before = t[cc] end + cc = c.after if cc then c.after = t[cc] end + cc = c.current if cc then c.current = t[cc] end end end end @@ -1598,7 +1598,8 @@ function fonts.otf.set_features(tfmdata) -- node and base, simple mapping local gposlist = otfdata.luatex.gposfeatures local gsublist = otfdata.luatex.gsubfeatures local mode = tfmdata.mode or fonts.mode - local fi = fonts.initializers[mode] + local initializers = fonts.initializers + local fi = initializers[mode] if fi then -- todo: delay initilization for mode 'node' local fiotf = fi.otf if fiotf then @@ -1615,7 +1616,7 @@ function fonts.otf.set_features(tfmdata) -- node and base, simple mapping end fiotf[f](tfmdata,value) -- can set mode (no need to pass otf) mode = tfmdata.mode or fonts.mode -- keep this, mode can be set local ! - local fi = fonts.initializers[mode] + local fi = initializers[mode] fiotf = fi.otf done[f] = true end @@ -1718,7 +1719,7 @@ function fonts.otf.features.prepare_base_kerns(tfmdata,kind,value) -- todo what for lookup,kerns in pairs(dk) do if somevalid[lookup] then for k, v in pairs(kerns) do - if v > 0 then + if v ~= 0 then t[k], done = v, true end end @@ -2162,6 +2163,8 @@ do fonts.otf.features.prepare = { } + local falsetable = { false, false, false } + function fonts.otf.features.prepare.feature(tfmdata,kind,value) if value then local language, script = tfmdata.language or "dflt", tfmdata.script or "dflt" @@ -2182,7 +2185,6 @@ do local flags = otfdata.luatex.ignore_flags local preparers = fonts.otf.features.prepare local process = fonts.otf.features.process - local falsetable = { false, false, false } for i=1,#lookuptable do local lookupname = lookuptable[i] local lookuptype = types[lookupname] @@ -2191,7 +2193,9 @@ do local processdata = prepare(tfmdata,kind,lookupname) if processdata then local processflags = flags[lookupname] or falsetable --- share false table - processes[#processes+1] = { process[lookuptype], lookupname, processdata, processflags } + -- local chain = (lookuptype == "gsub_contextchain") or (lookuptype == "gpos_contextchain") + local chain = lookuptype:find("context") ~= nil + processes[#processes+1] = { process[lookuptype], lookupname, processdata, processflags, chain } end end end @@ -2215,7 +2219,7 @@ do local p = ps[i] if p[1] == 'ligature' then if trace then - logs.report("define otf",string.format("feature %s ligature %s => %s",kind,p[2],o.name)) + logs.report("define otf",string.format("feature %s lookup %s ligature %s => %s",kind,lookup,p[2],o.name)) end local t = ligatures[lookup] if not t then @@ -2259,13 +2263,13 @@ do return ligatures end - -- gsub_single -> done - -- gsub_multiple -> done - -- gsub_alternate -> done - -- gsub_ligature -> done - -- gsub_context -> todo - -- gsub_contextchain -> done - -- gsub_reversechain -> todo + -- gsub_single -> done + -- gsub_multiple -> done + -- gsub_alternate -> done + -- gsub_ligature -> done + -- gsub_context -> todo + -- gsub_contextchain -> done + -- gsub_reversecontextchain -> todo -- we used to share code in the following functions but that was relatively -- due to extensive calls to functions (easily hundreds of thousands per @@ -2401,27 +2405,21 @@ do otfdata.luatex.covers = otfdata.luatex.covers or { } local characters = tfmdata.characters local cache = otfdata.luatex.covers - local function uncover(covers) + local function uncover(covers,result) -- lpeg hardly faster (.005 sec on mk) - if covers then - local result = { } - for n=1,#covers do - local c = covers[n] - local cc = cache[c] - if not cc then - local t = { } - for s in c:gmatch("[^ ]+") do - t[unicodes[s]] = true - end - cache[c] = t - result[n] = t - else - result[n] = cc + for n=1,#covers do + local c = covers[n] + local cc = cache[c] + if not cc then + local t = { } + for s in c:gmatch("[^ ]+") do + t[unicodes[s]] = true end + cache[c] = t + result[#result+1] = t + else + result[#result+1] = cc end - return result - else - return { } end end local lookupdata = otfdata.lookups[lookupname] @@ -2429,14 +2427,22 @@ do logs.error("otf process", string.format("missing lookupdata table %s",lookupname)) elseif lookupdata.rules then local rules = lookupdata.rules + local center_match = fonts.otf.center_match for nofrules=1,#rules do local rule = rules[nofrules] local coverage = rule.coverage if coverage and coverage.current then - local current = uncover(coverage.current) - local before = uncover(coverage.before) - local after = uncover(coverage.after) - if current[1] then + local current, before, after, sequence = coverage.current, coverage.before, coverage.after, { } + if before then + uncover(before,sequence) + end + local start = #sequence + 1 + uncover(current,sequence) + local stop = #sequence + if after then + uncover(after,sequence) + end + if sequence[1] then local lookups, lookuptype = rule.lookups, 'self' -- for the moment only lookup index 1 if lookups then @@ -2445,13 +2451,13 @@ do end lookuptype = types[lookups[1]] end - for unic, _ in pairs(current[1]) do + for unic, _ in pairs(sequence[1]) do local t = contexts[unic] if not t then contexts[unic] = { lookups={}, flags=flags[lookupname] } t = contexts[unic].lookups end - t[#t+1] = { nofrules, lookuptype, current, before, after, lookups } + t[#t+1] = { nofrules, lookuptype, sequence, start, stop, lookups } end end end @@ -2467,14 +2473,14 @@ do -- ruled->lookup=ks_latn_l_27_c_4 => internal[ls_l_84] => valid[ls_l_84_s] - -- gpos_mark2base -> done - -- gpos_mark2ligature -> done - -- gpos_mark2mark -> done - -- gpos_single -> not done - -- gpos_pair -> not done - -- gpos_cursive -> not done - -- gpos_context -> not done - -- gpos_contextchain -> not done + -- gpos_mark2base -> done + -- gpos_mark2ligature -> done + -- gpos_mark2mark -> done + -- gpos_single -> not done + -- gpos_pair -> not done + -- gpos_cursive -> not done + -- gpos_context -> not done + -- gpos_reversecontextchain -> not done function fonts.otf.features.prepare.anchors(tfmdata,kind,lookupname) -- tracing local featuredata = tfmdata.shared.featuredata[kind] @@ -2711,6 +2717,7 @@ do local glyph = node.id('glyph') local glue = node.id('glue') + local kern = node.id('kern') local disc = node.id('disc') local fontdata = fonts.tfm.id @@ -2763,12 +2770,26 @@ do if #processes == 1 then local p = processes[1] while start do -- evt splitsen - if start.id == glyph and start.subtype<256 and start.font == font and - (not attr or has_attribute(start,0,attr)) and -- dynamic feature - (not attribute or has_attribute(start,state,attribute)) then - -- we can make the p vars also global to this closure + if start.id == glyph then + if start.subtype<256 and start.font == font and + (not attr or has_attribute(start,0,attr)) and -- dynamic feature + (not attribute or has_attribute(start,state,attribute)) then + -- we can make the p vars also global to this closure + local pp = p[3] -- all lookups + local pc = pp[start.char] + if pc then + start, ok = p[1](start,kind,p[2],pc,pp,p[4]) + done = done or ok + if start then start = start.next end + else + start = start.next + end + else + start = start.next + end + elseif start.id == glue and p[5] then local pp = p[3] -- all lookups - local pc = pp[start.char] + local pc = pp[32] -- space if pc then start, ok = p[1](start,kind,p[2],pc,pp,p[4]) done = done or ok @@ -2782,23 +2803,46 @@ do end else while start do - if start.id == glyph and start.subtype<256 and start.font == font and - (not attr or has_attribute(start,0,attr)) and -- dynamic feature - (not attribute or has_attribute(start,state,attribute)) then - for i=1,#processes do local p = processes[i] - local pp = p[3] - local pc = pp[start.char] - if pc then - start, ok = p[1](start,kind,p[2],pc,pp,p[4]) - if ok then - done = true - break - elseif not start then - break + if start.id == glyph then + if start.subtype<256 and start.font == font and + (not attr or has_attribute(start,0,attr)) and -- dynamic feature + (not attribute or has_attribute(start,state,attribute)) then + local chr = start.char + for i=1,#processes do local p = processes[i] + local pp = p[3] + -- local pc = pp[start.char] -- var maken + local pc = pp[chr] + if pc then + start, ok = p[1](start,kind,p[2],pc,pp,p[4]) + if ok then + done = true + break + elseif not start then + break + end end end + if start then start = start.next end + elseif start.id == glue then + for i=1,#processes do local p = processes[i] + if p[5] then -- chain + local pp = p[3] + local pc = pp[32] + if pc then + start, ok = p[1](start,kind,p[2],pc,pp,p[4]) + if ok then + done = true + break + elseif not start then + break + end + end + end + end + if start then start = start.next end + else + start = start.next end - if start then start = start.next end else start = start.next end @@ -3258,9 +3302,9 @@ do -- We had a version that shared code, but it was too much a slow down -- todo n x n. - function chainprocs.gsub_single(start,stop,kind,lookupname,sequence,lookups) + function chainprocs.gsub_single(start,stop,kind,lookupname,sequence,f,l,lookups) local char = start.char - local cacheslot = sequence[1] + local cacheslot = sequence[f] -- [1] local replacement = cacheslot[char] if replacement == true then if lookups then @@ -3290,9 +3334,9 @@ do return start end - function chainprocs.gsub_multiple(start,stop,kind,lookupname,sequence,lookups) + function chainprocs.gsub_multiple(start,stop,kind,lookupname,sequence,f,l,lookups) local char = start.char - local cacheslot = sequence[1] + local cacheslot = sequence[f] -- [1] local replacement = cacheslot[char] if replacement == true then if lookups then @@ -3341,9 +3385,9 @@ do return start end - function chainprocs.gsub_alternate(start,stop,kind,lookupname,sequence,lookups) + function chainprocs.gsub_alternate(start,stop,kind,lookupname,sequence,f,l,lookups) local char = start.char - local cacheslot = sequence[1] + local cacheslot = sequence[f] -- [1] local replacement = cacheslot[char] if replacement == true then if lookups then @@ -3378,7 +3422,7 @@ do return start end - function chainprocs.gsub_ligature(start,stop,kind,lookupname,sequence,lookups,flags) + function chainprocs.gsub_ligature(start,stop,kind,lookupname,sequence,f,l,lookups,flags) if lookups then local featurecache = fontdata[currentfont].shared.featurecache if not featurecache[kind] then @@ -3426,18 +3470,19 @@ do return stop end - function chainprocs.gpos_mark2base(start,stop,kind,lookupname,sequence,lookups) + function chainprocs.gpos_mark2base(start,stop,kind,lookupname,sequence,f,l,lookups) local component = start.next if component and component.id == glyph and component.subtype<256 and component.font == currentfont and marks[component.char] then local char = start.char - local anchortag = sequence[1][char] + local anchortag = sequence[f][char] -- sequence[1][char] if anchortag == true then local classes = otfdata.anchor_classes for k=1,#classes do local v = classes[k] if v.lookup == lookupname and v.type == kind then anchortag = v.name - sequence[1][char] = anchortag + -- sequence[1][char] = anchortag + sequence[f][char] = anchortag break end end @@ -3484,18 +3529,19 @@ do return start, false end - function chainprocs.gpos_mark2ligature(start,stop,kind,lookupname,sequence,lookups) + function chainprocs.gpos_mark2ligature(start,stop,kind,lookupname,sequence,f,l,lookups) local component = start.next if component and component.id == glyph and component.subtype<256 and component.font == currentfont and marks[component.char] then local char = start.char - local anchortag = sequence[1][char] + local anchortag = sequence[f][char] -- [1][char] if anchortag == true then local classes = otfdata.anchor_classes for k=1,#classes do local v = classes[k] if v.lookup == lookupname and v.type == kind then anchortag = v.name - sequence[1][char] = anchortag + -- sequence[1][char] = anchortag + sequence[f][char] = anchortag break end end @@ -3547,18 +3593,19 @@ do return start, false end - function chainprocs.gpos_mark2mark(start,stop,kind,lookupname,sequence,lookups) + function chainprocs.gpos_mark2mark(start,stop,kind,lookupname,sequence,f,l,lookups) local component = start.next if component and component.id == glyph and component.subtype<256 and component.font == currentfont and marks[component.char] then local char = start.char - local anchortag = sequence[1][char] + local anchortag = sequence[f][char] -- [1][char] if anchortag == true then local classes = otfdata.anchor_classes for k=1,#classes do local v = classes[k] if v.lookup == lookupname and v.type == kind then anchortag = v.name - sequence[1][char] = anchortag + -- sequence[1][char] = anchortag + sequence[f][char] = anchortag break end end @@ -3610,20 +3657,20 @@ do return start, false end - function chainprocs.gpos_cursive(start,stop,kind,lookupname,sequence,lookups) + function chainprocs.gpos_cursive(start,stop,kind,lookupname,sequence,f,l,lookups) report("otf chain","chainproc gpos_cursive not yet supported") return start end - function chainprocs.gpos_single(start,stop,kind,lookupname,sequence,lookups) + function chainprocs.gpos_single(start,stop,kind,lookupname,sequence,f,l,lookups) report("otf process","chainproc gpos_single not yet supported") return start end - function chainprocs.gpos_pair(start,stop,kind,lookupname,sequence,lookups) + function chainprocs.gpos_pair(start,stop,kind,lookupname,sequence,f,l,lookups) report("otf process","chainproc gpos_pair not yet supported") return start end - function chainprocs.self(start,stop,kind,lookupname,sequence,lookups) + function chainprocs.self(start,stop,kind,lookupname,sequence,f,l,lookups) report("otf process","self refering lookup cannot happen") return stop end @@ -3634,124 +3681,67 @@ do local flags = contextdata.flags local skipmark, skipligature, skipbase = unpack(flags) for k=1,#contexts do - local match, stop = true, start - local rule, lookuptype, sequence, before, after, lookups = unpack(contexts[k]) - if #sequence > 0 then - if #sequence == 1 then - match = sequence[1][start.char] - else -- n = #sequence -> faster - for n=1,#sequence do - if stop then - local id = stop.id - if id == glyph and stop.subtype<256 and stop.font == currentfont then - local char = stop.char - local class = characters[char].description.class - if class == skipmark or class == skipligature or class == skipbase then - -- skip 'm - elseif sequence[n][char] then - if n < #sequence then - stop = stop.next - end - else - match = false break + local match, next, first, last = true, start, start, start + local rule, lookuptype, sequence, f, l, lookups = unpack(contexts[k]) -- unpack is slow + if #sequence == 1 then + match = next.id == glyph and next.subtype<256 and next.font == currentfont and sequence[1][next.char] + else + -- todo: better space check (maybe check for glue) +--~ print("\nSTART ", k, start) + local n, s = 1, #sequence + while n <= s do + if next then + local id = next.id + if id == glyph and next.subtype<256 and next.font == currentfont then -- normal char + local char = next.char + local class = characters[char].description.class + if class == skipmark or class == skipligature or class == skipbase then +--~ print("S",n,char,utf.char(char)) + -- skip + elseif sequence[n][char] then +--~ print("Y",n,char,utf.char(char)) + if n == f then + first = next + end + if n == l then + last = next end - elseif id == disc then -- what to do with kerns? - stop = stop.next + n = n + 1 else +--~ print("N",n,char,utf.char(char)) match = false break end - else + elseif id == disc then +--~ print("D",n) + -- skip + elseif not sequence[n][32] then -- brrr +--~ print("S",n) match = false break end - end - end - end - if match and #before > 0 then - local prev = start.prev - if prev then - if #before == 1 then - match = prev.id == glyph and prev.subtype<256 and prev.font == currentfont and before[1][prev.char] - else - for n=#before,1 do - if prev then - local id = prev.id - if id == glyph and prev.subtype<256 and prev.font == currentfont then -- normal char - local char = prev.char - local class = characters[char].description.class - if class == skipmark or class == skipligature or class == skipbase then - -- skip 'm - elseif not before[n][char] then - match = false break - end - elseif id == disc then - -- skip 'm - elseif not before[n][32] then - match = false break - end - prev = prev.prev - elseif not before[n][32] then - match = false break - end - end - end - elseif #before == 1 then - match = before[1][32] - else - for n=#before,1 do - if not before[n][32] then - match = false break - end - end - end - end - if match and #after > 0 then - local next = stop.next - if next then - if #after == 1 then - match = next.id == glyph and next.subtype<256 and next.font == currentfont and after[1][next.char] + next = next.next + elseif sequence[n][32] then + n = n + 1 else - for n=1,#after do - if next then - local id = next.id - if id == glyph and next.subtype<256 and next.font == currentfont then -- normal char - local char = next.char - local class = characters[char].description.class - if class == skipmark or class == skipligature or class == skipbase then - -- skip 'm - elseif not after[n][char] then - match = false break - end - elseif id == disc then - -- skip 'm - elseif not after[n][32] then -- brrr - match = false break - end - next = next.next - elseif not after[n][32] then - match = false break - end - end - end - elseif #after == 1 then - match = after[1][32] - else - for n=1,#after do - if not after[n][32] then - match = false break - end +--~ print("S",n) + match = false break end end +--~ print((match and "MATCH") or "NO MATCH") end if match then local trace = fonts.otf.trace_contexts if trace then - local char = start.char - report("otf chain",format("%s: rule %s of %s matches %s times at char %s (%s) lookuptype %s",kind,rule,lookupname,#sequence,char,utf.char(char),lookuptype)) + local char = first.char + report("otf chain",format("%s: rule %s of %s matches, replacing starts at char %s (%s) lookuptype %s",kind,rule,lookupname,char,utf.char(char),lookuptype)) end if lookups then local cp = chainprocs[lookuptype] if cp then - start = cp(start,stop,kind,lookupname,sequence,lookups,flags) + if start == first then + start = cp(first,last,kind,lookupname,sequence,f,l,lookups,flags) + else + first = cp(first,last,kind,lookupname,sequence,f,l,lookups,flags) + end else report("otf chain",format("%s: lookuptype %s not supported yet for %s",kind,lookuptype,lookupname)) end @@ -3766,101 +3756,64 @@ do end function fonts.otf.features.process.reversecontextchain(start,kind,lookupname,contextdata) - -- there is only a single substitution here so it is a simple case of the normal one - -- sequence is one character here and we swap the rest + -- PROBABLY WRONG, WE NEED TO WALK BACK OVER THE LIST local done = false local contexts = contextdata.lookups local flags = contextdata.flags local skipmark, skipligature, skipbase = unpack(flags) for k=1,#contexts do - local match, stop = true, start - local rule, lookuptype, sequence, before, after, lookups = unpack(contexts[k]) - match = sequence[1][start.char] - if match and #after > 0 then - local prev = start.prev - if prev then - if #after == 1 then - match = prev.id == glyph and prev.subtype<256 and prev.font == currentfont and after[1][prev.char] - else - for n=1,#after do - if prev then - local id = prev.id - if id == glyph and prev.subtype<256 and prev.font == currentfont then -- normal char - local char = prev.char - local class = characters[char].description.class - if class == skipmark or class == skipligature or class == skipbase then - -- skip 'm - elseif not after[n][char] then - match = false break - end - elseif id == disc then - -- skip 'm - elseif not after[n][32] then - match = false break + local match, next, first, last = true, start, start, start + local rule, lookuptype, sequence, f, l, lookups = unpack(contexts[k]) -- unpack is slow + if #sequence == 1 then + match = next.id == glyph and next.subtype<256 and next.font == currentfont and sequence[1][next.char] + else + local n, s = #sequence, 1 + while n > 0 do + if next then + local id = next.id + if id == glyph and next.subtype<256 and next.font == currentfont then -- normal char + local char = next.char + local class = characters[char].description.class + if class == skipmark or class == skipligature or class == skipbase then + -- skip + elseif sequence[n][char] then + if n == f then + first = next -- ok ? end - prev = prev.prev - elseif not after[n][32] then - match = false break - end - end - end - elseif #after == 1 then - match = after[1][32] - else - for n=#after,1 do - if not after[n][32] then - match = false break - end - end - end - end - if match and #before > 0 then - local next = stop.next - if next then - if #after == 1 then - match = next.id == glyph and next.subtype<256 and next.font == currentfont and before[1][next.char] - else - for n=#before,1 do - if next then - local id = next.id - if id == glyph and next.subtype<256 and next.font == currentfont then -- normal char - local char = next.char - local class = characters[char].description.class - if class == skipmark or class == skipligature or class == skipbase then - -- skip 'm - elseif not before[n][char] then - match = false break - end - elseif id == disc then - -- skip 'm - elseif not before[n][32] then -- brrr - match = false break + if n == l then + last = next -- ok ? end - next = next.next - elseif not before[n][32] then + n = n - 1 + else match = false break end - end - end - elseif #before == 1 then - match = before[1][32] - else - for n=1,#before do - if not before[n][32] then + elseif id == disc then + -- skip + elseif not sequence[n][32] then -- brrr match = false break end + next = next.next + elseif sequence[n][32] then + n = n - 1 + else + match = false break end end end if match then local trace = fonts.otf.trace_contexts if trace then - report("otf reverse chain",format("%s: rule %s of %s matches %s times at char %s (%s) lookuptype %s",kind,rule,lookupname,#sequence,char,utf.char(char),lookuptype)) + local char = first.char + report("otf reverse chain",format("%s: rule %s of %s matches, replacing starts at char %s (%s) lookuptype %s",kind,rule,lookupname,char,utf.char(char),lookuptype)) end if lookups then local cp = chainprocs[lookuptype] if cp then - start = cp(start,stop,kind,lookupname,sequence,lookups,flags) + if start == first then + start = cp(first,last,kind,lookupname,sequence,f,l,lookups,flags) + else + first = cp(first,last,kind,lookupname,sequence,f,l,lookups,flags) + end else report("otf reverse chain",format("%s: lookuptype %s not supported yet for %s",kind,lookuptype,lookupname)) end @@ -4537,6 +4490,18 @@ do local insert_after, insert_before, delete = node.insert_after, node.insert_before, nodes.delete + local function nobreak_before(head,current) + local p = current.prev + if p then + p = p.prev + if p and p.id == penalty then + p.penalty = 10000 + return head, current + end + end + return insert_before(head,current,nodes.penalty(10000)) + end + function fonts.analyzers.methods.hang(head,font,attr) -- maybe make a special version with no trace local characters = fontdata[font].characters @@ -4548,6 +4513,7 @@ do local interspecialskip = - stretch * hang_data.inter_char_half_factor local interspecialshrink = stretch * hang_data.inter_char_half_schrink_factor local internormalstretch = stretch * hang_data.inter_char_stretch_factor + local trace = fonts.color.trace while current do if current.id == glyph and current.subtype<256 then if current.font == font then @@ -4555,16 +4521,15 @@ do if false then -- don't ask -) elseif opening_punctuation_fw[char] or opening_parenthesis_fw[char] then - fcs(current,"font:init") + if trace then fcs(current,"font:init") end head, _ = insert_before(head,current,nodes.glue(interspecialskip,0,interspecialshrink)) - head, current = insert_after(head,current,nodes.penalty(0)) + head, current = insert_after(head,current,nodes.penalty(10000)) head, current = insert_after(head,current,nodes.glue(0,internormalstretch,0)) prevclass, done = 1, true elseif closing_punctuation_fw[char] or closing_parenthesis_fw[char] then - fcs(current,"font:fina") + if trace then fcs(current,"font:fina") end if prevclass > 0 then - local prev = current.prev - prev.prev.penalty = 10000 + head, current = nobreak_before(head,current) head, current = insert_after(head,current,nodes.penalty(10000)) head, current = insert_after(head,current,nodes.glue(interspecialskip,0,interspecialshrink)) head, current = insert_after(head,current,nodes.penalty(0)) @@ -4572,30 +4537,28 @@ do end prevclass, done = 2, true elseif opening_punctuation_hw[char] or opening_parenthesis_hw[char] then - fcs(current,"font:init") - head, current = insert_after(head,current,nodes.penalty(0)) + if trace then fcs(current,"font:init") end + head, current = insert_after(head,current,nodes.penalty(10000)) head, current = insert_after(head,current,nodes.glue(0,internormalstretch,0)) prevclass, done = 3, true elseif closing_punctuation_hw[char] or closing_parenthesis_hw[char] then - fcs(current,"font:fina") + if trace then fcs(current,"font:fina") end if prevclass > 0 then - local prev = current.prev - prev.prev.penalty = 10000 + head, current = nobreak_before(head,current) head, current = insert_after(head,current,nodes.penalty(0)) head, current = insert_after(head,current,nodes.glue(0,internormalstretch,0)) end prevclass, done = 4, true elseif hyphenation[char] then - fcs(current,"font:medi") + if trace then fcs(current,"font:medi") end if prevclass > 0 then - local prev = current.prev - prev.prev.penalty = 10000 + head, current = nobreak_before(head,current) head, current = insert_after(head,current,nodes.penalty(0)) head, current = insert_after(head,current,nodes.glue(0,internormalstretch,0)) end prevclass, done = 5, true elseif non_starter[char] then - fcs(current,"font:isol") + if trace then fcs(current,"font:isol") end head, current = insert_after(head,current,nodes.penalty(10000)) head, current = insert_after(head,current,nodes.glue(0,internormalstretch,0)) prevclass, done = 6, true diff --git a/tex/context/base/java-ini.tex b/tex/context/base/java-ini.tex index d9fe3c902..30f6a8394 100644 --- a/tex/context/base/java-ini.tex +++ b/tex/context/base/java-ini.tex @@ -486,7 +486,7 @@ \aftergroup\xdef \aftergroup#2% \aftergroup{% - \expanded{\convertargument#1\noexpand\to\noexpand\JScode}% + \expanded{\defconvertedargument\noexpand\JScode{#1}}% \expandafter\handletokens\JScode\with\dodoPSsanitizeJScode \aftergroup}% \endgroup diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua index 9787e1001..f4ad2225f 100644 --- a/tex/context/base/l-file.lua +++ b/tex/context/base/l-file.lua @@ -32,6 +32,10 @@ function file.basename(name) return name:match("^.+[/\\](.-)$") or name end +function file.nameonly(name) + return ((name:match("^.+[/\\](.-)$") or name):gsub("%..*$","")) +end + function file.extname(name) return name:match("^.+%.([^/\\]-)$") or "" end diff --git a/tex/context/base/l-os.lua b/tex/context/base/l-os.lua index 522337a0f..298dfa757 100644 --- a/tex/context/base/l-os.lua +++ b/tex/context/base/l-os.lua @@ -10,9 +10,12 @@ function os.resultof(command) return io.popen(command,"r"):read("*all") end ---~ if not os.exec then -- still not ok +if not os.exec then -- still not ok os.exec = os.execute ---~ end +end +if not os.spawn then -- still not ok + os.spawn = os.execute +end function os.launch(str) if os.platform == "windows" then diff --git a/tex/context/base/l-xml.lua b/tex/context/base/l-xml.lua index e3227f374..69002e64e 100644 --- a/tex/context/base/l-xml.lua +++ b/tex/context/base/l-xml.lua @@ -1577,14 +1577,20 @@ do function xml.include(xmldata,pattern,attribute,recursive,findfile) -- parse="text" (default: xml), encoding="" (todo) - pattern = pattern or 'include' - attribute = attribute or 'href' + pattern = pattern or 'include' + -- attribute = attribute or 'href' local function include(r,d,k) local ek, name = d[k], nil - if ek.at then - for a in attribute:gmatch("([^|]+)") do - name = ek.at[a] - if name then break end + if not attribute or attribute == "" then + local ekdt = ek.dt + name = (type(ekdt) == "table" and ekdt[1]) or ekdt + end + if not name then + if ek.at then + for a in (attribute or "href"):gmatch("([^|]+)") do + name = ek.at[a] + if name then break end + end end end if name then @@ -1605,6 +1611,8 @@ do else xml.empty(d,k) end + else + xml.empty(d,k) end else xml.empty(d,k) diff --git a/tex/context/base/lang-ini.lua b/tex/context/base/lang-ini.lua index 4c136c0ff..bc568ebff 100644 --- a/tex/context/base/lang-ini.lua +++ b/tex/context/base/lang-ini.lua @@ -1,8 +1,3 @@ - ---~ lang:hyphenation(string) ---~ string =lang:hyphenation() ---~ lang:clear_hyphenation() - if not modules then modules = { } end modules ['lang-ini'] = { version = 1.001, comment = "companion to lang-ini.tex", @@ -23,6 +18,11 @@ languages.hyphenation.data = languages.hyphenation.data or { } -- 2011 : nonbreakable hyphen -- 2013 : endash (compound hyphen) +--~ lang:hyphenation(string) +--~ string =lang:hyphenation() +--~ lang:clear_hyphenation() + + do -- we can consider hiding data (faster access too) diff --git a/tex/context/base/lang-ini.tex b/tex/context/base/lang-ini.tex index bc8cf165a..d9185eb33 100644 --- a/tex/context/base/lang-ini.tex +++ b/tex/context/base/lang-ini.tex @@ -443,6 +443,13 @@ \ifx\enablelanguagespecifics\undefined \def\enablelanguagespecifics[#1]{} \fi +% The following may be a solution for the fact that one cannot +% change catcodes of characters like : and ; inside an environment. + +\appendtoks + \enablelanguagespecifics[\currentlanguage]% +\to \everystarttext + \def\complexlanguage[#1]% {\edef\askedlanguage{#1}% \ifx\askedlanguage\empty \else diff --git a/tex/context/base/lang-mis.tex b/tex/context/base/lang-mis.tex index cfd189e18..13a3f2bb9 100644 --- a/tex/context/base/lang-mis.tex +++ b/tex/context/base/lang-mis.tex @@ -23,7 +23,7 @@ %D \blank} %D %D \gdef\test#1% -%D {\convertargument#1\to\ascii\ascii&\hyphenatedword{#1}\cr} +%D {\defconvertedargument\ascii{#1}\ascii&\hyphenatedword{#1}\cr} \unprotect @@ -680,212 +680,4 @@ \ifx\normalcompound\undefined \let\normalcompound=| \fi -%D ! ! This will be reimplemented !! - -%D \macros -%D {hyphenatedurl} -%D -%D For those who want to put full \URL's in a text, we offer -%D -%D \startbuffer -%D \hyphenatedurl{http://optimist.optimist/optimist/optimist.optimist#optimist} -%D \stopbuffer -%D -%D \typebuffer -%D -%D which breaks at the appropriate places. Watch the \type{#} -%D hack. -%D -%D When passed as argument, like in \type {\goto}, one needs -%D to substitute a \type {\\} for each \type{#}. -%D -%D \startbuffer -%D \hyphenatedurl{http://this.is.a.rather/strange/reference#indeed} -%D \stopbuffer -%D -%D \typebuffer - -\ifx\\\undefined \let\\\crlf \fi - -\chardef\urlsplitmode=1 - -% 0 => don't split -% 1 => . : na, rest voor -% 2 => alles na -% 3 => alles voor - -% \bgroup \catcode`\~=\active \catcode`\/=\active - -% Why not convert to ascii first? I will redo this one! - -\bgroup \catcode`\~=\active \catcode`\/=\active - -\unexpanded\gdef\hyphenatedurl#1% {}{} handles accents - {\bgroup - \ifnum\hyphenpenalty<10000 \else - \def\discretionary##1##2##3{##1\allowbreak##2}% - \fi - \obeyhyphens - \def\splitbefore##1% - {\setbox\scratchbox=\hbox{##1{}{}}% - \ifcase\urlsplitmode - \box\scratchbox - \or - \postwordbreak\box\scratchbox\prewordbreak - \or - \prewordbreak\discretionary{\box\scratchbox}{}{\box\scratchbox}\prewordbreak - \else - \postwordbreak\box\scratchbox\prewordbreak - \fi}% - \def\splitafter##1% - {\ifcase\urlsplitmode - ##1{}{}% - \or - \prewordbreak\discretionary{##1{}{}}{}{##1{}{}}\prewordbreak - \or - \prewordbreak\discretionary{##1{}{}}{}{##1{}{}}\prewordbreak - \else - \prewordbreak\discretionary{}{##1{}{}}{##1{}{}}\prewordbreak - \fi}% - \def\splitanyway##1% - {\prewordbreak##1\prewordbreak}% - \def\flushurl% - {\savedurl\let\savedurl\empty}% - \def\\% - {\spliturl\#}% - \let\~=\lettertilde\let~=\~% - \let\/=\letterslash\let/=\/% - \let\savedurl\empty - \scratchcounter\zerocount % used for hyphenmethod - \handletokens#1\with\scanurl\savedurl - \egroup} - -\egroup - -%D This would be better, but it spoils \type {\~} and so: -%D -%D \starttyping -%D \convertargument#1\to\ascii -%D \expandafter\handletokens\ascii\with\scanurl -%D \stoptyping - -\chardef\urlhyphenmethod=0 - -\def\scanurl#1% - {\advance\scratchcounter\plusone - \ifx#1\blankspace - \flushurl\splitanyway\normalspace - \else\ifx#1\ % - \flushurl\splitanyway\normalspace - \else\ifx#1\space - \flushurl\splitanyway\normalspace - \else\ifx#1\~% - \flushurl\splitbefore\~% - \else\ifx#1\#% - \flushurl\splitbefore\#% - \else\ifx#1\&% - \flushurl\splitbefore\&% - \else\ifx#1\%% - \flushurl\splitbefore\%% - \else\ifx#1\_% - \flushurl\splitbefore\_% - \else\if\noexpand#1\relax - #1% - \else\ifnum\catcode`#1=8 - \flushurl\splitbefore\_% - \else\ifnum\catcode`#1=6 - \flushurl\splitbefore\#% - \else\ifnum\catcode`#1=4 - \flushurl\splitbefore\&% - \else\expandafter\if\string#1\lettertilde - \flushurl\splitbefore\~% - \else\expandafter\if\string#1\letterpercent - \flushurl\splitbefore\%% - \else\expandafter\if\string#1\letterunderscore - \flushurl\splitbefore\_% - \else\expandafter\if\string#1\letterquestionmark - \flushurl\splitafter\letterquestionmark - \else\expandafter\if\string#1\letterat - \flushurl\splitafter\letterat - \else\expandafter\if\string#1\letterslash - \edef\savedurl{\savedurl\letterslash}% - \else\expandafter\if\string#1+% - \flushurl\splitafter+% - \else\expandafter\if\string#1:% - \flushurl\splitafter:% - \else\expandafter\if\string#1.% - \flushurl\splitafter.% - \else\expandafter\if\string#1(% - \flushurl\splitbefore(% - \else\expandafter\if\string#1)% - \flushurl\splitafter)% - \else - \ifx\savedurl\empty\else - \splitbefore\savedurl - \let\savedurl\empty - \fi - \ifcase\urlhyphenmethod - \string#1% - \else - \ifnum\scratchcounter>\plusthree % so, \http: will not break - \edef\savedurl{\string#1}% - \else - \string#1% - \fi - \fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} - -% \setupinteraction[state=start] -% \def\gotoURL#1{\useURL[foo][#1]\goto{\url[foo]}[url(foo)]} -% \starttext -% \endgraf \chardef\urlhyphenmethod=0 -% \hsize1pt\gotoURL{http://www.physik.fu-berlin.de/SomeVeryVeryVeryLongDirectory/And/AQuiteLongFileName.html} -% \endgraf \chardef\urlhyphenmethod=1 -% \hsize1pt\gotoURL{http://www.physik.fu-berlin.de/SomeVeryVeryVeryLongDirectory/And/AQuiteLongFileName.html} -% \stoptext - -% \useencoding[ffr] -% \mainlanguage[fr] -% \starttext -% \hyphenatedurl{http://somewhere.to/go} -% \stoptext - -%D When Joop Susan asked (on the \CONTEXT\ mailing list) how -%D to handle url's passed as argument, the following solutions -%D came to my mind: -%D -%D \starttyping -%D \def\whateverurl#1% -%D {{\def~{\string~}\useURL[dummy][#1]\goto{\url[dummy]}[URL(dummy)]}} -%D -%D \def\whateverurl#1% -%D {{\let~\lettertilde\useURL[dummy][#1]\goto{\url[dummy]}[URL(dummy)]}} -%D -%D \def\whateverurl#1% -%D {\convertargument#1\to\ascii -%D \expanded{\useURL[dummy][\ascii]}\goto{\url[dummy]}[URL(dummy)]} -%D \stoptyping - -%D \macros -%D {hyphenatedfile} -%D -%D For the moment we treat filenames in a similar way, -%D -%D \starttyping -%D \hyphenatedfile{here/there/filename.suffix} -%D \stoptyping - -\let\hyphenatedfile\hyphenatedurl - -% to be finished -% -% \def\hyphenatedstring#1% -% {\bgroup -% \nohyphens -% \def\next##1{##1\doif{##1}{-}{\allowbreak}}% -% \handletokens#1\with\next -% \egroup} -% -% {\hsize1cm\hyphenatedstring{ABXXXXXXXXXXC-12345-12345}} - \protect \endinput diff --git a/tex/context/base/lang-url.lua b/tex/context/base/lang-url.lua new file mode 100644 index 000000000..d3b4848a9 --- /dev/null +++ b/tex/context/base/lang-url.lua @@ -0,0 +1,82 @@ +if not modules then modules = { } end modules ['lang-url'] = { + version = 1.001, + comment = "companion to lang-url.tex", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +commands = commands or { } + +--[[ +

Hyphenating 's is somewhat tricky and a matter of taste. I did +consider using a dedicated hyphenation pattern or dealing with it by node +parsing, but the following solution suits as well. After all, we're mostly +dealing with characters.

+]]-- + +do + + commands.hyphenatedurl = commands.hyphenatedurl or { } + + commands.hyphenatedurl.characters = { + ["!"] = 1, + ["\""] = 1, + ["#"] = 1, + ["$"] = 1, + ["%"] = 1, + ["&"] = 1, + ["("] = 1, + ["*"] = 1, + ["+"] = 1, + [","] = 1, + ["-"] = 1, + ["."] = 1, + ["/"] = 1, + [":"] = 1, + [";"] = 1, + ["<"] = 1, + ["="] = 1, + [">"] = 1, + ["?"] = 1, + ["@"] = 1, + ["["] = 1, + ["\\"] = 1, + ["^"] = 1, + ["_"] = 1, + ["`"] = 1, + ["{"] = 1, + ["|"] = 1, + ["~"] = 1, + + ["'"] = 2, + [")"] = 2, + ["]"] = 2, + ["}"] = 2 + } + + commands.hyphenatedurl.lefthyphenmin = 2 + commands.hyphenatedurl.righthyphenmin = 3 + + local chars = commands.hyphenatedurl.characters + + function commands.hyphenatedurl.action(str, left, right) + local n = 0 + local b = math.max(left or commands.hyphenatedurl.lefthyphenmin,2) + local e = math.min(#str-(right or commands.hyphenatedurl.righthyphenmin)+2,#str) + local u = utf.byte + str = utf.gsub(str,"(.)",function(s) + n = n + 1 + local c = chars[s] + if not c or n<=b or n>=e then + return "\\n{" .. u(s) .. "}" + elseif c == 1 then + return "\\b{" .. u(s) .. "}" + elseif c == 2 then + return "\\a{" .. u(s) .. "}" + end + end ) + tex.sprint(tex.ctxcatcodes,str) + end + +end diff --git a/tex/context/base/lang-url.mkii b/tex/context/base/lang-url.mkii new file mode 100644 index 000000000..f3310cceb --- /dev/null +++ b/tex/context/base/lang-url.mkii @@ -0,0 +1,232 @@ +%D \module +%D [ file=lang-url, +%D version=2008.01.22, % used to be lang-mis +%D title=\CONTEXT\ Language Macros, +%D subtitle=Language Options, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +%D This is rather old code. The following solution was used +%D for a long time and is kind of built-up over the years. + +\ifx\\\undefined \let\\\crlf \fi + +\ifx\urlsplitmode\undefined \chardef\urlsplitmode\plusone \fi + +% 0 => don't split +% 1 => . : na, rest voor +% 2 => alles na +% 3 => alles voor + +% \bgroup \catcode`\~=\active \catcode`\/=\active +% +% \unexpanded\gdef\hyphenatedurl#1% {}{} handles accents +% {\bgroup +% \ifnum\hyphenpenalty<10000 \else +% \def\discretionary##1##2##3{##1\allowbreak##2}% +% \fi +% \obeyhyphens +% \def\splitbefore##1% +% {\setbox\scratchbox=\hbox{##1{}{}}% +% \ifcase\urlsplitmode +% \box\scratchbox +% \or +% \postwordbreak\box\scratchbox\prewordbreak +% \or +% \prewordbreak\discretionary{\box\scratchbox}{}{\box\scratchbox}\prewordbreak +% \else +% \postwordbreak\box\scratchbox\prewordbreak +% \fi}% +% \def\splitafter##1% +% {\ifcase\urlsplitmode +% ##1{}{}% +% \or +% \prewordbreak\discretionary{##1{}{}}{}{##1{}{}}\prewordbreak +% \or +% \prewordbreak\discretionary{##1{}{}}{}{##1{}{}}\prewordbreak +% \else +% \prewordbreak\discretionary{}{##1{}{}}{##1{}{}}\prewordbreak +% \fi}% +% \def\splitanyway##1% +% {\prewordbreak##1\prewordbreak}% +% \def\flushurl% +% {\savedurl\let\savedurl\empty}% +% \def\\% +% {\spliturl\#}% +% \let\~=\lettertilde\let~=\~% +% \let\/=\letterslash\let/=\/% +% \let\savedurl\empty +% \scratchcounter\zerocount % used for hyphenmethod +% \handletokens#1\with\scanurl\savedurl +% \egroup} +% +% \egroup + +% \chardef\urlhyphenmethod=0 + +% \def\scanurl#1% +% {\advance\scratchcounter\plusone +% \ifx#1\blankspace +% \flushurl\splitanyway\normalspace +% \else\ifx#1\ % +% \flushurl\splitanyway\normalspace +% \else\ifx#1\space +% \flushurl\splitanyway\normalspace +% \else\ifx#1\~% +% \flushurl\splitbefore\~% +% \else\ifx#1\#% +% \flushurl\splitbefore\#% +% \else\ifx#1\&% +% \flushurl\splitbefore\&% +% \else\ifx#1\%% +% \flushurl\splitbefore\%% +% \else\ifx#1\_% +% \flushurl\splitbefore\_% +% \else\if\noexpand#1\relax +% #1% +% \else\ifnum\catcode`#1=8 +% \flushurl\splitbefore\_% +% \else\ifnum\catcode`#1=6 +% \flushurl\splitbefore\#% +% \else\ifnum\catcode`#1=4 +% \flushurl\splitbefore\&% +% \else\expandafter\if\string#1\lettertilde +% \flushurl\splitbefore\~% +% \else\expandafter\if\string#1\letterpercent +% \flushurl\splitbefore\%% +% \else\expandafter\if\string#1\letterunderscore +% \flushurl\splitbefore\_% +% \else\expandafter\if\string#1\letterquestionmark +% \flushurl\splitafter\letterquestionmark +% \else\expandafter\if\string#1\letterat +% \flushurl\splitafter\letterat +% \else\expandafter\if\string#1\letterslash +% \edef\savedurl{\savedurl\letterslash}% +% \else\expandafter\if\string#1+% +% \flushurl\splitafter+% +% \else\expandafter\if\string#1:% +% \flushurl\splitafter:% +% \else\expandafter\if\string#1.% +% \flushurl\splitafter.% +% \else\expandafter\if\string#1(% +% \flushurl\splitbefore(% +% \else\expandafter\if\string#1)% +% \flushurl\splitafter)% +% \else +% \ifx\savedurl\empty\else +% \splitbefore\savedurl +% \let\savedurl\empty +% \fi +% \ifcase\urlhyphenmethod +% \string#1% +% \else +% \ifnum\scratchcounter>\plusthree % so, \http: will not break +% \edef\savedurl{\string#1}% +% \else +% \string#1% +% \fi +% \fi +% \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +%D The following approach takes more resources but is cleaner (after all, we now +%D have huge \TEX's. It's is basically a \TEX\ version of the \MKIV\ variant. + +\newtoks\everyhyphenatedurl + +\appendtoks + \let\&\letterampersand + \let\#\letterhash + \let\~\lettertilde + \let\\\letterbackslash + \let\$\letterdollar + \let\^\letterhat + \let\_\letterunderscore + \let\{\letterleftbrace + \let\}\letterrightbrace + \let\|\letterbar + \let~=\lettertilde + \let|=\letterbar +\to \everyhyphenatedurl + +\def\hyphenatedurlseparator{} % \periodcentered + +\def\dohyphenatedurlnormal#1{\char#1\relax}% +\def\dohyphenatedurlafter #1{\char#1\discretionary{}{\hyphenatedurlseparator}{}}% +\def\dohyphenatedurlbefore#1{\discretionary{\hyphenatedurlseparator}{}{}\char#1\relax}% + +% 0=normal 1=before 2=after + +\def\sethyphenatedurlnormal#1{\expandafter\chardef\csname url @ #1\endcsname\zerocount} +\def\sethyphenatedurlbefore#1{\expandafter\chardef\csname url @ #1\endcsname\plusone } +\def\sethyphenatedurlafter #1{\expandafter\chardef\csname url @ #1\endcsname\plustwo } + +\sethyphenatedurlbefore ! +\sethyphenatedurlbefore " +\sethyphenatedurlbefore \letterhash +\sethyphenatedurlbefore \letterdollar +\sethyphenatedurlbefore \letterpercent +\sethyphenatedurlbefore \letterampersand +\sethyphenatedurlbefore ( +\sethyphenatedurlbefore * +\sethyphenatedurlbefore + +\sethyphenatedurlbefore , +\sethyphenatedurlbefore - +\sethyphenatedurlbefore . +\sethyphenatedurlbefore / +\sethyphenatedurlbefore : +\sethyphenatedurlbefore ; +\sethyphenatedurlbefore < +\sethyphenatedurlbefore = +\sethyphenatedurlbefore > +\sethyphenatedurlbefore ? +\sethyphenatedurlbefore @ +\sethyphenatedurlbefore [ +\sethyphenatedurlbefore \letterbackslash +\sethyphenatedurlbefore ^ +\sethyphenatedurlbefore _ +\sethyphenatedurlbefore ` +\sethyphenatedurlbefore \letteropenbrace +\sethyphenatedurlbefore \letterbar +\sethyphenatedurlbefore \lettertilde + +\sethyphenatedurlafter ' +\sethyphenatedurlafter ) +\sethyphenatedurlafter ] +\sethyphenatedurlafter \letterclosebrace + +\unexpanded \def\hyphenatedurl#1% + {\dontleavehmode + \begingroup + \the\everyhyphenatedurl + \edef\ascii{#1}% + \expanded{\handletokens{\detokenize\expandafter{\ascii}}}\with\dohyphenatedurl + \endgroup} + +\def\dohyphenatedurl#1% + {\ifcase\executeifdefined{url @ #1}\zerocount\relax + \expandafter\dohyphenatedurlnormal + \or + \expandafter\dohyphenatedurlbefore + \or + \expandafter\dohyphenatedurlafter + \fi{\number`#1}} + +% maybe ... to be finished +% +% \def\hyphenatedstring#1% +% {\bgroup +% \nohyphens +% \def\next##1{##1\doif{##1}{-}{\allowbreak}}% +% \handletokens#1\with\next +% \egroup} +% +% {\hsize1cm\hyphenatedstring{ABXXXXXXXXXXC-12345-12345}} + +\protect \endinput diff --git a/tex/context/base/lang-url.mkiv b/tex/context/base/lang-url.mkiv new file mode 100644 index 000000000..7479fed68 --- /dev/null +++ b/tex/context/base/lang-url.mkiv @@ -0,0 +1,64 @@ +%D \module +%D [ file=lang-url, +%D version=2008.01.22, % used to be lang-mis +%D title=\CONTEXT\ Language Macros, +%D subtitle=Language Options, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\registerctxluafile{lang-url}{1.001} + +\unprotect + +% \urlsplitmode is not (yet) supported (not that much needed) + +\newtoks\everyhyphenatedurl + +\appendtoks + \let\&\letterampersand + \let\#\letterhash + \let\~\lettertilde + \let\\\letterbackslash + \let\$\letterdollar + \let\^\letterhat + \let\_\letterunderscore + \let\{\letterleftbrace + \let\}\letterrightbrace + \let\|\letterbar + \let~=\lettertilde + \let|=\letterbar +\to \everyhyphenatedurl + +\def\hyphenatedurlseparator{} % \periodcentered + +\def\dohyphenatedurlafter #1{\char#1\discretionary{}{\hyphenatedurlseparator}{}}% +\def\dohyphenatedurlbefore#1{\discretionary{\hyphenatedurlseparator}{}{}\char#1\relax}% +\def\dohyphenatedurlnormal#1{\char#1\relax}% + +\def\sethyphenatedurlnormal#1{\ctxlua{commands.hyphenatedurl.characters[\!!bs#1\!!es]=0}} +\def\sethyphenatedurlbefore#1{\ctxlua{commands.hyphenatedurl.characters[\!!bs#1\!!es]=1}} +\def\sethyphenatedurlafter #1{\ctxlua{commands.hyphenatedurl.characters[\!!bs#1\!!es]=2}} + +\chardef\hyphenatedurllefthyphenmin = 3 +\chardef\hyphenatedurlrighthyphenmin = 3 + +\unexpanded \def\hyphenatedurl#1% + {\dontleavehmode + \begingroup + \the\everyhyphenatedurl + \let\n\dohyphenatedurlnormal + \let\b\dohyphenatedurlbefore + \let\a\dohyphenatedurlafter + \expanded{\ctxlua{commands.hyphenatedurl.action( + \!!bs\noexpand\detokenize{#1}\!!es, + \number\hyphenatedurllefthyphenmin, + \number\hyphenatedurlrighthyphenmin + )}}% + \endgroup} + +\protect \endinput diff --git a/tex/context/base/lang-url.tex b/tex/context/base/lang-url.tex new file mode 100644 index 000000000..552dae571 --- /dev/null +++ b/tex/context/base/lang-url.tex @@ -0,0 +1,70 @@ +%D \module +%D [ file=lang-url, +%D version=2008.01.22, % used to be lang-mis +%D title=\CONTEXT\ Language Macros, +%D subtitle=Language Options, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{Context Language Macros / URL} + +\loadmarkfile{lang-url} + +\unprotect + +\ifx\urlsplitmode\undefined \chardef\urlsplitmode\zerocount \fi % not supported in mkiv + +%D \macros +%D {hyphenatedurl} +%D +%D For those who want to put full \URL's in a text, we offer +%D +%D \startbuffer +%D \hyphenatedurl{http://optimist.optimist/optimist/optimist.optimist#optimist} +%D \stopbuffer +%D +%D \typebuffer +%D +%D which breaks at the appropriate places. Watch the \type{#} +%D hack. +%D +%D When passed as argument, like in \type {\goto}, one needs +%D to substitute a \type {\\} for each \type{#}. +%D +%D \startbuffer +%D \hyphenatedurl{http://this.is.a.rather/strange/reference#indeed} +%D \stopbuffer +%D +%D \typebuffer + +\ifx\hyphenatedurl\undefined \let\hyphenatedurl\firstofoneargument \fi + +%D \macros +%D {hyphenatedfile} +%D +%D For the moment we treat filenames in a similar way, +%D +%D \starttyping +%D \hyphenatedfile{here/there/filename.suffix} +%D \stoptyping + +\ifx\hyphenatedfile\undefined \let\hyphenatedfile\hyphenatedurl \fi + +% \def\test#1% +% {\dontleavehmode +% \begingroup +% \tttf +% \hyphenatedurl {% +% \letterampersand #1\letterampersand #1\letterampersand #1\letterampersand #1\letterampersand +% \letterhash #1\letterhash #1\letterpercent #1\letterslash #1\letterampersand +% }% +% \endgroup} + +% \dorecurse{100}{\test{a} \test{ab} \test{abc} \test{abcd} \test{abcde} \test{abcdef}} + +\protect \endinput diff --git a/tex/context/base/luat-env.lua b/tex/context/base/luat-env.lua index 85dbd7033..c75edc5f3 100644 --- a/tex/context/base/luat-env.lua +++ b/tex/context/base/luat-env.lua @@ -131,7 +131,7 @@ function environment.loadluafile(filename,register) environment.showmessage("loading", fullname) if register then if not environment.regfil then - environment.regfil = io.open('luafiles.tmp', 'w') + environment.regfil = io.open('luafiles.tmp', 'w') -- we can consider 'a' end if environment.regfil then environment.regfil:write(fullname .."\n") @@ -156,13 +156,6 @@ function environment.loadlucfile(filename,version) environment.showmessage("loading", fullname) assert(chunk)() if version then ---~ if modules and modules[filename] and modules[filename].version ~= version then ---~ environment.showmessage("version mismatch", filename,"lua=" .. modules[filename].version, "luc=" ..version) ---~ environment.loadluafile(filename) ---~ elseif versions and versions[filename] and versions[filename] ~= version then ---~ environment.showmessage("version mismatch", filename,"lua=" .. versions[filename], "luc=" ..version) ---~ environment.loadluafile(filename) ---~ end local v = version -- can be nil if modules and modules[filename] then v = modules[filename].version -- new diff --git a/tex/context/base/luat-inp.lua b/tex/context/base/luat-inp.lua index 9ccf6ceeb..618696cb6 100644 --- a/tex/context/base/luat-inp.lua +++ b/tex/context/base/luat-inp.lua @@ -1055,22 +1055,132 @@ function input.unexpanded_path(instance,str) return file.join_path(input.unexpanded_path_list(instance,str)) end +--~ function input.expanded_path_list(instance,str) +--~ if not str then +--~ return { } +--~ elseif instance.savelists then +--~ -- engine+progname hash +--~ str = str:gsub("%$","") +--~ if not instance.lists[str] then -- cached +--~ local lst = input.split_path(input.expansion(instance,str)) +--~ instance.lists[str] = input.aux.expanded_path(instance,lst) +--~ end +--~ return instance.lists[str] +--~ else +--~ local lst = input.split_path(input.expansion(instance,str)) +--~ return input.aux.expanded_path(instance,lst) +--~ end +--~ end + +do + local done = { } + + function input.reset_extra_path(instance) + local ep = instance.extra_paths + if not ep then + ep, done = { }, { } + instance.extra_paths = ep + elseif #ep > 0 then + instance.lists, done = { }, { } + end + end + + function input.register_extra_path(instance,paths,subpaths) + local ep = instance.extra_paths or { } + local n = #ep + if paths and paths ~= "" then + if subpaths and subpaths ~= "" then + for p in paths:gmatch("[^,]+") do + -- we gmatch each step again, not that fast, but used seldom + for s in subpaths:gmatch("[^,]+") do + local ps = p .. "/" .. s + if not done[ps] then + ep[#ep+1] = input.clean_path(ps) + done[ps] = true + end + end + end + else + for p in paths:gmatch("[^,]+") do + if not done[p] then + ep[#ep+1] = input.clean_path(p) + done[p] = true + end + end + end + elseif subpaths and subpaths ~= "" then + for i=1,n do + -- we gmatch each step again, not that fast, but used seldom + for s in subpaths:gmatch("[^,]+") do + local ps = ep[i] .. "/" .. s + if not done[ps] then + ep[#ep+1] = input.clean_path(ps) + done[ps] = true + end + end + end + end + if #ep > 0 then + instance.extra_paths = ep -- register paths + end + if #ep > n then + instance.lists = { } -- erase the cache + end + end + +end + function input.expanded_path_list(instance,str) + local function made_list(list) + local ep = instance.extra_paths + if not ep or #ep == 0 then + return list + else + local done, new = { }, { } + -- honour . .. ../.. but only when at the start + for k, v in ipairs(list) do + if not done[v] then + if v:find("^[%.%/]$") then + done[v] = true + new[#new+1] = v + else + break + end + end + end + -- first the extra paths + for k, v in ipairs(ep) do + if not done[v] then + done[v] = true + new[#new+1] = v + end + end + -- next the formal paths + for k, v in ipairs(list) do + if not done[v] then + done[v] = true + new[#new+1] = v + end + end + return new + end + end if not str then - return { } + return ep or { } elseif instance.savelists then -- engine+progname hash str = str:gsub("%$","") if not instance.lists[str] then -- cached - local lst = input.split_path(input.expansion(instance,str)) + local lst = made_list(input.split_path(input.expansion(instance,str))) instance.lists[str] = input.aux.expanded_path(instance,lst) end return instance.lists[str] else local lst = input.split_path(input.expansion(instance,str)) - return input.aux.expanded_path(instance,lst) + return made_list(input.aux.expanded_path(instance,lst)) end end + function input.expand_path(instance,str) return file.join_path(input.expanded_path_list(instance,str)) end @@ -1937,7 +2047,11 @@ end function input.clean_path(str) --~ return (((str:gsub("\\","/")):gsub("^!+","")):gsub("//+","//")) - return ((str:gsub("\\","/")):gsub("^!+","")) + if str then + return ((str:gsub("\\","/")):gsub("^!+","")) + else + return nil + end end function input.do_with_path(name,func) diff --git a/tex/context/base/m-chart.tex b/tex/context/base/m-chart.tex index 2a29333b1..e08ff4276 100644 --- a/tex/context/base/m-chart.tex +++ b/tex/context/base/m-chart.tex @@ -1207,8 +1207,8 @@ \def\typeFLOWchart[#1]% {\bgroup \def\dohandleflowchart[##1][##2]{\typeFLOWbuffer{##1}}% - \convertargument\startFLOWchart[#1]\to\firstverbatimfileline - \convertargument \stopFLOWchart\to\lastverbatimfileline + \defconvertedargument\firstverbatimfileline{\startFLOWchart[#1]}% + \defconvertedargument\lastverbatimfileline {\stopFLOWchart}% \getvalue{\@FLOW@-#1} \egroup} diff --git a/tex/context/base/m-cweb.tex b/tex/context/base/m-cweb.tex index 044648d0b..c416c9b36 100644 --- a/tex/context/base/m-cweb.tex +++ b/tex/context/base/m-cweb.tex @@ -27,9 +27,9 @@ \def\dofindfirstcharacter#1#2% {\def\firstcharacter{}% \bgroup - \convertargument#2\to\ascii - \let\next=\dodofindfirstcharacter - \let\handlecase=#1 + \defconvertedargument\ascii{#2}% + \let\next\dodofindfirstcharacter + \let\handlecase#1% \expandafter\next\ascii\relax} \def\normalcase#1% @@ -1135,7 +1135,7 @@ \fi \message{*\secno}% progress report \makesectionformat % context - \convertargument#3\to\ascii + \defconvertedargument\ascii{#3}% \edef\next% {\write\CWEBcont % write to contents file {\string\ZZ{\ascii}{#1}{\secno}% @@ -1251,7 +1251,7 @@ \def\9##1{##1}% hold this one \catcode`*=11 \expandafter\def\expandafter\entry\expandafter{#1}% - \convertcommand\entry\to\ascii + \defconvertedcommand\ascii\entry \expanded{\FINDFIRSTCHARACTER{\ascii}}% \doifnot{\currentCWEBindexentry}{\firstcharacter} {\doifnot{\firstcharacter}{*} % signal for \firstbunch diff --git a/tex/context/base/m-database.tex b/tex/context/base/m-database.tex index 0486a062f..6cb9a6b6c 100644 --- a/tex/context/base/m-database.tex +++ b/tex/context/base/m-database.tex @@ -255,7 +255,7 @@ \ifx\currentlistquotechar\empty% \doprocessseplist#1\relax \else% - \convertargument#1\to\csvdata% + \defconvertedargument\csvdata{#1}% \expanded{\processquotedlist{}{\noexpand\end}% {\currentlistseparator}{\currentlistquotechar}% \noexpand\doprocessseparatedquoteditem \csvdata\currentlistseparator\noexpand\end}% diff --git a/tex/context/base/math-run.tex b/tex/context/base/math-run.tex index acb5bce3f..affa8d5af 100644 --- a/tex/context/base/math-run.tex +++ b/tex/context/base/math-run.tex @@ -89,9 +89,7 @@ ?% \fi\fi \NC \NR \NC visualization \NC \mathematics{\getvalue{#1}} \NC \NR - \NC definition \NC \tttf \@EA \convertcommand - \csname\@mt@\mathcollection#1\endcsname - \to \ascii \ascii \NC \NR + \NC definition \NC \tttf \@EA\defconvertedcommand\@EA\ascii\csname\@mt@\mathcollection#1\endcsname \ascii \NC \NR \stoptabulate} \protect \endinput diff --git a/tex/context/base/math-tex.tex b/tex/context/base/math-tex.tex index b2aeb5ce5..291bad93f 100644 --- a/tex/context/base/math-tex.tex +++ b/tex/context/base/math-tex.tex @@ -2,7 +2,7 @@ %D [ file=math-tex, %D version=2001.04.12, %D subtitle=Plain Specials, -%D author={Hans Hagen \& Taco Hoekwater}, +%D author={Hans Hagen, Taco Hoekwater \& Aditya Mahajan}, %D date=\currentdate, %D copyright=\PRAGMA] %C @@ -26,6 +26,46 @@ \definefamilysynonym [default] [ucgreek] [mr] \definefamilysynonym [default] [vargreek] [mi] + +%D \macros +%D {\setupmathematics} +%D +%D Configuration for integrals. (If needed we can speed this up and make it +%D installable; no processaction is needed then). + +\chardef\intlimitcode\zerocount % 0 nolimits 1 displaylimits 2 limits + +\def\intlimits + {\ifcase\intlimitcode \nolimits \or \displaylimits \or \limits \fi} + +\def\setupmathematics + {\dosingleargument\dosetupmathematics} + +\def\dosetupmathematics[#1]% + {\getparameters[\??mo][#1] + \processaction[\@@mointegral] + [ nolimits=>\chardef\intlimitcode\zerocount, + displaylimits=>\chardef\intlimitcode\plusone, + limits=>\chardef\intlimitcode\plustwo]} + +%D \startbuffer +%D $\int_a^b f(x) dx$ and also +%D $\iint_a^b f(x,y) dxdy$, $\iiint_a^b f(x,y) dxdy$, +%D $\iiiint_a^b f(x) dx$ +%D \startformula +%D \int_a^b f(x) dx \quad +%D \iint_a^b f(x) dx \quad +%D \iiint_a^b f(x) dx \quad +%D \iiiint_a^b f(x) dx \quad +%D \stopformula +%D \stopbuffer +%D +%D Default: \getbuffer +%D +%D Displaylimits: \setupmathematics[integral=displaylimits] \getbuffer +%D +%D Limits: \setupmathematics[integral=limits] \getbuffer + \startmathcollection [default] \definemathsymbol [alpha] [nothing] [lcgreek] ["0B] @@ -321,8 +361,8 @@ \startmathcollection[default] \definemathcommand [lnot] {\neg} -\definemathcommand [int] {\intop\nolimits} -\definemathcommand [oint] {\ointop\nolimits} +\definemathcommand [int] {\intop \intlimits} +\definemathcommand [oint] {\ointop\intlimits} \definemathcommand [land] {\wedge} \definemathcommand [lor] {\vee} \definemathcommand [neq] {\not=} @@ -648,9 +688,10 @@ \def\repeatintegral#1% {\scratchtoks\emptytoks - \let\dointlimits\nolimits + \let\dointlimits\donothing + \let\dodointlimits\intlimits \dorecurse{#1}{\appendtoks \intop \dointkern \to \scratchtoks} - \appendtoks \intop \dointlimits \to \scratchtoks + \appendtoks \intop \dointlimits \dodointlimits \to \scratchtoks \edef\dodorepeatintegral{\the\scratchtoks}% \futurelet\next\dorepeatintegral} @@ -659,8 +700,10 @@ %D subscript visually centered. \def\dorepeatintegral - {\ifx\next\limits \dointlimitcorrection \else - \ifx\next\displaylimits \dointlimitcorrection \fi\fi + {\ifx\next\limits \dointlimitcorrection \else + \ifx\next\displaylimits \dointlimitcorrection \else + \ifx\next\nolimits \donothing \else + \ifcase\intlimitcode\else \dointlimitcorrection \fi\fi\fi\fi \dodorepeatintegral} \def\dointlimitcorrection @@ -669,4 +712,8 @@ \mkern7mu\mathchoice{\mkern2mu}{}{}{}% \let\dointlimits\egroup} + +\setupmathematics + [integral=nolimits] + \protect \endinput diff --git a/tex/context/base/meta-ini.tex b/tex/context/base/meta-ini.tex index 4831967ef..d807795be 100644 --- a/tex/context/base/meta-ini.tex +++ b/tex/context/base/meta-ini.tex @@ -440,8 +440,8 @@ {\edef\theMPvariable{\getvalue{#1}}% \doifelsenothing\theMPvariable {\setevalue{#1}{\MPcolor{black}}} - {\convertcommand\theMPvariable\to\ascii % otherwise problems - \doifcolorelse \ascii % with 2\bodyfontsize + {\defconvertedcommand\ascii\theMPvariable % otherwise problems + \doifcolorelse \ascii % with 2\bodyfontsize {\setevalue{#1}{\MPcolor\theMPvariable}} {% can be aux macro \setbox\scratchbox\hbox{\scratchdimen\theMPvariable sp}% @@ -562,18 +562,6 @@ %D A more general way of passing environments is: -% ok but introduces \relax's -% -% \def\startMPenvironment % second arg gobbles spaces, so -% {\dodoubleempty\dostartMPenvironment} % that reset gives \emptytoks -% -% \long\def\dostartMPenvironment[#1][#2]#3\stopMPenvironment% -% {\doif{#1}\s!reset\resetMPenvironment % reset mp toks -% \doif{#1}\v!globaal{#3}% % use in main doc too -% \doif{#1}+{#3}% % use in main doc too -% \convertargument#3\to\ascii -% \expandafter\appendtoks\ascii\to\everyMPTEXgraphic} - \def\startMPenvironment % second arg gobbles spaces, so that reset gives \emptytoks {\bgroup \catcode`\^^M=\@@space @@ -584,7 +572,7 @@ \doif{#1}\s!reset\resetMPenvironment % reset mp toks \doif{#1}\v!global{#3}% % use in main doc too \doif{#1}+{#3}% % use in main doc too - \convertargument#3\to\ascii + \defconvertedargument\ascii{#3}% \expandafter\appendtoks\ascii\to\everyMPTEXgraphic} \def\resetMPenvironment @@ -707,7 +695,7 @@ \def\setMPtext#1#2% todo : #1 must be made : safe {%\forceMPTEXgraphic - \convertargument#2\to\ascii + \defconvertedargument\ascii{#2}% \dodoglobal\letvalue{\@@MPT#1}\ascii} % \def\MPtext #1{\getvalue{\@@MPT#1}} diff --git a/tex/context/base/meta-pdf.mkii b/tex/context/base/meta-pdf.mkii index 97aedf97e..51e01d8ed 100644 --- a/tex/context/base/meta-pdf.mkii +++ b/tex/context/base/meta-pdf.mkii @@ -672,7 +672,7 @@ {\ifnum\nofMParguments>\plusthree \handleMPtextnormal \else - \convertcommand\MPtextdata\to\MPtextdata + \defconvertedcommand\MPtextdata\MPtextdata \expanded{\splitstring\MPtextdata}\at::::\to\MPtexttag\and\MPtextnumber \executeifdefined{handleMPtext\MPtexttag}\handleMPtextnormal \fi} diff --git a/tex/context/base/meta-pdf.mkiv b/tex/context/base/meta-pdf.mkiv index e8ce94146..90b7b5dd8 100644 --- a/tex/context/base/meta-pdf.mkiv +++ b/tex/context/base/meta-pdf.mkiv @@ -78,11 +78,11 @@ % will be done better \def\MPStextext#1#2#3#4#5% if we clean up this plugin model, we can - {\def\MPtextdata{#3}% % delegate the splitter to lua + {\def\MPtextdata{#3}% % delegate the splitter to lua \def\MPtextsize{#2}% \def\lastMPmoveX{#4}% \def\lastMPmoveY{#5}% - \convertcommand\MPtextdata\to\MPtextdata + \defconvertedcommand\MPtextdata\MPtextdata % no edef \splitstring\MPtextdata\at::::\to\MPtexttag\and\MPtextnumber \executeifdefined{handleMPtext\MPtexttag} {\setbox\scratchbox\hbox diff --git a/tex/context/base/meta-tex.tex b/tex/context/base/meta-tex.tex index 616a2513c..720de6fb3 100644 --- a/tex/context/base/meta-tex.tex +++ b/tex/context/base/meta-tex.tex @@ -219,7 +219,7 @@ \global\MPTEXgraphictrue \else \global\MPTEXgraphicfalse - \edef\ascii{#1}\convertcommand\ascii\to\MPascii + \edef\ascii{#1}\defconvertedcommand\MPascii\ascii \the\MPTEXgraphicchecks\relax % \relax is end condition! \fi \flushMPTEXgraphic% % verbatimtex etc diff --git a/tex/context/base/meta-xml.tex b/tex/context/base/meta-xml.tex index 2138111f8..f6f81f767 100644 --- a/tex/context/base/meta-xml.tex +++ b/tex/context/base/meta-xml.tex @@ -23,7 +23,7 @@ \def\setMPtextXML#1#2% {\bgroup \enableXML - \expanded{\convertcommand#2}\to\ascii + \expanded{\defconvertedcommand\noexpand\ascii{#2}}% \expanded{\egroup\noexpand\dodoglobal\noexpand\setvalue{\@@MPT#1}{\ascii}}} \protect \endinput diff --git a/tex/context/base/page-flt.tex b/tex/context/base/page-flt.tex index 138f6ab75..0aa8deb45 100644 --- a/tex/context/base/page-flt.tex +++ b/tex/context/base/page-flt.tex @@ -1299,7 +1299,7 @@ \setgvalue{@fl@r@#1}% {\tracefloatnumber{#1}% \dowritetolist{#1}{\getvalue{@fl@n@#1}}{#3}{#1}% - \doglobal\convertargument#3\to\flasciititle % \asciititle is global + \gdefconvertedargument\flasciititle{#3}% \asciititle is global \doifsomething{#2}{\rawreference\s!flt{#2}{{\getvalue{@fl@n@#1}}{\flasciititle}}}% \letgvalue{@fl@r@#1}\relax}% nils \setgvalue{@fl@t@#1}% @@ -2095,7 +2095,7 @@ \egroup \dofloat{#4}{}{#6}% \else - \doglobal\convertargument#6\to\asciititle % \asciititle is global + \gdefconvertedargument\asciititle{#6}% \asciititle is global \ifnofloatnumber \global\setbox\floatbox\vbox {\unvbox\floatbox % no \vss, keep the depth diff --git a/tex/context/base/page-ini.tex b/tex/context/base/page-ini.tex index 6c0760d8b..03d90198a 100644 --- a/tex/context/base/page-ini.tex +++ b/tex/context/base/page-ini.tex @@ -783,8 +783,13 @@ \output{\inotrtrue\the\everybeforeoutput\the\mainoutput\the\everyafteroutput} +\ifx\pagediscards\undefined \let\pagediscards\relax \fi + \installoutput\synchronizeoutput % maybe add pagediscards - {\ifvoid\normalpagebox\else\unvbox\normalpagebox\fi} + {\ifvoid\normalpagebox\else + \unvbox\normalpagebox + \pagediscards % maybe not needed ? + \fi} \installoutput\discardpage {\setbox\scratchbox\box\normalpagebox} @@ -1074,7 +1079,7 @@ \def\doplaceversiontext#1#2% {\doifsomething{#2} - {\@EA\convertargument#2\to\ascii + {\defconvertedcommand\ascii{#2}% \space#1:\space\ascii\space \!!doneatrue}} @@ -1137,7 +1142,7 @@ \def\dotestinfo#1#2#3% {\ifinpagebody\else\ifnum\conceptmode=\plusthree \begingroup - \@EA\convertargument#3\to\ascii + \defconvertedcommand\ascii{#3}% \xdef\extratestinfo {#2\space\ascii}% \gdef\totaltestinfo @@ -1526,9 +1531,16 @@ \fi \fi} -\ifx\flushpagesofar\undefined - \let\flushpagesofar\relax -\fi +\def\flushpagesofar + {\endgraf + \ifdim\pagetotal>\pagegoal + \ifdim\dimexpr\pagetotal-\pageshrink\relax>\pagegoal + \goodbreak % \penalty0 + \else + \page + \fi + \else + \fi} \def\testcolumn {\dodoubleempty\dotestcolumn} diff --git a/tex/context/base/page-txt.tex b/tex/context/base/page-txt.tex index 3dc7721c9..c39d592ab 100644 --- a/tex/context/base/page-txt.tex +++ b/tex/context/base/page-txt.tex @@ -196,7 +196,7 @@ \def\dosingletexts#1#2#3#4#5#6% {\bgroup - \convertargument#6\to\ascii + \defconvertedargument\ascii{#6}% \doifsomething\ascii {\doattributes{#1#2}#3#4% {\placetextlinestrut{#1}% here ! diff --git a/tex/context/base/sort-ini.mkii b/tex/context/base/sort-ini.mkii index 3c79ef5f9..0f0499946 100644 --- a/tex/context/base/sort-ini.mkii +++ b/tex/context/base/sort-ini.mkii @@ -75,8 +75,8 @@ \let\currentexportclass\empty \def\exportsortaction#1#2#3% - {\convertargument#2\to\asciia - \convertargument#3\to\asciib + {\defconvertedargument\asciia{#2}% + \defconvertedargument\asciib{#3}% \immediatewriteutility{x #1 {\currentexportclass} {\asciia} {\asciib}}} \def\exportsortshortcut {\exportsortaction s} diff --git a/tex/context/base/spec-fdf.mkii b/tex/context/base/spec-fdf.mkii index d04890381..a329dc50a 100644 --- a/tex/context/base/spec-fdf.mkii +++ b/tex/context/base/spec-fdf.mkii @@ -94,7 +94,7 @@ \lccode`< \zerocount \lccode`> \zerocount \lccode`[ \zerocount \lccode`] \zerocount \lccode`\\\zerocount \lccode`/ \zerocount - \lowercase{\convertargument#1\to\ascii}% + \lowercase{\defconvertedargument\ascii{#1}}% % by integrating the split in the loop below % \splitofftokens\maxPDFstringsize\from\ascii\to\ascii % we diminish the processing time considerably diff --git a/tex/context/base/spec-fdf.tex b/tex/context/base/spec-fdf.tex index 3531ca0d9..754ce4a0f 100644 --- a/tex/context/base/spec-fdf.tex +++ b/tex/context/base/spec-fdf.tex @@ -932,7 +932,7 @@ \def\doPDFattachfile#1#2#3#4#5#6#7#8% {\bgroup % title width height color symbol file - \edef\PDFfile{#8}\convertcommand\PDFfile\to\PDFfile + \edefconvertedargument\PDFfile{#8}% % beware: the symbol may (indirectly) use the file % reference when typesetting the object number; \presetPDFsymbolappearance{#5}{#6}{#2}{#3}{#4}% sets width/height @@ -953,17 +953,17 @@ % semi-public \def\doPDFembedfile#1#2#3% symbolic name | filename | user name - {\edef\PDFfile{#1}\convertcommand\PDFfile\to\PDFfile + {\edefconvertedargument\PDFfile{#1}% \doifnotflagged{a:\PDFfile}% {\doPDFfilestreamobject{PDFEF}{\PDFfile}{#2}{#3}% \doglobal\setflag{a:\PDFfile}}} \def\doPDFgetembeddedfilereference#1#2% - {\edef\PDFfile{#1}\convertcommand\PDFfile\to\PDFfile + {\edefconvertedargument\PDFfile{#1}% \doPDFgetobjectreference{PDFEF}\PDFfile#2} \def\doPDFgetembeddedfilestreamreference#1#2% - {\edef\PDFfile{#1}\convertcommand\PDFfile\to\PDFfile + {\edefconvertedargument\PDFfile{#1}% \doPDFgetfilestreamreference\PDFfile#2} % == \doPDFgetobjectreference{PDFFS}\PDFfile#2 \definespecial \doattachfile {\doPDFattachfile} @@ -2318,9 +2318,9 @@ \def/doVb##1##2 {\egroup\check\Value{##2}} % watch the space \def\check##1##2% {\def##1{##2} - \advance\scratchcounter by 1 + \advance\scratchcounter\plusone\relax \ifodd\scratchcounter \else - \convertcommand\Title\to\asciia + \defconvertedcommand\asciia\Title \global\setFDFfield{\asciia}{\Value} \doglobal\addtocommalist\Title\allFDFfields \fi} diff --git a/tex/context/base/spec-mis.tex b/tex/context/base/spec-mis.tex index c85498127..bfd253205 100644 --- a/tex/context/base/spec-mis.tex +++ b/tex/context/base/spec-mis.tex @@ -163,7 +163,7 @@ *egroup \long\def\escapePSstring#1\to#2% - {\convertargument#1\to#2% + {\defconvertedargument#2{#1}% \bgroup \ifx#2\empty \else \setverbosecscharacters diff --git a/tex/context/base/supp-fil.mkii b/tex/context/base/supp-fil.mkii index 56ff7962a..ff4a2ab01 100644 --- a/tex/context/base/supp-fil.mkii +++ b/tex/context/base/supp-fil.mkii @@ -36,7 +36,6 @@ \lccode`\\=`\/ \lowercase{\expanded{\xdef\noexpand\sanitizedfilename{#1}}}% \egroup - % maybe \convertcommand\sanitizedfilename\to#2% \let#2\sanitizedfilename} \egroup diff --git a/tex/context/base/supp-fun.tex b/tex/context/base/supp-fun.tex index 080c3f958..b3b270328 100644 --- a/tex/context/base/supp-fun.tex +++ b/tex/context/base/supp-fun.tex @@ -132,8 +132,8 @@ \fi \def\DroppedCaps#1#2#3#4#5#6#7% does not yet handle accented chars - {\convertargument #7\to\asciia - \convertcommand \DroppedString\to\asciib + {\defconvertedargument\asciia{#7}% + \defconvertedcommand \asciib{\DroppedString}% \ExpandBothAfter\doifinstringelse\asciia\asciib {\noindentation \dontleavehmode diff --git a/tex/context/base/supp-lan.tex b/tex/context/base/supp-lan.tex index 0daf134a6..ec9176b50 100644 --- a/tex/context/base/supp-lan.tex +++ b/tex/context/base/supp-lan.tex @@ -21,7 +21,7 @@ %D \blank} %D %D \gdef\test#1% -%D {\convertargument#1\to\ascii\ascii&\hyphenatedword{#1}\cr} +%D {\defconvertedargument\ascii{#1}\ascii&\hyphenatedword{#1}\cr} %D One of \TEX's strong points in building paragraphs is the way %D hyphenations are handled. Although for real good hyphenation @@ -298,7 +298,7 @@ \beginTEX \def\installdiscretionaries#1#2#3% - {\convertargument#1\to\ascii + {\defconvertedargument\ascii{#1}% \setevalue{\strippedcsname\mathmodediscretionary\string#1}{\ascii}% \setvalue {\strippedcsname\textmodediscretionary\string#1}{#3}% \catcode`#1=\@@active @@ -713,7 +713,7 @@ \next} \def\activedododotextmodediscretionary#1#2% - {\convertargument#2\to\discretionarytoken + {\defconvertedargument\discretionarytoken{#2}% \def\textmodediscretionary {\getvalue{\strippedcsname\textmodediscretionary\string#1}}% \ifx#1\nextnext % takes care of ||| and +++ and ...... @@ -729,20 +729,20 @@ % but an hbox blocks a possible \discretionary \prewordbreak\textmodediscretionary\nextnext\allowbreak\postwordbreak \egroup - \else\convertargument=\to\next\ifx\next\discretionarytoken + \else\defconvertedargument\next=\ifx\next\discretionarytoken \prewordbreak\textmodediscretionary - \else\convertargument~\to\next\ifx\next\discretionarytoken + \else\defconvertedargument\next~\ifx\next\discretionarytoken \prewordbreak\discretionary{-}{}{\thinspace}\postwordbreak - \else\convertargument_\to\next\ifx\next\discretionarytoken + \else\defconvertedargument\next_\ifx\next\discretionarytoken \prewordbreak\discretionary{\textmodediscretionary} {\textmodediscretionary}{\textmodediscretionary}\prewordbreak - \else\convertargument(\to\next\ifx\next\discretionarytoken + \else\defconvertedargument\next(\ifx\next\discretionarytoken \ifdim\lastskip>\zeropoint\relax (\prewordbreak \else \prewordbreak\discretionary{}{(-}{(}\prewordbreak \fi - \else\convertargument)\to\next\ifx\next\discretionarytoken + \else\defconvertedargument\next)\ifx\next\discretionarytoken \ifx\nextnext\blankspace \prewordbreak)\relax \else\ifx\nextnext\space @@ -750,13 +750,13 @@ \else \prewordbreak\discretionary{-)}{}{)}\prewordbreak \fi\fi - \else\convertargument'\to\next\ifx\next\discretionarytoken + \else\defconvertedargument\next'\ifx\next\discretionarytoken \prewordbreak\discretionary{-}{}{'}\postwordbreak - \else\convertargument<\to\next\ifx\next\discretionarytoken + \else\defconvertedargument\next<\ifx\next\discretionarytoken \beginofsubsentence\prewordbreak\beginofsubsentencespacing - \else\convertargument>\to\next\ifx\next\discretionarytoken + \else\defconvertedargument\next>\ifx\next\discretionarytoken \endofsubsentencespacing\prewordbreak\endofsubsentence - \else\convertargument^\to\next\ifx\next\discretionarytoken + \else\defconvertedargument\next^\ifx\next\discretionarytoken \prewordbreak\discretionary{\hbox{$|$}}{}{\hbox{$|$}}% \allowbreak\postwordbreak \else @@ -778,7 +778,7 @@ \def\@tmd@{@@tmd@@} \def\activedododotextmodediscretionary#1#2% - {\convertargument#2\to\discretionarytoken + {\defconvertedargument\discretionarytoken{#2}% \def\textmodediscretionary% {\getvalue{\strippedcsname\textmodediscretionary\string#1}}% \ifx\discretionarytoken\empty @@ -814,7 +814,7 @@ \nextnextnext} % lookahead in commands \def\definetextmodediscretionary #1 - {\convertargument#1\to\ascii + {\defconvertedargument\ascii{#1}% \setvalue{\@tmd@\ascii}} \definetextmodediscretionary {} % empty case, also handled in parser @@ -913,7 +913,7 @@ %D we have \type {\nextnextnext}. \unexpanded\def\directdiscretionary#1% - {\convertargument#1\to\discretionarytoken + {\defconvertedargument\discretionarytoken{#1}% \let\textmodediscretionary\compoundhyphen \expandafter\ifx\csname\@tmd@\string#1\endcsname\relax \prewordbreak @@ -1298,7 +1298,7 @@ %D This would be better, but it spoils \type {\~} and so: %D %D \starttyping -%D \convertargument#1\to\ascii +%D \defconvertedargument\ascii{#1} %D \expandafter\handletokens\ascii\with\scanurl %D \stoptyping @@ -1395,7 +1395,7 @@ %D {{\let~\lettertilde\useURL[dummy][#1]\goto{\url[dummy]}[URL(dummy)]}} %D %D \def\whateverurl#1% -%D {\convertargument#1\to\ascii +%D {\defconvertedargument\ascii{#1}% %D \expanded{\useURL[dummy][\ascii]}\goto{\url[dummy]}[URL(dummy)]} %D \stoptyping diff --git a/tex/context/base/supp-mis.tex b/tex/context/base/supp-mis.tex index 51205dc1e..57661e591 100644 --- a/tex/context/base/supp-mis.tex +++ b/tex/context/base/supp-mis.tex @@ -384,8 +384,8 @@ \def\doconvertargument#1>{} \long\def\convertargument#1\to#2% - {\long\def\convertedargument{#1}% - \edef#2{\expandafter\doconvertargument\meaning\convertedargument}} + {\long\def\@@convertedargument{#1}% + \edef#2{\expandafter\doconvertargument\meaning\@@convertedargument}} \fi diff --git a/tex/context/base/syst-ext.tex b/tex/context/base/syst-ext.tex index 1388f4f2b..c63452644 100644 --- a/tex/context/base/syst-ext.tex +++ b/tex/context/base/syst-ext.tex @@ -1205,10 +1205,6 @@ \def\convertedcommand {\expandafter\doconvertargument\meaning} -%\long\def\convertargument#1\to#2% -% {\long\def\convertedargument{#1}% -% \dodoglobal\edef#2{\convertedcommand\convertedargument}} - \long\def\convertargument#1\to#2% {\long\def#2{#1}% saves a restore \dodoglobal\edef#2{\convertedcommand#2}} @@ -1216,20 +1212,29 @@ \long\def\convertcommand#1\to#2% {\dodoglobal\edef#2{\convertedcommand#1}} +% no dodoglobal ! + \long\def\defconvertedargument#1#2% less sensitive for \to {\long\def#1{#2}% saves a restore - \dodoglobal\edef#1{\convertedcommand#1}} + \edef#1{\convertedcommand#1}} \long\def\defconvertedcommand#1#2% less sensitive for \to - {\dodoglobal\edef#1{\convertedcommand#2}} + {\edef#1{\convertedcommand#2}} + +\long\def\gdefconvertedargument#1#2% less sensitive for \to + {\long\gdef#1{#2}% saves a restore + \xdef#1{\convertedcommand#1}} + +\long\def\gdefconvertedcommand#1#2% less sensitive for \to + {\xdef#1{\convertedcommand#2}} \endTEX \def\convertvalue#1\to {\expandafter\convertcommand\csname#1\endcsname\to} -\def\defconvertvalue#1#2% less sensitive for \to - {\@EA\defconvertcommand\@EA#1\csname#2\endcsname} +\def\defconvertedvalue#1#2% less sensitive for \to + {\@EA\defconvertedcommand\@EA#1\csname#2\endcsname} %D \macros %D {doifassignmentelse} @@ -1287,22 +1292,21 @@ %D something I found out when primitives like \type %D {\jobname} were fed (or something undefined). -\beginETEX \detokenize - -\long\def\convertargument#1\to#2% - {\dodoglobal\edef#2{\detokenize{#1}}} - -% \long\def\convertcommand#1\to#2% -% {\@EA\dodoglobal\@EA\edef\@EA#2\@EA{\@EA\detokenize\@EA{#1}}} +% command variant: one level expansion ! -\long\def\convertcommand#1\to#2% - {\dodoglobal\edef#2{\@EA\detokenize\@EA{#1}}} % hm, only second is also ok +\beginETEX \detokenize -\long\def\defconvertedargument#1#2% less sensitive for \to - {\dodoglobal\edef#1{\detokenize{#2}}} +\long\def\convertargument#1\to#2{\dodoglobal\edef#2{\detokenize{#1}}} +\long\def\convertcommand #1\to#2{\dodoglobal\edef#2{\@EA\detokenize\@EA{#1}}} % hm, only second is also ok -\long\def\defconvertedcommand#1#2% less sensitive for \to - {\dodoglobal\edef#1{\detokenize\@EA{#2}}} +\long\def\defconvertedargument #1#2{\edef#1{\detokenize {#2}}} +\long\def\defconvertedcommand #1#2{\edef#1{\detokenize\@EA{#2}}} +\long\def\edefconvertedargument#1#2{\edef#1{#2}% + \edef#1{\detokenize\@EA{#1}}} +\long\def\gdefconvertedargument#1#2{\xdef#1{\detokenize {#2}}} +\long\def\gdefconvertedcommand #1#2{\xdef#1{\detokenize\@EA{#2}}} +\long\def\xdefconvertedargument#1#2{\xdef#1{#2}% + \xdef#1{\detokenize\@EA{#1}}} \endETEX @@ -1324,35 +1328,6 @@ %D The \type{-}, the delimiter \type{\\\\} and the the second %D argument are completely redundant. -% %D As said, the \TEX\ alternative fails on expanding primitives, -% %D like in: -% %D -% %D \starttyping -% %D \convertcommand\someprimitive\to\ascii -% %D \stoptyping -% %D -% %D Because these primitives convert to themselves, we can use -% %D the backslash as a signal to treat them different. At the -% %D cost of slightly more overhead we can therefore define a -% %D more robust alternative. The catcode trickery is needed to -% %D get the backslash into the test as character (and not as -% %D escape, letter or whatever code else). -% % -% % does not work: -% % -% % \beginTEX -% % -% % \let\dodoconvertargument\doconvertargument -% % -% % \bgroup -% % \catcode`\*=\@@escape -% % \catcode`\\=\@@other -% % *gdef*doconvertargument#1% -% % {*ifx#1\*else*expandafter*dodoconvertargument*fi#1} -% % *egroup -% % -% % \endTEX - %D \macros %D {showvalue,showargument} %D @@ -1373,7 +1348,7 @@ \endETEX \long\def\showargument#1% - {\convertargument#1\to\ascii\show\ascii} + {\defconvertedargument\ascii{#1}\ascii} %D \macros %D {doifmeaningelse} @@ -1513,8 +1488,8 @@ \beginTEX \def\ConvertToConstant#1#2#3% - {\expandafter\convertargument\expandafter{#2}\to\!!stringa - \expandafter\convertargument\expandafter{#3}\to\!!stringb + {\expandafter\defconvertedargument\expandafter\!!stringa\expandafter{#2}% + \expandafter\defconvertedargument\expandafter\!!stringb\expandafter{#3}% #1{\!!stringa}{\!!stringb}} \endTEX @@ -3647,16 +3622,25 @@ \beginETEX +% \def\executeifdefined#1% #2 / never change this one again +% {\ifcsname#1\endcsname +% \expandafter\firstoftwoarguments +% \else +% \expandafter\secondoftwoarguments +% \fi +% {\csname#1\endcsname}} + \def\executeifdefined#1% #2 / never change this one again {\ifcsname#1\endcsname - \expandafter\firstoftwoarguments + \csname#1\expandafter\expandafter\expandafter\endcsname\expandafter\gobbleoneargument \else - \expandafter\secondoftwoarguments - \fi - {\csname#1\endcsname}} + \expandafter\firstofoneargument + \fi} \endETEX +% \letvalue{f }\firstofoneargument \def\executeifdefined#1{\csname\ifcsname#1\endcsname#1\else f \fi\endcsname} + %D This one also has the advantage that it is fully %D expandable and that it can be used after an assignment. diff --git a/tex/context/base/syst-gen.tex b/tex/context/base/syst-gen.tex index 94a622c76..739e0ed50 100644 --- a/tex/context/base/syst-gen.tex +++ b/tex/context/base/syst-gen.tex @@ -2237,8 +2237,8 @@ \def\unexpandedaction#1>{} \def\noexpandedaction#1#2% - {\def\convertedargument{#2}% - \@EA\edef\@EA#1\@EA{\@EA\unexpandedaction\meaning\convertedargument}} + {\def\@@convertedargument{#2}% + \@EA\edef\@EA#1\@EA{\@EA\unexpandedaction\meaning\@@convertedargument}} \def\dontexpandactions% {\let\expandedaction\noexpandedaction} diff --git a/tex/context/base/syst-new.tex b/tex/context/base/syst-new.tex index 853b2514c..ad5a84178 100644 --- a/tex/context/base/syst-new.tex +++ b/tex/context/base/syst-new.tex @@ -50,7 +50,7 @@ \dounspaced} \def\unspaceargument#1\to#2% - {\convertargument#1\to#2% + {\defconvertedargument#2{#1}% \@EA\edef\@EA#2\@EA{\@EA\unspaced\@EA{#2}}} \def\unspaceafter#1#2% @@ -638,7 +638,7 @@ {\ifx\compressedlist\empty\else\compressedlist,\fi {\the\!!counta}{\ifnum\!!countb>\!!counta\the\!!countb\fi}}} -%D \def\test#1{{\tttf#1->\compresscommalistnrs[#1]\convertcommand\compressedlist\to\ascii\ascii}} +%D \def\test#1{{\tttf#1->\compresscommalistnrs[#1]\defconvertedcommand\ascii\compressedlist\ascii}} %D \startlines %D \test{} %D \test{1} @@ -672,7 +672,7 @@ \fi \fi} -%D \def\test#1{{\tttf#1->\compresscommalist[#1]\convertcommand\compressedlist\to\ascii\ascii}} +%D \def\test#1{{\tttf#1->\compresscommalist[#1]\defconvertedcommand\ascii\compressedlist\ascii}} %D \startlines %D \test{} %D \test{1} @@ -699,7 +699,7 @@ \def\reversecommacommand[#1]% {\expanded{\reversecommalist[#1]}} -%D \def\test#1{{\tttf#1->\reversecommalist[#1]\convertcommand\reversedlist\to\ascii\ascii}} +%D \def\test#1{{\tttf#1->\reversecommalist[#1]\defconvertedcommand\ascii\reversedlist\ascii}} %D \startlines %D \test{} %D \test{1} @@ -723,7 +723,7 @@ \def\stripstring#1% #1 is \cs {\bgroup - \convertcommand#1\to\ascii + \defconvertedcommand\ascii{#1}% \global\let\globalascii\empty \donefalse \expandafter\handletokens\ascii\with\dostripstring diff --git a/tex/context/base/syst-omg.tex b/tex/context/base/syst-omg.tex index 0aa409ccb..01f140dac 100644 --- a/tex/context/base/syst-omg.tex +++ b/tex/context/base/syst-omg.tex @@ -74,14 +74,6 @@ \errmessage{This version of Omega is way to buggy (+ \string\SGMLFontEntity\space mess)!} -% \let\normalSGMLFontEntity\SGMLFontEntity -% -% \def\SGMLFontEntity#1#2#3#4#5% -% {\convertargument#3\to\ascii -% \expanded{\doifinstringelse{\letterbackslash}{\ascii}} -% {\normalSGMLFontEntity{#1}{#2}{#3}{#4}{#5}} -% {\normalSGMLFontEntity{#1}{#2}{\string#3}{#4}{#5}}} - \fi \protect \endinput diff --git a/tex/context/base/todo-mkii.tex b/tex/context/base/todo-mkii.tex new file mode 100644 index 000000000..5a0f340bd --- /dev/null +++ b/tex/context/base/todo-mkii.tex @@ -0,0 +1 @@ +MKII Todo List diff --git a/tex/context/base/todo-mkiv.tex b/tex/context/base/todo-mkiv.tex new file mode 100644 index 000000000..94fd6d478 --- /dev/null +++ b/tex/context/base/todo-mkiv.tex @@ -0,0 +1,6 @@ +MKIV Todo List + +-- language dependent case swapping (using char-map.lua) +-- figures (locating and scaling) +-- numbering +-- cross references diff --git a/tex/context/base/x-fo.tex b/tex/context/base/x-fo.tex index 9c09fe0db..396225546 100644 --- a/tex/context/base/x-fo.tex +++ b/tex/context/base/x-fo.tex @@ -2701,7 +2701,7 @@ leader-pattern-width=12pt, \defineconversion[1][\numbers] \def\handleFOformat#1#2% - {\convertargument#2\to\ascii + {\defconvertedargument\ascii{#2}% \doifconversiondefinedelse\ascii{\convertnumber\ascii{#1}}{#2}} %D Element: fo:pagenumber-citation diff --git a/tex/context/base/x-mmp.mkiv b/tex/context/base/x-mmp.mkiv index eed5d3ee2..57061fda5 100644 --- a/tex/context/base/x-mmp.mkiv +++ b/tex/context/base/x-mmp.mkiv @@ -240,7 +240,7 @@ \stopxmlsetups \startxmlsetups mml:mtext - \hbox \bgroup \tf % else encoding problems + \hbox \bgroup \tf % else encoding problems, we can make mr an option \doMMPpsometext{#1}{\xmlflush{#1}} \egroup \stopxmlsetups diff --git a/tex/context/base/x-newmml.tex b/tex/context/base/x-newmml.tex index 0d17aa4a5..f4dfa9129 100644 --- a/tex/context/base/x-newmml.tex +++ b/tex/context/base/x-newmml.tex @@ -2434,7 +2434,7 @@ \ifdim\wd\scratchbox=\zeropoint \edef\MMLpunit{#1em}% \else - \edef\ascii{#1}\convertcommand\ascii\to\ascii + \edefconvertedargument\ascii{#1}% \convertasciiafter\doifinstringelse{em}{\ascii}{\edef\MMLpunit{#1}}{% \convertasciiafter\doifinstringelse{ex}{\ascii}{\edef\MMLpunit{#1}}{% \convertasciiafter\doifinstringelse{pt}{\ascii}{\edef\MMLpunit{#1}}{% @@ -2452,7 +2452,7 @@ \ifdim\wd\scratchbox=\zeropoint \edef\MMLpunit{#1em}% \else - \edef\ascii{#1}\convertcommand\ascii\to\ascii + \edefconvertedargument\ascii{#1}% \convertasciiafter\doifinstringelse{em}{\ascii}{\edef\MMLpunit{#1}}{% \convertasciiafter\doifinstringelse{ex}{\ascii}{\edef\MMLpunit{#1}}{% \convertasciiafter\doifinstringelse{pt}{\ascii}{\edef\MMLpunit{#1}}{% diff --git a/tex/context/base/x-newmmo.tex b/tex/context/base/x-newmmo.tex index c410f002b..076f3f82c 100644 --- a/tex/context/base/x-newmmo.tex +++ b/tex/context/base/x-newmmo.tex @@ -200,7 +200,7 @@ {\checkMMLciSYMBOL} \def\checkMMLciSYMBOL#1% - {\convertargument#1\to\ascii + {\defconvertedargument\ascii{#1}% \executeifdefined{ci:symbol:crap:\ascii}{#1}} \setvalue{ci:symbol:crap:alpha}{\alpha} diff --git a/tex/context/base/x-res-08.tex b/tex/context/base/x-res-08.tex index b714cfb4d..3d0625f8c 100644 --- a/tex/context/base/x-res-08.tex +++ b/tex/context/base/x-res-08.tex @@ -55,7 +55,7 @@ \def\XMLfeedbackresource#1#2% {\begingroup - \convertcommand\currentresourcecomment\to\currentresourcecomment + \defconvertedcommand\currentresourcecomment\currentresourcecomment \doifnothing\figurefilefile{\edef\figurefilefile{\figurefilename.\figurefiletype}}% \immediate\write\XMLrllog {\writtenXMLelement{\XMLrlprefix usage}% diff --git a/tex/context/base/x-res-20.tex b/tex/context/base/x-res-20.tex index e81927c21..3ff069ffd 100644 --- a/tex/context/base/x-res-20.tex +++ b/tex/context/base/x-res-20.tex @@ -158,7 +158,7 @@ \def\docommand####1% {\beforesplitstring####1\at=\to\asciia \aftersplitstring ####1\at=\to\asciib - \convertcommand\asciib\to\asciib + \defconvertedcommand\asciib\asciib \doifsomething\asciib {\hsmash{\hbox to .75em{\asciia\hss}: \asciib}\endgraf}}% \processcommalist[##2]\docommand diff --git a/tex/context/base/x-set-11.mkii b/tex/context/base/x-set-11.mkii index 74f438f11..397c2c71c 100644 --- a/tex/context/base/x-set-11.mkii +++ b/tex/context/base/x-set-11.mkii @@ -17,7 +17,7 @@ {\expanded{\flushXMLelement{stp:\ascii}}} {\doifelseXMLelement{stp:\ascii:1} {\expanded{\flushXMLelement{stp:\ascii:1}}} - {\convertargument#1\to\ascii + {\defconvertedargument\ascii{#1}% \em unknown setup \quote{\ascii}}} \egroup} diff --git a/tex/context/base/x-xml-02.tex b/tex/context/base/x-xml-02.tex index 8c1063780..24f811c4d 100644 --- a/tex/context/base/x-xml-02.tex +++ b/tex/context/base/x-xml-02.tex @@ -47,8 +47,8 @@ \setupalign [broad,right] -\lowercasestring \inputfilename \to \lcinputfilename -\convertcommand \lcinputfilename \to \lcinputfilename % make _ safe +\lowercasestring\inputfilename \to \lcinputfilename +\defconvertedcommand\lcinputfilename\lcinputfilename % make _ safe \setupheadertexts [\lcinputfilename] diff --git a/tex/context/base/xtag-ext.tex b/tex/context/base/xtag-ext.tex index 9eea3643f..752007f5f 100644 --- a/tex/context/base/xtag-ext.tex +++ b/tex/context/base/xtag-ext.tex @@ -192,7 +192,7 @@ \gdef\doifelseXMLelementcontent#1% {\ifcsname\@@XMLsave:#1\endcsname \bgroup - \@EA\convertcommand\csname\@@XMLsave:#1\endcsname\to\ascii + \@EA\defconvertedcommand\@EA\ascii\csname\@@XMLsave:#1\endcsname \setbox\scratchbox\hbox{\ignorespaces\ascii\unskip\unskip\unskip}% \ifdim\wd\scratchbox>\zeropoint \egroup\@EAEAEA\firstoftwoarguments @@ -206,8 +206,8 @@ \gdef\doifelseXMLelementequals#1#2% {\ifcsname\@@XMLsave:#1\endcsname \bgroup - \@EA\convertcommand\csname\@@XMLsave:#1\endcsname\to\asciia - \convertargument#2\to\asciib + \@EA\defconvertedcommand\@EA\asciia\csname\@@XMLsave:#1\endcsname + \defconvertedargument\asciib{#2}% \ifx\asciia\asciib \egroup\@EAEAEA\firstoftwoarguments \else @@ -225,7 +225,7 @@ \gdef\convertXMLelement#1\to#2% {\ifcsname\@@XMLsave:#1\endcsname - \@EA\convertcommand\csname\@@XMLsave:#1\endcsname\to#2% + \@EA\defconvertedcommand\@EA#2\csname\@@XMLsave:#1\endcsname \else \let#2\ascii \fi} @@ -355,7 +355,7 @@ \bgroup \catcode`\<=\active -\long\gdef\expandxmlargument#1\to +\long\gdef\defexpandedxmlargument#1#2#3% {\begingroup \let\uppercase\firstofoneargument \def\getXMLhexcharacter##1{\numbertoutp{"##1}}% maps to private if needed @@ -371,9 +371,9 @@ \fi \let\uchar\relax \let\unicodechar\relax - \xdef\@@globalexpanded{#1}% + \xdef\@@globalexpanded{#3}% \endgroup - \convertcommand\@@globalexpanded\to} + #1#2\@@globalexpanded} \egroup @@ -389,9 +389,14 @@ \chardef\xmlexpandmode\plusone -\installexpander {xml} {\chardef\xmlexpandmode\plusone\expandxmlargument} -\installexpander {xml:cmd} {\chardef\xmlexpandmode\plusone\expandxmlargument} -\installexpander {xml:utf} {\chardef\xmlexpandmode\plustwo\expandxmlargument} +\def\defexpandedxmlargumentcmd {\chardef\xmlexpandmode\plusone\defexpandedxmlargument\defconvertedcommand} +\def\defexpandedxmlargumentutf {\chardef\xmlexpandmode\plustwo\defexpandedxmlargument\defconvertedcommand} +\def\gdefexpandedxmlargumentcmd{\chardef\xmlexpandmode\plusone\defexpandedxmlargument\gdefconvertedcommand} +\def\gdefexpandedxmlargumentutf{\chardef\xmlexpandmode\plustwo\defexpandedxmlargument\gdefconvertedcommand} + +\installexpander {xml} \defexpandedxmlargumentcmd \gdefexpandedxmlargumentcmd +\installexpander {xml:cmd} \defexpandedxmlargumentcmd \gdefexpandedxmlargumentcmd +\installexpander {xml:utf} \defexpandedxmlargumentutf \gdefexpandedxmlargumentutf \def\XMLtexmath#1{\begingroup\setnormalcatcodes\scantokens{\mathematics{#1}\ignorespaces}\endgroup} diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex index 155034145..48fcb4c80 100644 --- a/tex/context/base/xtag-ini.tex +++ b/tex/context/base/xtag-ini.tex @@ -631,7 +631,7 @@ \def\parseXMLprocess#1#2% {\cleanupXMLprocess{#2}% - \convertcommand#1\to\ascii + \defconvertedcommand\ascii{#1}% %\writestatus{xml-process}{\ascii} \expanded {\executeifdefined @@ -2308,7 +2308,7 @@ \chardef\utfunicodetracer7% new \xdef\@@XML@@string{\csname\@@XMLdata:#2\endcsname}% \egroup - \convertcommand\@@XML@@string\to#1} + \defconvertedcommand#1\@@XML@@string} % this has to expand nicely: % @@ -2325,7 +2325,7 @@ \let\getXMLentity\expandedXMLentity % should this go in \simplify ? \xdef\@@XML@@string{\csname\@@XMLdata:#2\endcsname}% \egroup - \convertcommand\@@XML@@string\to#1} + \defconvertedcommand#1\@@XML@@string} \def\defXMLpar#1#2#3% to be documented {\@EA\def\@EA#1\csname\ifcsname\@@XMLvariable:#2:#3\endcsname\@@XMLvariable:#2:#3\else\s!empty\fi\endcsname} @@ -2578,9 +2578,9 @@ \def\XMLtyp#1#2#3% {\ifcsname\@@XMLvariable:#1:#2\endcsname - \@EA\convertcommand\csname\@@XMLvariable:#1:#2\endcsname\to\ascii + \@EA\defconvertedcommand\@EA\ascii\csname\@@XMLvariable:#1:#2\endcsname \else - \convertargument#3\to\ascii + \defconvertedargument\ascii{#3}% \fi \ascii} @@ -2660,9 +2660,9 @@ \def\defXMLattributestring#1#2#3#4% {\ifcsname\@@XMLvariable:#2:#3\endcsname - \@EA\convertcommand\csname\@@XMLvariable:#2:#3\endcsname\to#1% + \@EA\defconvertedcommand\@EA#1\csname\@@XMLvariable:#2:#3\endcsname \else - \convertargument#4\to#1% + \defconvertedargument#1{#4}% \fi} \def\XMLprocess#1% @@ -2983,4 +2983,14 @@ \egroup +\def\defXMLexpanded#1#2% + {\begingroup + \let\getXMLentity\expandedXMLentity + \expanded{\endgroup\edef\noexpand#1{#2}}} + +\def\gdefXMLexpanded#1#2% + {\begingroup + \let\getXMLentity\expandedXMLentity + \expanded{\endgroup\xdef\noexpand#1{#2}}} + \protect \endinput diff --git a/tex/context/base/xtag-map.tex b/tex/context/base/xtag-map.tex index 28aabc488..c071d0377 100644 --- a/tex/context/base/xtag-map.tex +++ b/tex/context/base/xtag-map.tex @@ -468,7 +468,7 @@ \catcode`\\=\@@escape \iftraceXMLremapping \ifmmode\vbox\fi\bgroup - \convertcommand\remappedXMLdata\to\ascii + \defconvertedcommand\ascii\remappedXMLdata \tttf\veryraggedright\ascii\par \writestatus{xml-remap}{\ascii}% \egroup diff --git a/tex/context/base/xtag-mml.tex b/tex/context/base/xtag-mml.tex index ce51bffb2..e627e05b0 100644 --- a/tex/context/base/xtag-mml.tex +++ b/tex/context/base/xtag-mml.tex @@ -72,7 +72,7 @@ \ifx\XMLRtoks\undefined \newtoks\XMLRtoks \fi \def\convertasciiafter#1#2% - {\convertargument#2\to\asciiafter + {\defconvertedargument\asciiafter{#2}% \@EA#1\@EA{\asciiafter}} \def\checkMMLoperator#1% #2 diff --git a/tex/context/base/xtag-mmp.tex b/tex/context/base/xtag-mmp.tex index 3108191a0..01328cd40 100644 --- a/tex/context/base/xtag-mmp.tex +++ b/tex/context/base/xtag-mmp.tex @@ -58,7 +58,7 @@ \unprotect \def\convertasciiafter#1#2% - {\convertargument#2\to\asciiafter + {\defconvertedargument\asciiafter{#2}% \@EA#1\@EA{\asciiafter}} \def\checkMMLoperator#1#2% temp hack @@ -443,7 +443,7 @@ \ifdim\wd\scratchbox=\zeropoint \edef\MMLpunit{#1em}% \else - \edef\ascii{#1}\convertcommand\ascii\to\ascii + \edefconvertedargument\ascii{#1}% \convertasciiafter\doifinstringelse{em}{\ascii}{\edef\MMLpunit{#1}}{% \convertasciiafter\doifinstringelse{ex}{\ascii}{\edef\MMLpunit{#1}}{% \convertasciiafter\doifinstringelse{pt}{\ascii}{\edef\MMLpunit{#1}}{% diff --git a/tex/context/interface/cont-cz.xml b/tex/context/interface/cont-cz.xml index c82e72d0c..17834cd9c 100644 --- a/tex/context/interface/cont-cz.xml +++ b/tex/context/interface/cont-cz.xml @@ -417,7 +417,6 @@ - diff --git a/tex/context/interface/cont-de.xml b/tex/context/interface/cont-de.xml index 3b2638f60..8044a6c1d 100644 --- a/tex/context/interface/cont-de.xml +++ b/tex/context/interface/cont-de.xml @@ -417,7 +417,6 @@ - diff --git a/tex/context/interface/cont-en.xml b/tex/context/interface/cont-en.xml index 69884654e..e902887c4 100644 --- a/tex/context/interface/cont-en.xml +++ b/tex/context/interface/cont-en.xml @@ -417,7 +417,6 @@ - diff --git a/tex/context/interface/cont-fr.xml b/tex/context/interface/cont-fr.xml index b74b60e4f..920e76ed9 100644 --- a/tex/context/interface/cont-fr.xml +++ b/tex/context/interface/cont-fr.xml @@ -417,7 +417,6 @@ - diff --git a/tex/context/interface/cont-it.xml b/tex/context/interface/cont-it.xml index fbdb3acd2..15e4144cb 100644 --- a/tex/context/interface/cont-it.xml +++ b/tex/context/interface/cont-it.xml @@ -417,7 +417,6 @@ - diff --git a/tex/context/interface/cont-nl.xml b/tex/context/interface/cont-nl.xml index 84d9a4b17..da3caca42 100644 --- a/tex/context/interface/cont-nl.xml +++ b/tex/context/interface/cont-nl.xml @@ -417,7 +417,6 @@ - diff --git a/tex/context/interface/cont-ro.xml b/tex/context/interface/cont-ro.xml index 0d2b5af05..9cdd3b7ee 100644 --- a/tex/context/interface/cont-ro.xml +++ b/tex/context/interface/cont-ro.xml @@ -417,7 +417,6 @@ - diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml index 452e643fe..9825860cb 100644 --- a/tex/context/interface/keys-cz.xml +++ b/tex/context/interface/keys-cz.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 63082344b..3e6509f3d 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 35c150820..54f807058 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index 0c6e4e3b3..08ad77896 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 499138874..5199ba474 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index d8134698e..5a8574699 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -1,6 +1,6 @@ - + diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index c48114c6d..fd4eee379 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -1,6 +1,6 @@ - + -- cgit v1.2.3