From bd1d54f72a77a9a9b6efa8ca635c3e4e2fa45cd3 Mon Sep 17 00:00:00 2001 From: Marius Date: Sat, 20 Oct 2012 13:20:19 +0300 Subject: beta 2012.10.20 11:51 --- scripts/context/lua/mtxrun.lua | 43 ++++++++++++++++++++++++++++++++++ scripts/context/stubs/mswin/mtxrun.lua | 43 ++++++++++++++++++++++++++++++++++ scripts/context/stubs/unix/mtxrun | 43 ++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) (limited to 'scripts') diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index b3170f7b2..97690ecc7 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -11103,6 +11103,49 @@ function xml.separate(x,pattern) return x end +-- + +local helpers = xml.helpers or { } +xml.helpers = helpers + +local function normal(e,action) + local edt = e.dt + if edt then + for i=1,#edt do + local str = edt[i] + if type(str) == "string" and str ~= "" then + edt[i] = action(str) + end + end + end +end + +local function recurse(e,action) + local edt = e.dt + if edt then + for i=1,#edt do + local str = edt[i] + if type(str) ~= "string" then + recurse(str,action,recursive) + elseif str ~= "" then + edt[i] = action(str) + end + end + end +end + +function helpers.recursetext(collected,action,recursive) + if recursive then + for i=1,#collected do + recurse(collected[i],action) + end + else + for i=1,#collected do + normal(collected[i],action) + end + end +end + end -- of closure diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index b3170f7b2..97690ecc7 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -11103,6 +11103,49 @@ function xml.separate(x,pattern) return x end +-- + +local helpers = xml.helpers or { } +xml.helpers = helpers + +local function normal(e,action) + local edt = e.dt + if edt then + for i=1,#edt do + local str = edt[i] + if type(str) == "string" and str ~= "" then + edt[i] = action(str) + end + end + end +end + +local function recurse(e,action) + local edt = e.dt + if edt then + for i=1,#edt do + local str = edt[i] + if type(str) ~= "string" then + recurse(str,action,recursive) + elseif str ~= "" then + edt[i] = action(str) + end + end + end +end + +function helpers.recursetext(collected,action,recursive) + if recursive then + for i=1,#collected do + recurse(collected[i],action) + end + else + for i=1,#collected do + normal(collected[i],action) + end + end +end + end -- of closure diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index b3170f7b2..97690ecc7 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -11103,6 +11103,49 @@ function xml.separate(x,pattern) return x end +-- + +local helpers = xml.helpers or { } +xml.helpers = helpers + +local function normal(e,action) + local edt = e.dt + if edt then + for i=1,#edt do + local str = edt[i] + if type(str) == "string" and str ~= "" then + edt[i] = action(str) + end + end + end +end + +local function recurse(e,action) + local edt = e.dt + if edt then + for i=1,#edt do + local str = edt[i] + if type(str) ~= "string" then + recurse(str,action,recursive) + elseif str ~= "" then + edt[i] = action(str) + end + end + end +end + +function helpers.recursetext(collected,action,recursive) + if recursive then + for i=1,#collected do + recurse(collected[i],action) + end + else + for i=1,#collected do + normal(collected[i],action) + end + end +end + end -- of closure -- cgit v1.2.3