From fa92f9c6079291c35f057dbb687e65e70b80f535 Mon Sep 17 00:00:00 2001 From: Marius Date: Thu, 9 Jun 2011 02:00:19 +0300 Subject: beta 2011.06.09 00:59 --- tex/context/base/cldf-com.lua | 18 +++++++++ tex/context/base/cldf-ini.lua | 14 +++++-- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/data-pre.lua | 7 ++-- tex/context/base/status-files.pdf | Bin 23482 -> 23483 bytes tex/context/base/status-lua.pdf | Bin 155008 -> 155009 bytes tex/context/base/x-mathml.lua | 59 ++++++++++++++++++---------- tex/generic/context/luatex-fonts-merged.lua | 2 +- 11 files changed, 76 insertions(+), 32 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cldf-com.lua b/tex/context/base/cldf-com.lua index 08116974f..9f5d2bcae 100644 --- a/tex/context/base/cldf-com.lua +++ b/tex/context/base/cldf-com.lua @@ -73,6 +73,24 @@ function context.egroup() context("}") end +-- -- speedtest needed: +-- +-- local ctxcatcodes = tex.ctxcatcodes +-- +-- local flush, writer = context.getlogger() +-- +-- trackers.register("context.trace",function(v) +-- flush, writer = context.getlogger() +-- end) +-- +-- function context.bgroup() +-- flush(ctxcatcodes,"{") +-- end +-- +-- function context.egroup() +-- flush(ctxcatcodes,"}") +-- end + local rule = nodes.pool.rule function context.hrule(w,h,d,dir) diff --git a/tex/context/base/cldf-ini.lua b/tex/context/base/cldf-ini.lua index a7f7ce332..593fdcd76 100644 --- a/tex/context/base/cldf-ini.lua +++ b/tex/context/base/cldf-ini.lua @@ -227,7 +227,7 @@ end -- -- -- -local function writer(parent,command,first,...) +local function writer(parent,command,first,...) -- already optimized before call local t = { first, ... } flush(currentcatcodes,command) -- todo: ctx|prt|texcatcodes local direct = false @@ -461,6 +461,7 @@ local function pushlogger(trace) currenttrace = trace flush, writer = tracedflush, tracedwriter context.__flush = flush + return flush, writer end local function poplogger() @@ -469,13 +470,14 @@ local function poplogger() flush, writer = normalflush, normalwriter context.__flush = flush end + return flush, writer end local function settracing(v) if v then - pushlogger(report_context) + return pushlogger(report_context) else - poplogger() + return poplogger() end end @@ -487,6 +489,10 @@ context.pushlogger = pushlogger context.poplogger = poplogger context.settracing = settracing +function context.getlogger() + return flush, writer +end + local trace_cld = false trackers.register("context.files", function(v) trace_cld = v end) function context.runfile(filename) @@ -740,6 +746,8 @@ setmetatable(delayed, { __index = indexer, __call = caller } ) -- helpers: +-- we could have faster calls here + function context.concat(t,separator) local done = false for i=1,#t do diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 839324aff..42ccd18b0 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.06.08 19:06} +\newcontextversion{2011.06.09 00:59} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 2b07231c8..dc05044d3 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.06.08 19:06} +\newcontextversion{2011.06.09 00:59} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 884a21051..a9ee8b97d 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.06.08 19:06} +\edef\contextversion{2011.06.09 00:59} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 78601ae7c..97c7bad50 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.06.08 19:06} +\edef\contextversion{2011.06.09 00:59} %D For those who want to use this: diff --git a/tex/context/base/data-pre.lua b/tex/context/base/data-pre.lua index f774ba6eb..fa3588c6e 100644 --- a/tex/context/base/data-pre.lua +++ b/tex/context/base/data-pre.lua @@ -105,8 +105,9 @@ function resolvers.allprefixes(separator) end local function _resolve_(method,target) - if prefixes[method] then - return prefixes[method](target) + local action = prefixes[method] + if action then + return action(target) else return method .. ":" .. target end @@ -121,7 +122,7 @@ end local function resolve(str) -- use schemes, this one is then for the commandline only local res = resolved[str] if not res then - res = gsub(str,"([a-z][a-z]+):([^ \"\']*)",_resolve_) + res = gsub(str,"([a-z][a-z]+):([^ \"\';]*)",_resolve_) -- home:xx;selfautoparent:xx; etc resolved[str] = res abstract[res] = str end diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 40ef6bdfe..40b67769f 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index fcfec5d36..c1308ced5 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/x-mathml.lua b/tex/context/base/x-mathml.lua index fa99d51e6..7481cef0d 100644 --- a/tex/context/base/x-mathml.lua +++ b/tex/context/base/x-mathml.lua @@ -12,6 +12,7 @@ local type, next = type, next local utf = unicode.utf8 local texsprint, ctxcatcodes, txtcatcodes = tex.sprint, tex.ctxcatcodes, tex.txtcatcodes local format, lower, find, gsub = string.format, string.lower, string.find, string.gsub +local strip = string.strip local utfchar, utffind, utfgmatch, utfgsub = utf.char, utf.find, utf.gmatch, utf.gsub local xmlsprint, xmlcprint, xmltext, xmlcontent = xml.sprint, xml.cprint, xml.text, xml.content local lxmltext, getid = lxml.text, lxml.getid @@ -455,11 +456,12 @@ function xml.functions.remapopenmath(e) end function mathml.checked_operator(str) - texsprint(ctxcatcodes,(utfgsub(str,".",o_replacements))) + str = utfgsub(str,".",o_replacements) + context(str) end function mathml.stripped(str) - tex.sprint(ctxcatcodes,str:strip()) + context(strip(str)) end function characters.remapentity(chr,slot) -- brrrrrr @@ -481,7 +483,7 @@ function mathml.mo(id) local str = xmlcontent(getid(id)) or "" local rep = gsub(str,"&.-;","") local rep = utfgsub(rep,".",o_replacements) - texsprint(ctxcatcodes,rep) + context(rep) -- context.mo(rep) -- fails with \left etc end @@ -495,10 +497,10 @@ function mathml.mi(id) if not rep then rep = gsub(str,".",i_replacements) end - texsprint(ctxcatcodes,rep) + context(rep) -- context.mi(rep) else - context.xmlflush(id) + context.xmlflush(id) -- xmlsprint or so end end @@ -521,7 +523,6 @@ function mathml.mfenced(id) -- multiple separators -- skip elseif n == 1 then xmlsprint(collected[1]) -- to be checked ---~ lxml.all(id,"/*") else local t = { } for s in utfgmatch(separators,"[^%s]") do @@ -555,22 +556,38 @@ function mathml.mfenced(id) -- multiple separators texsprint(ctxcatcodes,"\\disabledelimiter") end +--~ local function flush(e,tag,toggle) +--~ if toggle then +--~ context("^{") +--~ else +--~ context("_{") +--~ end +--~ if tag == "none" then +--~ context("{}") +--~ else +--~ xmlsprint(e.dt) +--~ end +--~ if not toggle then +--~ context("}") +--~ else +--~ context("}{}") +--~ end +--~ return not toggle +--~ end + local function flush(e,tag,toggle) - -- texsprint(ctxcatcodes,(toggle and "^{") or "_{") - if toggle then - texsprint(ctxcatcodes,"^{") - else - texsprint(ctxcatcodes,"_{") - end if tag == "none" then - texsprint(ctxcatcodes,"{}") - else + -- if not toggle then + context("{}") -- {} starts a new ^_ set + -- end + elseif toggle then + context("^{") xmlsprint(e.dt) - end - if not toggle then - texsprint(ctxcatcodes,"}") + context("}{}") -- {} starts a new ^_ set else - texsprint(ctxcatcodes,"}{}") + context("_{") + xmlsprint(e.dt) + context("}") end return not toggle end @@ -580,7 +597,7 @@ function mathml.mmultiscripts(id) for e in lxml.collected(id,"/*") do local tag = e.tg if tag == "mprescripts" then - texsprint(ctxcatcodes,"{}") + context("{}") done = true elseif done then toggle = flush(e,tag,toggle) @@ -786,7 +803,7 @@ function mathml.csymbol(root) local hash = url.hashed(lower(at.definitionUrl or "")) local full = hash.original or "" local base = hash.path or "" - local text = string.strip(xmltext(root) or "") + local text = strip(xmltext(root) or "") context.mmlapplycsymbol(full,base,encoding,text) end @@ -794,7 +811,7 @@ function mathml.menclosepattern(root) root = getid(root) local a = root.at.notation if a and a ~= "" then - texsprint("mml:enclose:",(gsub(a," +",",mml:enclose:"))) + context("mml:enclose:",(gsub(a," +",",mml:enclose:"))) end end diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index a826b33f0..098fe4c0d 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 06/08/11 19:06:42 +-- merge date : 06/09/11 00:59:00 do -- begin closure to overcome local limits and interference -- cgit v1.2.3