diff options
-rw-r--r-- | metapost/context/base/mp-tool.mpiv | 6 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 30 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 30 | ||||
-rwxr-xr-x | scripts/context/stubs/unix/mtxrun | 30 | ||||
-rw-r--r-- | scripts/context/stubs/win64/mtxrun.lua | 30 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4436 -> 4439 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/lxml-aux.lua | 24 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24913 -> 24916 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 326320 -> 326318 bytes | |||
-rw-r--r-- | tex/context/base/typo-tal.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/x-asciimath.lua | 101 | ||||
-rw-r--r-- | tex/context/base/x-asciimath.mkiv | 11 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
15 files changed, 191 insertions, 79 deletions
diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv index 7845467a4..17bb0e9c2 100644 --- a/metapost/context/base/mp-tool.mpiv +++ b/metapost/context/base/mp-tool.mpiv @@ -292,12 +292,12 @@ enddef; %D Some missing functions can be implemented rather straightforward (thanks to %D Taco and others): -pi := 3.14159265358979323846 ; radian := 180/pi ; % 2pi*radian = 360 ; +% oldpi := 3.14159265358979323846 ; % from <math.h> +pi := 3.14159265358979323846264338327950288419716939937510 ; % 50 digits +radian := 180/pi ; % 2pi*radian = 360 ; % let +++ = ++ ; -numeric Pi ; Pi := pi ; % for some old compatibility reasons i guess - vardef sqr primary x = x*x enddef ; vardef log primary x = if x=0: 0 else: mlog(x)/mlog(10) fi enddef ; vardef ln primary x = if x=0: 0 else: mlog(x)/256 fi enddef ; diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 81d47d1f2..fb3fdf5a9 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -11321,7 +11321,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 25139, stripped down to: 17839 +-- original size: 25695, stripped down to: 18281 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -11331,6 +11331,7 @@ if not modules then modules={} end modules ['lxml-aux']={ license="see context related readme files" } local trace_manipulations=false trackers.register("lxml.manipulations",function(v) trace_manipulations=v end) +local trace_inclusions=false trackers.register("lxml.inclusions",function(v) trace_inclusions=v end) local report_xml=logs.reporter("xml") local xml=xml local xmlconvert,xmlcopy,xmlname=xml.convert,xml.copy,xml.name @@ -11637,11 +11638,14 @@ xml.insertafter=insert_element xml.insertbefore=function(r,p,e) insert_element(r,p,e,true) end xml.injectafter=inject_element xml.injectbefore=function(r,p,e) inject_element(r,p,e,true) end -local function include(xmldata,pattern,attribute,recursive,loaddata) +local function include(xmldata,pattern,attribute,recursive,loaddata,level) pattern=pattern or 'include' loaddata=loaddata or io.loaddata local collected=xmlapplylpath(xmldata,pattern) if collected then + if not level then + level=1 + end for c=1,#collected do local ek=collected[c] local name=nil @@ -11655,11 +11659,19 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) if not name then for a in gmatch(attribute or "href","([^|]+)") do name=ekat[a] - if name then break end + if name then + break + end + end + end + local data=nil + if name and name~="" then + data=loaddata(name) or "" + if trace_inclusions then + report_xml("including %s bytes from %a at level %s by pattern %a and attribute %a (%srecursing)",#data,name,level,pattern,attribute or "",recursive and "" or "not ") end end - local data=name and name~="" and loaddata(name) or "" - if data=="" then + if not data or data=="" then epdt[ek.ni]="" elseif ekat["parse"]=="text" then epdt[ek.ni]=xml.escaped(data) @@ -11669,7 +11681,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) epdt[ek.ni]="" else if recursive then - include(xi,pattern,attribute,recursive,loaddata) + include(xi,pattern,attribute,recursive,loaddata,level+1) end local child=xml.body(xi) child.__p__=ekrt @@ -12036,7 +12048,7 @@ local function recurse(e,action) for i=1,#edt do local str=edt[i] if type(str)~="string" then - recurse(str,action,recursive) + recurse(str,action) elseif str~="" then edt[i]=action(str) end @@ -17259,8 +17271,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 710105 --- stripped bytes : 252051 +-- original bytes : 710661 +-- stripped bytes : 252165 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 81d47d1f2..fb3fdf5a9 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -11321,7 +11321,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 25139, stripped down to: 17839 +-- original size: 25695, stripped down to: 18281 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -11331,6 +11331,7 @@ if not modules then modules={} end modules ['lxml-aux']={ license="see context related readme files" } local trace_manipulations=false trackers.register("lxml.manipulations",function(v) trace_manipulations=v end) +local trace_inclusions=false trackers.register("lxml.inclusions",function(v) trace_inclusions=v end) local report_xml=logs.reporter("xml") local xml=xml local xmlconvert,xmlcopy,xmlname=xml.convert,xml.copy,xml.name @@ -11637,11 +11638,14 @@ xml.insertafter=insert_element xml.insertbefore=function(r,p,e) insert_element(r,p,e,true) end xml.injectafter=inject_element xml.injectbefore=function(r,p,e) inject_element(r,p,e,true) end -local function include(xmldata,pattern,attribute,recursive,loaddata) +local function include(xmldata,pattern,attribute,recursive,loaddata,level) pattern=pattern or 'include' loaddata=loaddata or io.loaddata local collected=xmlapplylpath(xmldata,pattern) if collected then + if not level then + level=1 + end for c=1,#collected do local ek=collected[c] local name=nil @@ -11655,11 +11659,19 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) if not name then for a in gmatch(attribute or "href","([^|]+)") do name=ekat[a] - if name then break end + if name then + break + end + end + end + local data=nil + if name and name~="" then + data=loaddata(name) or "" + if trace_inclusions then + report_xml("including %s bytes from %a at level %s by pattern %a and attribute %a (%srecursing)",#data,name,level,pattern,attribute or "",recursive and "" or "not ") end end - local data=name and name~="" and loaddata(name) or "" - if data=="" then + if not data or data=="" then epdt[ek.ni]="" elseif ekat["parse"]=="text" then epdt[ek.ni]=xml.escaped(data) @@ -11669,7 +11681,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) epdt[ek.ni]="" else if recursive then - include(xi,pattern,attribute,recursive,loaddata) + include(xi,pattern,attribute,recursive,loaddata,level+1) end local child=xml.body(xi) child.__p__=ekrt @@ -12036,7 +12048,7 @@ local function recurse(e,action) for i=1,#edt do local str=edt[i] if type(str)~="string" then - recurse(str,action,recursive) + recurse(str,action) elseif str~="" then edt[i]=action(str) end @@ -17259,8 +17271,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 710105 --- stripped bytes : 252051 +-- original bytes : 710661 +-- stripped bytes : 252165 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 81d47d1f2..fb3fdf5a9 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -11321,7 +11321,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 25139, stripped down to: 17839 +-- original size: 25695, stripped down to: 18281 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -11331,6 +11331,7 @@ if not modules then modules={} end modules ['lxml-aux']={ license="see context related readme files" } local trace_manipulations=false trackers.register("lxml.manipulations",function(v) trace_manipulations=v end) +local trace_inclusions=false trackers.register("lxml.inclusions",function(v) trace_inclusions=v end) local report_xml=logs.reporter("xml") local xml=xml local xmlconvert,xmlcopy,xmlname=xml.convert,xml.copy,xml.name @@ -11637,11 +11638,14 @@ xml.insertafter=insert_element xml.insertbefore=function(r,p,e) insert_element(r,p,e,true) end xml.injectafter=inject_element xml.injectbefore=function(r,p,e) inject_element(r,p,e,true) end -local function include(xmldata,pattern,attribute,recursive,loaddata) +local function include(xmldata,pattern,attribute,recursive,loaddata,level) pattern=pattern or 'include' loaddata=loaddata or io.loaddata local collected=xmlapplylpath(xmldata,pattern) if collected then + if not level then + level=1 + end for c=1,#collected do local ek=collected[c] local name=nil @@ -11655,11 +11659,19 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) if not name then for a in gmatch(attribute or "href","([^|]+)") do name=ekat[a] - if name then break end + if name then + break + end + end + end + local data=nil + if name and name~="" then + data=loaddata(name) or "" + if trace_inclusions then + report_xml("including %s bytes from %a at level %s by pattern %a and attribute %a (%srecursing)",#data,name,level,pattern,attribute or "",recursive and "" or "not ") end end - local data=name and name~="" and loaddata(name) or "" - if data=="" then + if not data or data=="" then epdt[ek.ni]="" elseif ekat["parse"]=="text" then epdt[ek.ni]=xml.escaped(data) @@ -11669,7 +11681,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) epdt[ek.ni]="" else if recursive then - include(xi,pattern,attribute,recursive,loaddata) + include(xi,pattern,attribute,recursive,loaddata,level+1) end local child=xml.body(xi) child.__p__=ekrt @@ -12036,7 +12048,7 @@ local function recurse(e,action) for i=1,#edt do local str=edt[i] if type(str)~="string" then - recurse(str,action,recursive) + recurse(str,action) elseif str~="" then edt[i]=action(str) end @@ -17259,8 +17271,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 710105 --- stripped bytes : 252051 +-- original bytes : 710661 +-- stripped bytes : 252165 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 81d47d1f2..fb3fdf5a9 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -11321,7 +11321,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 25139, stripped down to: 17839 +-- original size: 25695, stripped down to: 18281 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -11331,6 +11331,7 @@ if not modules then modules={} end modules ['lxml-aux']={ license="see context related readme files" } local trace_manipulations=false trackers.register("lxml.manipulations",function(v) trace_manipulations=v end) +local trace_inclusions=false trackers.register("lxml.inclusions",function(v) trace_inclusions=v end) local report_xml=logs.reporter("xml") local xml=xml local xmlconvert,xmlcopy,xmlname=xml.convert,xml.copy,xml.name @@ -11637,11 +11638,14 @@ xml.insertafter=insert_element xml.insertbefore=function(r,p,e) insert_element(r,p,e,true) end xml.injectafter=inject_element xml.injectbefore=function(r,p,e) inject_element(r,p,e,true) end -local function include(xmldata,pattern,attribute,recursive,loaddata) +local function include(xmldata,pattern,attribute,recursive,loaddata,level) pattern=pattern or 'include' loaddata=loaddata or io.loaddata local collected=xmlapplylpath(xmldata,pattern) if collected then + if not level then + level=1 + end for c=1,#collected do local ek=collected[c] local name=nil @@ -11655,11 +11659,19 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) if not name then for a in gmatch(attribute or "href","([^|]+)") do name=ekat[a] - if name then break end + if name then + break + end + end + end + local data=nil + if name and name~="" then + data=loaddata(name) or "" + if trace_inclusions then + report_xml("including %s bytes from %a at level %s by pattern %a and attribute %a (%srecursing)",#data,name,level,pattern,attribute or "",recursive and "" or "not ") end end - local data=name and name~="" and loaddata(name) or "" - if data=="" then + if not data or data=="" then epdt[ek.ni]="" elseif ekat["parse"]=="text" then epdt[ek.ni]=xml.escaped(data) @@ -11669,7 +11681,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) epdt[ek.ni]="" else if recursive then - include(xi,pattern,attribute,recursive,loaddata) + include(xi,pattern,attribute,recursive,loaddata,level+1) end local child=xml.body(xi) child.__p__=ekrt @@ -12036,7 +12048,7 @@ local function recurse(e,action) for i=1,#edt do local str=edt[i] if type(str)~="string" then - recurse(str,action,recursive) + recurse(str,action) elseif str~="" then edt[i]=action(str) end @@ -17259,8 +17271,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 710105 --- stripped bytes : 252051 +-- original bytes : 710661 +-- stripped bytes : 252165 -- end library merge diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 59be62f4b..15fca6049 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{2014.07.10 13:14} +\newcontextversion{2014.07.11 12:20} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 93b4e9264..3e3f29803 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 168658a29..5ce04e804 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.07.10 13:14} +\edef\contextversion{2014.07.11 12:20} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/lxml-aux.lua b/tex/context/base/lxml-aux.lua index 3f502df44..ba8a7ef47 100644 --- a/tex/context/base/lxml-aux.lua +++ b/tex/context/base/lxml-aux.lua @@ -10,6 +10,7 @@ if not modules then modules = { } end modules ['lxml-aux'] = { -- compatibility reasons local trace_manipulations = false trackers.register("lxml.manipulations", function(v) trace_manipulations = v end) +local trace_inclusions = false trackers.register("lxml.inclusions", function(v) trace_inclusions = v end) local report_xml = logs.reporter("xml") @@ -363,12 +364,15 @@ xml.insertbefore = function(r,p,e) insert_element(r,p,e,true) end xml.injectafter = inject_element xml.injectbefore = function(r,p,e) inject_element(r,p,e,true) end -local function include(xmldata,pattern,attribute,recursive,loaddata) +local function include(xmldata,pattern,attribute,recursive,loaddata,level) -- attribute = attribute or 'href' pattern = pattern or 'include' loaddata = loaddata or io.loaddata local collected = xmlapplylpath(xmldata,pattern) if collected then + if not level then + level = 1 + end for c=1,#collected do local ek = collected[c] local name = nil @@ -382,11 +386,19 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) if not name then for a in gmatch(attribute or "href","([^|]+)") do name = ekat[a] - if name then break end + if name then + break + end + end + end + local data = nil + if name and name ~= "" then + data = loaddata(name) or "" + if trace_inclusions then + report_xml("including %s bytes from %a at level %s by pattern %a and attribute %a (%srecursing)",#data,name,level,pattern,attribute or "",recursive and "" or "not ") end end - local data = name and name ~= "" and loaddata(name) or "" - if data == "" then + if not data or data == "" then epdt[ek.ni] = "" -- xml.empty(d,k) elseif ekat["parse"] == "text" then -- for the moment hard coded @@ -397,7 +409,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) epdt[ek.ni] = "" -- xml.empty(d,k) else if recursive then - include(xi,pattern,attribute,recursive,loaddata) + include(xi,pattern,attribute,recursive,loaddata,level+1) end local child = xml.body(xi) -- xml.assign(d,k,xi) child.__p__ = ekrt @@ -838,7 +850,7 @@ local function recurse(e,action) for i=1,#edt do local str = edt[i] if type(str) ~= "string" then - recurse(str,action,recursive) + recurse(str,action) -- ,recursive elseif str ~= "" then edt[i] = action(str) end diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 469b8c6dd..96f2ce099 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 92da8bdc0..d0362cd72 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/typo-tal.mkiv b/tex/context/base/typo-tal.mkiv index 126233b1a..32b99ff01 100644 --- a/tex/context/base/typo-tal.mkiv +++ b/tex/context/base/typo-tal.mkiv @@ -96,7 +96,7 @@ \def\typo_charalign_pass {\hbox\bgroup\signalcharacteralign\plusone\scratchcounter\let\next} -\unexpanded\def\startcharacteralig +\unexpanded\def\startcharacteralign {\dosingleempty\typo_charalign_start} \def\typo_charalign_start[#1]#2\stopcharacteralign diff --git a/tex/context/base/x-asciimath.lua b/tex/context/base/x-asciimath.lua index 0849b42a5..00ffd4cc0 100644 --- a/tex/context/base/x-asciimath.lua +++ b/tex/context/base/x-asciimath.lua @@ -43,6 +43,10 @@ local concat, remove, sortedhash, sortedkeys, keys = table.concat, table.remove, local rep, gmatch, gsub, find = string.rep, string.gmatch, string.gsub, string.find local formatters = string.formatters +local xmltext = xml.text +local xmlinclusion = xml.inclusion +local xmlcollected = xml.collected + local reserved = { -- ["aleph"] = "\\aleph", -- ["vdots"] = "\\vdots", @@ -1322,10 +1326,51 @@ end -- so far +local function register(s,cleanedup,collected,shortname) + local c = cleanedup(s) + local f = collected[c] + if f then + f.count = f.count + 1 + f.files[shortname] = (f.files[shortname] or 0) + 1 + if s ~= c then + f.cleanedup = f.cleanedup + 1 + end + f.dirty[s] = (f.dirty[s] or 0) + 1 + else + local texcode = convert(s) + local message = invalidtex(texcode) + if message then + report_asciimath("%s: %s",message,s) + end + collected[c] = { + count = 1, + files = { [shortname] = 1 }, + texcode = texcode, + message = message, + cleanedup = s ~= c and 1 or 0, + dirty = { [s] = 1 } + } + end +end + +local function wrapup(collected,indexed) + local n = 0 + for k, v in sortedhash(collected) do + n = n + 1 + v.n= n + indexed[n] = k + end +end + function collect(fpattern,element,collected,indexed) local element = element or "am" local mpattern = formatters["<%s>(.-)</%s>"](element,element) - local filenames = dir.glob(fpattern) + local filenames = resolvers.findtexfile(fpattern) + if filenames and filenames ~= "" then + filenames = { filenames } + else + filenames = dir.glob(fpattern) + end local cfpattern = gsub(fpattern,"^%./",lfs.currentdir()) local cfpattern = gsub(cfpattern,"\\","/") local wildcard = string.split(cfpattern,"*")[1] @@ -1340,45 +1385,36 @@ function collect(fpattern,element,collected,indexed) if shortname == "" then shortname = filename end - for s in gmatch(io.loaddata(filename),mpattern) do - local c = cleanedup(s) - local f = collected[c] - if f then - f.count = f.count + 1 - f.files[shortname] = (f.files[shortname] or 0) + 1 - if s ~= c then - f.cleanedup = f.cleanedup + 1 - end - f.dirty[s] = (f.dirty[s] or 0) + 1 - else - local texcode = convert(s) - local message = invalidtex(texcode) - if message then - report_asciimath("%s: %s",message,s) - end - collected[c] = { - count = 1, - files = { [shortname] = 1 }, - texcode = texcode, - message = message, - cleanedup = s ~= c and 1 or 0, - dirty = { [s] = 1 } - } + local fullname = resolvers.findtexfile(filename) or filename + if fullname ~= "" then + for s in gmatch(io.loaddata(fullname),mpattern) do + register(s,cleanedup,collected,shortname) end end end - local n = 0 - for k, v in sortedhash(collected) do - n = n + 1 - v.n= n - indexed[n] = k + wrapup(collected,indexed) + return collected, indexed +end + +function filter(root,pattern,collected,indexed) + if not pattern or pattern == "" then + pattern = "am" + end + if not collected then + collected = { } + indexed = { } end + for c in xmlcollected(root,pattern) do + register(xmltext(c),cleanedup,collected,xmlinclusion(c) or "" ) + end + wrapup(collected,indexed) return collected, indexed end asciimath.convert = convert asciimath.reserved = reserved asciimath.collect = collect +asciimath.filter = filter asciimath.invalidtex = invalidtex asciimath.cleanedup = cleanedup @@ -1569,6 +1605,11 @@ function show.load(str,element) end end +function show.filter(id,element) + collected, indexed, ignored = { }, { }, { } + asciimath.filter(lxml.getid(id),element or "am",collected,indexed) +end + function show.max() context(#indexed) end diff --git a/tex/context/base/x-asciimath.mkiv b/tex/context/base/x-asciimath.mkiv index d491e5810..acdcae64a 100644 --- a/tex/context/base/x-asciimath.mkiv +++ b/tex/context/base/x-asciimath.mkiv @@ -137,6 +137,7 @@ \unexpanded\def\ShowAsciiMathLoad [#1]{\ctxlua{moduledata.asciimath.show.load("#1")}} \unexpanded\def\ShowAsciiMathIgnore[#1]{\ctxlua{moduledata.asciimath.show.ignore("#1")}} +\unexpanded\def\ShowAsciiMathXML #1#2{\ctxlua{moduledata.asciimath.show.filter("#1","#2")}} \unexpanded\def\ShowAsciiMathStats {\ctxlua{moduledata.asciimath.show.statistics()}} \unexpanded\def\ShowAsciiMathMax {\ctxlua{moduledata.asciimath.show.max()}} @@ -191,6 +192,16 @@ \ShowAsciiMathStop \fi} +\unexpanded\def\xmlShowAsciiMath#1#2% + {\iffirstargument + \ShowAsciiMathStart + \ShowAsciiMathXML{#1}{#2}% + \dorecurse{\ShowAsciiMathMax}{\ShowAsciiMathResult\recurselevel} + \page + \ShowAsciiMathStats + \ShowAsciiMathStop + \fi} + \unexpanded\def\ShowAsciiMathSave {\dosingleempty\doShowAsciiMathSave} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index d82d95d6b..99a0d35ab 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 07/10/14 13:14:58 +-- merge date : 07/11/14 12:20:35 do -- begin closure to overcome local limits and interference |