diff options
author | Karl Berry <karl@freefriends.org> | 2016-04-27 21:54:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-04-27 21:54:13 +0000 |
commit | 4ca0e50699e2f4fc4dbe8b1dc4fe528a51b5429d (patch) | |
tree | 15c515e279a70c47939a7451b70ebfec6bbcb579 /Master/texmf-dist/tex/context/modules/mkiv/s-xml-analyzers.lua | |
parent | 92b16675f5d3c1e9819112e099165b4dbc5f8a52 (diff) |
context (27apr16)
git-svn-id: svn://tug.org/texlive/trunk@40787 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/modules/mkiv/s-xml-analyzers.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/modules/mkiv/s-xml-analyzers.lua | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/context/modules/mkiv/s-xml-analyzers.lua b/Master/texmf-dist/tex/context/modules/mkiv/s-xml-analyzers.lua index 9de6471d148..c356d4c3785 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/s-xml-analyzers.lua +++ b/Master/texmf-dist/tex/context/modules/mkiv/s-xml-analyzers.lua @@ -20,6 +20,7 @@ local chardata = characters.data local tags = { } local char = { } local attr = { } +local ents = { } local name = nil local function analyze(filename) @@ -40,6 +41,7 @@ local function analyze(filename) tags = { } char = { } attr = { } + ents = { } table.setmetatableindex(tags,function(t,k) local v = { @@ -62,6 +64,11 @@ local function analyze(filename) return 0 end) + table.setmetatableindex(ents,function(t,k) + t[k] = 0 + return 0 + end) + local function collect(e,parent) local dt = e.dt if e.special then @@ -112,12 +119,19 @@ local function analyze(filename) end for i=1,#filename do - collect(xml.load(filename[i])) + local root = xml.load(filename[i]) + collect(root) + -- + local names = root.statistics.entities.names + for n in next, names do + ents[n] = ents[n] + 1 + end end table.setmetatableindex(tags,nil) table.setmetatableindex(char,nil) table.setmetatableindex(attr,nil) + table.setmetatableindex(ents,nil) end @@ -170,3 +184,15 @@ function moduledata.xml.analyzers.characters(filename) context.stoptabulate() end +function moduledata.xml.analyzers.entities(filename) + analyze(filename) + context.starttabulate { "|l|r|" } + for e, n in table.sortedhash(ents) do + NC() context(e) + NC() context(n) + NC() NR() + end + context.stoptabulate() +end + + |