From a115fb4ebf3890ee3cabdf98f3f945a349860752 Mon Sep 17 00:00:00 2001 From: Mojca Miklavec Date: Tue, 22 May 2012 21:04:25 +0000 Subject: ConTeXt 2012.05.22 16:12 git-svn-id: svn://tug.org/texlive/trunk@26572 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/scripts/context/stubs/unix/mtxrun | 74 +++++++++++++++++++++- 1 file changed, 72 insertions(+), 2 deletions(-) (limited to 'Master/texmf-dist/scripts/context/stubs/unix/mtxrun') diff --git a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun b/Master/texmf-dist/scripts/context/stubs/unix/mtxrun index 335c4fcb9e0..a8bbca88534 100755 --- a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun +++ b/Master/texmf-dist/scripts/context/stubs/unix/mtxrun @@ -8112,7 +8112,7 @@ xml.tocdata(e,"error") --ldx]]-- -function xml.tocdata(e,wrapper) +function xml.tocdata(e,wrapper) -- a few more in the aux module local whatever = type(e) == "table" and xmltostring(e.dt) or e or "" if wrapper then whatever = format("<%s>%s",wrapper,whatever,wrapper) @@ -10095,6 +10095,36 @@ function xml.cdatatotext(e) end end +-- local x = xml.convert("123") +-- xml.texttocdata(xml.first(x,"a")) +-- print(x) -- 23]]> + +function xml.texttocdata(e) -- could be a finalizer + local dt = e.dt + local s = xml.tostring(dt) -- no shortcut? + e.tg = "@cd@" + e.special = true + e.ns = "" + e.rn = "" + e.dt = { s } + e.at = nil +end + +-- local x = xml.convert("123") +-- xml.tocdata(xml.first(x,"a")) +-- print(x) -- 123]]> + +function xml.elementtocdata(e) -- could be a finalizer + local dt = e.dt + local s = xml.tostring(e) -- no shortcut? + e.tg = "@cd@" + e.special = true + e.ns = "" + e.rn = "" + e.dt = { s } + e.at = nil +end + xml.builtinentities = table.tohash { "amp", "quot", "apos", "lt", "gt" } -- used often so share local entities = characters and characters.entities or nil @@ -10242,7 +10272,7 @@ if not modules then modules = { } end modules ['lxml-xml'] = { } local concat = table.concat -local find = string.find +local find, lower, upper = string.find, string.lower, string.upper local xml = xml @@ -10639,6 +10669,46 @@ function xml.textonly(e) -- no pattern return concat(textonly(e,{})) end +-- + +-- local x = xml.convert("123") +-- xml.filter(x,"**/lowerall()") print(x) +-- xml.filter(x,"**/upperall()") print(x) + +function finalizers.lowerall(collected) + for c=1,#collected do + local e = collected[c] + if not e.special then + e.tg = lower(e.tg) + local eat = e.at + if eat then + local t = { } + for k,v in next, eat do + t[lower(k)] = v + end + e.at = t + end + end + end +end + +function finalizers.upperall(collected) + for c=1,#collected do + local e = collected[c] + if not e.special then + e.tg = upper(e.tg) + local eat = e.at + if eat then + local t = { } + for k,v in next, eat do + t[upper(k)] = v + end + e.at = t + end + end + end +end + end -- of closure -- cgit v1.2.3