diff options
author | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-22 21:04:25 +0000 |
---|---|---|
committer | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-22 21:04:25 +0000 |
commit | a115fb4ebf3890ee3cabdf98f3f945a349860752 (patch) | |
tree | e4d25217d24f4c1b6d863007725f538169379e87 /Master/texmf-dist/tex/context/base/lxml-xml.lua | |
parent | d36378879c10c7378bc52d9fe7d1ce9c3677d98b (diff) |
ConTeXt 2012.05.22 16:12
git-svn-id: svn://tug.org/texlive/trunk@26572 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/lxml-xml.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/lxml-xml.lua | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/context/base/lxml-xml.lua b/Master/texmf-dist/tex/context/base/lxml-xml.lua index 7e7922cfb25..d0e25607820 100644 --- a/Master/texmf-dist/tex/context/base/lxml-xml.lua +++ b/Master/texmf-dist/tex/context/base/lxml-xml.lua @@ -7,7 +7,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 @@ -403,3 +403,43 @@ end function xml.textonly(e) -- no pattern return concat(textonly(e,{})) end + +-- + +-- local x = xml.convert("<x><a x='+'>1<B>2</B>3</a></x>") +-- 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 |