diff options
author | Marius <mariausol@gmail.com> | 2012-05-22 02:40:13 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-05-22 02:40:13 +0300 |
commit | ffb360b52944514197aa47313c26816cd2fb7a7e (patch) | |
tree | af46811e825bb977838cd2db44646879f281b752 /tex/context/base/lxml-xml.lua | |
parent | 3821b4213bf250551cfa122313ae2c56f9923533 (diff) | |
download | context-ffb360b52944514197aa47313c26816cd2fb7a7e.tar.gz |
beta 2012.05.22 01:22
Diffstat (limited to 'tex/context/base/lxml-xml.lua')
-rw-r--r-- | tex/context/base/lxml-xml.lua | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/tex/context/base/lxml-xml.lua b/tex/context/base/lxml-xml.lua index 7e7922cfb..d0e256078 100644 --- a/tex/context/base/lxml-xml.lua +++ b/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 |