From b707604d6f165b803831d20654724c8f129d4700 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Fri, 11 Jul 2014 13:15:03 +0200 Subject: 2014-07-11 12:22:00 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4436 -> 4439 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/lxml-aux.lua | 24 +++-- tex/context/base/status-files.pdf | Bin 24913 -> 24916 bytes tex/context/base/status-lua.pdf | Bin 326320 -> 326318 bytes tex/context/base/typo-tal.mkiv | 2 +- tex/context/base/x-asciimath.lua | 101 +++++++++++++++------ tex/context/base/x-asciimath.mkiv | 11 +++ tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 10 files changed, 104 insertions(+), 40 deletions(-) (limited to 'tex') 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 index 93b4e9264..3e3f29803 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ 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 index 469b8c6dd..96f2ce099 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 92da8bdc0..d0362cd72 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/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>(.-)"](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 -- cgit v1.2.3